diff --git a/TODO.txt b/TODO.txt index a719857..4d94725 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,26 +1,13 @@ general: -- Force monsters that are squeezed (e.g. on door) to always move. -- Ability to play SFX slower to e.g. give some monsters lower pitch? - Rewrite python scripts to C (faster, less bloat). - Try to recolor textures and give them a bit more of variety. - On Win$hit builds display an anti-windshit text, by macro. - automatic tests: a frontend that will play the game, check the state, rendered frames etc. -- weapon autoswitch: when a stronger weapon becomes available via picking up - ammo, maybe it should automatically be switched to (could have disable - setting) - try to remove the debug flag (-g1) from compiler and see if it decreases size - compile on BSD and WinShit - make SFML frontend -- port to GB Meta -- save/load (optional): - When a level is finished, the state at the beginning of the next one (health, - ammo, time, ...) is automatically saved and can be restored via load option in - the menu. This save as well as some other things (game progress, inagme - settings, ...) will be preserved even adter game restart if the platform - implements a saving function. -- more levels - disable transparency for walls for performance (setting)? - add time slowdown constant - some monsters could reflect plasma, i.e. not be hurt by it, but reflect it @@ -31,7 +18,6 @@ general: - run on raspbery pi - add robot deactivator item? (encourages "stealth" gameplay) - optional graphics enhance: vertical wall shading ("ambient occlusions")? -- option for disabling wall transparency, for performance? level ideas: @@ -153,6 +139,14 @@ bugs: done: - add headbob +- save/load (optional): + When a level is finished, the state at the beginning of the next one (health, + ammo, time, ...) is automatically saved and can be restored via load option in + the menu. This save as well as some other things (game progress, inagme + settings, ...) will be preserved even adter game restart if the platform + implements a saving function. +- more levels +- port to GB Meta - "Smart" weapon switching. e.g. don't auto switch to knife unless necessary, or auto switch to a weapon from knife if ammo is picked up. - option for vertical auto aim @@ -198,6 +192,12 @@ done: - Bytebeat is bugged on Pokitto, outputs different values than on PC. Fix this. scratched: +- option for disabling wall transparency, for performance? +- weapon autoswitch: when a stronger weapon becomes available via picking up + ammo, maybe it should automatically be switched to (could have disable + setting) +- Ability to play SFX slower to e.g. give some monsters lower pitch? +- Force monsters that are squeezed (e.g. on door) to always move. - try to make z-buffer 3 line instead of 1D, possibly like this (to keep performance): - at compile time selct X = power of 2 closest to vertical resolution diff --git a/game.h b/game.h index 660ead0..586bf1d 100755 --- a/game.h +++ b/game.h @@ -2082,6 +2082,15 @@ void SFG_monsterPerformAI(SFG_MonsterRecord *monster) (attackType == SFG_MONSTER_ATTACK_MELEE) || (attackType == SFG_MONSTER_ATTACK_EXPLODE); + uint8_t monsterSquare[2] = + { + SFG_MONSTER_COORD_TO_SQUARES(monster->coords[0]), + SFG_MONSTER_COORD_TO_SQUARES(monster->coords[1]) + }; + + RCL_Unit currentHeight = + SFG_floorCollisionHeightAt(monsterSquare[0],monsterSquare[1]); + if ( // sometimes randomly attack !notRanged && (SFG_random() < @@ -2144,20 +2153,13 @@ void SFG_monsterPerformAI(SFG_MonsterRecord *monster) SFG_distantSoundVolume( SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[0]), SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[1]), - SFG_floorHeightAt( - SFG_MONSTER_COORD_TO_SQUARES(monster->coords[0]), - SFG_MONSTER_COORD_TO_SQUARES(monster->coords[1]) - ) - ) + currentHeight) ); SFG_launchProjectile( projectile, pos, - SFG_floorHeightAt( - SFG_MONSTER_COORD_TO_SQUARES(monster->coords[0]), - SFG_MONSTER_COORD_TO_SQUARES(monster->coords[1]) - ) + RCL_UNITS_PER_SQUARE / 2, + currentHeight + RCL_UNITS_PER_SQUARE / 2, dir, 0, SFG_PROJECTILE_SPAWN_OFFSET @@ -2173,9 +2175,6 @@ void SFG_monsterPerformAI(SFG_MonsterRecord *monster) { // non-ranged monsters walk towards player - uint8_t mX = SFG_MONSTER_COORD_TO_SQUARES(monster->coords[0]); - uint8_t mY = SFG_MONSTER_COORD_TO_SQUARES(monster->coords[1]); - RCL_Unit pX, pY, pZ; SFG_getMonsterWorldPosition(monster,&pX,&pY,&pZ); @@ -2189,29 +2188,29 @@ void SFG_monsterPerformAI(SFG_MonsterRecord *monster) { // walk towards player - if (mX > SFG_player.squarePosition[0]) + if (monsterSquare[0] > SFG_player.squarePosition[0]) { - if (mY > SFG_player.squarePosition[1]) + if (monsterSquare[1] > SFG_player.squarePosition[1]) state = SFG_MONSTER_STATE_GOING_NW; - else if (mY < SFG_player.squarePosition[1]) + else if (monsterSquare[1] < SFG_player.squarePosition[1]) state = SFG_MONSTER_STATE_GOING_SW; else state = SFG_MONSTER_STATE_GOING_W; } - else if (mX < SFG_player.squarePosition[0]) + else if (monsterSquare[0] < SFG_player.squarePosition[0]) { - if (mY > SFG_player.squarePosition[1]) + if (monsterSquare[1] > SFG_player.squarePosition[1]) state = SFG_MONSTER_STATE_GOING_NE; - else if (mY < SFG_player.squarePosition[1]) + else if (monsterSquare[1] < SFG_player.squarePosition[1]) state = SFG_MONSTER_STATE_GOING_SE; else state = SFG_MONSTER_STATE_GOING_E; } else { - if (mY > SFG_player.squarePosition[1]) + if (monsterSquare[1] > SFG_player.squarePosition[1]) state = SFG_MONSTER_STATE_GOING_N; - else if (mY < SFG_player.squarePosition[1]) + else if (monsterSquare[1] < SFG_player.squarePosition[1]) state = SFG_MONSTER_STATE_GOING_S; } } @@ -2294,9 +2293,7 @@ void SFG_monsterPerformAI(SFG_MonsterRecord *monster) SFG_distantSoundVolume( SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[0]), SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[1]), - SFG_floorHeightAt( - SFG_MONSTER_COORD_TO_SQUARES(monster->coords[0]), - SFG_MONSTER_COORD_TO_SQUARES(monster->coords[1]))) / 2); + currentHeight) / 2); if (add) state = SFG_MONSTER_STATE_IDLE; @@ -2315,9 +2312,6 @@ void SFG_monsterPerformAI(SFG_MonsterRecord *monster) } else { - RCL_Unit currentHeight = - SFG_floorCollisionHeightAt(monster->coords[0] / 4,monster->coords[1] / 4); - RCL_Unit newHeight = SFG_floorCollisionHeightAt(newPos[0] / 4,newPos[1] / 4); diff --git a/main_sdl.c b/main_sdl.c index 5e06da7..9bc76aa 100644 --- a/main_sdl.c +++ b/main_sdl.c @@ -371,8 +371,9 @@ int main(int argc, char *argv[]) SDL_Init(SDL_INIT_AUDIO); - SDL_AudioSpec audioSpec; + SDL_AudioSpec audioSpec, audioSpec2; + SDL_memset(&audioSpec, 0, sizeof(audioSpec)); audioSpec.callback = audioFillCallback; audioSpec.userdata = 0; audioSpec.freq = 8000; @@ -380,7 +381,7 @@ int main(int argc, char *argv[]) audioSpec.channels = 1; audioSpec.samples = 128; - if (SDL_OpenAudio(&audioSpec,0) < 0) + if (SDL_OpenAudio(&audioSpec,&audioSpec2) < 0) puts("SDL: could not initialize audio"); for (int16_t i = 0; i < SFG_SFX_SAMPLE_COUNT; ++i)