From 295ed303af137464c995efe165d8767d22f89859 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 26 Apr 2020 11:55:10 +0200 Subject: [PATCH 1/6] Make T_StartCrumble use its own thinker data structure --- src/p_floor.c | 175 +++++++++++++++++++++++++------------------------- src/p_map.c | 4 +- src/p_saveg.c | 59 ++++++++++++++++- src/p_spec.h | 20 +++++- 4 files changed, 164 insertions(+), 94 deletions(-) diff --git a/src/p_floor.c b/src/p_floor.c index 179cf73c7..d0fef319c 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -757,7 +757,7 @@ void T_BounceCheese(bouncecheese_t *bouncer) // T_StartCrumble //////////////////////////////// ////////////////////////////////////////////////// // Crumbling platform Tails 03-11-2002 -void T_StartCrumble(elevator_t *elevator) +void T_StartCrumble(crumble_t *crumble) { ffloor_t *rover; sector_t *sector; @@ -765,42 +765,42 @@ void T_StartCrumble(elevator_t *elevator) // Once done, the no-return thinker just sits there, // constantly 'returning'... kind of an oxymoron, isn't it? - if (((elevator->floordestheight == 1 && elevator->direction == -1) - || (elevator->floordestheight == 0 && elevator->direction == 1)) - && elevator->type == elevateContinuous) // No return crumbler + if (((crumble->floordestheight == 1 && crumble->direction == -1) + || (crumble->floordestheight == 0 && crumble->direction == 1)) + && crumble->type == elevateContinuous) // No return crumbler { - elevator->sector->ceilspeed = 0; - elevator->sector->floorspeed = 0; + crumble->sector->ceilspeed = 0; + crumble->sector->floorspeed = 0; return; } - if (elevator->distance != 0) + if (crumble->distance != 0) { - if (elevator->distance > 0) // Count down the timer + if (crumble->distance > 0) // Count down the timer { - elevator->distance--; - if (elevator->distance <= 0) - elevator->distance = -15*TICRATE; // Timer until platform returns to original position. + crumble->distance--; + if (crumble->distance <= 0) + crumble->distance = -15*TICRATE; // Timer until platform returns to original position. else { // Timer isn't up yet, so just keep waiting. - elevator->sector->ceilspeed = 0; - elevator->sector->floorspeed = 0; + crumble->sector->ceilspeed = 0; + crumble->sector->floorspeed = 0; return; } } - else if (++elevator->distance == 0) // Reposition back to original spot + else if (++crumble->distance == 0) // Reposition back to original spot { - for (i = -1; (i = P_FindSectorFromTag(elevator->sourceline->tag, i)) >= 0 ;) + for (i = -1; (i = P_FindSectorFromTag(crumble->sourceline->tag, i)) >= 0 ;) { sector = §ors[i]; for (rover = sector->ffloors; rover; rover = rover->next) { if (rover->flags & FF_CRUMBLE && rover->flags & FF_FLOATBOB - && rover->master == elevator->sourceline) + && rover->master == crumble->sourceline) { - rover->alpha = elevator->origspeed; + rover->alpha = crumble->origspeed; if (rover->alpha == 0xff) rover->flags &= ~FF_TRANSLUCENT; @@ -809,39 +809,39 @@ void T_StartCrumble(elevator_t *elevator) } // Up! - if (elevator->floordestheight == 1) - elevator->direction = -1; + if (crumble->floordestheight == 1) + crumble->direction = -1; else - elevator->direction = 1; + crumble->direction = 1; - elevator->sector->ceilspeed = 0; - elevator->sector->floorspeed = 0; + crumble->sector->ceilspeed = 0; + crumble->sector->floorspeed = 0; return; } // Flash to indicate that the platform is about to return. - if (elevator->distance > -224 && (leveltime % ((abs(elevator->distance)/8) + 1) == 0)) + if (crumble->distance > -224 && (leveltime % ((abs(crumble->distance)/8) + 1) == 0)) { - for (i = -1; (i = P_FindSectorFromTag(elevator->sourceline->tag, i)) >= 0 ;) + for (i = -1; (i = P_FindSectorFromTag(crumble->sourceline->tag, i)) >= 0 ;) { sector = §ors[i]; for (rover = sector->ffloors; rover; rover = rover->next) { if (!(rover->flags & FF_NORETURN) && rover->flags & FF_CRUMBLE && rover->flags & FF_FLOATBOB - && rover->master == elevator->sourceline) + && rover->master == crumble->sourceline) { - if (rover->alpha == elevator->origspeed) + if (rover->alpha == crumble->origspeed) { rover->flags |= FF_TRANSLUCENT; rover->alpha = 0x00; } else { - if (elevator->origspeed == 0xff) + if (crumble->origspeed == 0xff) rover->flags &= ~FF_TRANSLUCENT; - rover->alpha = elevator->origspeed; + rover->alpha = crumble->origspeed; } } } @@ -851,74 +851,74 @@ void T_StartCrumble(elevator_t *elevator) // We're about to go back to the original position, // so set this to let other thinkers know what is // about to happen. - if (elevator->distance < 0 && elevator->distance > -3) - elevator->sector->crumblestate = CRUMBLE_RESTORE; // makes T_BounceCheese remove itself + if (crumble->distance < 0 && crumble->distance > -3) + crumble->sector->crumblestate = CRUMBLE_RESTORE; // makes T_BounceCheese remove itself } - if ((elevator->floordestheight == 0 && elevator->direction == -1) - || (elevator->floordestheight == 1 && elevator->direction == 1)) // Down + if ((crumble->floordestheight == 0 && crumble->direction == -1) + || (crumble->floordestheight == 1 && crumble->direction == 1)) // Down { - elevator->sector->crumblestate = CRUMBLE_FALL; // Allow floating now. + crumble->sector->crumblestate = CRUMBLE_FALL; // Allow floating now. // Only fall like this if it isn't meant to float on water - if (elevator->high != 42) + if (crumble->high != 42) { - elevator->speed += gravity; // Gain more and more speed + crumble->speed += gravity; // Gain more and more speed - if ((elevator->floordestheight == 0 && !(elevator->sector->ceilingheight < -16384*FRACUNIT)) - || (elevator->floordestheight == 1 && !(elevator->sector->ceilingheight > 16384*FRACUNIT))) + if ((crumble->floordestheight == 0 && !(crumble->sector->ceilingheight < -16384*FRACUNIT)) + || (crumble->floordestheight == 1 && !(crumble->sector->ceilingheight > 16384*FRACUNIT))) { fixed_t dest; - if (elevator->floordestheight == 1) - dest = elevator->sector->ceilingheight + (elevator->speed*2); + if (crumble->floordestheight == 1) + dest = crumble->sector->ceilingheight + (crumble->speed*2); else - dest = elevator->sector->ceilingheight - (elevator->speed*2); + dest = crumble->sector->ceilingheight - (crumble->speed*2); T_MovePlane //jff 4/7/98 reverse order of ceiling/floor ( - elevator->sector, - elevator->speed, + crumble->sector, + crumble->speed, dest, false, true, // move ceiling - elevator->direction + crumble->direction ); - if (elevator->floordestheight == 1) - dest = elevator->sector->floorheight + (elevator->speed*2); + if (crumble->floordestheight == 1) + dest = crumble->sector->floorheight + (crumble->speed*2); else - dest = elevator->sector->floorheight - (elevator->speed*2); + dest = crumble->sector->floorheight - (crumble->speed*2); T_MovePlane ( - elevator->sector, - elevator->speed, + crumble->sector, + crumble->speed, dest, false, false, // move floor - elevator->direction + crumble->direction ); - elevator->sector->ceilspeed = 42; - elevator->sector->floorspeed = elevator->speed*elevator->direction; + crumble->sector->ceilspeed = 42; + crumble->sector->floorspeed = crumble->speed*crumble->direction; } } } else // Up (restore to original position) { - elevator->sector->crumblestate = CRUMBLE_WAIT; - elevator->sector->ceilingheight = elevator->ceilingwasheight; - elevator->sector->floorheight = elevator->floorwasheight; - elevator->sector->floordata = NULL; - elevator->sector->ceilingdata = NULL; - elevator->sector->ceilspeed = 0; - elevator->sector->floorspeed = 0; - elevator->sector->moved = true; - P_RemoveThinker(&elevator->thinker); + crumble->sector->crumblestate = CRUMBLE_WAIT; + crumble->sector->ceilingheight = crumble->ceilingwasheight; + crumble->sector->floorheight = crumble->floorwasheight; + crumble->sector->floordata = NULL; + crumble->sector->ceilingdata = NULL; + crumble->sector->ceilspeed = 0; + crumble->sector->floorspeed = 0; + crumble->sector->moved = true; + P_RemoveThinker(&crumble->thinker); } - for (i = -1; (i = P_FindSectorFromTag(elevator->sourceline->tag, i)) >= 0 ;) + for (i = -1; (i = P_FindSectorFromTag(crumble->sourceline->tag, i)) >= 0 ;) { sector = §ors[i]; sector->moved = true; @@ -2309,7 +2309,7 @@ void EV_DoContinuousFall(sector_t *sec, sector_t *backsector, fixed_t spd, boole INT32 EV_StartCrumble(sector_t *sec, ffloor_t *rover, boolean floating, player_t *player, fixed_t origalpha, boolean crumblereturn) { - elevator_t *elevator; + crumble_t *crumble; sector_t *foundsec; INT32 i; @@ -2320,55 +2320,54 @@ INT32 EV_StartCrumble(sector_t *sec, ffloor_t *rover, boolean floating, if (sec->crumblestate >= CRUMBLE_ACTIVATED) return 0; - // create and initialize new elevator thinker - elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL); - P_AddThinker(THINK_MAIN, &elevator->thinker); - elevator->thinker.function.acp1 = (actionf_p1)T_StartCrumble; + // create and initialize new crumble thinker + crumble = Z_Calloc(sizeof (*crumble), PU_LEVSPEC, NULL); + P_AddThinker(THINK_MAIN, &crumble->thinker); + crumble->thinker.function.acp1 = (actionf_p1)T_StartCrumble; // Does this crumbler return? if (crumblereturn) - elevator->type = elevateBounce; + crumble->type = elevateBounce; else - elevator->type = elevateContinuous; + crumble->type = elevateContinuous; - // set up the fields according to the type of elevator action - elevator->sector = sec; - elevator->speed = 0; + // set up the fields + crumble->sector = sec; + crumble->speed = 0; if (player && player->mo && (player->mo->eflags & MFE_VERTICALFLIP)) { - elevator->direction = 1; // Up - elevator->floordestheight = 1; + crumble->direction = 1; // Up + crumble->floordestheight = 1; } else { - elevator->direction = -1; // Down - elevator->floordestheight = 0; + crumble->direction = -1; // Down + crumble->floordestheight = 0; } - elevator->floorwasheight = elevator->sector->floorheight; - elevator->ceilingwasheight = elevator->sector->ceilingheight; - elevator->distance = TICRATE; // Used for delay time - elevator->low = 0; - elevator->player = player; - elevator->origspeed = origalpha; + crumble->floorwasheight = crumble->sector->floorheight; + crumble->ceilingwasheight = crumble->sector->ceilingheight; + crumble->distance = TICRATE; // Used for delay time + crumble->player = player; + crumble->origspeed = origalpha; - elevator->sourceline = rover->master; + crumble->sourceline = rover->master; - sec->floordata = elevator; + sec->floordata = crumble; if (floating) - elevator->high = 42; + crumble->high = 42; else - elevator->high = 0; + crumble->high = 0; - elevator->sector->crumblestate = CRUMBLE_ACTIVATED; + crumble->sector->crumblestate = CRUMBLE_ACTIVATED; - for (i = -1; (i = P_FindSectorFromTag(elevator->sourceline->tag, i)) >= 0 ;) + for (i = -1; (i = P_FindSectorFromTag(crumble->sourceline->tag, i)) >= 0 ;) { foundsec = §ors[i]; - P_SpawnMobj(foundsec->soundorg.x, foundsec->soundorg.y, elevator->direction == 1 ? elevator->sector->floorheight : elevator->sector->ceilingheight, MT_CRUMBLEOBJ); + P_SpawnMobj(foundsec->soundorg.x, foundsec->soundorg.y, crumble->direction == 1 ? crumble->sector->floorheight : crumble->sector->ceilingheight, MT_CRUMBLEOBJ); } return 1; diff --git a/src/p_map.c b/src/p_map.c index accc52836..2b6623f71 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -4223,14 +4223,14 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush) { //If the thing was crushed by a crumbling FOF, reward the player who made it crumble! thinker_t *think; - elevator_t *crumbler; + crumble_t *crumbler; for (think = thlist[THINK_MAIN].next; think != &thlist[THINK_MAIN]; think = think->next) { if (think->function.acp1 != (actionf_p1)T_StartCrumble) continue; - crumbler = (elevator_t *)think; + crumbler = (crumble_t *)think; if (crumbler->player && crumbler->player->mo && crumbler->player->mo != thing diff --git a/src/p_saveg.c b/src/p_saveg.c index f6e31fc3a..5032cfc75 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1930,6 +1930,30 @@ static void SaveElevatorThinker(const thinker_t *th, const UINT8 type) WRITEUINT32(save_p, SaveLine(ht->sourceline)); } +// +// SaveCrumbleThinker +// +// Saves a crumble_t thinker +// +static void SaveCrumbleThinker(const thinker_t *th, const UINT8 type) +{ + const crumble_t *ht = (const void *)th; + WRITEUINT8(save_p, type); + WRITEUINT8(save_p, ht->type); + WRITEUINT32(save_p, SaveSector(ht->sector)); + WRITEUINT32(save_p, SaveSector(ht->actionsector)); + WRITEINT32(save_p, ht->direction); + WRITEFIXED(save_p, ht->floordestheight); + WRITEFIXED(save_p, ht->speed); + WRITEFIXED(save_p, ht->origspeed); + WRITEFIXED(save_p, ht->high); + WRITEFIXED(save_p, ht->distance); + WRITEFIXED(save_p, ht->floorwasheight); + WRITEFIXED(save_p, ht->ceilingwasheight); + WRITEUINT32(save_p, SavePlayer(ht->player)); // was dummy + WRITEUINT32(save_p, SaveLine(ht->sourceline)); +} + // // SaveScrollThinker // @@ -2377,7 +2401,7 @@ static void P_NetArchiveThinkers(void) } else if (th->function.acp1 == (actionf_p1)T_CameraScanner) { - SaveElevatorThinker(th, tc_camerascanner); + SaveCrumbleThinker(th, tc_camerascanner); continue; } else if (th->function.acp1 == (actionf_p1)T_Scroll) @@ -3142,7 +3166,7 @@ static thinker_t* LoadFireflickerThinker(actionf_p1 thinker) return &ht->thinker; } // -// LoadElevatorThinker +// +vatorThinker // // Loads a elevator_t from a save game // @@ -3179,6 +3203,35 @@ static thinker_t* LoadElevatorThinker(actionf_p1 thinker, UINT8 floorOrCeiling) return &ht->thinker; } +// +// LoadCrumbleThinker +// +// Loads a crumble_t from a save game +// +static thinker_t* LoadCrumbleThinker(actionf_p1 thinker) +{ + crumble_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); + ht->thinker.function.acp1 = thinker; + ht->type = READUINT8(save_p); + ht->sector = LoadSector(READUINT32(save_p)); + ht->actionsector = LoadSector(READUINT32(save_p)); + ht->direction = READINT32(save_p); + ht->floordestheight = READFIXED(save_p); + ht->speed = READFIXED(save_p); + ht->origspeed = READFIXED(save_p); + ht->high = READFIXED(save_p); + ht->distance = READFIXED(save_p); + ht->floorwasheight = READFIXED(save_p); + ht->ceilingwasheight = READFIXED(save_p); + ht->player = LoadPlayer(READUINT32(save_p)); // was dummy + ht->sourceline = LoadLine(READUINT32(save_p)); + + if (ht->sector) + ht->sector->floordata = ht; + + return &ht->thinker; +} + // // LoadScrollThinker // @@ -3707,7 +3760,7 @@ static void P_NetUnArchiveThinkers(void) break; case tc_startcrumble: - th = LoadElevatorThinker((actionf_p1)T_StartCrumble, 1); + th = LoadCrumbleThinker((actionf_p1)T_StartCrumble); break; case tc_marioblock: diff --git a/src/p_spec.h b/src/p_spec.h index e243e3a61..7e2a97ce9 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -311,6 +311,24 @@ typedef struct line_t *sourceline; } elevator_t; +typedef struct +{ + thinker_t thinker; + elevator_e type; + sector_t *sector; + sector_t *actionsector; // The sector the rover action is taking place in. + INT32 direction; + fixed_t floordestheight; + fixed_t speed; + fixed_t origspeed; + fixed_t high; + fixed_t distance; + fixed_t floorwasheight; // Height the floor WAS at + fixed_t ceilingwasheight; // Height the ceiling WAS at + player_t *player; // Player who initiated the thinker (used for airbob) + line_t *sourceline; +} crumble_t; + typedef struct { thinker_t thinker; @@ -440,7 +458,7 @@ void T_MoveFloor(floormove_t *movefloor); void T_MoveElevator(elevator_t *elevator); void T_ContinuousFalling(continuousfall_t *faller); void T_BounceCheese(bouncecheese_t *bouncer); -void T_StartCrumble(elevator_t *elevator); +void T_StartCrumble(crumble_t *crumble); void T_MarioBlock(mariothink_t *block); void T_FloatSector(floatthink_t *floater); void T_MarioBlockChecker(mariocheck_t *block); From 554de0e0f52730a66ec5e05613aaba5c80b68688 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 26 Apr 2020 16:51:14 +0200 Subject: [PATCH 2/6] T_StartCrumble refactoring, part 1 --- src/p_floor.c | 139 +++++++++++++++++++++++--------------------------- src/p_map.c | 4 +- src/p_saveg.c | 24 ++++----- src/p_spec.h | 19 ++++--- 4 files changed, 88 insertions(+), 98 deletions(-) diff --git a/src/p_floor.c b/src/p_floor.c index d0fef319c..220202d07 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -765,22 +765,21 @@ void T_StartCrumble(crumble_t *crumble) // Once done, the no-return thinker just sits there, // constantly 'returning'... kind of an oxymoron, isn't it? - if (((crumble->floordestheight == 1 && crumble->direction == -1) - || (crumble->floordestheight == 0 && crumble->direction == 1)) - && crumble->type == elevateContinuous) // No return crumbler + if ((((crumble->flags & CF_REVERSE) && crumble->direction == -1) + || (!(crumble->flags & CF_REVERSE) && crumble->direction == 1)) + && !(crumble->flags & CF_RETURN)) { crumble->sector->ceilspeed = 0; crumble->sector->floorspeed = 0; return; } - if (crumble->distance != 0) + if (crumble->timer != 0) { - if (crumble->distance > 0) // Count down the timer + if (crumble->timer > 0) // Count down the timer { - crumble->distance--; - if (crumble->distance <= 0) - crumble->distance = -15*TICRATE; // Timer until platform returns to original position. + if (--crumble->timer <= 0) + crumble->timer = -15*TICRATE; // Timer until platform returns to original position. else { // Timer isn't up yet, so just keep waiting. @@ -789,7 +788,7 @@ void T_StartCrumble(crumble_t *crumble) return; } } - else if (++crumble->distance == 0) // Reposition back to original spot + else if (++crumble->timer == 0) // Reposition back to original spot { for (i = -1; (i = P_FindSectorFromTag(crumble->sourceline->tag, i)) >= 0 ;) { @@ -797,19 +796,24 @@ void T_StartCrumble(crumble_t *crumble) for (rover = sector->ffloors; rover; rover = rover->next) { - if (rover->flags & FF_CRUMBLE && rover->flags & FF_FLOATBOB - && rover->master == crumble->sourceline) - { - rover->alpha = crumble->origspeed; + if (!(rover->flags & FF_CRUMBLE)) + continue; - if (rover->alpha == 0xff) - rover->flags &= ~FF_TRANSLUCENT; - } + if (!(rover->flags & FF_FLOATBOB)) + continue; + + if (rover->master != crumble->sourceline) + continue; + + rover->alpha = crumble->origalpha; + + if (rover->alpha == 0xff) + rover->flags &= ~FF_TRANSLUCENT; } } // Up! - if (crumble->floordestheight == 1) + if (crumble->flags & CF_REVERSE) crumble->direction = -1; else crumble->direction = 1; @@ -820,7 +824,7 @@ void T_StartCrumble(crumble_t *crumble) } // Flash to indicate that the platform is about to return. - if (crumble->distance > -224 && (leveltime % ((abs(crumble->distance)/8) + 1) == 0)) + if (crumble->timer > -224 && (leveltime % ((abs(crumble->timer)/8) + 1) == 0)) { for (i = -1; (i = P_FindSectorFromTag(crumble->sourceline->tag, i)) >= 0 ;) { @@ -828,21 +832,29 @@ void T_StartCrumble(crumble_t *crumble) for (rover = sector->ffloors; rover; rover = rover->next) { - if (!(rover->flags & FF_NORETURN) && rover->flags & FF_CRUMBLE && rover->flags & FF_FLOATBOB - && rover->master == crumble->sourceline) - { - if (rover->alpha == crumble->origspeed) - { - rover->flags |= FF_TRANSLUCENT; - rover->alpha = 0x00; - } - else - { - if (crumble->origspeed == 0xff) - rover->flags &= ~FF_TRANSLUCENT; + if (rover->flags & FF_NORETURN) + continue; - rover->alpha = crumble->origspeed; - } + if (!(rover->flags & FF_CRUMBLE)) + continue; + + if (!(rover->flags & FF_FLOATBOB)) + continue; + + if (rover->master != crumble->sourceline) + continue; + + if (rover->alpha == crumble->origalpha) + { + rover->flags |= FF_TRANSLUCENT; + rover->alpha = 0x00; + } + else + { + rover->alpha = crumble->origalpha; + + if (rover->alpha == 0xff) + rover->flags &= ~FF_TRANSLUCENT; } } } @@ -851,53 +863,41 @@ void T_StartCrumble(crumble_t *crumble) // We're about to go back to the original position, // so set this to let other thinkers know what is // about to happen. - if (crumble->distance < 0 && crumble->distance > -3) + if (crumble->timer < 0 && crumble->timer > -3) crumble->sector->crumblestate = CRUMBLE_RESTORE; // makes T_BounceCheese remove itself } - if ((crumble->floordestheight == 0 && crumble->direction == -1) - || (crumble->floordestheight == 1 && crumble->direction == 1)) // Down + if ((!(crumble->flags & CF_REVERSE) && crumble->direction == -1) + || ((crumble->flags & CF_REVERSE) && crumble->direction == 1)) // Down { crumble->sector->crumblestate = CRUMBLE_FALL; // Allow floating now. // Only fall like this if it isn't meant to float on water - if (crumble->high != 42) + if (!(crumble->flags & CF_FLOATBOB)) { crumble->speed += gravity; // Gain more and more speed - if ((crumble->floordestheight == 0 && !(crumble->sector->ceilingheight < -16384*FRACUNIT)) - || (crumble->floordestheight == 1 && !(crumble->sector->ceilingheight > 16384*FRACUNIT))) + if ((!(crumble->flags & CF_REVERSE) && crumble->sector->ceilingheight >= -16384*FRACUNIT) + || ((crumble->flags & CF_REVERSE) && crumble->sector->ceilingheight <= 16384*FRACUNIT)) { - fixed_t dest; - - if (crumble->floordestheight == 1) - dest = crumble->sector->ceilingheight + (crumble->speed*2); - else - dest = crumble->sector->ceilingheight - (crumble->speed*2); - T_MovePlane //jff 4/7/98 reverse order of ceiling/floor ( crumble->sector, crumble->speed, - dest, + crumble->sector->ceilingheight + crumble->direction*crumble->speed*2, false, true, // move ceiling crumble->direction ); - if (crumble->floordestheight == 1) - dest = crumble->sector->floorheight + (crumble->speed*2); - else - dest = crumble->sector->floorheight - (crumble->speed*2); - - T_MovePlane - ( - crumble->sector, - crumble->speed, - dest, - false, - false, // move floor - crumble->direction + T_MovePlane + ( + crumble->sector, + crumble->speed, + crumble->sector->floorheight + crumble->direction*crumble->speed*2, + false, + false, // move floor + crumble->direction ); crumble->sector->ceilspeed = 42; @@ -2325,12 +2325,6 @@ INT32 EV_StartCrumble(sector_t *sec, ffloor_t *rover, boolean floating, P_AddThinker(THINK_MAIN, &crumble->thinker); crumble->thinker.function.acp1 = (actionf_p1)T_StartCrumble; - // Does this crumbler return? - if (crumblereturn) - crumble->type = elevateBounce; - else - crumble->type = elevateContinuous; - // set up the fields crumble->sector = sec; crumble->speed = 0; @@ -2338,28 +2332,25 @@ INT32 EV_StartCrumble(sector_t *sec, ffloor_t *rover, boolean floating, if (player && player->mo && (player->mo->eflags & MFE_VERTICALFLIP)) { crumble->direction = 1; // Up - crumble->floordestheight = 1; + crumble->flags |= CF_REVERSE; } else - { crumble->direction = -1; // Down - crumble->floordestheight = 0; - } crumble->floorwasheight = crumble->sector->floorheight; crumble->ceilingwasheight = crumble->sector->ceilingheight; - crumble->distance = TICRATE; // Used for delay time + crumble->timer = TICRATE; crumble->player = player; - crumble->origspeed = origalpha; + crumble->origalpha = origalpha; crumble->sourceline = rover->master; sec->floordata = crumble; + if (crumblereturn) + crumble->flags |= CF_RETURN; if (floating) - crumble->high = 42; - else - crumble->high = 0; + crumble->flags |= CF_FLOATBOB; crumble->sector->crumblestate = CRUMBLE_ACTIVATED; diff --git a/src/p_map.c b/src/p_map.c index 2b6623f71..0c21e3e69 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -4235,9 +4235,7 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush) if (crumbler->player && crumbler->player->mo && crumbler->player->mo != thing && crumbler->actionsector == thing->subsector->sector - && crumbler->sector == rover->master->frontsector - && (crumbler->type == elevateBounce - || crumbler->type == elevateContinuous)) + && crumbler->sector == rover->master->frontsector) { killer = crumbler->player->mo; } diff --git a/src/p_saveg.c b/src/p_saveg.c index 5032cfc75..c4830b995 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1939,19 +1939,17 @@ static void SaveCrumbleThinker(const thinker_t *th, const UINT8 type) { const crumble_t *ht = (const void *)th; WRITEUINT8(save_p, type); - WRITEUINT8(save_p, ht->type); + WRITEUINT32(save_p, SaveLine(ht->sourceline)); WRITEUINT32(save_p, SaveSector(ht->sector)); WRITEUINT32(save_p, SaveSector(ht->actionsector)); + WRITEUINT32(save_p, SavePlayer(ht->player)); // was dummy WRITEINT32(save_p, ht->direction); - WRITEFIXED(save_p, ht->floordestheight); + WRITEINT32(save_p, ht->origalpha); + WRITEINT32(save_p, ht->timer); WRITEFIXED(save_p, ht->speed); - WRITEFIXED(save_p, ht->origspeed); - WRITEFIXED(save_p, ht->high); - WRITEFIXED(save_p, ht->distance); WRITEFIXED(save_p, ht->floorwasheight); WRITEFIXED(save_p, ht->ceilingwasheight); - WRITEUINT32(save_p, SavePlayer(ht->player)); // was dummy - WRITEUINT32(save_p, SaveLine(ht->sourceline)); + WRITEUINT8(save_p, ht->flags); } // @@ -3212,19 +3210,17 @@ static thinker_t* LoadCrumbleThinker(actionf_p1 thinker) { crumble_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->type = READUINT8(save_p); + ht->sourceline = LoadLine(READUINT32(save_p)); ht->sector = LoadSector(READUINT32(save_p)); ht->actionsector = LoadSector(READUINT32(save_p)); + ht->player = LoadPlayer(READUINT32(save_p)); ht->direction = READINT32(save_p); - ht->floordestheight = READFIXED(save_p); + ht->origalpha = READINT32(save_p); + ht->timer = READINT32(save_p); ht->speed = READFIXED(save_p); - ht->origspeed = READFIXED(save_p); - ht->high = READFIXED(save_p); - ht->distance = READFIXED(save_p); ht->floorwasheight = READFIXED(save_p); ht->ceilingwasheight = READFIXED(save_p); - ht->player = LoadPlayer(READUINT32(save_p)); // was dummy - ht->sourceline = LoadLine(READUINT32(save_p)); + ht->flags = READUINT8(save_p); if (ht->sector) ht->sector->floordata = ht; diff --git a/src/p_spec.h b/src/p_spec.h index 7e2a97ce9..c26cb4523 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -311,22 +311,27 @@ typedef struct line_t *sourceline; } elevator_t; +typedef enum +{ + CF_RETURN = 1, // Return after crumbling + CF_FLOATBOB = 1<<1, // Float on water + CF_REVERSE = 1<<2, // Reverse gravity +} crumbleflag_t; + typedef struct { thinker_t thinker; - elevator_e type; + line_t *sourceline; sector_t *sector; sector_t *actionsector; // The sector the rover action is taking place in. + player_t *player; // Player who initiated the thinker (used for airbob) INT32 direction; - fixed_t floordestheight; + INT32 origalpha; + INT32 timer; fixed_t speed; - fixed_t origspeed; - fixed_t high; - fixed_t distance; fixed_t floorwasheight; // Height the floor WAS at fixed_t ceilingwasheight; // Height the ceiling WAS at - player_t *player; // Player who initiated the thinker (used for airbob) - line_t *sourceline; + UINT8 flags; } crumble_t; typedef struct From f4282718dc3a22f5e2f7c1d0356ce3e2289bc232 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 26 Apr 2020 18:31:39 +0200 Subject: [PATCH 3/6] Accidentally changed the wrong SaveElevatorThinker call to SaveCrumbleThinker --- src/p_saveg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index c4830b995..74f94590c 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -2399,7 +2399,7 @@ static void P_NetArchiveThinkers(void) } else if (th->function.acp1 == (actionf_p1)T_CameraScanner) { - SaveCrumbleThinker(th, tc_camerascanner); + SaveElevatorThinker(th, tc_camerascanner); continue; } else if (th->function.acp1 == (actionf_p1)T_Scroll) @@ -2424,7 +2424,7 @@ static void P_NetArchiveThinkers(void) } else if (th->function.acp1 == (actionf_p1)T_StartCrumble) { - SaveElevatorThinker(th, tc_startcrumble); + SaveCrumbleThinker(th, tc_startcrumble); continue; } else if (th->function.acp1 == (actionf_p1)T_MarioBlock) From 82bf72f5e1dba7997d4e7be49d190b14b0098950 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 26 Apr 2020 18:38:45 +0200 Subject: [PATCH 4/6] Remove obsolete stuff from elevator_t --- src/p_saveg.c | 18 ++++++------------ src/p_spec.h | 1 - 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index 74f94590c..c04a9ee2d 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1926,7 +1926,6 @@ static void SaveElevatorThinker(const thinker_t *th, const UINT8 type) WRITEFIXED(save_p, ht->delaytimer); WRITEFIXED(save_p, ht->floorwasheight); WRITEFIXED(save_p, ht->ceilingwasheight); - WRITEUINT32(save_p, SavePlayer(ht->player)); // was dummy WRITEUINT32(save_p, SaveLine(ht->sourceline)); } @@ -3168,7 +3167,7 @@ static thinker_t* LoadFireflickerThinker(actionf_p1 thinker) // // Loads a elevator_t from a save game // -static thinker_t* LoadElevatorThinker(actionf_p1 thinker, UINT8 floorOrCeiling) +static thinker_t* LoadElevatorThinker(actionf_p1 thinker, boolean setplanedata) { elevator_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; @@ -3187,15 +3186,12 @@ static thinker_t* LoadElevatorThinker(actionf_p1 thinker, UINT8 floorOrCeiling) ht->delaytimer = READFIXED(save_p); ht->floorwasheight = READFIXED(save_p); ht->ceilingwasheight = READFIXED(save_p); - ht->player = LoadPlayer(READUINT32(save_p)); // was dummy ht->sourceline = LoadLine(READUINT32(save_p)); - if (ht->sector) + if (ht->sector && setplanedata) { - if (floorOrCeiling & 2) - ht->sector->ceilingdata = ht; - if (floorOrCeiling & 1) - ht->sector->floordata = ht; + ht->sector->ceilingdata = ht; + ht->sector->floordata = ht; } return &ht->thinker; @@ -3722,7 +3718,7 @@ static void P_NetUnArchiveThinkers(void) break; case tc_elevator: - th = LoadElevatorThinker((actionf_p1)T_MoveElevator, 3); + th = LoadElevatorThinker((actionf_p1)T_MoveElevator, true); break; case tc_continuousfalling: @@ -3745,10 +3741,8 @@ static void P_NetUnArchiveThinkers(void) th = LoadRaiseThinker((actionf_p1)T_RaiseSector); break; - /// \todo rewrite all the code that uses an elevator_t but isn't an elevator - /// \note working on it! case tc_camerascanner: - th = LoadElevatorThinker((actionf_p1)T_CameraScanner, 0); + th = LoadElevatorThinker((actionf_p1)T_CameraScanner, false); break; case tc_bouncecheese: diff --git a/src/p_spec.h b/src/p_spec.h index c26cb4523..f7785125a 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -307,7 +307,6 @@ typedef struct fixed_t delaytimer; fixed_t floorwasheight; // Height the floor WAS at fixed_t ceilingwasheight; // Height the ceiling WAS at - player_t *player; // Player who initiated the thinker (used for airbob) line_t *sourceline; } elevator_t; From fb1746e95b2a2a2647d8ca2997b655a2d0278f88 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 26 Apr 2020 18:42:31 +0200 Subject: [PATCH 5/6] Deprecate the camera scanner effect and print a warning when it's used --- src/p_spec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_spec.c b/src/p_spec.c index 826260d3a..57795f2bf 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -6156,6 +6156,8 @@ static inline void P_AddCameraScanner(sector_t *sourcesec, sector_t *actionsecto { elevator_t *elevator; // Why not? LOL + CONS_Alert(CONS_WARNING, M_GetText("Detected a camera scanner effect (linedef type 5). This effect is deprecated and will be removed in the future!\n")); + // create and initialize new elevator thinker elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL); P_AddThinker(THINK_MAIN, &elevator->thinker); From be0959fa904889ae65532d2afec21b58f73eb1b8 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Fri, 1 May 2020 11:25:32 +0200 Subject: [PATCH 6/6] Remove bogus comments from p_saveg.c --- src/p_saveg.c | 397 +------------------------------------------------- 1 file changed, 5 insertions(+), 392 deletions(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index c04a9ee2d..2f84e97ef 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -59,9 +59,6 @@ typedef enum DRONE = 0x80, } player_saveflags; -// -// P_ArchivePlayer -// static inline void P_ArchivePlayer(void) { const player_t *player = &players[consoleplayer]; @@ -77,9 +74,6 @@ static inline void P_ArchivePlayer(void) WRITEINT32(save_p, player->continues); } -// -// P_UnArchivePlayer -// static inline void P_UnArchivePlayer(void) { INT16 skininfo = READUINT16(save_p); @@ -92,9 +86,6 @@ static inline void P_UnArchivePlayer(void) savedata.continues = READINT32(save_p); } -// -// P_NetArchivePlayers -// static void P_NetArchivePlayers(void) { INT32 i, j; @@ -300,9 +291,6 @@ static void P_NetArchivePlayers(void) } } -// -// P_NetUnArchivePlayers -// static void P_NetUnArchivePlayers(void) { INT32 i, j; @@ -772,9 +760,6 @@ static void P_NetUnArchiveColormaps(void) #define LD_S2BOTTEX 0x04 #define LD_S2MIDTEX 0x08 -// -// P_NetArchiveWorld -// static void P_NetArchiveWorld(void) { size_t i; @@ -1022,9 +1007,6 @@ static void P_NetArchiveWorld(void) save_p = put; } -// -// P_NetUnArchiveWorld -// static void P_NetUnArchiveWorld(void) { UINT16 i; @@ -1341,11 +1323,6 @@ static UINT32 SaveSlope(const pslope_t *slope) return 0xFFFFFFFF; } -// -// SaveMobjThinker -// -// Saves a mobj_t thinker -// static void SaveMobjThinker(const thinker_t *th, const UINT8 type) { const mobj_t *mobj = (const mobj_t *)th; @@ -1646,11 +1623,6 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) WRITEUINT32(save_p, mobj->mobjnum); } -// -// SaveNoEnemiesThinker -// -// Saves a noenemies_t thinker -// static void SaveNoEnemiesThinker(const thinker_t *th, const UINT8 type) { const noenemies_t *ht = (const void *)th; @@ -1658,11 +1630,6 @@ static void SaveNoEnemiesThinker(const thinker_t *th, const UINT8 type) WRITEUINT32(save_p, SaveLine(ht->sourceline)); } -// -// SaveBounceCheeseThinker -// -// Saves a bouncecheese_t thinker -// static void SaveBounceCheeseThinker(const thinker_t *th, const UINT8 type) { const bouncecheese_t *ht = (const void *)th; @@ -1676,11 +1643,6 @@ static void SaveBounceCheeseThinker(const thinker_t *th, const UINT8 type) WRITECHAR(save_p, ht->low); } -// -// SaveContinuousFallThinker -// -// Saves a continuousfall_t thinker -// static void SaveContinuousFallThinker(const thinker_t *th, const UINT8 type) { const continuousfall_t *ht = (const void *)th; @@ -1693,11 +1655,6 @@ static void SaveContinuousFallThinker(const thinker_t *th, const UINT8 type) WRITEFIXED(save_p, ht->destheight); } -// -// SaveMarioBlockThinker -// -// Saves a mariothink_t thinker -// static void SaveMarioBlockThinker(const thinker_t *th, const UINT8 type) { const mariothink_t *ht = (const void *)th; @@ -1710,11 +1667,6 @@ static void SaveMarioBlockThinker(const thinker_t *th, const UINT8 type) WRITEINT16(save_p, ht->tag); } -// -// SaveMarioCheckThinker -// -// Saves a mariocheck_t thinker -// static void SaveMarioCheckThinker(const thinker_t *th, const UINT8 type) { const mariocheck_t *ht = (const void *)th; @@ -1723,11 +1675,6 @@ static void SaveMarioCheckThinker(const thinker_t *th, const UINT8 type) WRITEUINT32(save_p, SaveSector(ht->sector)); } -// -// SaveThwompThinker -// -// Saves a thwomp_t thinker -// static void SaveThwompThinker(const thinker_t *th, const UINT8 type) { const thwomp_t *ht = (const void *)th; @@ -1744,11 +1691,6 @@ static void SaveThwompThinker(const thinker_t *th, const UINT8 type) WRITEUINT16(save_p, ht->sound); } -// -// SaveFloatThinker -// -// Saves a floatthink_t thinker -// static void SaveFloatThinker(const thinker_t *th, const UINT8 type) { const floatthink_t *ht = (const void *)th; @@ -1758,10 +1700,6 @@ static void SaveFloatThinker(const thinker_t *th, const UINT8 type) WRITEINT16(save_p, ht->tag); } -// SaveEachTimeThinker -// -// Loads a eachtime_t from a save game -// static void SaveEachTimeThinker(const thinker_t *th, const UINT8 type) { const eachtime_t *ht = (const void *)th; @@ -1776,10 +1714,6 @@ static void SaveEachTimeThinker(const thinker_t *th, const UINT8 type) WRITECHAR(save_p, ht->triggerOnExit); } -// SaveRaiseThinker -// -// Saves a raise_t thinker -// static void SaveRaiseThinker(const thinker_t *th, const UINT8 type) { const raise_t *ht = (const void *)th; @@ -1794,11 +1728,6 @@ static void SaveRaiseThinker(const thinker_t *th, const UINT8 type) WRITEUINT8(save_p, ht->flags); } -// -// SaveCeilingThinker -// -// Saves a ceiling_t thinker -// static void SaveCeilingThinker(const thinker_t *th, const UINT8 type) { const ceiling_t *ht = (const void *)th; @@ -1820,11 +1749,6 @@ static void SaveCeilingThinker(const thinker_t *th, const UINT8 type) WRITEFIXED(save_p, ht->sourceline); } -// -// SaveFloormoveThinker -// -// Saves a floormove_t thinker -// static void SaveFloormoveThinker(const thinker_t *th, const UINT8 type) { const floormove_t *ht = (const void *)th; @@ -1841,11 +1765,6 @@ static void SaveFloormoveThinker(const thinker_t *th, const UINT8 type) WRITEFIXED(save_p, ht->delaytimer); } -// -// SaveLightflashThinker -// -// Saves a lightflash_t thinker -// static void SaveLightflashThinker(const thinker_t *th, const UINT8 type) { const lightflash_t *ht = (const void *)th; @@ -1855,11 +1774,6 @@ static void SaveLightflashThinker(const thinker_t *th, const UINT8 type) WRITEINT32(save_p, ht->minlight); } -// -// SaveStrobeThinker -// -// Saves a strobe_t thinker -// static void SaveStrobeThinker(const thinker_t *th, const UINT8 type) { const strobe_t *ht = (const void *)th; @@ -1872,11 +1786,6 @@ static void SaveStrobeThinker(const thinker_t *th, const UINT8 type) WRITEINT32(save_p, ht->brighttime); } -// -// SaveGlowThinker -// -// Saves a glow_t thinker -// static void SaveGlowThinker(const thinker_t *th, const UINT8 type) { const glow_t *ht = (const void *)th; @@ -1887,11 +1796,7 @@ static void SaveGlowThinker(const thinker_t *th, const UINT8 type) WRITEINT32(save_p, ht->direction); WRITEINT32(save_p, ht->speed); } -// -// SaveFireflickerThinker -// -// Saves a fireflicker_t thinker -// + static inline void SaveFireflickerThinker(const thinker_t *th, const UINT8 type) { const fireflicker_t *ht = (const void *)th; @@ -1902,11 +1807,7 @@ static inline void SaveFireflickerThinker(const thinker_t *th, const UINT8 type) WRITEINT32(save_p, ht->maxlight); WRITEINT32(save_p, ht->minlight); } -// -// SaveElevatorThinker -// -// Saves a elevator_t thinker -// + static void SaveElevatorThinker(const thinker_t *th, const UINT8 type) { const elevator_t *ht = (const void *)th; @@ -1929,11 +1830,6 @@ static void SaveElevatorThinker(const thinker_t *th, const UINT8 type) WRITEUINT32(save_p, SaveLine(ht->sourceline)); } -// -// SaveCrumbleThinker -// -// Saves a crumble_t thinker -// static void SaveCrumbleThinker(const thinker_t *th, const UINT8 type) { const crumble_t *ht = (const void *)th; @@ -1951,11 +1847,6 @@ static void SaveCrumbleThinker(const thinker_t *th, const UINT8 type) WRITEUINT8(save_p, ht->flags); } -// -// SaveScrollThinker -// -// Saves a scroll_t thinker -// static inline void SaveScrollThinker(const thinker_t *th, const UINT8 type) { const scroll_t *ht = (const void *)th; @@ -1972,11 +1863,6 @@ static inline void SaveScrollThinker(const thinker_t *th, const UINT8 type) WRITEUINT8(save_p, ht->type); } -// -// SaveFrictionThinker -// -// Saves a friction_t thinker -// static inline void SaveFrictionThinker(const thinker_t *th, const UINT8 type) { const friction_t *ht = (const void *)th; @@ -1988,11 +1874,6 @@ static inline void SaveFrictionThinker(const thinker_t *th, const UINT8 type) WRITEUINT8(save_p, ht->roverfriction); } -// -// SavePusherThinker -// -// Saves a pusher_t thinker -// static inline void SavePusherThinker(const thinker_t *th, const UINT8 type) { const pusher_t *ht = (const void *)th; @@ -2012,11 +1893,6 @@ static inline void SavePusherThinker(const thinker_t *th, const UINT8 type) WRITEINT32(save_p, ht->slider); } -// -// SaveLaserThinker -// -// Saves a laserthink_t thinker -// static void SaveLaserThinker(const thinker_t *th, const UINT8 type) { const laserthink_t *ht = (const void *)th; @@ -2026,11 +1902,6 @@ static void SaveLaserThinker(const thinker_t *th, const UINT8 type) WRITEUINT32(save_p, SaveLine(ht->sourceline)); } -// -// SaveLightlevelThinker -// -// Saves a lightlevel_t thinker -// static void SaveLightlevelThinker(const thinker_t *th, const UINT8 type) { const lightlevel_t *ht = (const void *)th; @@ -2043,11 +1914,6 @@ static void SaveLightlevelThinker(const thinker_t *th, const UINT8 type) WRITEINT32(save_p, ht->timer); } -// -// SaveExecutorThinker -// -// Saves a executor_t thinker -// static void SaveExecutorThinker(const thinker_t *th, const UINT8 type) { const executor_t *ht = (const void *)th; @@ -2058,11 +1924,6 @@ static void SaveExecutorThinker(const thinker_t *th, const UINT8 type) WRITEINT32(save_p, ht->timer); } -// -// SaveDisappearThinker -// -// Saves a disappear_t thinker -// static void SaveDisappearThinker(const thinker_t *th, const UINT8 type) { const disappear_t *ht = (const void *)th; @@ -2076,11 +1937,6 @@ static void SaveDisappearThinker(const thinker_t *th, const UINT8 type) WRITEINT32(save_p, ht->exists); } -// -// SaveFadeThinker -// -// Saves a fade_t thinker -// static void SaveFadeThinker(const thinker_t *th, const UINT8 type) { const fade_t *ht = (const void *)th; @@ -2104,11 +1960,6 @@ static void SaveFadeThinker(const thinker_t *th, const UINT8 type) WRITEUINT8(save_p, ht->exactalpha); } -// -// SaveFadeColormapThinker -// -// Saves a fadecolormap_t thinker -// static void SaveFadeColormapThinker(const thinker_t *th, const UINT8 type) { const fadecolormap_t *ht = (const void *)th; @@ -2121,11 +1972,6 @@ static void SaveFadeColormapThinker(const thinker_t *th, const UINT8 type) WRITEINT32(save_p, ht->timer); } -// -// SavePlaneDisplaceThinker -// -// Saves a planedisplace_t thinker -// static void SavePlaneDisplaceThinker(const thinker_t *th, const UINT8 type) { const planedisplace_t *ht = (const void *)th; @@ -2137,7 +1983,6 @@ static void SavePlaneDisplaceThinker(const thinker_t *th, const UINT8 type) WRITEUINT8(save_p, ht->type); } -/// Save a dynamic slope thinker. static inline void SaveDynamicSlopeThinker(const thinker_t *th, const UINT8 type) { const dynplanethink_t* ht = (const void*)th; @@ -2153,12 +1998,6 @@ static inline void SaveDynamicSlopeThinker(const thinker_t *th, const UINT8 type } #ifdef POLYOBJECTS - -// -// SavePolyrotateThinker -// -// Saves a polyrotate_t thinker -// static inline void SavePolyrotatetThinker(const thinker_t *th, const UINT8 type) { const polyrotate_t *ht = (const void *)th; @@ -2168,11 +2007,6 @@ static inline void SavePolyrotatetThinker(const thinker_t *th, const UINT8 type) WRITEINT32(save_p, ht->distance); } -// -// SavePolymoveThinker -// -// Saves a polymovet_t thinker -// static void SavePolymoveThinker(const thinker_t *th, const UINT8 type) { const polymove_t *ht = (const void *)th; @@ -2185,11 +2019,6 @@ static void SavePolymoveThinker(const thinker_t *th, const UINT8 type) WRITEANGLE(save_p, ht->angle); } -// -// SavePolywaypointThinker -// -// Saves a polywaypoint_t thinker -// static void SavePolywaypointThinker(const thinker_t *th, UINT8 type) { const polywaypoint_t *ht = (const void *)th; @@ -2209,11 +2038,6 @@ static void SavePolywaypointThinker(const thinker_t *th, UINT8 type) WRITEUINT32(save_p, SaveMobjnum(ht->target)); } -// -// SavePolyslidedoorThinker -// -// Saves a polyslidedoor_t thinker -// static void SavePolyslidedoorThinker(const thinker_t *th, const UINT8 type) { const polyslidedoor_t *ht = (const void *)th; @@ -2233,11 +2057,6 @@ static void SavePolyslidedoorThinker(const thinker_t *th, const UINT8 type) WRITEUINT8(save_p, ht->closing); } -// -// SavePolyswingdoorThinker -// -// Saves a polyswingdoor_t thinker -// static void SavePolyswingdoorThinker(const thinker_t *th, const UINT8 type) { const polyswingdoor_t *ht = (const void *)th; @@ -2287,25 +2106,8 @@ static void SavePolyfadeThinker(const thinker_t *th, const UINT8 type) WRITEINT32(save_p, ht->duration); WRITEINT32(save_p, ht->timer); } - #endif -/* -// -// SaveWhatThinker -// -// Saves a what_t thinker -// -static inline void SaveWhatThinker(const thinker_t *th, const UINT8 type) -{ - const what_t *ht = (const void *)th; - WRITEUINT8(save_p, type); -} -*/ -// -// P_NetArchiveThinkers -// -// static void P_NetArchiveThinkers(void) { const thinker_t *th; @@ -2605,11 +2407,6 @@ static inline pslope_t *LoadSlope(UINT32 slopeid) return NULL; } -// -// LoadMobjThinker -// -// Loads a mobj_t from a save game -// static thinker_t* LoadMobjThinker(actionf_p1 thinker) { thinker_t *next; @@ -2886,10 +2683,6 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) return &mobj->thinker; } -// LoadNoEnemiesThinker -// -// Loads a noenemies_t from a save game -// static thinker_t* LoadNoEnemiesThinker(actionf_p1 thinker) { noenemies_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -2898,10 +2691,6 @@ static thinker_t* LoadNoEnemiesThinker(actionf_p1 thinker) return &ht->thinker; } -// LoadBounceCheeseThinker -// -// Loads a bouncecheese_t from a save game -// static thinker_t* LoadBounceCheeseThinker(actionf_p1 thinker) { bouncecheese_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -2916,10 +2705,6 @@ static thinker_t* LoadBounceCheeseThinker(actionf_p1 thinker) return &ht->thinker; } -// LoadContinuousFallThinker -// -// Loads a continuousfall_t from a save game -// static thinker_t* LoadContinuousFallThinker(actionf_p1 thinker) { continuousfall_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -2933,10 +2718,6 @@ static thinker_t* LoadContinuousFallThinker(actionf_p1 thinker) return &ht->thinker; } -// LoadMarioBlockThinker -// -// Loads a mariothink_t from a save game -// static thinker_t* LoadMarioBlockThinker(actionf_p1 thinker) { mariothink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -2950,10 +2731,6 @@ static thinker_t* LoadMarioBlockThinker(actionf_p1 thinker) return &ht->thinker; } -// LoadMarioCheckThinker -// -// Loads a mariocheck_t from a save game -// static thinker_t* LoadMarioCheckThinker(actionf_p1 thinker) { mariocheck_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -2963,10 +2740,6 @@ static thinker_t* LoadMarioCheckThinker(actionf_p1 thinker) return &ht->thinker; } -// LoadThwompThinker -// -// Loads a thwomp_t from a save game -// static thinker_t* LoadThwompThinker(actionf_p1 thinker) { thwomp_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -2984,10 +2757,6 @@ static thinker_t* LoadThwompThinker(actionf_p1 thinker) return &ht->thinker; } -// LoadFloatThinker -// -// Loads a floatthink_t from a save game -// static thinker_t* LoadFloatThinker(actionf_p1 thinker) { floatthink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -2998,10 +2767,6 @@ static thinker_t* LoadFloatThinker(actionf_p1 thinker) return &ht->thinker; } -// LoadEachTimeThinker -// -// Loads a eachtime_t from a save game -// static thinker_t* LoadEachTimeThinker(actionf_p1 thinker) { size_t i; @@ -3017,10 +2782,6 @@ static thinker_t* LoadEachTimeThinker(actionf_p1 thinker) return &ht->thinker; } -// LoadRaiseThinker -// -// Loads a raise_t from a save game -// static thinker_t* LoadRaiseThinker(actionf_p1 thinker) { raise_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3036,11 +2797,6 @@ static thinker_t* LoadRaiseThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadCeilingThinker -// -// Loads a ceiling_t from a save game -// static thinker_t* LoadCeilingThinker(actionf_p1 thinker) { ceiling_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3065,11 +2821,6 @@ static thinker_t* LoadCeilingThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadFloormoveThinker -// -// Loads a floormove_t from a save game -// static thinker_t* LoadFloormoveThinker(actionf_p1 thinker) { floormove_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3089,11 +2840,6 @@ static thinker_t* LoadFloormoveThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadLightflashThinker -// -// Loads a lightflash_t from a save game -// static thinker_t* LoadLightflashThinker(actionf_p1 thinker) { lightflash_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3106,11 +2852,6 @@ static thinker_t* LoadLightflashThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadStrobeThinker -// -// Loads a strobe_t from a save game -// static thinker_t* LoadStrobeThinker(actionf_p1 thinker) { strobe_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3126,11 +2867,6 @@ static thinker_t* LoadStrobeThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadGlowThinker -// -// Loads a glow_t from a save game -// static thinker_t* LoadGlowThinker(actionf_p1 thinker) { glow_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3144,11 +2880,7 @@ static thinker_t* LoadGlowThinker(actionf_p1 thinker) ht->sector->lightingdata = ht; return &ht->thinker; } -// -// LoadFireflickerThinker -// -// Loads a fireflicker_t from a save game -// + static thinker_t* LoadFireflickerThinker(actionf_p1 thinker) { fireflicker_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3162,11 +2894,7 @@ static thinker_t* LoadFireflickerThinker(actionf_p1 thinker) ht->sector->lightingdata = ht; return &ht->thinker; } -// -// +vatorThinker -// -// Loads a elevator_t from a save game -// + static thinker_t* LoadElevatorThinker(actionf_p1 thinker, boolean setplanedata) { elevator_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3197,11 +2925,6 @@ static thinker_t* LoadElevatorThinker(actionf_p1 thinker, boolean setplanedata) return &ht->thinker; } -// -// LoadCrumbleThinker -// -// Loads a crumble_t from a save game -// static thinker_t* LoadCrumbleThinker(actionf_p1 thinker) { crumble_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3224,11 +2947,6 @@ static thinker_t* LoadCrumbleThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadScrollThinker -// -// Loads a scroll_t from a save game -// static thinker_t* LoadScrollThinker(actionf_p1 thinker) { scroll_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3246,11 +2964,6 @@ static thinker_t* LoadScrollThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadFrictionThinker -// -// Loads a friction_t from a save game -// static inline thinker_t* LoadFrictionThinker(actionf_p1 thinker) { friction_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3263,11 +2976,6 @@ static inline thinker_t* LoadFrictionThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadPusherThinker -// -// Loads a pusher_t from a save game -// static thinker_t* LoadPusherThinker(actionf_p1 thinker) { pusher_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3289,11 +2997,6 @@ static thinker_t* LoadPusherThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadLaserThinker -// -// Loads a laserthink_t from a save game -// static inline thinker_t* LoadLaserThinker(actionf_p1 thinker) { laserthink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3309,11 +3012,6 @@ static inline thinker_t* LoadLaserThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadLightlevelThinker -// -// Loads a lightlevel_t from a save game -// static inline thinker_t* LoadLightlevelThinker(actionf_p1 thinker) { lightlevel_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3329,11 +3027,6 @@ static inline thinker_t* LoadLightlevelThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadExecutorThinker -// -// Loads a executor_t from a save game -// static inline thinker_t* LoadExecutorThinker(actionf_p1 thinker) { executor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3345,11 +3038,6 @@ static inline thinker_t* LoadExecutorThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadDisappearThinker -// -// Loads a disappear_t thinker -// static inline thinker_t* LoadDisappearThinker(actionf_p1 thinker) { disappear_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3364,11 +3052,6 @@ static inline thinker_t* LoadDisappearThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadFadeThinker -// -// Loads a fade_t thinker -// static inline thinker_t* LoadFadeThinker(actionf_p1 thinker) { sector_t *ss; @@ -3411,10 +3094,6 @@ static inline thinker_t* LoadFadeThinker(actionf_p1 thinker) return &ht->thinker; } -// LoadFadeColormapThinker -// -// Loads a fadecolormap_t from a save game -// static inline thinker_t* LoadFadeColormapThinker(actionf_p1 thinker) { fadecolormap_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3430,11 +3109,6 @@ static inline thinker_t* LoadFadeColormapThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadPlaneDisplaceThinker -// -// Loads a planedisplace_t thinker -// static inline thinker_t* LoadPlaneDisplaceThinker(actionf_p1 thinker) { planedisplace_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3448,7 +3122,6 @@ static inline thinker_t* LoadPlaneDisplaceThinker(actionf_p1 thinker) return &ht->thinker; } -/// Save a dynamic slope thinker. static inline thinker_t* LoadDynamicSlopeThinker(actionf_p1 thinker) { dynplanethink_t* ht = Z_Malloc(sizeof(*ht), PU_LEVSPEC, NULL); @@ -3464,12 +3137,6 @@ static inline thinker_t* LoadDynamicSlopeThinker(actionf_p1 thinker) } #ifdef POLYOBJECTS - -// -// LoadPolyrotateThinker -// -// Loads a polyrotate_t thinker -// static inline thinker_t* LoadPolyrotatetThinker(actionf_p1 thinker) { polyrotate_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3480,11 +3147,6 @@ static inline thinker_t* LoadPolyrotatetThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadPolymoveThinker -// -// Loads a polymovet_t thinker -// static thinker_t* LoadPolymoveThinker(actionf_p1 thinker) { polymove_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3498,11 +3160,6 @@ static thinker_t* LoadPolymoveThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadPolywaypointThinker -// -// Loads a polywaypoint_t thinker -// static inline thinker_t* LoadPolywaypointThinker(actionf_p1 thinker) { polywaypoint_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3523,11 +3180,6 @@ static inline thinker_t* LoadPolywaypointThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadPolyslidedoorThinker -// -// loads a polyslidedoor_t thinker -// static inline thinker_t* LoadPolyslidedoorThinker(actionf_p1 thinker) { polyslidedoor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3548,11 +3200,6 @@ static inline thinker_t* LoadPolyslidedoorThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadPolyswingdoorThinker -// -// Loads a polyswingdoor_t thinker -// static inline thinker_t* LoadPolyswingdoorThinker(actionf_p1 thinker) { polyswingdoor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3568,11 +3215,6 @@ static inline thinker_t* LoadPolyswingdoorThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadPolydisplaceThinker -// -// Loads a polydisplace_t thinker -// static inline thinker_t* LoadPolydisplaceThinker(actionf_p1 thinker) { polydisplace_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3597,11 +3239,6 @@ static inline thinker_t* LoadPolyrotdisplaceThinker(actionf_p1 thinker) return &ht->thinker; } -// -// LoadPolyfadeThinker -// -// Loads a polyfadet_t thinker -// static thinker_t* LoadPolyfadeThinker(actionf_p1 thinker) { polyfade_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); @@ -3618,22 +3255,6 @@ static thinker_t* LoadPolyfadeThinker(actionf_p1 thinker) } #endif -/* -// -// LoadWhatThinker -// -// load a what_t thinker -// -static inline void LoadWhatThinker(actionf_p1 thinker) -{ - what_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); - ht->thinker.function.acp1 = thinker; -} -*/ - -// -// P_NetUnArchiveThinkers -// static void P_NetUnArchiveThinkers(void) { thinker_t *currentthinker; @@ -3982,9 +3603,7 @@ static inline void P_UnArchivePolyObjects(void) P_UnArchivePolyObj(&PolyObjects[i]); } #endif -// -// P_FinishMobjs -// + static inline void P_FinishMobjs(void) { thinker_t *currentthinker; @@ -4093,9 +3712,6 @@ static void P_RelinkPointers(void) } } -// -// P_NetArchiveSpecials -// static inline void P_NetArchiveSpecials(void) { size_t i, z; @@ -4136,9 +3752,6 @@ static inline void P_NetArchiveSpecials(void) WRITEUINT8(save_p, 0x00); } -// -// P_NetUnArchiveSpecials -// static void P_NetUnArchiveSpecials(void) { size_t i;