void drawHud(void) { int x, y = 0, i; if(cam->hud > 1) y = 1 - cam->hud--; else if(cam->hud < 1) { y = -10 - cam->hud; if(++cam->hud > 0) cam->hud = 0; } GrayClipSprite32_TRANW_R(LEFT,y,12,gfx->HUD.left_C0,gfx->HUD.left_C1,v0,v1); GrayClipSprite32_TRANW_R(LEFT + 32,y,12,gfx->HUD.middle_C0,gfx->HUD.middle_C1,v0,v1); GrayClipSprite32_TRANW_R(RIGHT,y,12,gfx->HUD.right_C0,gfx->HUD.right_C1,v0,v1); for(i = 0; i < samus->items.tanks_owned; i++) { if(i < samus->items.tanks_full) GrayClipSprite8_TRANB_R(LEFT + 4 +(i%6)*5, i<6?y+1:y+5, 3, gfx->HUD.tankFull_C0, gfx->HUD.tankFull_C1, v0, v1); else GrayClipSprite8_TRANW_R(LEFT + 4 +(i%6)*5, i<6?y+1:y+5, 3, gfx->HUD.tankEmpty_C0, gfx->HUD.tankEmpty_C1, v0, v1); } x = LEFT + 34; GrayClipSprite8_TRANB_R(x, y+1, 7, gfx->HUD.numbers[(samus->HP/10)*2], gfx->HUD.numbers[(samus->HP/10)*2 + 1], v0, v1); GrayClipSprite8_TRANB_R(x + 7, y+1, 7, gfx->HUD.numbers[(samus->HP%10)*2], gfx->HUD.numbers[(samus->HP%10)*2 + 1], v0, v1); x = LEFT + 50; GrayClipSprite32_TRANW_R(x, y + 1, 8, gfx->HUD.weapons_C0, gfx->HUD.weapons_C1, v0, v1); /*if(samus->weapons.missile_ammo == 0) GrayFastFillRect_R(v0,v1,x,y+1,x+7,y+8,1); if(samus->weapons.superMissile_ammo == 0) GrayFastFillRect_R(v0,v1,x+9,y+1,x+16,y+8,1); if(samus->weapons.powerBomb_ammo == 0) GrayFastFillRect_R(v0,v1,x+18,y+1,x+26,y+8,1);*/ int ammo = 0; if(samus->weapons.gun == &templates->weapons.missile) { GrayInvertRect2B(x,y+1,x+7,y+8,v0,v1); ammo = samus->weapons.missile_ammo; } else if(samus->weapons.gun == &templates->weapons.superMissile) { GrayInvertRect2B(x+9,y+1,x+16,y+8,v0,v1); ammo = samus->weapons.superMissile_ammo; } else if(samus->weapons.bomb == &templates->weapons.powerBomb) { GrayInvertRect2B(x+18,y+1,x+26,y+8,v0,v1); ammo = samus->weapons.powerBomb_ammo; } else return; x = LEFT + 78; GrayClipSprite8_TRANB_R(x, y+1, 7, gfx->HUD.numbers[(ammo/10)*2], gfx->HUD.numbers[(ammo/10)*2 + 1], v0, v1); GrayClipSprite8_TRANB_R(x + 7, y+1, 7, gfx->HUD.numbers[(ammo%10)*2], gfx->HUD.numbers[(ammo%10)*2 + 1], v0, v1); }
/* Returns the option chosen by the user */ short Menu(const char *title, const char Options[], short Max_Length, short pos, short Fading) { short width = 0, No_Options = 0, Main_Pos = 0; short a, Changing = FALSE; while(_KeyCheck(ESCKEY)); do { if (DrawStrWidth(Options + (Max_Length * No_Options), F_6x8) > width) width = DrawStrWidth(Options + (Max_Length * No_Options), F_6x8); } while(*(Options + (Max_Length * (++No_Options))) != 0); do { memset(Hiddenl, 0xFF, LCD_SIZE + LCD_SIZE); GraySpriteX8_AND(g->Zerox + 8, 0, 16, ExciteBike_Title[1], ExciteBike_Title[0], 18, Hiddenl, Hiddend); Display_Author(); FS_DrawGrayString(0, 22, title, A_SHADOWED | A_XOR | A_CENTERED, F_6x8); for(a = (No_Options > 5 ? 6 : No_Options); a--;) FS_DrawGrayString(g->Zerox + 22, 34 + 10 * a, Options + (Max_Length * (Main_Pos + a)), A_XOR, F_6x8); register short Offset = 2 + (g->Zerox >> 3) + 30 * (10 * pos + 0 + 36); *((char*)Hiddend + Offset + 0) &= 0x1F; *((char*)Hiddend + Offset + 30) &= 0x1F; *((char*)Hiddenl + Offset + 30) &= 0xBF; *((char*)Hiddend + Offset + 60) &= 0x1F; // Highlight the selected Option GrayInvertRect2B(g->Zerox + 21, 33 + 10 * pos, g->Zerox + 23 + width, 41 + 10 * pos, Hiddenl, Hiddend); if (!strcmp(title, "- Choose Mode -")) { a = Zeroy + 75; if (pos == 0) { FS_DrawGrayString(0, a, EFG("(The fastest time at the end of the race wins)", "(Le plus rapide à la course gagne)", "(die beste Zeit am Ende des Rennens gewinnt)"), A_CENTERED | A_XOR, F_4x6); FS_DrawGrayString(0, a + 7, EFG("Hint: Perform flips to lower your time", "Astuce: pirouettes pour meil. tps", "Tipp: Loopings für eine bessere Zeit"), A_CENTERED | A_XOR, F_4x6); } if (pos == 1) { FS_DrawGrayString(0, a, EFG("(The first person to cross the finish line wins)", "(Celui qui arrive en premier gagne)", "(derjenige, der als Erster ankommt, gewinnt)"), A_CENTERED | A_XOR, F_4x6); } } if (Fading) { // Make a new menu screen fade in Dissolve(); Fading = FALSE; } else { Toggle_Screens(); } // Algorithm allows for any size menues to be scrolled easily if (_keytest(RR_UP)) { if (Changing == FALSE) { Changing = TRUE; if (--pos < 0) { if (--Main_Pos < 0) { pos = (No_Options > 5 ? 5 : No_Options - 1); Main_Pos = (No_Options > 5) * (No_Options - 6); } else pos = 0; } } } else if (_keytest(RR_DOWN)) { if (Changing == FALSE) { Changing = TRUE; if (++pos >= (No_Options > 5 ? 6 : No_Options)) { if (++Main_Pos >= (No_Options > 5) * (No_Options - 5)) pos = Main_Pos = 0; else pos = 5; } } } else Changing = FALSE; if (_KeyCheck(ESCKEY) || _KeyCheck(TEACHERKEY)) { Exit_Linkplay(); while(_KeyCheck(ESCKEY)); return QUIT; } } while (!_KeyCheck(CONFIRMKEY) && !(_keytest(RR_ENTER) || (CALCULATOR && _keytest(RR_ENTER1)) || (CALCULATOR && _keytest(RR_ENTER2)))); while(_rowread(0)); return Main_Pos + pos; // Return the option chosen by the user }