Skip to content

Free games for graphing calculators: NumWorks, TI-Nspire CX, Casio fx-CG50 and soon TI-84 Plus CE. Balatro, Celeste, Hollow Knight, Minecraft and more.

Isaac: the boss's VS screen

Mason36365dd022f9195
diff --git a/games/isaac/src/bosses.c b/games/isaac/src/bosses.c
index 4cfcd8ae..8783219f 100644
--- a/games/isaac/src/bosses.c
+++ b/games/isaac/src/bosses.c
@@ -84,6 +84,15 @@ static const BossInfo bosses[MON_COUNT - MON_MONSTRO] = {
};
static const BossInfo *info(int type) { return type >= MON_MONSTRO && type < MON_COUNT ? &bosses[type - MON_MONSTRO] : NULL; }
+const char *boss_name(int type) {
+ const BossInfo *b = info(type);
+ return b && b->name ? b->name : "";
+}
+int boss_sprite(int type) {
+ const BossInfo *b = info(type);
+ if (type == MON_SATAN) return SPR_SATAN;
+ return b && b->spr ? b->spr : -1;
+}
static Ent *boss_new(int type, float x, float y, int hp_scale_pct) {
const BossInfo *b = info(type);
diff --git a/games/isaac/src/floor.c b/games/isaac/src/floor.c
index 1368c338..cda12439 100644
--- a/games/isaac/src/floor.c
+++ b/games/isaac/src/floor.c
@@ -553,6 +553,7 @@ void floor_enter_room(int index, int from_dir) {
if (!ents_alive_monsters()) r->state |= RS_CLEARED;
}
g_room_was_cleared = r->state & RS_CLEARED;
+ if ((r->kind == ROOM_BOSS || r->kind == ROOM_MINIBOSS) && !(r->state & RS_CLEARED) && g_mode == MODE_PLAY) g_boss_intro = 64;
/* where he comes in */
static const float ex[5] = {160, ROOM_X + 14, 160, ROOM_R - 14, 160}, ey[5] = {ROOM_B - 12, 120, ROOM_Y + 14, 120, 140};
int d = from_dir < 0 || from_dir > 4 ? 4 : from_dir;
diff --git a/games/isaac/src/game.c b/games/isaac/src/game.c
index 7023daeb..869da9e4 100644
--- a/games/isaac/src/game.c
+++ b/games/isaac/src/game.c
@@ -9,7 +9,7 @@
int g_mode;
bool g_running = true;
uint32_t g_frame, g_keys, g_pressed;
-int g_room_frames, g_shake, g_killer, g_transition;
+int g_room_frames, g_shake, g_killer, g_transition, g_boss_intro;
bool g_room_was_cleared;
uint32_t g_run_seed, g_rng = 0x2545F491u;
uint8_t g_wins, g_best_stage;
@@ -185,6 +185,11 @@ static void play_update(void) {
}
return;
}
+ if (g_boss_intro > 0) {
+ g_boss_intro--;
+ if (g_boss_intro > 12 && (g_pressed & (K_OK | K_BACK))) g_boss_intro = 12;
+ return;
+ }
if (pl.dead) {
player_update(0);
ents_update();
@@ -238,6 +243,26 @@ static void draw_room(void) {
if (fl.curse & CURSE_DARKNESS) gfx_dark((int)pl.x, (int)pl.y - 8, 46, 26);
hud_draw();
if (g_keys & K_MAP) map_draw_full();
+ if (g_boss_intro > 0 && g_transition == 0) {
+ /* Rebirth's: a band across the room, him on the left, the boss on the right, VS between them */
+ int k = 64 - g_boss_intro, slide = k < 10 ? (10 - k) * 32 : g_boss_intro < 10 ? (10 - g_boss_intro) * 32 : 0;
+ int a = g_boss_intro < 8 ? g_boss_intro * 4 : 32;
+ gfx_rect(0, 0, SCREEN_W, SCREEN_H, C_BLACK, a / 2);
+ gfx_rect(0, 70, SCREEN_W, 100, rgb565(0x1A0E0A), a);
+ gfx_rect(0, 70, SCREEN_W, 2, rgb565(0x6A3020), a);
+ gfx_rect(0, 168, SCREEN_W, 2, rgb565(0x6A3020), a);
+ int head = character_head(pl.character);
+ gfx_sprite_scaled(head + 1, 0, 70 - slide, 156, 512, 512, 0, 0, 0, a);
+ gfx_sprite_scaled(head, 0, 70 - slide, 142, 512, 512, 0, 0, 0, a);
+ Room *r = room_cur();
+ int boss = r->kind == ROOM_MINIBOSS ? r->boss : fl.boss;
+ const char *name = boss_name(boss);
+ int spr = boss_sprite(boss);
+ if (spr >= 0) gfx_sprite_scaled(spr, 0, 238 + slide, 160, 300, 300, GFX_FLIPX, 0, 0, a);
+ gfx_text_c(FONT_UPHEAVAL, 160, 98, "VS", rgb565(0xE0D0B0), 3, true);
+ gfx_text_c(FONT_UPHEAVAL, 160, 178, name, C_WHITE, 2, true);
+ gfx_text_c(FONT_UPHEAVAL, 160, 50, character_name(pl.character), rgb565(0xE0D0B0), 2, true);
+ }
if (g_transition > 0) {
int a = g_transition > 5 ? (10 - g_transition) * 7 : g_transition * 7;
gfx_rect(0, 0, SCREEN_W, SCREEN_H, C_BLACK, a > 32 ? 32 : a);
diff --git a/games/isaac/src/game.h b/games/isaac/src/game.h
index b708bd0c..d9974491 100644
--- a/games/isaac/src/game.h
+++ b/games/isaac/src/game.h
@@ -196,6 +196,8 @@ void boss_spawn(int type, float x, float y);
bool boss_on_death(Ent *e);
void boss_draw(Ent *e);
float bosses_hp(float *max); /* the boss bar */
+const char *boss_name(int type);
+int boss_sprite(int type);
void mon_set_sprite(Ent *e);
/* pickups (pickups.c) */
@@ -332,6 +334,7 @@ extern int g_killer; /* what killed him (MON_*, or -1..-n: other ca
extern bool g_room_was_cleared;
extern uint32_t g_run_seed;
extern int g_transition; /* frames of the dip to black between rooms */
+extern int g_boss_intro; /* frames left of the boss's introduction (him VS it) */
extern uint8_t g_wins; /* runs won: Mom, Mom's Heart, Satan, Isaac (progress kept) */
extern uint16_t g_deaths, g_runs;
extern uint8_t g_best_stage;