Merge branch 'elevator-cleanup' into 'next'

elevator_t cleanup

See merge request STJr/SRB2!896
This commit is contained in:
MascaraSnake 2020-05-01 05:46:37 -04:00
commit 9029422311
5 changed files with 193 additions and 525 deletions

View file

@ -757,7 +757,7 @@ void T_BounceCheese(bouncecheese_t *bouncer)
// T_StartCrumble //////////////////////////////// // T_StartCrumble ////////////////////////////////
////////////////////////////////////////////////// //////////////////////////////////////////////////
// Crumbling platform Tails 03-11-2002 // Crumbling platform Tails 03-11-2002
void T_StartCrumble(elevator_t *elevator) void T_StartCrumble(crumble_t *crumble)
{ {
ffloor_t *rover; ffloor_t *rover;
sector_t *sector; sector_t *sector;
@ -765,84 +765,96 @@ void T_StartCrumble(elevator_t *elevator)
// Once done, the no-return thinker just sits there, // Once done, the no-return thinker just sits there,
// constantly 'returning'... kind of an oxymoron, isn't it? // constantly 'returning'... kind of an oxymoron, isn't it?
if (((elevator->floordestheight == 1 && elevator->direction == -1) if ((((crumble->flags & CF_REVERSE) && crumble->direction == -1)
|| (elevator->floordestheight == 0 && elevator->direction == 1)) || (!(crumble->flags & CF_REVERSE) && crumble->direction == 1))
&& elevator->type == elevateContinuous) // No return crumbler && !(crumble->flags & CF_RETURN))
{ {
elevator->sector->ceilspeed = 0; crumble->sector->ceilspeed = 0;
elevator->sector->floorspeed = 0; crumble->sector->floorspeed = 0;
return; return;
} }
if (elevator->distance != 0) if (crumble->timer != 0)
{ {
if (elevator->distance > 0) // Count down the timer if (crumble->timer > 0) // Count down the timer
{ {
elevator->distance--; if (--crumble->timer <= 0)
if (elevator->distance <= 0) crumble->timer = -15*TICRATE; // Timer until platform returns to original position.
elevator->distance = -15*TICRATE; // Timer until platform returns to original position.
else else
{ {
// Timer isn't up yet, so just keep waiting. // Timer isn't up yet, so just keep waiting.
elevator->sector->ceilspeed = 0; crumble->sector->ceilspeed = 0;
elevator->sector->floorspeed = 0; crumble->sector->floorspeed = 0;
return; return;
} }
} }
else if (++elevator->distance == 0) // Reposition back to original spot else if (++crumble->timer == 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 = &sectors[i]; sector = &sectors[i];
for (rover = sector->ffloors; rover; rover = rover->next) for (rover = sector->ffloors; rover; rover = rover->next)
{ {
if (rover->flags & FF_CRUMBLE && rover->flags & FF_FLOATBOB if (!(rover->flags & FF_CRUMBLE))
&& rover->master == elevator->sourceline) continue;
{
rover->alpha = elevator->origspeed;
if (rover->alpha == 0xff) if (!(rover->flags & FF_FLOATBOB))
rover->flags &= ~FF_TRANSLUCENT; continue;
}
if (rover->master != crumble->sourceline)
continue;
rover->alpha = crumble->origalpha;
if (rover->alpha == 0xff)
rover->flags &= ~FF_TRANSLUCENT;
} }
} }
// Up! // Up!
if (elevator->floordestheight == 1) if (crumble->flags & CF_REVERSE)
elevator->direction = -1; crumble->direction = -1;
else else
elevator->direction = 1; crumble->direction = 1;
elevator->sector->ceilspeed = 0; crumble->sector->ceilspeed = 0;
elevator->sector->floorspeed = 0; crumble->sector->floorspeed = 0;
return; return;
} }
// Flash to indicate that the platform is about to return. // Flash to indicate that the platform is about to return.
if (elevator->distance > -224 && (leveltime % ((abs(elevator->distance)/8) + 1) == 0)) if (crumble->timer > -224 && (leveltime % ((abs(crumble->timer)/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 = &sectors[i]; sector = &sectors[i];
for (rover = sector->ffloors; rover; rover = rover->next) for (rover = sector->ffloors; rover; rover = rover->next)
{ {
if (!(rover->flags & FF_NORETURN) && rover->flags & FF_CRUMBLE && rover->flags & FF_FLOATBOB if (rover->flags & FF_NORETURN)
&& rover->master == elevator->sourceline) continue;
{
if (rover->alpha == elevator->origspeed)
{
rover->flags |= FF_TRANSLUCENT;
rover->alpha = 0x00;
}
else
{
if (elevator->origspeed == 0xff)
rover->flags &= ~FF_TRANSLUCENT;
rover->alpha = elevator->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,74 +863,62 @@ void T_StartCrumble(elevator_t *elevator)
// We're about to go back to the original position, // We're about to go back to the original position,
// so set this to let other thinkers know what is // so set this to let other thinkers know what is
// about to happen. // about to happen.
if (elevator->distance < 0 && elevator->distance > -3) if (crumble->timer < 0 && crumble->timer > -3)
elevator->sector->crumblestate = CRUMBLE_RESTORE; // makes T_BounceCheese remove itself crumble->sector->crumblestate = CRUMBLE_RESTORE; // makes T_BounceCheese remove itself
} }
if ((elevator->floordestheight == 0 && elevator->direction == -1) if ((!(crumble->flags & CF_REVERSE) && crumble->direction == -1)
|| (elevator->floordestheight == 1 && elevator->direction == 1)) // Down || ((crumble->flags & CF_REVERSE) && 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 // Only fall like this if it isn't meant to float on water
if (elevator->high != 42) if (!(crumble->flags & CF_FLOATBOB))
{ {
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)) if ((!(crumble->flags & CF_REVERSE) && crumble->sector->ceilingheight >= -16384*FRACUNIT)
|| (elevator->floordestheight == 1 && !(elevator->sector->ceilingheight > 16384*FRACUNIT))) || ((crumble->flags & CF_REVERSE) && crumble->sector->ceilingheight <= 16384*FRACUNIT))
{ {
fixed_t dest;
if (elevator->floordestheight == 1)
dest = elevator->sector->ceilingheight + (elevator->speed*2);
else
dest = elevator->sector->ceilingheight - (elevator->speed*2);
T_MovePlane //jff 4/7/98 reverse order of ceiling/floor T_MovePlane //jff 4/7/98 reverse order of ceiling/floor
( (
elevator->sector, crumble->sector,
elevator->speed, crumble->speed,
dest, crumble->sector->ceilingheight + crumble->direction*crumble->speed*2,
false, false,
true, // move ceiling true, // move ceiling
elevator->direction crumble->direction
); );
if (elevator->floordestheight == 1) T_MovePlane
dest = elevator->sector->floorheight + (elevator->speed*2); (
else crumble->sector,
dest = elevator->sector->floorheight - (elevator->speed*2); crumble->speed,
crumble->sector->floorheight + crumble->direction*crumble->speed*2,
T_MovePlane false,
( false, // move floor
elevator->sector, crumble->direction
elevator->speed,
dest,
false,
false, // move floor
elevator->direction
); );
elevator->sector->ceilspeed = 42; crumble->sector->ceilspeed = 42;
elevator->sector->floorspeed = elevator->speed*elevator->direction; crumble->sector->floorspeed = crumble->speed*crumble->direction;
} }
} }
} }
else // Up (restore to original position) else // Up (restore to original position)
{ {
elevator->sector->crumblestate = CRUMBLE_WAIT; crumble->sector->crumblestate = CRUMBLE_WAIT;
elevator->sector->ceilingheight = elevator->ceilingwasheight; crumble->sector->ceilingheight = crumble->ceilingwasheight;
elevator->sector->floorheight = elevator->floorwasheight; crumble->sector->floorheight = crumble->floorwasheight;
elevator->sector->floordata = NULL; crumble->sector->floordata = NULL;
elevator->sector->ceilingdata = NULL; crumble->sector->ceilingdata = NULL;
elevator->sector->ceilspeed = 0; crumble->sector->ceilspeed = 0;
elevator->sector->floorspeed = 0; crumble->sector->floorspeed = 0;
elevator->sector->moved = true; crumble->sector->moved = true;
P_RemoveThinker(&elevator->thinker); 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 = &sectors[i]; sector = &sectors[i];
sector->moved = true; 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, INT32 EV_StartCrumble(sector_t *sec, ffloor_t *rover, boolean floating,
player_t *player, fixed_t origalpha, boolean crumblereturn) player_t *player, fixed_t origalpha, boolean crumblereturn)
{ {
elevator_t *elevator; crumble_t *crumble;
sector_t *foundsec; sector_t *foundsec;
INT32 i; INT32 i;
@ -2320,55 +2320,45 @@ INT32 EV_StartCrumble(sector_t *sec, ffloor_t *rover, boolean floating,
if (sec->crumblestate >= CRUMBLE_ACTIVATED) if (sec->crumblestate >= CRUMBLE_ACTIVATED)
return 0; return 0;
// create and initialize new elevator thinker // create and initialize new crumble thinker
elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL); crumble = Z_Calloc(sizeof (*crumble), PU_LEVSPEC, NULL);
P_AddThinker(THINK_MAIN, &elevator->thinker); P_AddThinker(THINK_MAIN, &crumble->thinker);
elevator->thinker.function.acp1 = (actionf_p1)T_StartCrumble; crumble->thinker.function.acp1 = (actionf_p1)T_StartCrumble;
// Does this crumbler return? // set up the fields
if (crumblereturn) crumble->sector = sec;
elevator->type = elevateBounce; crumble->speed = 0;
else
elevator->type = elevateContinuous;
// set up the fields according to the type of elevator action
elevator->sector = sec;
elevator->speed = 0;
if (player && player->mo && (player->mo->eflags & MFE_VERTICALFLIP)) if (player && player->mo && (player->mo->eflags & MFE_VERTICALFLIP))
{ {
elevator->direction = 1; // Up crumble->direction = 1; // Up
elevator->floordestheight = 1; crumble->flags |= CF_REVERSE;
} }
else else
{ crumble->direction = -1; // Down
elevator->direction = -1; // Down
elevator->floordestheight = 0;
}
elevator->floorwasheight = elevator->sector->floorheight; crumble->floorwasheight = crumble->sector->floorheight;
elevator->ceilingwasheight = elevator->sector->ceilingheight; crumble->ceilingwasheight = crumble->sector->ceilingheight;
elevator->distance = TICRATE; // Used for delay time crumble->timer = TICRATE;
elevator->low = 0; crumble->player = player;
elevator->player = player; crumble->origalpha = origalpha;
elevator->origspeed = origalpha;
elevator->sourceline = rover->master; crumble->sourceline = rover->master;
sec->floordata = elevator; sec->floordata = crumble;
if (crumblereturn)
crumble->flags |= CF_RETURN;
if (floating) if (floating)
elevator->high = 42; crumble->flags |= CF_FLOATBOB;
else
elevator->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 = &sectors[i]; foundsec = &sectors[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; return 1;

View file

@ -4223,21 +4223,19 @@ 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! //If the thing was crushed by a crumbling FOF, reward the player who made it crumble!
thinker_t *think; thinker_t *think;
elevator_t *crumbler; crumble_t *crumbler;
for (think = thlist[THINK_MAIN].next; think != &thlist[THINK_MAIN]; think = think->next) for (think = thlist[THINK_MAIN].next; think != &thlist[THINK_MAIN]; think = think->next)
{ {
if (think->function.acp1 != (actionf_p1)T_StartCrumble) if (think->function.acp1 != (actionf_p1)T_StartCrumble)
continue; continue;
crumbler = (elevator_t *)think; crumbler = (crumble_t *)think;
if (crumbler->player && crumbler->player->mo if (crumbler->player && crumbler->player->mo
&& crumbler->player->mo != thing && crumbler->player->mo != thing
&& crumbler->actionsector == thing->subsector->sector && crumbler->actionsector == thing->subsector->sector
&& crumbler->sector == rover->master->frontsector && crumbler->sector == rover->master->frontsector)
&& (crumbler->type == elevateBounce
|| crumbler->type == elevateContinuous))
{ {
killer = crumbler->player->mo; killer = crumbler->player->mo;
} }

View file

@ -59,9 +59,6 @@ typedef enum
DRONE = 0x80, DRONE = 0x80,
} player_saveflags; } player_saveflags;
//
// P_ArchivePlayer
//
static inline void P_ArchivePlayer(void) static inline void P_ArchivePlayer(void)
{ {
const player_t *player = &players[consoleplayer]; const player_t *player = &players[consoleplayer];
@ -77,9 +74,6 @@ static inline void P_ArchivePlayer(void)
WRITEINT32(save_p, player->continues); WRITEINT32(save_p, player->continues);
} }
//
// P_UnArchivePlayer
//
static inline void P_UnArchivePlayer(void) static inline void P_UnArchivePlayer(void)
{ {
INT16 skininfo = READUINT16(save_p); INT16 skininfo = READUINT16(save_p);
@ -92,9 +86,6 @@ static inline void P_UnArchivePlayer(void)
savedata.continues = READINT32(save_p); savedata.continues = READINT32(save_p);
} }
//
// P_NetArchivePlayers
//
static void P_NetArchivePlayers(void) static void P_NetArchivePlayers(void)
{ {
INT32 i, j; INT32 i, j;
@ -300,9 +291,6 @@ static void P_NetArchivePlayers(void)
} }
} }
//
// P_NetUnArchivePlayers
//
static void P_NetUnArchivePlayers(void) static void P_NetUnArchivePlayers(void)
{ {
INT32 i, j; INT32 i, j;
@ -1185,9 +1173,6 @@ static void UnArchiveLines(void)
} }
} }
//
// P_NetArchiveWorld
//
static void P_NetArchiveWorld(void) static void P_NetArchiveWorld(void)
{ {
// initialize colormap vars because paranoia // initialize colormap vars because paranoia
@ -1200,9 +1185,6 @@ static void P_NetArchiveWorld(void)
R_ClearTextureNumCache(false); R_ClearTextureNumCache(false);
} }
//
// P_NetUnArchiveWorld
//
static void P_NetUnArchiveWorld(void) static void P_NetUnArchiveWorld(void)
{ {
UINT16 i; UINT16 i;
@ -1362,11 +1344,6 @@ static UINT32 SaveSlope(const pslope_t *slope)
return 0xFFFFFFFF; return 0xFFFFFFFF;
} }
//
// SaveMobjThinker
//
// Saves a mobj_t thinker
//
static void SaveMobjThinker(const thinker_t *th, const UINT8 type) static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
{ {
const mobj_t *mobj = (const mobj_t *)th; const mobj_t *mobj = (const mobj_t *)th;
@ -1639,11 +1616,6 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
WRITEUINT32(save_p, mobj->mobjnum); WRITEUINT32(save_p, mobj->mobjnum);
} }
//
// SaveNoEnemiesThinker
//
// Saves a noenemies_t thinker
//
static void SaveNoEnemiesThinker(const thinker_t *th, const UINT8 type) static void SaveNoEnemiesThinker(const thinker_t *th, const UINT8 type)
{ {
const noenemies_t *ht = (const void *)th; const noenemies_t *ht = (const void *)th;
@ -1651,11 +1623,6 @@ static void SaveNoEnemiesThinker(const thinker_t *th, const UINT8 type)
WRITEUINT32(save_p, SaveLine(ht->sourceline)); WRITEUINT32(save_p, SaveLine(ht->sourceline));
} }
//
// SaveBounceCheeseThinker
//
// Saves a bouncecheese_t thinker
//
static void SaveBounceCheeseThinker(const thinker_t *th, const UINT8 type) static void SaveBounceCheeseThinker(const thinker_t *th, const UINT8 type)
{ {
const bouncecheese_t *ht = (const void *)th; const bouncecheese_t *ht = (const void *)th;
@ -1669,11 +1636,6 @@ static void SaveBounceCheeseThinker(const thinker_t *th, const UINT8 type)
WRITECHAR(save_p, ht->low); WRITECHAR(save_p, ht->low);
} }
//
// SaveContinuousFallThinker
//
// Saves a continuousfall_t thinker
//
static void SaveContinuousFallThinker(const thinker_t *th, const UINT8 type) static void SaveContinuousFallThinker(const thinker_t *th, const UINT8 type)
{ {
const continuousfall_t *ht = (const void *)th; const continuousfall_t *ht = (const void *)th;
@ -1686,11 +1648,6 @@ static void SaveContinuousFallThinker(const thinker_t *th, const UINT8 type)
WRITEFIXED(save_p, ht->destheight); WRITEFIXED(save_p, ht->destheight);
} }
//
// SaveMarioBlockThinker
//
// Saves a mariothink_t thinker
//
static void SaveMarioBlockThinker(const thinker_t *th, const UINT8 type) static void SaveMarioBlockThinker(const thinker_t *th, const UINT8 type)
{ {
const mariothink_t *ht = (const void *)th; const mariothink_t *ht = (const void *)th;
@ -1703,11 +1660,6 @@ static void SaveMarioBlockThinker(const thinker_t *th, const UINT8 type)
WRITEINT16(save_p, ht->tag); WRITEINT16(save_p, ht->tag);
} }
//
// SaveMarioCheckThinker
//
// Saves a mariocheck_t thinker
//
static void SaveMarioCheckThinker(const thinker_t *th, const UINT8 type) static void SaveMarioCheckThinker(const thinker_t *th, const UINT8 type)
{ {
const mariocheck_t *ht = (const void *)th; const mariocheck_t *ht = (const void *)th;
@ -1716,11 +1668,6 @@ static void SaveMarioCheckThinker(const thinker_t *th, const UINT8 type)
WRITEUINT32(save_p, SaveSector(ht->sector)); WRITEUINT32(save_p, SaveSector(ht->sector));
} }
//
// SaveThwompThinker
//
// Saves a thwomp_t thinker
//
static void SaveThwompThinker(const thinker_t *th, const UINT8 type) static void SaveThwompThinker(const thinker_t *th, const UINT8 type)
{ {
const thwomp_t *ht = (const void *)th; const thwomp_t *ht = (const void *)th;
@ -1737,11 +1684,6 @@ static void SaveThwompThinker(const thinker_t *th, const UINT8 type)
WRITEUINT16(save_p, ht->sound); WRITEUINT16(save_p, ht->sound);
} }
//
// SaveFloatThinker
//
// Saves a floatthink_t thinker
//
static void SaveFloatThinker(const thinker_t *th, const UINT8 type) static void SaveFloatThinker(const thinker_t *th, const UINT8 type)
{ {
const floatthink_t *ht = (const void *)th; const floatthink_t *ht = (const void *)th;
@ -1751,10 +1693,6 @@ static void SaveFloatThinker(const thinker_t *th, const UINT8 type)
WRITEINT16(save_p, ht->tag); WRITEINT16(save_p, ht->tag);
} }
// SaveEachTimeThinker
//
// Loads a eachtime_t from a save game
//
static void SaveEachTimeThinker(const thinker_t *th, const UINT8 type) static void SaveEachTimeThinker(const thinker_t *th, const UINT8 type)
{ {
const eachtime_t *ht = (const void *)th; const eachtime_t *ht = (const void *)th;
@ -1769,10 +1707,6 @@ static void SaveEachTimeThinker(const thinker_t *th, const UINT8 type)
WRITECHAR(save_p, ht->triggerOnExit); WRITECHAR(save_p, ht->triggerOnExit);
} }
// SaveRaiseThinker
//
// Saves a raise_t thinker
//
static void SaveRaiseThinker(const thinker_t *th, const UINT8 type) static void SaveRaiseThinker(const thinker_t *th, const UINT8 type)
{ {
const raise_t *ht = (const void *)th; const raise_t *ht = (const void *)th;
@ -1787,11 +1721,6 @@ static void SaveRaiseThinker(const thinker_t *th, const UINT8 type)
WRITEUINT8(save_p, ht->flags); WRITEUINT8(save_p, ht->flags);
} }
//
// SaveCeilingThinker
//
// Saves a ceiling_t thinker
//
static void SaveCeilingThinker(const thinker_t *th, const UINT8 type) static void SaveCeilingThinker(const thinker_t *th, const UINT8 type)
{ {
const ceiling_t *ht = (const void *)th; const ceiling_t *ht = (const void *)th;
@ -1813,11 +1742,6 @@ static void SaveCeilingThinker(const thinker_t *th, const UINT8 type)
WRITEFIXED(save_p, ht->sourceline); WRITEFIXED(save_p, ht->sourceline);
} }
//
// SaveFloormoveThinker
//
// Saves a floormove_t thinker
//
static void SaveFloormoveThinker(const thinker_t *th, const UINT8 type) static void SaveFloormoveThinker(const thinker_t *th, const UINT8 type)
{ {
const floormove_t *ht = (const void *)th; const floormove_t *ht = (const void *)th;
@ -1834,11 +1758,6 @@ static void SaveFloormoveThinker(const thinker_t *th, const UINT8 type)
WRITEFIXED(save_p, ht->delaytimer); WRITEFIXED(save_p, ht->delaytimer);
} }
//
// SaveLightflashThinker
//
// Saves a lightflash_t thinker
//
static void SaveLightflashThinker(const thinker_t *th, const UINT8 type) static void SaveLightflashThinker(const thinker_t *th, const UINT8 type)
{ {
const lightflash_t *ht = (const void *)th; const lightflash_t *ht = (const void *)th;
@ -1848,11 +1767,6 @@ static void SaveLightflashThinker(const thinker_t *th, const UINT8 type)
WRITEINT32(save_p, ht->minlight); WRITEINT32(save_p, ht->minlight);
} }
//
// SaveStrobeThinker
//
// Saves a strobe_t thinker
//
static void SaveStrobeThinker(const thinker_t *th, const UINT8 type) static void SaveStrobeThinker(const thinker_t *th, const UINT8 type)
{ {
const strobe_t *ht = (const void *)th; const strobe_t *ht = (const void *)th;
@ -1865,11 +1779,6 @@ static void SaveStrobeThinker(const thinker_t *th, const UINT8 type)
WRITEINT32(save_p, ht->brighttime); WRITEINT32(save_p, ht->brighttime);
} }
//
// SaveGlowThinker
//
// Saves a glow_t thinker
//
static void SaveGlowThinker(const thinker_t *th, const UINT8 type) static void SaveGlowThinker(const thinker_t *th, const UINT8 type)
{ {
const glow_t *ht = (const void *)th; const glow_t *ht = (const void *)th;
@ -1880,11 +1789,7 @@ static void SaveGlowThinker(const thinker_t *th, const UINT8 type)
WRITEINT32(save_p, ht->direction); WRITEINT32(save_p, ht->direction);
WRITEINT32(save_p, ht->speed); WRITEINT32(save_p, ht->speed);
} }
//
// SaveFireflickerThinker
//
// Saves a fireflicker_t thinker
//
static inline void SaveFireflickerThinker(const thinker_t *th, const UINT8 type) static inline void SaveFireflickerThinker(const thinker_t *th, const UINT8 type)
{ {
const fireflicker_t *ht = (const void *)th; const fireflicker_t *ht = (const void *)th;
@ -1895,11 +1800,7 @@ static inline void SaveFireflickerThinker(const thinker_t *th, const UINT8 type)
WRITEINT32(save_p, ht->maxlight); WRITEINT32(save_p, ht->maxlight);
WRITEINT32(save_p, ht->minlight); WRITEINT32(save_p, ht->minlight);
} }
//
// SaveElevatorThinker
//
// Saves a elevator_t thinker
//
static void SaveElevatorThinker(const thinker_t *th, const UINT8 type) static void SaveElevatorThinker(const thinker_t *th, const UINT8 type)
{ {
const elevator_t *ht = (const void *)th; const elevator_t *ht = (const void *)th;
@ -1919,15 +1820,26 @@ static void SaveElevatorThinker(const thinker_t *th, const UINT8 type)
WRITEFIXED(save_p, ht->delaytimer); WRITEFIXED(save_p, ht->delaytimer);
WRITEFIXED(save_p, ht->floorwasheight); WRITEFIXED(save_p, ht->floorwasheight);
WRITEFIXED(save_p, ht->ceilingwasheight); WRITEFIXED(save_p, ht->ceilingwasheight);
WRITEUINT32(save_p, SavePlayer(ht->player)); // was dummy
WRITEUINT32(save_p, SaveLine(ht->sourceline)); WRITEUINT32(save_p, SaveLine(ht->sourceline));
} }
// static void SaveCrumbleThinker(const thinker_t *th, const UINT8 type)
// SaveScrollThinker {
// const crumble_t *ht = (const void *)th;
// Saves a scroll_t thinker WRITEUINT8(save_p, 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);
WRITEINT32(save_p, ht->origalpha);
WRITEINT32(save_p, ht->timer);
WRITEFIXED(save_p, ht->speed);
WRITEFIXED(save_p, ht->floorwasheight);
WRITEFIXED(save_p, ht->ceilingwasheight);
WRITEUINT8(save_p, ht->flags);
}
static inline void SaveScrollThinker(const thinker_t *th, const UINT8 type) static inline void SaveScrollThinker(const thinker_t *th, const UINT8 type)
{ {
const scroll_t *ht = (const void *)th; const scroll_t *ht = (const void *)th;
@ -1944,11 +1856,6 @@ static inline void SaveScrollThinker(const thinker_t *th, const UINT8 type)
WRITEUINT8(save_p, ht->type); WRITEUINT8(save_p, ht->type);
} }
//
// SaveFrictionThinker
//
// Saves a friction_t thinker
//
static inline void SaveFrictionThinker(const thinker_t *th, const UINT8 type) static inline void SaveFrictionThinker(const thinker_t *th, const UINT8 type)
{ {
const friction_t *ht = (const void *)th; const friction_t *ht = (const void *)th;
@ -1960,11 +1867,6 @@ static inline void SaveFrictionThinker(const thinker_t *th, const UINT8 type)
WRITEUINT8(save_p, ht->roverfriction); WRITEUINT8(save_p, ht->roverfriction);
} }
//
// SavePusherThinker
//
// Saves a pusher_t thinker
//
static inline void SavePusherThinker(const thinker_t *th, const UINT8 type) static inline void SavePusherThinker(const thinker_t *th, const UINT8 type)
{ {
const pusher_t *ht = (const void *)th; const pusher_t *ht = (const void *)th;
@ -1984,11 +1886,6 @@ static inline void SavePusherThinker(const thinker_t *th, const UINT8 type)
WRITEINT32(save_p, ht->slider); WRITEINT32(save_p, ht->slider);
} }
//
// SaveLaserThinker
//
// Saves a laserthink_t thinker
//
static void SaveLaserThinker(const thinker_t *th, const UINT8 type) static void SaveLaserThinker(const thinker_t *th, const UINT8 type)
{ {
const laserthink_t *ht = (const void *)th; const laserthink_t *ht = (const void *)th;
@ -1998,11 +1895,6 @@ static void SaveLaserThinker(const thinker_t *th, const UINT8 type)
WRITEUINT32(save_p, SaveLine(ht->sourceline)); WRITEUINT32(save_p, SaveLine(ht->sourceline));
} }
//
// SaveLightlevelThinker
//
// Saves a lightlevel_t thinker
//
static void SaveLightlevelThinker(const thinker_t *th, const UINT8 type) static void SaveLightlevelThinker(const thinker_t *th, const UINT8 type)
{ {
const lightlevel_t *ht = (const void *)th; const lightlevel_t *ht = (const void *)th;
@ -2015,11 +1907,6 @@ static void SaveLightlevelThinker(const thinker_t *th, const UINT8 type)
WRITEINT32(save_p, ht->timer); WRITEINT32(save_p, ht->timer);
} }
//
// SaveExecutorThinker
//
// Saves a executor_t thinker
//
static void SaveExecutorThinker(const thinker_t *th, const UINT8 type) static void SaveExecutorThinker(const thinker_t *th, const UINT8 type)
{ {
const executor_t *ht = (const void *)th; const executor_t *ht = (const void *)th;
@ -2030,11 +1917,6 @@ static void SaveExecutorThinker(const thinker_t *th, const UINT8 type)
WRITEINT32(save_p, ht->timer); WRITEINT32(save_p, ht->timer);
} }
//
// SaveDisappearThinker
//
// Saves a disappear_t thinker
//
static void SaveDisappearThinker(const thinker_t *th, const UINT8 type) static void SaveDisappearThinker(const thinker_t *th, const UINT8 type)
{ {
const disappear_t *ht = (const void *)th; const disappear_t *ht = (const void *)th;
@ -2048,11 +1930,6 @@ static void SaveDisappearThinker(const thinker_t *th, const UINT8 type)
WRITEINT32(save_p, ht->exists); WRITEINT32(save_p, ht->exists);
} }
//
// SaveFadeThinker
//
// Saves a fade_t thinker
//
static void SaveFadeThinker(const thinker_t *th, const UINT8 type) static void SaveFadeThinker(const thinker_t *th, const UINT8 type)
{ {
const fade_t *ht = (const void *)th; const fade_t *ht = (const void *)th;
@ -2076,11 +1953,6 @@ static void SaveFadeThinker(const thinker_t *th, const UINT8 type)
WRITEUINT8(save_p, ht->exactalpha); WRITEUINT8(save_p, ht->exactalpha);
} }
//
// SaveFadeColormapThinker
//
// Saves a fadecolormap_t thinker
//
static void SaveFadeColormapThinker(const thinker_t *th, const UINT8 type) static void SaveFadeColormapThinker(const thinker_t *th, const UINT8 type)
{ {
const fadecolormap_t *ht = (const void *)th; const fadecolormap_t *ht = (const void *)th;
@ -2093,11 +1965,6 @@ static void SaveFadeColormapThinker(const thinker_t *th, const UINT8 type)
WRITEINT32(save_p, ht->timer); WRITEINT32(save_p, ht->timer);
} }
//
// SavePlaneDisplaceThinker
//
// Saves a planedisplace_t thinker
//
static void SavePlaneDisplaceThinker(const thinker_t *th, const UINT8 type) static void SavePlaneDisplaceThinker(const thinker_t *th, const UINT8 type)
{ {
const planedisplace_t *ht = (const void *)th; const planedisplace_t *ht = (const void *)th;
@ -2109,7 +1976,6 @@ static void SavePlaneDisplaceThinker(const thinker_t *th, const UINT8 type)
WRITEUINT8(save_p, ht->type); WRITEUINT8(save_p, ht->type);
} }
/// Save a dynamic slope thinker.
static inline void SaveDynamicSlopeThinker(const thinker_t *th, const UINT8 type) static inline void SaveDynamicSlopeThinker(const thinker_t *th, const UINT8 type)
{ {
const dynplanethink_t* ht = (const void*)th; const dynplanethink_t* ht = (const void*)th;
@ -2125,12 +1991,6 @@ static inline void SaveDynamicSlopeThinker(const thinker_t *th, const UINT8 type
} }
#ifdef POLYOBJECTS #ifdef POLYOBJECTS
//
// SavePolyrotateThinker
//
// Saves a polyrotate_t thinker
//
static inline void SavePolyrotatetThinker(const thinker_t *th, const UINT8 type) static inline void SavePolyrotatetThinker(const thinker_t *th, const UINT8 type)
{ {
const polyrotate_t *ht = (const void *)th; const polyrotate_t *ht = (const void *)th;
@ -2140,11 +2000,6 @@ static inline void SavePolyrotatetThinker(const thinker_t *th, const UINT8 type)
WRITEINT32(save_p, ht->distance); WRITEINT32(save_p, ht->distance);
} }
//
// SavePolymoveThinker
//
// Saves a polymovet_t thinker
//
static void SavePolymoveThinker(const thinker_t *th, const UINT8 type) static void SavePolymoveThinker(const thinker_t *th, const UINT8 type)
{ {
const polymove_t *ht = (const void *)th; const polymove_t *ht = (const void *)th;
@ -2157,11 +2012,6 @@ static void SavePolymoveThinker(const thinker_t *th, const UINT8 type)
WRITEANGLE(save_p, ht->angle); WRITEANGLE(save_p, ht->angle);
} }
//
// SavePolywaypointThinker
//
// Saves a polywaypoint_t thinker
//
static void SavePolywaypointThinker(const thinker_t *th, UINT8 type) static void SavePolywaypointThinker(const thinker_t *th, UINT8 type)
{ {
const polywaypoint_t *ht = (const void *)th; const polywaypoint_t *ht = (const void *)th;
@ -2181,11 +2031,6 @@ static void SavePolywaypointThinker(const thinker_t *th, UINT8 type)
WRITEUINT32(save_p, SaveMobjnum(ht->target)); WRITEUINT32(save_p, SaveMobjnum(ht->target));
} }
//
// SavePolyslidedoorThinker
//
// Saves a polyslidedoor_t thinker
//
static void SavePolyslidedoorThinker(const thinker_t *th, const UINT8 type) static void SavePolyslidedoorThinker(const thinker_t *th, const UINT8 type)
{ {
const polyslidedoor_t *ht = (const void *)th; const polyslidedoor_t *ht = (const void *)th;
@ -2205,11 +2050,6 @@ static void SavePolyslidedoorThinker(const thinker_t *th, const UINT8 type)
WRITEUINT8(save_p, ht->closing); WRITEUINT8(save_p, ht->closing);
} }
//
// SavePolyswingdoorThinker
//
// Saves a polyswingdoor_t thinker
//
static void SavePolyswingdoorThinker(const thinker_t *th, const UINT8 type) static void SavePolyswingdoorThinker(const thinker_t *th, const UINT8 type)
{ {
const polyswingdoor_t *ht = (const void *)th; const polyswingdoor_t *ht = (const void *)th;
@ -2259,25 +2099,8 @@ static void SavePolyfadeThinker(const thinker_t *th, const UINT8 type)
WRITEINT32(save_p, ht->duration); WRITEINT32(save_p, ht->duration);
WRITEINT32(save_p, ht->timer); WRITEINT32(save_p, ht->timer);
} }
#endif #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) static void P_NetArchiveThinkers(void)
{ {
const thinker_t *th; const thinker_t *th;
@ -2395,7 +2218,7 @@ static void P_NetArchiveThinkers(void)
} }
else if (th->function.acp1 == (actionf_p1)T_StartCrumble) else if (th->function.acp1 == (actionf_p1)T_StartCrumble)
{ {
SaveElevatorThinker(th, tc_startcrumble); SaveCrumbleThinker(th, tc_startcrumble);
continue; continue;
} }
else if (th->function.acp1 == (actionf_p1)T_MarioBlock) else if (th->function.acp1 == (actionf_p1)T_MarioBlock)
@ -2577,11 +2400,6 @@ static inline pslope_t *LoadSlope(UINT32 slopeid)
return NULL; return NULL;
} }
//
// LoadMobjThinker
//
// Loads a mobj_t from a save game
//
static thinker_t* LoadMobjThinker(actionf_p1 thinker) static thinker_t* LoadMobjThinker(actionf_p1 thinker)
{ {
thinker_t *next; thinker_t *next;
@ -2840,10 +2658,6 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
return &mobj->thinker; return &mobj->thinker;
} }
// LoadNoEnemiesThinker
//
// Loads a noenemies_t from a save game
//
static thinker_t* LoadNoEnemiesThinker(actionf_p1 thinker) static thinker_t* LoadNoEnemiesThinker(actionf_p1 thinker)
{ {
noenemies_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); noenemies_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -2852,10 +2666,6 @@ static thinker_t* LoadNoEnemiesThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
// LoadBounceCheeseThinker
//
// Loads a bouncecheese_t from a save game
//
static thinker_t* LoadBounceCheeseThinker(actionf_p1 thinker) static thinker_t* LoadBounceCheeseThinker(actionf_p1 thinker)
{ {
bouncecheese_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); bouncecheese_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -2874,10 +2684,6 @@ static thinker_t* LoadBounceCheeseThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
// LoadContinuousFallThinker
//
// Loads a continuousfall_t from a save game
//
static thinker_t* LoadContinuousFallThinker(actionf_p1 thinker) static thinker_t* LoadContinuousFallThinker(actionf_p1 thinker)
{ {
continuousfall_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); continuousfall_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -2898,10 +2704,6 @@ static thinker_t* LoadContinuousFallThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
// LoadMarioBlockThinker
//
// Loads a mariothink_t from a save game
//
static thinker_t* LoadMarioBlockThinker(actionf_p1 thinker) static thinker_t* LoadMarioBlockThinker(actionf_p1 thinker)
{ {
mariothink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); mariothink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -2922,10 +2724,6 @@ static thinker_t* LoadMarioBlockThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
// LoadMarioCheckThinker
//
// Loads a mariocheck_t from a save game
//
static thinker_t* LoadMarioCheckThinker(actionf_p1 thinker) static thinker_t* LoadMarioCheckThinker(actionf_p1 thinker)
{ {
mariocheck_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); mariocheck_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -2935,10 +2733,6 @@ static thinker_t* LoadMarioCheckThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
// LoadThwompThinker
//
// Loads a thwomp_t from a save game
//
static thinker_t* LoadThwompThinker(actionf_p1 thinker) static thinker_t* LoadThwompThinker(actionf_p1 thinker)
{ {
thwomp_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); thwomp_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -2963,10 +2757,6 @@ static thinker_t* LoadThwompThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
// LoadFloatThinker
//
// Loads a floatthink_t from a save game
//
static thinker_t* LoadFloatThinker(actionf_p1 thinker) static thinker_t* LoadFloatThinker(actionf_p1 thinker)
{ {
floatthink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); floatthink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -2977,10 +2767,6 @@ static thinker_t* LoadFloatThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
// LoadEachTimeThinker
//
// Loads a eachtime_t from a save game
//
static thinker_t* LoadEachTimeThinker(actionf_p1 thinker) static thinker_t* LoadEachTimeThinker(actionf_p1 thinker)
{ {
size_t i; size_t i;
@ -2996,10 +2782,6 @@ static thinker_t* LoadEachTimeThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
// LoadRaiseThinker
//
// Loads a raise_t from a save game
//
static thinker_t* LoadRaiseThinker(actionf_p1 thinker) static thinker_t* LoadRaiseThinker(actionf_p1 thinker)
{ {
raise_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); raise_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3015,11 +2797,6 @@ static thinker_t* LoadRaiseThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadCeilingThinker
//
// Loads a ceiling_t from a save game
//
static thinker_t* LoadCeilingThinker(actionf_p1 thinker) static thinker_t* LoadCeilingThinker(actionf_p1 thinker)
{ {
ceiling_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ceiling_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3044,11 +2821,6 @@ static thinker_t* LoadCeilingThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadFloormoveThinker
//
// Loads a floormove_t from a save game
//
static thinker_t* LoadFloormoveThinker(actionf_p1 thinker) static thinker_t* LoadFloormoveThinker(actionf_p1 thinker)
{ {
floormove_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); floormove_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3068,11 +2840,6 @@ static thinker_t* LoadFloormoveThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadLightflashThinker
//
// Loads a lightflash_t from a save game
//
static thinker_t* LoadLightflashThinker(actionf_p1 thinker) static thinker_t* LoadLightflashThinker(actionf_p1 thinker)
{ {
lightflash_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); lightflash_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3085,11 +2852,6 @@ static thinker_t* LoadLightflashThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadStrobeThinker
//
// Loads a strobe_t from a save game
//
static thinker_t* LoadStrobeThinker(actionf_p1 thinker) static thinker_t* LoadStrobeThinker(actionf_p1 thinker)
{ {
strobe_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); strobe_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3105,11 +2867,6 @@ static thinker_t* LoadStrobeThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadGlowThinker
//
// Loads a glow_t from a save game
//
static thinker_t* LoadGlowThinker(actionf_p1 thinker) static thinker_t* LoadGlowThinker(actionf_p1 thinker)
{ {
glow_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); glow_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3123,11 +2880,7 @@ static thinker_t* LoadGlowThinker(actionf_p1 thinker)
ht->sector->lightingdata = ht; ht->sector->lightingdata = ht;
return &ht->thinker; return &ht->thinker;
} }
//
// LoadFireflickerThinker
//
// Loads a fireflicker_t from a save game
//
static thinker_t* LoadFireflickerThinker(actionf_p1 thinker) static thinker_t* LoadFireflickerThinker(actionf_p1 thinker)
{ {
fireflicker_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); fireflicker_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3141,12 +2894,8 @@ static thinker_t* LoadFireflickerThinker(actionf_p1 thinker)
ht->sector->lightingdata = ht; ht->sector->lightingdata = ht;
return &ht->thinker; return &ht->thinker;
} }
//
// LoadElevatorThinker static thinker_t* LoadElevatorThinker(actionf_p1 thinker, boolean setplanedata)
//
// Loads a elevator_t from a save game
//
static thinker_t* LoadElevatorThinker(actionf_p1 thinker, UINT8 floorOrCeiling)
{ {
elevator_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); elevator_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
ht->thinker.function.acp1 = thinker; ht->thinker.function.acp1 = thinker;
@ -3165,25 +2914,39 @@ static thinker_t* LoadElevatorThinker(actionf_p1 thinker, UINT8 floorOrCeiling)
ht->delaytimer = READFIXED(save_p); ht->delaytimer = READFIXED(save_p);
ht->floorwasheight = READFIXED(save_p); ht->floorwasheight = READFIXED(save_p);
ht->ceilingwasheight = READFIXED(save_p); ht->ceilingwasheight = READFIXED(save_p);
ht->player = LoadPlayer(READUINT32(save_p)); // was dummy
ht->sourceline = LoadLine(READUINT32(save_p)); ht->sourceline = LoadLine(READUINT32(save_p));
if (ht->sector) if (ht->sector && setplanedata)
{ {
if (floorOrCeiling & 2) ht->sector->ceilingdata = ht;
ht->sector->ceilingdata = ht; ht->sector->floordata = ht;
if (floorOrCeiling & 1)
ht->sector->floordata = ht;
} }
return &ht->thinker; return &ht->thinker;
} }
// static thinker_t* LoadCrumbleThinker(actionf_p1 thinker)
// LoadScrollThinker {
// crumble_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
// Loads a scroll_t from a save game ht->thinker.function.acp1 = thinker;
// 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->origalpha = READINT32(save_p);
ht->timer = READINT32(save_p);
ht->speed = READFIXED(save_p);
ht->floorwasheight = READFIXED(save_p);
ht->ceilingwasheight = READFIXED(save_p);
ht->flags = READUINT8(save_p);
if (ht->sector)
ht->sector->floordata = ht;
return &ht->thinker;
}
static thinker_t* LoadScrollThinker(actionf_p1 thinker) static thinker_t* LoadScrollThinker(actionf_p1 thinker)
{ {
scroll_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); scroll_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3201,11 +2964,6 @@ static thinker_t* LoadScrollThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadFrictionThinker
//
// Loads a friction_t from a save game
//
static inline thinker_t* LoadFrictionThinker(actionf_p1 thinker) static inline thinker_t* LoadFrictionThinker(actionf_p1 thinker)
{ {
friction_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); friction_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3218,11 +2976,6 @@ static inline thinker_t* LoadFrictionThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadPusherThinker
//
// Loads a pusher_t from a save game
//
static thinker_t* LoadPusherThinker(actionf_p1 thinker) static thinker_t* LoadPusherThinker(actionf_p1 thinker)
{ {
pusher_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); pusher_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3244,11 +2997,6 @@ static thinker_t* LoadPusherThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadLaserThinker
//
// Loads a laserthink_t from a save game
//
static inline thinker_t* LoadLaserThinker(actionf_p1 thinker) static inline thinker_t* LoadLaserThinker(actionf_p1 thinker)
{ {
laserthink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); laserthink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3264,11 +3012,6 @@ static inline thinker_t* LoadLaserThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadLightlevelThinker
//
// Loads a lightlevel_t from a save game
//
static inline thinker_t* LoadLightlevelThinker(actionf_p1 thinker) static inline thinker_t* LoadLightlevelThinker(actionf_p1 thinker)
{ {
lightlevel_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); lightlevel_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3284,11 +3027,6 @@ static inline thinker_t* LoadLightlevelThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadExecutorThinker
//
// Loads a executor_t from a save game
//
static inline thinker_t* LoadExecutorThinker(actionf_p1 thinker) static inline thinker_t* LoadExecutorThinker(actionf_p1 thinker)
{ {
executor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); executor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3300,11 +3038,6 @@ static inline thinker_t* LoadExecutorThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadDisappearThinker
//
// Loads a disappear_t thinker
//
static inline thinker_t* LoadDisappearThinker(actionf_p1 thinker) static inline thinker_t* LoadDisappearThinker(actionf_p1 thinker)
{ {
disappear_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); disappear_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3319,11 +3052,6 @@ static inline thinker_t* LoadDisappearThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadFadeThinker
//
// Loads a fade_t thinker
//
static inline thinker_t* LoadFadeThinker(actionf_p1 thinker) static inline thinker_t* LoadFadeThinker(actionf_p1 thinker)
{ {
sector_t *ss; sector_t *ss;
@ -3366,10 +3094,6 @@ static inline thinker_t* LoadFadeThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
// LoadFadeColormapThinker
//
// Loads a fadecolormap_t from a save game
//
static inline thinker_t* LoadFadeColormapThinker(actionf_p1 thinker) static inline thinker_t* LoadFadeColormapThinker(actionf_p1 thinker)
{ {
fadecolormap_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); fadecolormap_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3385,11 +3109,6 @@ static inline thinker_t* LoadFadeColormapThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadPlaneDisplaceThinker
//
// Loads a planedisplace_t thinker
//
static inline thinker_t* LoadPlaneDisplaceThinker(actionf_p1 thinker) static inline thinker_t* LoadPlaneDisplaceThinker(actionf_p1 thinker)
{ {
planedisplace_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); planedisplace_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3403,7 +3122,6 @@ static inline thinker_t* LoadPlaneDisplaceThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
/// Save a dynamic slope thinker.
static inline thinker_t* LoadDynamicSlopeThinker(actionf_p1 thinker) static inline thinker_t* LoadDynamicSlopeThinker(actionf_p1 thinker)
{ {
dynplanethink_t* ht = Z_Malloc(sizeof(*ht), PU_LEVSPEC, NULL); dynplanethink_t* ht = Z_Malloc(sizeof(*ht), PU_LEVSPEC, NULL);
@ -3419,12 +3137,6 @@ static inline thinker_t* LoadDynamicSlopeThinker(actionf_p1 thinker)
} }
#ifdef POLYOBJECTS #ifdef POLYOBJECTS
//
// LoadPolyrotateThinker
//
// Loads a polyrotate_t thinker
//
static inline thinker_t* LoadPolyrotatetThinker(actionf_p1 thinker) static inline thinker_t* LoadPolyrotatetThinker(actionf_p1 thinker)
{ {
polyrotate_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); polyrotate_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3435,11 +3147,6 @@ static inline thinker_t* LoadPolyrotatetThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadPolymoveThinker
//
// Loads a polymovet_t thinker
//
static thinker_t* LoadPolymoveThinker(actionf_p1 thinker) static thinker_t* LoadPolymoveThinker(actionf_p1 thinker)
{ {
polymove_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); polymove_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3453,11 +3160,6 @@ static thinker_t* LoadPolymoveThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadPolywaypointThinker
//
// Loads a polywaypoint_t thinker
//
static inline thinker_t* LoadPolywaypointThinker(actionf_p1 thinker) static inline thinker_t* LoadPolywaypointThinker(actionf_p1 thinker)
{ {
polywaypoint_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); polywaypoint_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3478,11 +3180,6 @@ static inline thinker_t* LoadPolywaypointThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadPolyslidedoorThinker
//
// loads a polyslidedoor_t thinker
//
static inline thinker_t* LoadPolyslidedoorThinker(actionf_p1 thinker) static inline thinker_t* LoadPolyslidedoorThinker(actionf_p1 thinker)
{ {
polyslidedoor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); polyslidedoor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3503,11 +3200,6 @@ static inline thinker_t* LoadPolyslidedoorThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadPolyswingdoorThinker
//
// Loads a polyswingdoor_t thinker
//
static inline thinker_t* LoadPolyswingdoorThinker(actionf_p1 thinker) static inline thinker_t* LoadPolyswingdoorThinker(actionf_p1 thinker)
{ {
polyswingdoor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); polyswingdoor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3523,11 +3215,6 @@ static inline thinker_t* LoadPolyswingdoorThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadPolydisplaceThinker
//
// Loads a polydisplace_t thinker
//
static inline thinker_t* LoadPolydisplaceThinker(actionf_p1 thinker) static inline thinker_t* LoadPolydisplaceThinker(actionf_p1 thinker)
{ {
polydisplace_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); polydisplace_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3552,11 +3239,6 @@ static inline thinker_t* LoadPolyrotdisplaceThinker(actionf_p1 thinker)
return &ht->thinker; return &ht->thinker;
} }
//
// LoadPolyfadeThinker
//
// Loads a polyfadet_t thinker
//
static thinker_t* LoadPolyfadeThinker(actionf_p1 thinker) static thinker_t* LoadPolyfadeThinker(actionf_p1 thinker)
{ {
polyfade_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); polyfade_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
@ -3573,22 +3255,6 @@ static thinker_t* LoadPolyfadeThinker(actionf_p1 thinker)
} }
#endif #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) static void P_NetUnArchiveThinkers(void)
{ {
thinker_t *currentthinker; thinker_t *currentthinker;
@ -3673,7 +3339,7 @@ static void P_NetUnArchiveThinkers(void)
break; break;
case tc_elevator: case tc_elevator:
th = LoadElevatorThinker((actionf_p1)T_MoveElevator, 3); th = LoadElevatorThinker((actionf_p1)T_MoveElevator, true);
break; break;
case tc_continuousfalling: case tc_continuousfalling:
@ -3696,10 +3362,8 @@ static void P_NetUnArchiveThinkers(void)
th = LoadRaiseThinker((actionf_p1)T_RaiseSector); th = LoadRaiseThinker((actionf_p1)T_RaiseSector);
break; break;
/// \todo rewrite all the code that uses an elevator_t but isn't an elevator
/// \note working on it!
case tc_camerascanner: case tc_camerascanner:
th = LoadElevatorThinker((actionf_p1)T_CameraScanner, 0); th = LoadElevatorThinker((actionf_p1)T_CameraScanner, false);
break; break;
case tc_bouncecheese: case tc_bouncecheese:
@ -3707,7 +3371,7 @@ static void P_NetUnArchiveThinkers(void)
break; break;
case tc_startcrumble: case tc_startcrumble:
th = LoadElevatorThinker((actionf_p1)T_StartCrumble, 1); th = LoadCrumbleThinker((actionf_p1)T_StartCrumble);
break; break;
case tc_marioblock: case tc_marioblock:
@ -3939,9 +3603,7 @@ static inline void P_UnArchivePolyObjects(void)
P_UnArchivePolyObj(&PolyObjects[i]); P_UnArchivePolyObj(&PolyObjects[i]);
} }
#endif #endif
//
// P_FinishMobjs
//
static inline void P_FinishMobjs(void) static inline void P_FinishMobjs(void)
{ {
thinker_t *currentthinker; thinker_t *currentthinker;
@ -4050,9 +3712,6 @@ static void P_RelinkPointers(void)
} }
} }
//
// P_NetArchiveSpecials
//
static inline void P_NetArchiveSpecials(void) static inline void P_NetArchiveSpecials(void)
{ {
size_t i, z; size_t i, z;
@ -4093,9 +3752,6 @@ static inline void P_NetArchiveSpecials(void)
WRITEUINT8(save_p, 0x00); WRITEUINT8(save_p, 0x00);
} }
//
// P_NetUnArchiveSpecials
//
static void P_NetUnArchiveSpecials(void) static void P_NetUnArchiveSpecials(void)
{ {
size_t i; size_t i;

View file

@ -6185,6 +6185,8 @@ static inline void P_AddCameraScanner(sector_t *sourcesec, sector_t *actionsecto
{ {
elevator_t *elevator; // Why not? LOL 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 // create and initialize new elevator thinker
elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL); elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL);
P_AddThinker(THINK_MAIN, &elevator->thinker); P_AddThinker(THINK_MAIN, &elevator->thinker);

View file

@ -308,10 +308,32 @@ typedef struct
fixed_t delaytimer; fixed_t delaytimer;
fixed_t floorwasheight; // Height the floor WAS at fixed_t floorwasheight; // Height the floor WAS at
fixed_t ceilingwasheight; // Height the ceiling WAS at fixed_t ceilingwasheight; // Height the ceiling WAS at
player_t *player; // Player who initiated the thinker (used for airbob)
line_t *sourceline; line_t *sourceline;
} elevator_t; } 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;
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;
INT32 origalpha;
INT32 timer;
fixed_t speed;
fixed_t floorwasheight; // Height the floor WAS at
fixed_t ceilingwasheight; // Height the ceiling WAS at
UINT8 flags;
} crumble_t;
typedef struct typedef struct
{ {
thinker_t thinker; thinker_t thinker;
@ -441,7 +463,7 @@ void T_MoveFloor(floormove_t *movefloor);
void T_MoveElevator(elevator_t *elevator); void T_MoveElevator(elevator_t *elevator);
void T_ContinuousFalling(continuousfall_t *faller); void T_ContinuousFalling(continuousfall_t *faller);
void T_BounceCheese(bouncecheese_t *bouncer); 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_MarioBlock(mariothink_t *block);
void T_FloatSector(floatthink_t *floater); void T_FloatSector(floatthink_t *floater);
void T_MarioBlockChecker(mariocheck_t *block); void T_MarioBlockChecker(mariocheck_t *block);