From 5cacc3b438722c5aa6c1e55a3a000c7a905a4d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Fri, 18 Oct 2019 17:41:55 +0200 Subject: [PATCH] Rename monster --- assets.h | 4 ++-- levels.h | 13 ++++++++----- main.c | 8 ++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/assets.h b/assets.h index 0af0320..5bc46f1 100644 --- a/assets.h +++ b/assets.h @@ -737,7 +737,7 @@ reused flipped (good for walk anims). */ SFG_PROGRAM_MEMORY uint8_t SFG_monsterSprites[][SFG_TEXTURE_SIZE * SFG_TEXTURE_SIZE] = { - { // 0, monster1 idle + { // 0, spider idle 175,175,175,0,0,0,0,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175, 175,175,175,0,0,0,0,175,175,175,175,175,0,5,4,95,5,0,175,175,175,175,175,175, 175,175,175,175,175,175,175,175,175,175,0,6,3,5,4,0,175,175,175,0,5,0,2,2,0,5,0, @@ -776,7 +776,7 @@ SFG_PROGRAM_MEMORY uint8_t 4,3,0,175,175,175,175,175,0,0,0,0,175,175,175,175,175,175,175,175,175,175,175, 175,175,175,175,175,175,175,0,0,0,0,175,175,175 }, - { // 1, monster1 attacking + { // 1, spider attacking 175,175,183,183,183,1,1,1,183,22,102,175,175,175,175,175,175,175,175,175,175, 175,175,175,0,0,0,0,0,175,175,175,175,175,183,183,191,183,183,183,183,191,191, 191,175,175,175,175,175,175,175,175,175,175,175,0,6,4,4,5,4,0,0,175,175,175,175, diff --git a/levels.h b/levels.h index a92b468..64e8738 100644 --- a/levels.h +++ b/levels.h @@ -86,9 +86,12 @@ typedef struct unused because that will be used by the game engine, so the values must be lower than 128. */ -#define SFG_LEVEL_ELEMENT_NONE 0 -#define SFG_LEVEL_ELEMENT_BARREL 1 -#define SFG_LEVEL_ELEMENT_MONSTER1 2 +#define SFG_LEVEL_ELEMENT_NONE 255 +#define SFG_LEVEL_ELEMENT_BARREL 0x01 + /* Monsters have lower 4 bits zero and are only distinguished by the 4 upper + bits, as this is convenient for the code. + */ +#define SFG_LEVEL_ELEMENT_MONSTER_SPIDER 0x00 typedef struct { @@ -237,8 +240,8 @@ SFG_PROGRAM_MEMORY SFG_Level SFG_level0 = {SFG_LEVEL_ELEMENT_BARREL, {12, 4}}, {SFG_LEVEL_ELEMENT_BARREL, {15, 4}}, {SFG_LEVEL_ELEMENT_BARREL, {24, 10}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}}, {SFG_LEVEL_ELEMENT_BARREL, {13, 4}}, {SFG_LEVEL_ELEMENT_BARREL, {12, 6}}, - {SFG_LEVEL_ELEMENT_MONSTER1, {15, 7}}, {SFG_LEVEL_ELEMENT_MONSTER1, {16, 8}}, - {SFG_LEVEL_ELEMENT_MONSTER1, {16, 7}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}}, + {SFG_LEVEL_ELEMENT_MONSTER_SPIDER, {15, 7}}, {SFG_LEVEL_ELEMENT_MONSTER_SPIDER, {16, 8}}, + {SFG_LEVEL_ELEMENT_MONSTER_SPIDER, {16, 7}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}}, {SFG_LEVEL_ELEMENT_NONE, {0, 0}}, diff --git a/main.c b/main.c index 8fdcf80..31480ef 100755 --- a/main.c +++ b/main.c @@ -415,7 +415,7 @@ static inline uint8_t SFG_RCL_unitToZBuffer(RCL_Unit x) uint8_t okay = x < 255; return okay * (x + 1) - 1; -}; +} /** Says whether given key is currently pressed (down). This should be preferred @@ -947,13 +947,13 @@ void SFG_setAndInitLevel(const SFG_Level *level) SFG_currentLevel.itemRecordCount++; break; - case SFG_LEVEL_ELEMENT_MONSTER1: - SFG_LOG("adding monster1"); + case SFG_LEVEL_ELEMENT_MONSTER_SPIDER: + SFG_LOG("adding monster: spider"); monster = &(SFG_currentLevel.monsterRecords[SFG_currentLevel.monsterRecordCount]); - monster->stateType = 0; + monster->stateType = e->elementType | 0; monster->health = 255; monster->coords[0] = e->coords[0] * 4; monster->coords[1] = e->coords[1] * 4;