mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-22 10:52:23 +00:00
Eradicate levelspecthink_t
This commit is contained in:
parent
da594db3fc
commit
54cbd66999
4 changed files with 38 additions and 74 deletions
|
@ -1071,26 +1071,20 @@ static mobj_t *SearchMarioNode(msecnode_t *node)
|
|||
return thing;
|
||||
}
|
||||
|
||||
void T_MarioBlockChecker(levelspecthink_t *block)
|
||||
void T_MarioBlockChecker(mariocheck_t *block)
|
||||
{
|
||||
line_t *masterline = block->sourceline;
|
||||
if (block->vars[2] == 1) // Don't update the textures when the block's being bumped upwards.
|
||||
return;
|
||||
if (SearchMarioNode(block->sector->touching_thinglist))
|
||||
{
|
||||
sides[masterline->sidenum[0]].midtexture = sides[masterline->sidenum[0]].bottomtexture; // Update textures
|
||||
if (masterline->backsector)
|
||||
{
|
||||
block->sector->ceilingpic = block->sector->floorpic = masterline->backsector->ceilingpic; // Update flats to be backside's ceiling
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sides[masterline->sidenum[0]].midtexture = sides[masterline->sidenum[0]].toptexture;
|
||||
if (masterline->backsector)
|
||||
{
|
||||
block->sector->ceilingpic = block->sector->floorpic = masterline->backsector->floorpic; // Update flats to be backside's floor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1639,25 +1639,6 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
|||
WRITEUINT32(save_p, mobj->mobjnum);
|
||||
}
|
||||
|
||||
//
|
||||
// SaveSpecialLevelThinker
|
||||
//
|
||||
// Saves a levelspecthink_t thinker
|
||||
//
|
||||
static void SaveSpecialLevelThinker(const thinker_t *th, const UINT8 type)
|
||||
{
|
||||
const levelspecthink_t *ht = (const void *)th;
|
||||
size_t i;
|
||||
WRITEUINT8(save_p, type);
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
WRITEFIXED(save_p, ht->vars[i]); //var[16]
|
||||
WRITEFIXED(save_p, ht->var2s[i]); //var[16]
|
||||
}
|
||||
WRITEUINT32(save_p, SaveLine(ht->sourceline));
|
||||
WRITEUINT32(save_p, SaveSector(ht->sector));
|
||||
}
|
||||
|
||||
//
|
||||
// SaveNoEnemiesThinker
|
||||
//
|
||||
|
@ -1722,6 +1703,19 @@ 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;
|
||||
WRITEUINT8(save_p, type);
|
||||
WRITEUINT32(save_p, SaveLine(ht->sourceline));
|
||||
WRITEUINT32(save_p, SaveSector(ht->sector));
|
||||
}
|
||||
|
||||
//
|
||||
// SaveThwompThinker
|
||||
//
|
||||
|
@ -2411,7 +2405,7 @@ static void P_NetArchiveThinkers(void)
|
|||
}
|
||||
else if (th->function.acp1 == (actionf_p1)T_MarioBlockChecker)
|
||||
{
|
||||
SaveSpecialLevelThinker(th, tc_marioblockchecker);
|
||||
SaveMarioCheckThinker(th, tc_marioblockchecker);
|
||||
continue;
|
||||
}
|
||||
else if (th->function.acp1 == (actionf_p1)T_FloatSector)
|
||||
|
@ -2864,41 +2858,6 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
|
|||
return &mobj->thinker;
|
||||
}
|
||||
|
||||
//
|
||||
// LoadSpecialLevelThinker
|
||||
//
|
||||
// Loads a levelspecthink_t from a save game
|
||||
//
|
||||
// floorOrCeiling:
|
||||
// 0 - Don't set
|
||||
// 1 - Floor Only
|
||||
// 2 - Ceiling Only
|
||||
// 3 - Both
|
||||
//
|
||||
static thinker_t* LoadSpecialLevelThinker(actionf_p1 thinker, UINT8 floorOrCeiling)
|
||||
{
|
||||
levelspecthink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||
size_t i;
|
||||
ht->thinker.function.acp1 = thinker;
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
ht->vars[i] = READFIXED(save_p); //var[16]
|
||||
ht->var2s[i] = READFIXED(save_p); //var[16]
|
||||
}
|
||||
ht->sourceline = LoadLine(READUINT32(save_p));
|
||||
ht->sector = LoadSector(READUINT32(save_p));
|
||||
|
||||
if (ht->sector)
|
||||
{
|
||||
if (floorOrCeiling & 2)
|
||||
ht->sector->ceilingdata = ht;
|
||||
if (floorOrCeiling & 1)
|
||||
ht->sector->floordata = ht;
|
||||
}
|
||||
|
||||
return &ht->thinker;
|
||||
}
|
||||
|
||||
// LoadNoEnemiesThinker
|
||||
//
|
||||
// Loads a noenemies_t from a save game
|
||||
|
@ -2963,6 +2922,19 @@ 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);
|
||||
ht->thinker.function.acp1 = thinker;
|
||||
ht->sourceline = LoadLine(READUINT32(save_p));
|
||||
ht->sector = LoadSector(READUINT32(save_p));
|
||||
return &ht->thinker;
|
||||
}
|
||||
|
||||
// LoadThwompThinker
|
||||
//
|
||||
// Loads a thwomp_t from a save game
|
||||
|
@ -3736,7 +3708,7 @@ static void P_NetUnArchiveThinkers(void)
|
|||
break;
|
||||
|
||||
case tc_marioblockchecker:
|
||||
th = LoadSpecialLevelThinker((actionf_p1)T_MarioBlockChecker, 0);
|
||||
th = LoadMarioCheckThinker((actionf_p1)T_MarioBlockChecker);
|
||||
break;
|
||||
|
||||
case tc_floatsector:
|
||||
|
|
|
@ -5983,7 +5983,7 @@ static void P_AddPlaneDisplaceThinker(INT32 type, fixed_t speed, INT32 control,
|
|||
*/
|
||||
static void P_AddBlockThinker(sector_t *sec, line_t *sourceline)
|
||||
{
|
||||
levelspecthink_t *block;
|
||||
mariocheck_t *block;
|
||||
|
||||
// create and initialize new elevator thinker
|
||||
block = Z_Calloc(sizeof (*block), PU_LEVSPEC, NULL);
|
||||
|
|
18
src/p_spec.h
18
src/p_spec.h
|
@ -311,15 +311,6 @@ typedef struct
|
|||
line_t *sourceline;
|
||||
} elevator_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
thinker_t thinker;
|
||||
fixed_t vars[16]; // Misc. variables
|
||||
fixed_t var2s[16]; // Second misc variables buffer.
|
||||
line_t *sourceline; // Source line of the thinker
|
||||
sector_t *sector; // Sector the thinker is from
|
||||
} levelspecthink_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
thinker_t thinker;
|
||||
|
@ -360,6 +351,13 @@ typedef struct
|
|||
INT16 tag;
|
||||
} mariothink_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
thinker_t thinker;
|
||||
line_t *sourceline;
|
||||
sector_t *sector;
|
||||
} mariocheck_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
thinker_t thinker;
|
||||
|
@ -445,7 +443,7 @@ void T_BounceCheese(bouncecheese_t *bouncer);
|
|||
void T_StartCrumble(elevator_t *elevator);
|
||||
void T_MarioBlock(mariothink_t *block);
|
||||
void T_FloatSector(floatthink_t *floater);
|
||||
void T_MarioBlockChecker(levelspecthink_t *block);
|
||||
void T_MarioBlockChecker(mariocheck_t *block);
|
||||
void T_ThwompSector(thwomp_t *thwomp);
|
||||
void T_NoEnemiesSector(noenemies_t *nobaddies);
|
||||
void T_EachTimeThinker(eachtime_t *eachtime);
|
||||
|
|
Loading…
Reference in a new issue