Hardcoded the saloon door

This commit is contained in:
MascaraSnake 2019-06-12 21:20:14 +02:00
parent 6a46fc76b8
commit fafabaae2b
8 changed files with 176 additions and 1 deletions

View File

@ -232,7 +232,8 @@ typedef enum
// Specific level gimmicks.
CR_ZOOMTUBE,
CR_ROPEHANG,
CR_MACESPIN
CR_MACESPIN,
CR_MINECART
} carrytype_t; // pw_carry
// Player powers. (don't edit this comment)

View File

@ -2405,6 +2405,7 @@ static actionpointer_t actionpointers[] =
{{A_KillSegments}, "A_KILLSEGMENTS"},
{{A_SnapperSpawn}, "A_SNAPPERSPAWN"},
{{A_SnapperThinker}, "A_SNAPPERTHINKER"},
{{A_SaloonDoorSpawn}, "A_SALOONDOORSPAWN"},
{{NULL}, "NONE"},
// This NULL entry must be the last in the list
@ -5785,6 +5786,10 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_ARIDDUST2",
"S_ARIDDUST3",
// Saloon door
"S_SALOONDOOR",
"S_SALOONDOORTHINKER",
// Train cameo
"S_TRAINCAMEOSPAWNER_1",
"S_TRAINCAMEOSPAWNER_2",
@ -7498,6 +7503,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_DUSTDEVIL",
"MT_DUSTLAYER",
"MT_ARIDDUST",
"MT_SALOONDOOR",
"MT_SALOONDOORTHINKER",
"MT_TRAINCAMEOSPAWNER",
"MT_TRAINSEG",
"MT_TRAINDUSTSPAWNER",
@ -8500,6 +8507,7 @@ struct {
{"CR_ZOOMTUBE",CR_ZOOMTUBE},
{"CR_ROPEHANG",CR_ROPEHANG},
{"CR_MACESPIN",CR_MACESPIN},
{"CR_MINECART",CR_MINECART},
// Ring weapons (ringweapons_t)
// Useful for A_GiveWeapon

View File

@ -361,6 +361,8 @@ light_t *t_lspr[NUMSPRITES] =
&lspr[NOLIGHT], // SPR_REMT
&lspr[NOLIGHT], // SPR_TAZD
&lspr[NOLIGHT], // SPR_ADST
&lspr[NOLIGHT], // SPR_NON2
&lspr[NOLIGHT], // SPR_SALD
&lspr[NOLIGHT], // SPR_TRAE
&lspr[NOLIGHT], // SPR_TRAI
&lspr[NOLIGHT], // SPR_STEA

View File

@ -256,6 +256,8 @@ char sprnames[NUMSPRITES + 1][5] =
"REMT", // TNT proximity shell
"TAZD", // Dust devil
"ADST", // Arid dust
"NON2", // Saloon door thinker
"SALD", // Saloon door
"TRAE", // Train cameo locomotive
"TRAI", // Train cameo wagon
"STEA", // Train steam
@ -2423,6 +2425,10 @@ state_t states[NUMSTATES] =
{SPR_ADST, 3|FF_ANIMATE, 24, {NULL}, 3, 8, S_NULL}, // S_ARIDDUST2
{SPR_ADST, 6|FF_ANIMATE, 24, {NULL}, 3, 8, S_NULL}, // S_ARIDDUST3
// Saloon door
{SPR_SALD, 0|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_SALOONDOOR
{SPR_NON2, 0, -1, {A_SaloonDoorSpawn}, 0, 0, S_NULL}, // S_SALONDOORTHINKER
// Train cameo
{SPR_NULL, 0, -1, {NULL}, 0, 0, S_TRAINCAMEOSPAWNER_2}, // S_TRAINCAMEOSPAWNER_1
{SPR_NULL, 0, 14, {A_TrainCameo}, 20, 18, S_TRAINCAMEOSPAWNER_3}, // S_TRAINCAMEOSPAWNER_2
@ -11834,6 +11840,60 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate
},
{ // MT_SALOONDOOR
-1, // doomednum
S_SALOONDOOR, // spawnstate
1, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
0, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
0, // speed
48*FRACUNIT, // radius
160*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_s3k90, // activesound
MF_SOLID|MF_NOGRAVITY|MF_RUNSPAWNFUNC|MF_PAPERCOLLISION, // flags
S_NULL // raisestate
},
{ // MT_SALOONDOORTHINKER
1221, // doomednum
S_SALOONDOORTHINKER, // spawnstate
1, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
0, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
0, // speed
96*FRACUNIT, // radius
160*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_NOGRAVITY|MF_RUNSPAWNFUNC, // flags
S_NULL // raisestate
},
{ // MT_TRAINCAMEOSPAWNER
1222, // doomednum
S_TRAINCAMEOSPAWNER_1, // spawnstate

View File

@ -263,6 +263,7 @@ void A_CanarivoreGas();
void A_KillSegments();
void A_SnapperSpawn();
void A_SnapperThinker();
void A_SaloonDoorSpawn();
// ratio of states to sprites to mobj types is roughly 6 : 1 : 1
#define NUMMOBJFREESLOTS 256
@ -499,6 +500,8 @@ typedef enum sprite
SPR_REMT, // TNT proximity shell
SPR_TAZD, // Dust devil
SPR_ADST, // Arid dust
SPR_NON2, // Saloon door thinker
SPR_SALD, // Saloon door
SPR_TRAE, // Train cameo locomotive
SPR_TRAI, // Train cameo wagon
SPR_STEA, // Train steam
@ -2546,6 +2549,10 @@ typedef enum state
S_ARIDDUST2,
S_ARIDDUST3,
// Saloon door
S_SALOONDOOR,
S_SALOONDOORTHINKER,
// Train cameo
S_TRAINCAMEOSPAWNER_1,
S_TRAINCAMEOSPAWNER_2,
@ -4279,6 +4286,8 @@ typedef enum mobj_type
MT_DUSTDEVIL,
MT_DUSTLAYER,
MT_ARIDDUST,
MT_SALOONDOOR,
MT_SALOONDOORTHINKER,
MT_TRAINCAMEOSPAWNER,
MT_TRAINSEG,
MT_TRAINDUSTSPAWNER,

View File

@ -292,6 +292,7 @@ void A_CanarivoreGas(mobj_t *actor);
void A_KillSegments(mobj_t *actor);
void A_SnapperSpawn(mobj_t *actor);
void A_SnapperThinker(mobj_t *actor);
void A_SaloonDoorSpawn(mobj_t *actor);
//for p_enemy.c
//
@ -13460,4 +13461,55 @@ void A_SnapperThinker(mobj_t *actor)
}
P_SnapperLegPlace(actor);
}
// Function: A_SaloonDoorSpawn
//
// Description: Spawns a saloon door.
//
// var1 = unused
// var2 = unused
//
void A_SaloonDoorSpawn(mobj_t *actor)
{
angle_t ang = actor->angle;
angle_t fa = (ang >> ANGLETOFINESHIFT) & FINEMASK;
fixed_t c = FINECOSINE(fa);
fixed_t s = FINESINE(fa);
INT32 d = 48;
fixed_t x = actor->x;
fixed_t y = actor->y;
fixed_t z = actor->z;
mobj_t *door;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_SaloonDoorSpawn", actor))
return;
#endif
//Front
door = P_SpawnMobj(x + c*d, y + s*d, z, MT_SALOONDOOR);
door->angle = ang + ANGLE_180;
// Origin angle
door->extravalue1 = AngleFixed(door->angle);
// Angular speed
door->extravalue2 = 0;
// Origin door
door->tracer = actor;
//Back
door = P_SpawnMobj(x - c*d, y - s*d, z, MT_SALOONDOOR);
door->angle = ang;
// Origin angle
door->extravalue1 = AngleFixed(door->angle);
// Angular speed
door->extravalue2 = 0;
// Origin door
door->tracer = actor;
}

View File

@ -818,6 +818,21 @@ static boolean PIT_CheckThing(mobj_t *thing)
}
#endif
if (thing->type == MT_SALOONDOOR && tmthing->player)
{
if ((tmthing->player->powers[pw_carry] == CR_MINECART && tmthing->player->mo->tracer && !P_MobjWasRemoved(tmthing->player->mo->tracer)))
{
fixed_t dx = tmthing->momx;
fixed_t dy = tmthing->momy;
fixed_t dm = min(FixedHypot(dx, dy), 16*FRACUNIT);
angle_t ang = R_PointToAngle2(0, 0, dx, dy) - thing->angle;
fixed_t s = FINESINE((ang >> ANGLETOFINESHIFT) & FINEMASK);
S_StartSound(tmthing, thing->info->activesound);
thing->extravalue2 += FixedMul(s, dm);
return true;
}
}
if (thing->type == MT_TNTBARREL && tmthing->player)
{
if (tmthing->momz < 0)

View File

@ -8467,6 +8467,34 @@ void P_MobjThinker(mobj_t *mobj)
mobj->flags2 |= MF2_AMBUSH;
break;
}
case MT_SALOONDOOR:
{
fixed_t x = mobj->tracer->x;
fixed_t y = mobj->tracer->y;
fixed_t z = mobj->tracer->z;
angle_t oang = FixedAngle(mobj->extravalue1);
angle_t fa = (oang >> ANGLETOFINESHIFT) & FINEMASK;
fixed_t c0 = -96*FINECOSINE(fa);
fixed_t s0 = -96*FINESINE(fa);
angle_t fma;
fixed_t c, s;
// Adjust angular speed
fixed_t da = AngleFixed(mobj->angle - oang);
if (da > 180*FRACUNIT)
da -= 360*FRACUNIT;
mobj->extravalue2 = 8*(mobj->extravalue2 - da/32)/9;
// Update angle
mobj->angle += FixedAngle(mobj->extravalue2);
// Update position
fma = (mobj->angle >> ANGLETOFINESHIFT) & FINEMASK;
c = 48*FINECOSINE(fma);
s = 48*FINESINE(fma);
P_TeleportMove(mobj, x + c0 + c, y + s0 + s, z);
break;
}
case MT_SPINFIRE:
if (mobj->flags & MF_NOGRAVITY)
{