From 348c9dbf9a19647c4dd5b779083e33d763623c55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Thu, 7 Jan 2021 15:36:38 +0100 Subject: [PATCH] Fix AVR --- constants.h | 6 +++--- game.h | 16 +++++++++++++++- images.h | 2 +- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/constants.h b/constants.h index 316bcc8..956baa0 100644 --- a/constants.h +++ b/constants.h @@ -513,7 +513,7 @@ uint16_t SFG_monsterAttributeTable[SFG_MONSTERS_TOTAL] = cccc: fire cooldown in frames, i.e. time after which the next shot can be shot again, ccccc has to be multiplied by 16 to get the real value */ -SFG_PROGRAM_MEMORY uint8_t SFG_weaponAttributeTable[SFG_WEAPONS_TOTAL] = +static const uint8_t SFG_weaponAttributeTable[SFG_WEAPONS_TOTAL] = { /* knife */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_MELEE,1,650), // DPS: 6.2 /* shotgun */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_BULLET,2,1250), // DPS: 12.8 @@ -523,7 +523,7 @@ SFG_PROGRAM_MEMORY uint8_t SFG_weaponAttributeTable[SFG_WEAPONS_TOTAL] = /* solution */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_PLASMA,4,1050) // DPS: 85.7 }; -SFG_PROGRAM_MEMORY uint8_t SFG_attackDamageTable[SFG_WEAPON_FIRE_TYPES_TOTAL] = +static const uint8_t SFG_attackDamageTable[SFG_WEAPON_FIRE_TYPES_TOTAL] = { /* melee */ 4, /* bullet */ 8, @@ -562,7 +562,7 @@ SFG_PROGRAM_MEMORY uint8_t SFG_attackDamageTable[SFG_WEAPON_FIRE_TYPES_TOTAL] = #define LOW_FPS (SFG_FPS < 24) ///< low FPS needs low speeds, because collisions -SFG_PROGRAM_MEMORY uint8_t SFG_projectileAttributeTable[SFG_PROJECTILES_TOTAL] = +static const uint8_t SFG_projectileAttributeTable[SFG_PROJECTILES_TOTAL] = { /* explosion */ SFG_PROJECTILE_ATTRIBUTE(0,400), /* fireball */ SFG_PROJECTILE_ATTRIBUTE(10,1000), diff --git a/game.h b/game.h index ada4e48..329d712 100755 --- a/game.h +++ b/game.h @@ -2991,7 +2991,9 @@ void SFG_drawText( while (pos < maxLength && text[pos] != 0) // for each character { - uint16_t character = SFG_font[SFG_charToFontIndex(text[pos])]; + uint16_t character = + //SFG_PROGRAM_MEMORY_U8(SFG_font + SFG_charToFontIndex(text[pos])); + SFG_font[SFG_charToFontIndex(text[pos])]; for (uint8_t i = 0; i < SFG_FONT_CHARACTER_SIZE; ++i) // for each line { @@ -4642,6 +4644,18 @@ void SFG_draw() SFG_backgroundBlurIndex = 0; #endif +uint8_t aaa = 0; +/* +for (uint16_t j = 0; j < SFG_SCREEN_RESOLUTION_Y; ++j) +for (uint16_t i = 0; i < SFG_SCREEN_RESOLUTION_Y; ++i) +{ +SFG_setGamePixel(i,j,2); +aaa++; +} +SFG_drawText("aaa",10,10,2,7,255,0); + +return; +*/ if (SFG_game.state == SFG_GAME_STATE_MENU) { SFG_drawMenu(); diff --git a/images.h b/images.h index 0a07af6..a6f0f7f 100644 --- a/images.h +++ b/images.h @@ -1344,7 +1344,7 @@ uint8_t SFG_charToFontIndex(char c) /** 4x4 font, each character stored as 16 bits. */ -uint16_t SFG_font[47] = +static const uint16_t SFG_font[47] = { 0xfaf0, // 0 "A" 0xfd70, // 1 "B"