gfx, shit
This commit is contained in:
parent
364a34ce33
commit
0151304d05
8 changed files with 140 additions and 33 deletions
58
src/chrome.h
58
src/chrome.h
|
|
@ -95,7 +95,8 @@ static void updateMap(){
|
|||
|
||||
// compute new enemy positions
|
||||
for(s16 i = 0; i < ENEMY_COUNT; i++){
|
||||
if(!enemies[i].active || enemies[i].image == NULL){
|
||||
if(!enemies[i].active || enemies[i].image == NULL
|
||||
|| enemies[i].pos.y < FIX32(0) || enemies[i].pos.y > GAME_H_F){
|
||||
mapNewCol[i] = -1;
|
||||
mapNewRow[i] = -1;
|
||||
continue;
|
||||
|
|
@ -113,7 +114,7 @@ static void updateMap(){
|
|||
|
||||
// compute new human positions
|
||||
for(s16 i = 0; i < HUMAN_COUNT; i++){
|
||||
if(!humans[i].active || humans[i].image == NULL){
|
||||
if(!humans[i].active || humans[i].image == NULL || humans[i].state == HUMAN_COLLECTED){
|
||||
mapNewHumanCol[i] = -1;
|
||||
mapNewHumanRow[i] = -1;
|
||||
continue;
|
||||
|
|
@ -185,6 +186,7 @@ void loadChrome(){
|
|||
}
|
||||
|
||||
bool didGameOver;
|
||||
u32 gameOverClock;
|
||||
static void doGameOver(){
|
||||
didGameOver = TRUE;
|
||||
for(s16 i = 0; i < BULLET_COUNT; i++) if(bullets[i].active) SPR_setPalette(bullets[i].image, PAL1);
|
||||
|
|
@ -203,9 +205,59 @@ static void doGameOver(){
|
|||
VDP_drawText("PRESS ANY BUTTON", 12, 14);
|
||||
}
|
||||
|
||||
static void showPause(){
|
||||
for(s16 i = 0; i < BULLET_COUNT; i++) if(bullets[i].active) SPR_setPalette(bullets[i].image, PAL1);
|
||||
for(s16 i = 0; i < ENEMY_COUNT; i++) if(enemies[i].active) SPR_setPalette(enemies[i].image, PAL1);
|
||||
for(s16 i = 0; i < HUMAN_COUNT; i++) if(humans[i].active) SPR_setPalette(humans[i].image, PAL1);
|
||||
SPR_setPalette(player.image, PAL1);
|
||||
VDP_drawText("PAUSE", 17, 13);
|
||||
}
|
||||
|
||||
static void clearPause(){
|
||||
for(s16 i = 0; i < BULLET_COUNT; i++) if(bullets[i].active) SPR_setPalette(bullets[i].image, PAL0);
|
||||
for(s16 i = 0; i < ENEMY_COUNT; i++) if(enemies[i].active) SPR_setPalette(enemies[i].image, PAL0);
|
||||
for(s16 i = 0; i < HUMAN_COUNT; i++) if(humans[i].active) SPR_setPalette(humans[i].image, PAL0);
|
||||
SPR_setPalette(player.image, PAL0);
|
||||
VDP_clearText(17, 13, 5);
|
||||
}
|
||||
|
||||
u32 pauseClock;
|
||||
static void updatePause(){
|
||||
if(gameOver) return;
|
||||
if(ctrl.start){
|
||||
if(!isPausing){
|
||||
isPausing = TRUE;
|
||||
if(!paused){
|
||||
pauseClock = 0;
|
||||
paused = TRUE;
|
||||
showPause();
|
||||
} else {
|
||||
paused = FALSE;
|
||||
clearPause();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
isPausing = FALSE;
|
||||
}
|
||||
if(paused){
|
||||
if(pauseClock % 60 < 30)
|
||||
VDP_drawText("PAUSE", 17, 13);
|
||||
else
|
||||
VDP_clearText(17, 13, 5);
|
||||
pauseClock++;
|
||||
if(pauseClock >= 240) pauseClock = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void updateChrome(){
|
||||
updatePause();
|
||||
if(gameOver && !didGameOver) doGameOver();
|
||||
if(didGameOver) return;
|
||||
if(didGameOver){
|
||||
gameOverClock++;
|
||||
if((gameOverClock > 120 && (ctrl.a || ctrl.b || ctrl.c || ctrl.start)) || gameOverClock > 900)
|
||||
SYS_hardReset();
|
||||
return;
|
||||
}
|
||||
if(lastScore != score){
|
||||
lastScore = score;
|
||||
drawScore();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue