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.
C calculatorcalculator-gamescasiochesscrossy-roaddrive-madfx-cg50gamesgeometry-dashgraphing-calculatorndlessnumworksnumworks-appsnumworks-calculatornumworks-gamenumworks-gamestetristi-84-plus-ceti-nspire
Celeste: entity classes take less room
Mason Chenb0153179df5c
diff --git a/games/celeste/src/berry.c b/games/celeste/src/berry.cindex 141d7690..f08625cf 100644--- a/games/celeste/src/berry.c+++ b/games/celeste/src/berry.c@@ -59,7 +59,7 @@ bool leader_gain(Ent *e, float follow_delay, bool persistent) {f->move = 1;f->persistent = persistent;if (persistent) e->tags |= TAG_PERSISTENT;- if (e->cls->on_gain_leader) e->cls->on_gain_leader(e);+ if (MORE(e->cls)->on_gain_leader) MORE(e->cls)->on_gain_leader(e);return true;}/* Follower.OnLoseLeaderUtil */@@ -69,7 +69,7 @@ static void lost(Fol *f) {e->tags &= (uint8_t)~TAG_PERSISTENT;e->room = (uint8_t)g_level.room_slot; /* it stays in this room now */}- if (e->cls->on_lose_leader) e->cls->on_lose_leader(e);+ if (MORE(e->cls)->on_lose_leader) MORE(e->cls)->on_lose_leader(e);}void leader_lose(Ent *e) {int i = find(e);@@ -371,8 +371,8 @@ static void berry_on_dash(Ent *e, V2 dir) {}static const EntClass BERRY = {.size = sizeof(Berry), .name = "strawberry", .update = berry_update, .render = berry_render,- .on_player = berry_on_player, .on_lose_leader = berry_lose_leader,- .on_dash = berry_on_dash, .kind = KIND_PCOLLIDE};+ .on_player = berry_on_player, .kind = KIND_PCOLLIDE,+ .more = &(const EntMore){.on_lose_leader = berry_lose_leader, .on_dash = berry_on_dash}};int berry_golden_room(void) {for (int i = 0; i < leader_count(); i++) {@@ -554,9 +554,10 @@ static void seed_attach(Ent *e, Ent *solid) {static void seed_sm_move(Ent *e, V2 amount) { e->x += amount.x, e->y += amount.y; }static const EntClass SEED = {.size = sizeof(Seed), .name = "strawberrySeed", .update = seed_update, .render = seed_render,- .on_player = seed_on_player, .on_gain_leader = seed_gain_leader,- .on_lose_leader = seed_lose_leader, .sm_riding = seed_riding, .sm_attach = seed_attach,- .sm_move = seed_sm_move, .kind = KIND_PCOLLIDE | KIND_STATICMOVER};+ .on_player = seed_on_player, .kind = KIND_PCOLLIDE | KIND_STATICMOVER,+ .more = &(const EntMore){.on_gain_leader = seed_gain_leader,+ .on_lose_leader = seed_lose_leader, .sm_riding = seed_riding,+ .sm_attach = seed_attach, .sm_move = seed_sm_move}};/* ---------------------------------------------------------------- the strawberry entity */static void berry_new(const EData *d, bool golden, bool memorial) {diff --git a/games/celeste/src/ch0.c b/games/celeste/src/ch0.cindex 74fe151d..64a42d6d 100644--- a/games/celeste/src/ch0.c+++ b/games/celeste/src/ch0.c@@ -30,7 +30,7 @@ static void car_render(Ent *e) {if (tex_get(T_scenery_car_body, &t)) gfx_tex_ex(T_scenery_car_body, e->x, e->y, t.fw / 2.f, (float)t.fh, 1, 1, 0, 0xFFFF, 255, 0);}static const EntClass CAR = {.size = sizeof(Car), .name = "introCar", .update = car_update, .render = car_render,- .collide_rect = car_rect, .kind = KIND_JUMPTHRU};+ .kind = KIND_JUMPTHRU, .more = &(const EntMore){.collide_rect = car_rect}};typedef struct { uint16_t tex, tint; uint8_t origin_bottom, center; } Pic;static void pic_render(Ent *e) {Pic *p = ST(e, Pic);diff --git a/games/celeste/src/ch1.c b/games/celeste/src/ch1.cindex 5696bc57..fc14d019 100644--- a/games/celeste/src/ch1.c+++ b/games/celeste/src/ch1.c@@ -469,7 +469,8 @@ static void event1_enter(Ent *e, Player *p) {level_register_complete(); /* OnBegin */cutscene_start(c, end1_end, false, true);}-static const EntClass EVENT1 = {.size = 1, .name = "eventTrigger", .on_enter = event1_enter, .kind = KIND_TRIGGER};+static const EntClass EVENT1 = {.size = 1, .name = "eventTrigger", .kind = KIND_TRIGGER,+ .more = &(const EntMore){.on_enter = event1_enter}};/* ---------------------------------------------------------------- Memorial and MemorialText */#define MEMO_N 96diff --git a/games/celeste/src/ch2.c b/games/celeste/src/ch2.cindex 09afcca3..516c4b56 100644--- a/games/celeste/src/ch2.c+++ b/games/celeste/src/ch2.c@@ -2883,7 +2883,8 @@ static void event_enter(Ent *e, Player *p) {if (s->end) level_register_complete(); /* CS02_Ending.OnBegin */cutscene_start(c, call_end, false, s->end);}-static const EntClass EVENTTRIG = {.name = "eventTrigger", .size = sizeof(Event), .on_enter = event_enter, .kind = KIND_TRIGGER};+static const EntClass EVENTTRIG = {.name = "eventTrigger", .size = sizeof(Event), .kind = KIND_TRIGGER,+ .more = &(const EntMore){.on_enter = event_enter}};/* InteractTrigger: talk to read something (ch2_interact_new: chapter 3's too) */typedef struct { Talk talk; void (*on_talk)(Ent *e, Player *p); } Interact;diff --git a/games/celeste/src/ch3.c b/games/celeste/src/ch3.cindex 9df3098f..94a73fb1 100644--- a/games/celeste/src/ch3.c+++ b/games/celeste/src/ch3.c@@ -503,9 +503,9 @@ static void clutfront_render(Ent *e) {gfx_custom(clut_blk_layer, m, 0, VIEW_H);}static const EntClass CLUTTERFRONT = {.name = "clutterBlocks", .size = sizeof(ClutterFront), .render = clutfront_render};-static const EntClass CLUTTER = {.name = "clutterBase", .size = sizeof(Clutter), .update = clutter_update, .render = clutter_render,- .awake = clutter_awake, .removed = clutter_removed, .collide_rect = clutter_collide_rect,- .kind = KIND_SOLID};+static const EntClass CLUTTER = {.name = "clutterBase", .size = sizeof(Clutter), .update = clutter_update,+ .render = clutter_render, .awake = clutter_awake, .removed = clutter_removed, .kind = KIND_SOLID,+ .more = &(const EntMore){.collide_rect = clutter_collide_rect}};/* yellowBlocks / greenBlocks / redBlocks: ClutterBlockGenerator.Add */static void new_clutter_area(const EData *d, int color, float w, float h) {int slot = g_level.room_slot;@@ -805,8 +805,9 @@ static void cswitch_render(Ent *e) {if (!s->pressed) gfx_tex_ex(cswitch_icon[s->color], e->x + 16, e->y + 8, 8, 8, 1, 1, 0, 0xFFFF, 255, 0);light_add(e->x + e->cw / 2, e->y - 1, 0x00FFFF, 1, s->pressed ? 24 : 32, s->pressed ? 48 : 64);}-static const EntClass CSWITCH = {.name = "colorSwitch", .size = sizeof(CSwitch), .update = cswitch_update, .render = cswitch_render,- .on_dash_collide = cswitch_dashed, .kind = KIND_SOLID};+static const EntClass CSWITCH = {.name = "colorSwitch", .size = sizeof(CSwitch), .update = cswitch_update,+ .render = cswitch_render, .kind = KIND_SOLID,+ .more = &(const EntMore){.on_dash_collide = cswitch_dashed}};static int clut_color_of(const char *s) {for (int i = 0; i < 3; i++)if (!strcmp(s, CLUT_NAMES[i])) return i;@@ -864,7 +865,7 @@ static void gdoor_render(Ent *e) {spr_draw(&s, e->x + e->cw / 2, e->y + e->ch / 2);}static const EntClass GDOOR = {.name = "clutterDoor", .size = sizeof(GDoor), .update = gdoor_update, .render = gdoor_render,- .on_dash_collide = gdoor_dashed, .kind = KIND_SOLID};+ .kind = KIND_SOLID, .more = &(const EntMore){.on_dash_collide = gdoor_dashed}};static void new_gdoor(const EData *d, bool oshiro) {Ent *e = ent_new(&GDOOR, d->x, d->y);if (!e) return;@@ -1177,8 +1178,8 @@ static void ts_removed(Ent *e) { /* frees its tendrils: the later ones move dos->n = 0;}static const EntClass TSPIKES_CLASS = {.name = "triggerSpikes", .size = sizeof(TSpikes), .update = ts_update, .render = ts_render,- .removed = ts_removed, .on_player = ts_on_player, .sm_riding = ts_riding,- .kind = KIND_PCOLLIDE | KIND_STATICMOVER};+ .removed = ts_removed, .on_player = ts_on_player, .kind = KIND_PCOLLIDE | KIND_STATICMOVER,+ .more = &(const EntMore){.sm_riding = ts_riding}};static void new_tspikes(const EData *d, int dir, int size) {int n = size / 4;if (nts + n > TSPIKES) return;@@ -1240,8 +1241,8 @@ static void door_update(Ent *e) {}static void door_render(Ent *e) { spr_draw(&ST(e, Door)->spr, e->x, e->y); }static const EntClass DOOR = {.name = "door", .size = sizeof(Door), .update = door_update, .render = door_render,- .on_player = door_on_player, .on_squish = door_squish, .is_riding_solid = door_riding,- .kind = KIND_ACTOR | KIND_PCOLLIDE};+ .on_player = door_on_player, .kind = KIND_ACTOR | KIND_PCOLLIDE,+ .more = &(const EntMore){.on_squish = door_squish, .is_riding_solid = door_riding}};static void new_door(const EData *d) {Ent *e = ent_new(&DOOR, d->x, d->y);if (!e) return;@@ -1407,8 +1408,9 @@ static void moving_update(Ent *e) {static void moving_trigger(Ent *e, Ent *m) { (void)m, ST(e, Moving)->sink_timer = 0.4f; }static void moving_render(Ent *e) { platform_draw(ST(e, Moving)->tex, e->x, e->y, e->cw); }static void moving_awake(Ent *e) { plat_static_movers_attach(e); }-static const EntClass MOVING = {.name = "movingPlatform", .size = sizeof(Moving), .update = moving_update, .render = moving_render,- .awake = moving_awake, .on_staticmover_trigger = moving_trigger, .kind = KIND_JUMPTHRU};+static const EntClass MOVING = {.name = "movingPlatform", .size = sizeof(Moving), .update = moving_update,+ .render = moving_render, .awake = moving_awake, .kind = KIND_JUMPTHRU,+ .more = &(const EntMore){.on_staticmover_trigger = moving_trigger}};static void new_moving(const EData *d) {float w = EA(d, movingPlatform, width);Ent *e = ent_new(&MOVING, d->x, d->y);@@ -2006,7 +2008,8 @@ static void oshtrig_enter(Ent *e, Player *p) {}ent_remove(e);}-static const EntClass OSHTRIG = {.name = "oshiroTrigger", .size = sizeof(OshTrig), .on_enter = oshtrig_enter, .kind = KIND_TRIGGER};+static const EntClass OSHTRIG = {.name = "oshiroTrigger", .size = sizeof(OshTrig), .kind = KIND_TRIGGER,+ .more = &(const EntMore){.on_enter = oshtrig_enter}};/* ---------------------------------------------------------------- ResortMirror *//* the glass (glassbg's middle), its shine (glassfg) at shineAlpha x mirrorAlpha, and the frame (its own entity,@@ -4231,7 +4234,8 @@ static void fade_stay(Ent *e, Player *p) {g_level.lighting = area_darkness() + v;}}-static const EntClass FADETRIG = {.name = "fadeTrigger", .size = sizeof(Fade), .on_stay = fade_stay, .kind = KIND_TRIGGER};+static const EntClass FADETRIG = {.name = "fadeTrigger", .size = sizeof(Fade), .kind = KIND_TRIGGER,+ .more = &(const EntMore){.on_stay = fade_stay}};/* ---------------------------------------------------------------- the factories */bool ents_ch3(const EData *d) {diff --git a/games/celeste/src/ch4.c b/games/celeste/src/ch4.cindex d29b1ed8..6e4f8809 100644--- a/games/celeste/src/ch4.c+++ b/games/celeste/src/ch4.c@@ -235,7 +235,8 @@ static void booster_render(Ent *e) {static void outline_render(Ent *e) { gfx_tex_ex(tex("objects/booster/outline"), e->x, e->y, 16, 16, 1, 1, 0, 0xFFFF, 191, 0); }static const EntClass BOOSTER_OUTLINE = {.name = "boosterOutline", .size = 0, .render = outline_render};static const EntClass BOOSTER = {.name = "booster", .size = sizeof(Booster), .update = booster_update, .render = booster_render,- .on_player = booster_on_player, .on_dash = booster_on_dash, .kind = KIND_PCOLLIDE};+ .on_player = booster_on_player, .kind = KIND_PCOLLIDE,+ .more = &(const EntMore){.on_dash = booster_on_dash}};static void new_booster(const EData *d) {Ent *e = ent_new(&BOOSTER, d->x, d->y);if (!e) return;@@ -415,8 +416,9 @@ static void mdebris_render(Ent *e) {float s = d->returning ? 1 + d->ret * 0.5f : 1;gfx_tex_ex(mb_debris_tex[d->tex], e->x + d->ox, e->y + d->oy, 4, 4, d->flip ? -s : s, s, d->rot, 0xFFFF, (uint8_t)(d->alpha * 255), 0);}-static const EntClass MB_DEBRIS = {.name = "moveBlockDebris", .size = sizeof(MDebris), .update = mdebris_update, .render = mdebris_render,- .on_squish = mdebris_squish, .kind = KIND_ACTOR};+static const EntClass MB_DEBRIS = {.name = "moveBlockDebris", .size = sizeof(MDebris), .update = mdebris_update,+ .render = mdebris_render, .kind = KIND_ACTOR,+ .more = &(const EntMore){.on_squish = mdebris_squish}};/* MoveBlock.Border */typedef struct { int16_t parent; } MBorder;@@ -703,8 +705,9 @@ static void mb_awake(Ent *e) {if (b) b->depth = 1, b->collidable = 0, ST(b, MBorder)->parent = ent_ref(e);ST(e, MoveB)->border = ent_ref(b);}-static const EntClass MOVEBLOCK = {.name = "moveBlock", .size = sizeof(MoveB), .update = mb_update, .render = mb_render, .awake = mb_awake,- .on_staticmover_trigger = mb_trigger, .kind = KIND_SOLID};+static const EntClass MOVEBLOCK = {.name = "moveBlock", .size = sizeof(MoveB), .update = mb_update, .render = mb_render,+ .awake = mb_awake, .kind = KIND_SOLID,+ .more = &(const EntMore){.on_staticmover_trigger = mb_trigger}};static void new_moveblock(const EData *d) {Ent *e = ent_new(&MOVEBLOCK, d->x, d->y);if (!e) return;@@ -974,7 +977,8 @@ static bool bgsolid_collide_rect(const Ent *e, float l, float t, float r, float}return false;}-static const EntClass BGSOLID = {.name = "bgSolidTiles", .size = sizeof(BgSolid), .collide_rect = bgsolid_collide_rect, .kind = KIND_SOLID};+static const EntClass BGSOLID = {.name = "bgSolidTiles", .size = sizeof(BgSolid), .kind = KIND_SOLID,+ .more = &(const EntMore){.collide_rect = bgsolid_collide_rect}};typedef struct { float duck_timer; int16_t bg; uint8_t enabled, activated; } White;static void white_disable(Ent *e) {White *w = ST(e, White);@@ -1416,7 +1420,8 @@ static void windtrig_enter(Ent *e, Player *p) {}wind_set_pattern(ST(c, Wind), ST(e, WindTrig)->pattern);}-static const EntClass WINDTRIG = {.name = "windTrigger", .size = sizeof(WindTrig), .on_enter = windtrig_enter, .kind = KIND_TRIGGER};+static const EntClass WINDTRIG = {.name = "windTrigger", .size = sizeof(WindTrig), .kind = KIND_TRIGGER,+ .more = &(const EntMore){.on_enter = windtrig_enter}};/* Level.TransitionRoutine: the wind trigger under the player's destination sets the pattern, else the room's */static void wind_transition_pattern(Wind *w) {w->pattern = 0, w->ever_set = 0;@@ -1517,7 +1522,8 @@ static void windattack_enter(Ent *e, Player *p) {}ent_remove(e);}-static const EntClass WINDATTACK = {.name = "windAttackTrigger", .size = 0, .on_enter = windattack_enter, .kind = KIND_TRIGGER};+static const EntClass WINDATTACK = {.name = "windAttackTrigger", .size = 0, .kind = KIND_TRIGGER,+ .more = &(const EntMore){.on_enter = windattack_enter}};/* ---------------------------------------------------------------- the factories *//* ---------------------------------------------------------------- the story: helpers */diff --git a/games/celeste/src/ch5.c b/games/celeste/src/ch5.cindex 76fab553..a488cd19 100644--- a/games/celeste/src/ch5.c+++ b/games/celeste/src/ch5.c@@ -759,8 +759,9 @@ static void dswitch_render(Ent *e) {DSwitch *s = ST(e, DSwitch);cs_draw(&s->spr, e->x + SIDE_SPR[s->side][0], e->y + SIDE_SPR[s->side][1], 1, 1, SIDE_ROT[s->side], 0xFFFF, 255);}-static const EntClass DSWITCH = {.name = "dashSwitch", .size = sizeof(DSwitch), .update = dswitch_update, .render = dswitch_render,- .awake = dswitch_awake, .on_dash_collide = dswitch_hit, .kind = KIND_SOLID};+static const EntClass DSWITCH = {.name = "dashSwitch", .size = sizeof(DSwitch), .update = dswitch_update,+ .render = dswitch_render, .awake = dswitch_awake, .kind = KIND_SOLID,+ .more = &(const EntMore){.on_dash_collide = dswitch_hit}};static bool is_dswitch(Ent *e) { return e && e->cls == &DSWITCH; }static void new_dswitch(const EData *d, bool horizontal) {@@ -881,7 +882,7 @@ static void swap_render(Ent *e) {if (s->red_alpha > 0) swap_style(pos, e->cw, e->ch, swap_tex[s->moon][1], swap_mid[s->moon][1][f], a8(s->red_alpha));}static const EntClass SWAP = {.name = "swapBlock", .size = sizeof(Swap), .update = swap_update, .render = swap_render,- .on_dash = swap_on_dash, .kind = KIND_SOLID};+ .kind = KIND_SOLID, .more = &(const EntMore){.on_dash = swap_on_dash}};static void swappath_update(Ent *e) { ST(e, SwapPath)->timer += DT * 4; }static void swappath_render(Ent *e) {@@ -1577,8 +1578,8 @@ static void theo_render(Ent *e) {light_add(e->x, e->y - 5, 0xFFFFFF, 1, 32, 64);}static const EntClass THEO = {.name = "theoCrystal", .size = sizeof(Theo), .update = theo_update, .render = theo_render,- .awake = theo_awake, .on_squish = theo_squish, .is_riding_solid = theo_riding,- .kind = KIND_ACTOR | KIND_HOLDABLE};+ .awake = theo_awake, .kind = KIND_ACTOR | KIND_HOLDABLE,+ .more = &(const EntMore){.on_squish = theo_squish, .is_riding_solid = theo_riding}};static void new_theo(const EData *d) {Ent *e = ent_new(&THEO, d->x, d->y);if (!e) return;@@ -1659,8 +1660,8 @@ static void pedestal_render(Ent *e) {gfx_tex_ex(T_characters_theoCrystal_pedestal, e->x, e->y, 32, 72, 1, 1, 0, 0xFFFF, 255, 0); /* JustifyOrigin(0.5, 1) */}static const EntClass PEDESTAL = {.name = "theoCrystalPedestal", .size = sizeof(Pedestal), .update = pedestal_update,- .render = pedestal_render, .awake = pedestal_awake, .on_dash_collide = pedestal_hit,- .kind = KIND_SOLID};+ .render = pedestal_render, .awake = pedestal_awake, .kind = KIND_SOLID,+ .more = &(const EntMore){.on_dash_collide = pedestal_hit}};static void new_pedestal(const EData *d) {Ent *e = ent_new(&PEDESTAL, d->x, d->y);if (!e) return;@@ -2455,8 +2456,9 @@ static void seeker_removed(Ent *e) {}static bool seeker_riding(Ent *e, Ent *o) { return (void)e, (void)o, false; }static const EntClass SEEKER = {.name = "seeker", .size = sizeof(Seeker), .update = seeker_update, .render = seeker_render,- .awake = seeker_awake, .removed = seeker_removed, .on_squish = seeker_squish,- .is_riding_solid = seeker_riding, .is_riding_jumpthru = seeker_riding, .kind = KIND_ACTOR};+ .awake = seeker_awake, .removed = seeker_removed, .kind = KIND_ACTOR,+ .more = &(const EntMore){.on_squish = seeker_squish,+ .is_riding_solid = seeker_riding, .is_riding_jumpthru = seeker_riding}};/* the HotPink DeathEffect of a squished seeker */typedef struct { float t; uint16_t color, pad; } DeathFx;@@ -4102,8 +4104,8 @@ static void event_update(Ent *e) { /* Brighten() */Event *ev = ST(e, Event);if (ev->brighten && (g_level.lighting = approach(g_level.lighting, 0.15f, DT * 4)) == 0.15f) ev->brighten = 0;}-static const EntClass EVENTTRIG = {.name = "eventTrigger", .size = sizeof(Event), .update = event_update,- .on_enter = event_enter, .kind = KIND_TRIGGER};+static const EntClass EVENTTRIG = {.name = "eventTrigger", .size = sizeof(Event), .update = event_update, .kind = KIND_TRIGGER,+ .more = &(const EntMore){.on_enter = event_enter}};static bool new_event(const EData *d) {static const char *const names[4] = {"ch5_see_theo", "ch5_found_theo", "ch5_mirror_reflection", "cancel_ch5_see_theo"};const char *ev = EAS(d, eventTrigger, event);@@ -4185,7 +4187,8 @@ static void minitrig_update(Ent *e) { /* OnTheoEnter: a HoldableCollider */if (ST(e, MiniTrig)->mode == 2 && t && collide_ent_at(e, e->x, e->y, t)) minitrig_fire(e);}static const EntClass MINITRIG = {.name = "minitextboxTrigger", .size = sizeof(MiniTrig), .update = minitrig_update,- .awake = minitrig_awake, .on_enter = minitrig_enter, .kind = KIND_TRIGGER};+ .awake = minitrig_awake, .kind = KIND_TRIGGER,+ .more = &(const EntMore){.on_enter = minitrig_enter}};static void new_minitrig(const EData *d) {uint32_t h = level_entity_hash(d);Ent *e = ent_new(&MINITRIG, d->x, d->y);diff --git a/games/celeste/src/ch6.c b/games/celeste/src/ch6.cindex e71aefe0..29c17ca0 100644--- a/games/celeste/src/ch6.c+++ b/games/celeste/src/ch6.c@@ -672,8 +672,8 @@ static void kevin_update(Ent *e) {for (int i = 0; i < g_nents; i++) {Ent *o = &g_ents[i];if (o->cls && o->dead != 1 && !strcmp(o->cls->name, "fallingBlock") && collide_ent_at(e, e->x + k->crush_dir.x, e->y + k->crush_dir.y, o) &&- o->cls->on_staticmover_trigger)- o->cls->on_staticmover_trigger(o, NULL);+ MORE(o->cls)->on_staticmover_trigger)+ MORE(o->cls)->on_staticmover_trigger(o, NULL);}kevin_impact(e);level_dir_shake(k->crush_dir, 0.3f);@@ -761,7 +761,7 @@ static void kevin_render(Ent *e) {cs_draw(&k->face, x + fx, y + fy, 1, 1, 0, 0xFFFF, 255);}static const EntClass KEVIN = {.name = "crushBlock", .size = sizeof(Kevin), .update = kevin_update, .render = kevin_render,- .on_dash_collide = kevin_dashed, .kind = KIND_SOLID};+ .kind = KIND_SOLID, .more = &(const EntMore){.on_dash_collide = kevin_dashed}};static void new_kevin(const EData *d) {float w = EA(d, crushBlock, width), h = EA(d, crushBlock, height);Ent *e = ent_new(&KEVIN, d->x, d->y);@@ -1289,7 +1289,8 @@ static void hstatue_render(Ent *e) {}static void hstatue_awake(Ent *e) { hstatue_check_all(e, true); }static const EntClass HSTATUE = {.name = "reflectionHeartStatue", .size = sizeof(HStatue), .update = hstatue_update,- .render = hstatue_render, .awake = hstatue_awake, .on_dash = hstatue_on_dash};+ .render = hstatue_render, .awake = hstatue_awake,+ .more = &(const EntMore){.on_dash = hstatue_on_dash}};static void new_hstatue(const EData *d) {if (d->nnodes < 5) return;Ent *e = ent_new(&HSTATUE, d->x, d->y);@@ -1438,8 +1439,8 @@ static void bfall_render(Ent *e) {bt_draw(b->q, b->w, b->h, e->x + e->shakex, e->y + e->shakey, 1 - b->hl, b->hl);}static void bfall_shake(Ent *e, V2 a) { plat_static_movers_shake(e, a); }-static const EntClass BFALL = {.name = "finalBossFallingBlock", .size = sizeof(BFall), .update = bfall_update, .render = bfall_render,- .on_shake = bfall_shake, .kind = KIND_SOLID};+static const EntClass BFALL = {.name = "finalBossFallingBlock", .size = sizeof(BFall), .update = bfall_update,+ .render = bfall_render, .kind = KIND_SOLID, .more = &(const EntMore){.on_shake = bfall_shake}};static void new_bfall(const EData *d) {float w = EA(d, finalBossFallingBlock, width), h = EA(d, finalBossFallingBlock, height);Ent *e = ent_new(&BFALL, d->x, d->y);@@ -1592,8 +1593,8 @@ static void bmove_render(Ent *e) {}}static void bmove_shake(Ent *e, V2 a) { plat_static_movers_shake(e, a); }-static const EntClass BMOVE = {.name = "finalBossMovingBlock", .size = sizeof(BMove), .update = bmove_update, .render = bmove_render,- .on_shake = bmove_shake, .kind = KIND_SOLID};+static const EntClass BMOVE = {.name = "finalBossMovingBlock", .size = sizeof(BMove), .update = bmove_update,+ .render = bmove_render, .kind = KIND_SOLID, .more = &(const EntMore){.on_shake = bmove_shake}};static void new_bmove(const EData *d) {float w = EA(d, finalBossMovingBlock, width), h = EA(d, finalBossMovingBlock, height);Ent *e = ent_new(&BMOVE, d->x, d->y);@@ -4346,7 +4347,8 @@ static void event6_enter(Ent *e, Player *p) {} else if (!level_get_flag("reflection") && (cs = s6_new(reflect6_run, reflect6_end, true, false))) /* ch6_reflect */S6_(cs)->f[0] = cx - 5;}-static const EntClass EVENT6 = {.name = "eventTrigger", .size = sizeof(Event6), .on_enter = event6_enter, .kind = KIND_TRIGGER};+static const EntClass EVENT6 = {.name = "eventTrigger", .size = sizeof(Event6), .kind = KIND_TRIGGER,+ .more = &(const EntMore){.on_enter = event6_enter}};static bool new_event6(const EData *d) {const char *ev = EAS(d, eventTrigger, event);int which = !strcmp(ev, "ch6_boss_intro") ? 0 : !strcmp(ev, "ch6_reflect") ? 1 : -1;diff --git a/games/celeste/src/ch7.c b/games/celeste/src/ch7.cindex 43373ba3..dc4f1c84 100644--- a/games/celeste/src/ch7.c+++ b/games/celeste/src/ch7.c@@ -881,7 +881,8 @@ static void summit_enter(Ent *e, Player *p) {level_register_complete(); /* OnBegin: RegisterAreaComplete */ST(cs, Ending7)->target = s->target;}-static const EntClass SUMMITTRIG = {.name = "eventTrigger", .size = sizeof(Summit), .on_enter = summit_enter, .kind = KIND_TRIGGER};+static const EntClass SUMMITTRIG = {.name = "eventTrigger", .size = sizeof(Summit), .kind = KIND_TRIGGER,+ .more = &(const EntMore){.on_enter = summit_enter}};/* ---------------------------------------------------------------- NPC07X_Granny_Ending */typedef struct {@@ -1754,7 +1755,8 @@ static void ctrig_enter(Ent *e, Player *p) {(void)p;if (have_ch7() && cr.active) cr.event = *ST(e, uint8_t);}-static const EntClass CTRIG = {.name = "creditsTrigger", .size = 4, .on_enter = ctrig_enter, .kind = KIND_TRIGGER};+static const EntClass CTRIG = {.name = "creditsTrigger", .size = 4, .kind = KIND_TRIGGER,+ .more = &(const EntMore){.on_enter = ctrig_enter}};/* ---------------------------------------------------------------- the factories */bool ents_ch7(const EData *d) {diff --git a/games/celeste/src/ch8.c b/games/celeste/src/ch8.cindex ce806aeb..0f04b960 100644--- a/games/celeste/src/ch8.c+++ b/games/celeste/src/ch8.c@@ -314,7 +314,8 @@ static void door_enter(Ent *e, Player *p) {Ent *cs = scene_new(&ENTERDOOR, door_end, true, false);if (cs) ST(cs, EnterDoor)->target_x = d->left;}-static const EntClass DOORTRIG = {.name = "eventTrigger", .size = sizeof(Door8), .on_enter = door_enter, .kind = KIND_TRIGGER};+static const EntClass DOORTRIG = {.name = "eventTrigger", .size = sizeof(Door8), .kind = KIND_TRIGGER,+ .more = &(const EntMore){.on_enter = door_enter}};/* ---------------------------------------------------------------- the factories */bool ents_ch8(const EData *d) {diff --git a/games/celeste/src/ch9.c b/games/celeste/src/ch9.cindex 21a64d42..932ece78 100644--- a/games/celeste/src/ch9.c+++ b/games/celeste/src/ch9.c@@ -1453,14 +1453,15 @@ static void adv_leave(Ent *e, Player *p) {}p->cam_anchor_lerp = v2(0, 0);}-static const EntClass ADVTRIG = {.name = "cameraAdvanceTargetTrigger", .size = sizeof(AdvTrig), .on_stay = adv_stay, .on_leave = adv_leave,- .kind = KIND_TRIGGER};+static const EntClass ADVTRIG = {.name = "cameraAdvanceTargetTrigger", .size = sizeof(AdvTrig), .kind = KIND_TRIGGER,+ .more = &(const EntMore){.on_stay = adv_stay, .on_leave = adv_leave}};typedef struct { uint8_t state; } NoRefill;static void norefill_enter(Ent *e, Player *p) {g_session.no_refills = ST(e, NoRefill)->state; /* Session.Inventory.NoRefills */p->inventory_norefills = ST(e, NoRefill)->state;}-static const EntClass NOREFILL = {.name = "noRefillTrigger", .size = sizeof(NoRefill), .on_enter = norefill_enter, .kind = KIND_TRIGGER};+static const EntClass NOREFILL = {.name = "noRefillTrigger", .size = sizeof(NoRefill), .kind = KIND_TRIGGER,+ .more = &(const EntMore){.on_enter = norefill_enter}};/* ---------------------------------------------------------------- CoreMessage */typedef struct { float alpha; uint8_t line; } CoreMsg;diff --git a/games/celeste/src/dust.c b/games/celeste/src/dust.cindex 4c93302a..8ec25954 100644--- a/games/celeste/src/dust.c+++ b/games/celeste/src/dust.c@@ -405,10 +405,11 @@ static void mover_awake(Ent *e) {m->eye = m->eye_target = angle_vec(a + diff * 0.3f, 1);}-static const EntClass MOVER = {.name = "movingSpinner", .size = sizeof(Mover), .update = mover_update,- .render = mover_render, .on_player = mover_on_player, .awake = mover_awake,- .collide_rect = mover_collide, .sm_riding = mover_riding, .sm_move = mover_sm_move,- .sm_destroy = mover_sm_destroy, .kind = KIND_PCOLLIDE | KIND_STATICMOVER};+static const EntClass MOVER = {.name = "movingSpinner", .size = sizeof(Mover), .update = mover_update, .render = mover_render,+ .on_player = mover_on_player, .awake = mover_awake, .kind = KIND_PCOLLIDE | KIND_STATICMOVER,+ .more = &(const EntMore){.collide_rect = mover_collide,+ .sm_riding = mover_riding, .sm_move = mover_sm_move,+ .sm_destroy = mover_sm_destroy}};static bool dust_room_of(const EData *d) {int a = g_session.area;diff --git a/games/celeste/src/ent.c b/games/celeste/src/ent.cindex bccf3ef3..cf2692f3 100644--- a/games/celeste/src/ent.c+++ b/games/celeste/src/ent.c@@ -2,6 +2,7 @@* JumpThru movement (pixel by pixel, pushing and carrying riders). */#include "ent.h"#include "level.h"+const EntMore g_no_more;Ent g_ents[MAX_ENTS];int g_nents;@@ -216,10 +217,10 @@ bool collide_ent_at(const Ent *e, float x, float y, const Ent *o) {if (e->ctype == COL_NONE || o->ctype == COL_NONE) return false;/* ColliderLists: the entity's own test against the other's box */if (o->ctype == COL_LIST && e->ctype == COL_BOX)- return o->cls->collide_rect(o, x + e->cx, y + e->cy, x + e->cx + e->cw, y + e->cy + e->ch);+ return MORE(o->cls)->collide_rect(o, x + e->cx, y + e->cy, x + e->cx + e->cw, y + e->cy + e->ch);if (e->ctype == COL_LIST && o->ctype == COL_BOX) {float dx = e->x - x, dy = e->y - y;- return e->cls->collide_rect(e, o->x + o->cx + dx, o->y + o->cy + dy, o->x + o->cx + o->cw + dx, o->y + o->cy + o->ch + dy);+ return MORE(e->cls)->collide_rect(e, o->x + o->cx + dx, o->y + o->cy + dy, o->x + o->cx + o->cw + dx, o->y + o->cy + o->ch + dy);}float l = x + e->cx, t = y + e->cy;if (e->ctype == COL_BOX) {@@ -248,7 +249,7 @@ bool collide_rect(const Ent *e, float l, float t, float r, float b) {if (e->ctype == COL_CIRCLE) return rect_circle(l, t, r, b, e->x + e->cx, e->y + e->cy, e->cw);if (e == g_solidtiles) return tiles_solid_rect(l, t, r, b);if (e->ctype == COL_GRID) return level_grid_collide(e, l, t, r, b);- if (e->ctype == COL_LIST) return e->cls->collide_rect(e, l, t, r, b);+ if (e->ctype == COL_LIST) return MORE(e->cls)->collide_rect(e, l, t, r, b);return false;}@@ -292,12 +293,12 @@ bool point_solid(float x, float y) { return rect_solid(x, y, x + 1, y + 1); }/* ---------------------------------------------------------------- Actor */bool actor_is_riding_jumpthru(Ent *e, Ent *j) {- if (e->cls->is_riding_jumpthru) return e->cls->is_riding_jumpthru(e, j);+ if (MORE(e->cls)->is_riding_jumpthru) return MORE(e->cls)->is_riding_jumpthru(e, j);if (e->ignore_jumpthrus) return false;return collide_ent_at(e, e->x, e->y + 1, j) && !collide_ent_at(e, e->x, e->y, j);}bool actor_is_riding_solid(Ent *e, Ent *s) {- if (e->cls->is_riding_solid) return e->cls->is_riding_solid(e, s);+ if (MORE(e->cls)->is_riding_solid) return MORE(e->cls)->is_riding_solid(e, s);return collide_ent_at(e, e->x, e->y + 1, s);}@@ -426,7 +427,7 @@ bool actor_try_squish_wiggle(Ent *e, Collision *c) {}static void actor_squish(Ent *e, Collision *c) {- if (e->cls->on_squish) e->cls->on_squish(e, c);+ if (MORE(e->cls)->on_squish) MORE(e->cls)->on_squish(e, c);else if (!actor_try_squish_wiggle(e, c)) ent_remove(e);}@@ -453,7 +454,7 @@ void plat_static_movers_move(Ent *p, V2 amount) {for (int i = 0; i < g_nents; i++) {Ent *m = &g_ents[i];if (m->cls && ent_platform(m) == p && m->dead != 1) {- if (m->cls->sm_move) m->cls->sm_move(m, amount);+ if (MORE(m->cls)->sm_move) MORE(m->cls)->sm_move(m, amount);else m->x += amount.x, m->y += amount.y;}}@@ -461,14 +462,14 @@ void plat_static_movers_move(Ent *p, V2 amount) {void plat_static_movers_shake(Ent *p, V2 amount) {for (int i = 0; i < g_nents; i++) {Ent *m = &g_ents[i];- if (m->cls && ent_platform(m) == p && m->cls->sm_shake) m->cls->sm_shake(m, amount);+ if (m->cls && ent_platform(m) == p && MORE(m->cls)->sm_shake) MORE(m->cls)->sm_shake(m, amount);}}void plat_static_movers_enable(Ent *p, bool on) {for (int i = 0; i < g_nents; i++) {Ent *m = &g_ents[i];if (m->cls && ent_platform(m) == p) {- if (m->cls->sm_enable) m->cls->sm_enable(m, on);+ if (MORE(m->cls)->sm_enable) MORE(m->cls)->sm_enable(m, on);else m->collidable = m->visible = m->active = on;}}@@ -477,23 +478,23 @@ void plat_static_movers_destroy(Ent *p) {for (int i = 0; i < g_nents; i++) {Ent *m = &g_ents[i];if (m->cls && ent_platform(m) == p) {- if (m->cls->sm_destroy) m->cls->sm_destroy(m);+ if (MORE(m->cls)->sm_destroy) MORE(m->cls)->sm_destroy(m);else ent_remove(m);ent_set_platform(m, NULL);}}}void plat_static_movers_trigger(Ent *p) {- if (p->cls->on_staticmover_trigger) p->cls->on_staticmover_trigger(p, NULL);+ if (MORE(p->cls)->on_staticmover_trigger) MORE(p->cls)->on_staticmover_trigger(p, NULL);}void plat_static_movers_attach(Ent *p) {for (int i = 0; i < g_nents; i++) {Ent *m = &g_ents[i];if (!m->cls || !(m->kind & KIND_STATICMOVER) || m->plat || m->dead == 1) continue;- if (m->cls->sm_riding && m->cls->sm_riding(m, p)) {+ if (MORE(m->cls)->sm_riding && MORE(m->cls)->sm_riding(m, p)) {ent_set_platform(m, p);- if (m->cls->sm_attach) m->cls->sm_attach(m, p);+ if (MORE(m->cls)->sm_attach) MORE(m->cls)->sm_attach(m, p);}}}@@ -510,7 +511,7 @@ void plat_update(Ent *e) {V2 was = e_shake(e);e->shakex = (int8_t)(rndi(3) - 1), e->shakey = (int8_t)(rndi(3) - 1); /* Calc.Random.ShakeVector */V2 d = v2sub(e_shake(e), was);- if (e->cls->on_shake) e->cls->on_shake(e, d);+ if (MORE(e->cls)->on_shake) MORE(e->cls)->on_shake(e, d);else plat_static_movers_shake(e, d);}for (int i = 0; i < nshakes; i++)@@ -542,7 +543,7 @@ void plat_stop_shaking(Ent *e) {e->shaking = 0;if (e->shakex || e->shakey) {V2 d = v2(-e->shakex, -(float)e->shakey);- if (e->cls->on_shake) e->cls->on_shake(e, d);+ if (MORE(e->cls)->on_shake) MORE(e->cls)->on_shake(e, d);else plat_static_movers_shake(e, d);e->shakex = e->shakey = 0;}diff --git a/games/celeste/src/ent.h b/games/celeste/src/ent.hindex a4492c07..1af62d0c 100644--- a/games/celeste/src/ent.h+++ b/games/celeste/src/ent.h@@ -30,20 +30,13 @@ enum {typedef struct { V2 dir, moved, target; Ent *hit, *pusher; } Collision;typedef void (*CollideFn)(Ent *self, Collision *c);+/* what few kinds of entities have (EntClass.more) */typedef struct {- const char *name;- uint16_t size; /* bytes of state (ST) */- void (*update)(Ent *e);- void (*render)(Ent *e);- void (*awake)(Ent *e);- void (*removed)(Ent *e);/* platforms */int (*on_dash_collide)(Ent *e, Player *p, V2 dir); /* DASH_* */void (*on_collide)(Ent *e, V2 dir);void (*on_shake)(Ent *e, V2 amount);void (*on_staticmover_trigger)(Ent *e, Ent *mover);- /* PlayerCollider */- void (*on_player)(Ent *e, Player *p);/* StaticMover */void (*sm_move)(Ent *e, V2 amount);void (*sm_shake)(Ent *e, V2 amount);@@ -65,9 +58,21 @@ typedef struct {void (*on_dash)(Ent *e, V2 dir);/* custom collision for entities made of many parts (spinners, clutter): e vs a rect */bool (*collide_rect)(const Ent *e, float l, float t, float r, float b);- /* tracker-like membership */- uint16_t kind;+} EntMore;+typedef struct {+ const char *name;+ uint16_t size; /* bytes of state (ST) */+ uint16_t kind; /* tracker-like membership */+ void (*update)(Ent *e);+ void (*render)(Ent *e);+ void (*awake)(Ent *e);+ void (*removed)(Ent *e);+ /* PlayerCollider */+ void (*on_player)(Ent *e, Player *p);+ const EntMore *more; /* the rest (NULL: none of it) */} EntClass;+extern const EntMore g_no_more;+#define MORE(cls) ((cls)->more ? (cls)->more : &g_no_more)/* An entity: about 64 bytes here, plus its type's own state (EntClass.size bytes)* in a shared arena, reached with ST(e, Type). */diff --git a/games/celeste/src/entities.c b/games/celeste/src/entities.cindex ce410b15..78f045de 100644--- a/games/celeste/src/entities.c+++ b/games/celeste/src/entities.c@@ -117,7 +117,7 @@ V2 level_closest_spawn(V2 at) {void level_dash_listeners(V2 dir) {for (int i = 0; i < g_nents; i++) {Ent *e = &g_ents[i];- if (e->cls && e->dead != 1 && e->cls->on_dash) e->cls->on_dash(e, dir);+ if (e->cls && e->dead != 1 && MORE(e->cls)->on_dash) MORE(e->cls)->on_dash(e, dir);}}WEAK void level_booster_boosted(Ent *b, V2 dir) { (void)b, (void)dir; }@@ -242,8 +242,9 @@ void spikes_set_cassette(Ent *e, uint16_t on, uint16_t off, V2 origin) {}static void spikes_sm_shake(Ent *e, V2 a) { e->shakex = (int8_t)(e->shakex + a.x), e->shakey = (int8_t)(e->shakey + a.y); }static const EntClass SPIKES = {.size = sizeof(Spikes), .name = "spikes", .render = spikes_render, .on_player = spikes_on_player,- .sm_riding = spikes_riding, .sm_shake = spikes_sm_shake, .sm_enable = spikes_sm_enable,- .kind = KIND_PCOLLIDE | KIND_STATICMOVER | KIND_SPIKES};+ .kind = KIND_PCOLLIDE | KIND_STATICMOVER | KIND_SPIKES,+ .more = &(const EntMore){.sm_riding = spikes_riding,+ .sm_shake = spikes_sm_shake, .sm_enable = spikes_sm_enable}};static void new_spikes(const EData *d, int dir) {int size;@@ -330,8 +331,8 @@ static void spring_attach(Ent *e, Ent *p) {ents_mark_unsorted();}static const EntClass SPRING = {.size = sizeof(Spring), .name = "spring", .update = spring_update, .render = spring_render,- .on_player = spring_on_player, .sm_riding = spring_riding, .sm_attach = spring_attach,- .kind = KIND_PCOLLIDE | KIND_STATICMOVER};+ .on_player = spring_on_player, .kind = KIND_PCOLLIDE | KIND_STATICMOVER,+ .more = &(const EntMore){.sm_riding = spring_riding, .sm_attach = spring_attach}};static void new_spring(const EData *d, int orient, bool can_use) {if (!spring_tex[0]) {@@ -868,7 +869,8 @@ static void falling_trigger(Ent *e, Ent *m) {}static void block_shake(Ent *e, V2 a) { plat_static_movers_shake(e, a); }static const EntClass FALLING = {.size = sizeof(Block), .name = "fallingBlock", .update = falling_update, .render = block_render,- .on_staticmover_trigger = falling_trigger, .on_shake = block_shake, .kind = KIND_SOLID};+ .kind = KIND_SOLID,+ .more = &(const EntMore){.on_staticmover_trigger = falling_trigger, .on_shake = block_shake}};static Ent *new_block(const EntClass *cls, const EData *d, float w, float h, char type, bool overlay) {Ent *e = ent_new(cls, d->x, d->y);@@ -896,7 +898,7 @@ static char tile_attr(const EData *d, int off, char kind) {/* DashBlock */static int dash_block_hit(Ent *e, Player *p, V2 dir);static const EntClass DASHBLOCK = {.size = sizeof(Block), .name = "dashBlock", .update = plat_update, .render = block_render,- .on_dash_collide = dash_block_hit, .kind = KIND_SOLID};+ .kind = KIND_SOLID, .more = &(const EntMore){.on_dash_collide = dash_block_hit}};void level_break_dash_block(Ent *e, V2 dir) {(void)dir;Block *b = ST(e, Block);@@ -1065,7 +1067,7 @@ static void camtarget_leave(Ent *e, Player *p) {bool other = false;for (int i = 0; i < g_nents; i++) {Ent *o = &g_ents[i];- if (o != e && o->cls && o->cls->on_stay == camtarget_stay && o->triggered) other = true;+ if (o != e && o->cls && MORE(o->cls)->on_stay == camtarget_stay && o->triggered) other = true;}if (!other) {p->cam_anchor_lerp = v2(0, 0);@@ -1078,9 +1080,12 @@ static void respawn_enter(Ent *e, Player *p) {g_session.rx = (int16_t)t->a.x, g_session.ry = (int16_t)t->a.y;}}-static const EntClass CAMOFF = {.size = sizeof(Trig), .name = "cameraOffsetTrigger", .on_enter = camoff_enter, .kind = KIND_TRIGGER};-static const EntClass CAMTARGET = {.size = sizeof(Trig), .name = "cameraTargetTrigger", .on_stay = camtarget_stay, .on_leave = camtarget_leave, .kind = KIND_TRIGGER};-static const EntClass RESPAWN = {.size = sizeof(Trig), .name = "changeRespawnTrigger", .on_enter = respawn_enter, .kind = KIND_TRIGGER};+static const EntClass CAMOFF = {.size = sizeof(Trig), .name = "cameraOffsetTrigger", .kind = KIND_TRIGGER,+ .more = &(const EntMore){.on_enter = camoff_enter}};+static const EntClass CAMTARGET = {.size = sizeof(Trig), .name = "cameraTargetTrigger", .kind = KIND_TRIGGER,+ .more = &(const EntMore){.on_stay = camtarget_stay, .on_leave = camtarget_leave}};+static const EntClass RESPAWN = {.size = sizeof(Trig), .name = "changeRespawnTrigger", .kind = KIND_TRIGGER,+ .more = &(const EntMore){.on_enter = respawn_enter}};static const EntClass KILLBOX = {.size = sizeof(int), .name = "killbox", .kind = KIND_KILLBOX};/* HeartGem.removeCameraTriggers: every CameraOffsetTrigger goes */diff --git a/games/celeste/src/heart.c b/games/celeste/src/heart.cindex 8cf905dc..b2d4a1fe 100644--- a/games/celeste/src/heart.c+++ b/games/celeste/src/heart.c@@ -635,8 +635,8 @@ static void sat_render(Ent *e) {if (s->pulse_on) bloom_add(e->x - 12, e->y - 44, 1, 8), bloom_add(e->x + 32, e->y + 20, 1, 8);if (s->bloom > 0) bloom_add(s->bird_at.x, s->bird_at.y, s->bloom, 32);}-static const EntClass SATELLITE = {.name = "birdForsakenCityGem", .size = sizeof(Sat), .update = sat_update,- .render = sat_render, .on_dash = sat_on_dash};+static const EntClass SATELLITE = {.name = "birdForsakenCityGem", .size = sizeof(Sat), .update = sat_update, .render = sat_render,+ .more = &(const EntMore){.on_dash = sat_on_dash}};static bool sat_new(const EData *d) {Ent *e = ent_new(&SATELLITE, d->x, d->y);diff --git a/games/celeste/src/player.c b/games/celeste/src/player.cindex 86c50a81..b53c0f8a 100644--- a/games/celeste/src/player.c+++ b/games/celeste/src/player.c@@ -661,8 +661,8 @@ static void on_collide_h(Ent *e, Collision *c) {return;}if (P->state == ST_DREAMDASH) return;- if (player_dash_attacking(P) && c->hit && c->hit->cls->on_dash_collide && c->dir.x == signf(P->dash_dir.x)) {- int r = c->hit->cls->on_dash_collide(c->hit, P, c->dir);+ if (player_dash_attacking(P) && c->hit && MORE(c->hit->cls)->on_dash_collide && c->dir.x == signf(P->dash_dir.x)) {+ int r = MORE(c->hit->cls)->on_dash_collide(c->hit, P, c->dir);if (P->state == ST_REDDASH) r = DASH_IGNORE;if (r == DASH_REBOUND) { player_rebound(P, -(int)signf(P->speed.x)); return; }if (r == DASH_BOUNCE) { reflect_bounce(v2(-signf(P->speed.x), 0)); return; }@@ -691,7 +691,7 @@ static void on_collide_h(Ent *e, Collision *c) {P->wall_speed_retained = P->speed.x;P->wall_speed_retention_timer = WallSpeedRetentionTime;}- if (c->hit && c->hit->cls->on_collide) c->hit->cls->on_collide(c->hit, c->dir);+ if (c->hit && MORE(c->hit->cls)->on_collide) MORE(c->hit->cls)->on_collide(c->hit, c->dir);P->speed.x = 0;P->dash_attack_timer = 0;if (P->state == ST_REDDASH) SET(ST_HITSQUASH);@@ -709,15 +709,15 @@ static void on_collide_v(Ent *e, Collision *c) {return;}if (P->state == ST_DREAMDASH) return;- if (c->hit && c->hit->cls->on_dash_collide) {+ if (c->hit && MORE(c->hit->cls)->on_dash_collide) {if (player_dash_attacking(P) && c->dir.y == signf(P->dash_dir.y)) {- int r = c->hit->cls->on_dash_collide(c->hit, P, c->dir);+ int r = MORE(c->hit->cls)->on_dash_collide(c->hit, P, c->dir);if (P->state == ST_REDDASH) r = DASH_IGNORE;if (r == DASH_REBOUND) { player_rebound(P, 0); return; }if (r == DASH_BOUNCE) { reflect_bounce(v2(0, -signf(P->speed.y))); return; }if (r == DASH_IGNORE) return;} else if (P->state == ST_SUMMITLAUNCH) {- c->hit->cls->on_dash_collide(c->hit, P, c->dir);+ MORE(c->hit->cls)->on_dash_collide(c->hit, P, c->dir);return;}}@@ -780,7 +780,7 @@ static void on_collide_v(Ent *e, Collision *c) {return;}}- if (c->hit && c->hit->cls->on_collide) c->hit->cls->on_collide(c->hit, c->dir);+ if (c->hit && MORE(c->hit->cls)->on_collide) MORE(c->hit->cls)->on_collide(c->hit, c->dir);P->dash_attack_timer = 0;P->speed.y = 0;if (P->state == ST_REDDASH) SET(ST_HITSQUASH);@@ -2567,12 +2567,12 @@ static void trigger_check(void) {if (collide_ent_at(E, E->x, E->y, t)) {if (!t->triggered) {t->triggered = 1;- if (t->cls->on_enter) t->cls->on_enter(t, P);+ if (MORE(t->cls)->on_enter) MORE(t->cls)->on_enter(t, P);}- if (t->cls->on_stay) t->cls->on_stay(t, P);+ if (MORE(t->cls)->on_stay) MORE(t->cls)->on_stay(t, P);} else if (t->triggered) {t->triggered = 0;- if (t->cls->on_leave) t->cls->on_leave(t, P);+ if (MORE(t->cls)->on_leave) MORE(t->cls)->on_leave(t, P);}}}@@ -2736,10 +2736,11 @@ static void player_render(Ent *e) {/* ---------------------------------------------------------------- spawning */-static const EntClass PLAYER_CLASS = {- .name = "player", .size = sizeof(ActorExt), .update = player_update, .render = player_render,- .on_squish = on_squish, .is_riding_solid = is_riding_solid, .is_riding_jumpthru = is_riding_jumpthru,- .kind = KIND_ACTOR | KIND_PLAYER};+static const EntClass PLAYER_CLASS = {.name = "player", .size = sizeof(ActorExt), .update = player_update,+ .render = player_render, .kind = KIND_ACTOR | KIND_PLAYER,+ .more = &(const EntMore){.on_squish = on_squish,+ .is_riding_solid = is_riding_solid,+ .is_riding_jumpthru = is_riding_jumpthru}};void player_spawn(V2 at, int intro) {Player *p = P;