* Smiles hardcode!

* Add a default behaviour to followmobj (just basic A_CapeChase).
* Allow for modifying which character starting a new SP game should start you on, relative to the first valid character. (SOC's "startchar" variable)
* Make MF2_SHADOW transferrable via linkdraw.
* Modify P_GetSkinSprite2's recursion limiter to have zero chance of ever infinitely looping.
This commit is contained in:
toasterbabe 2017-10-03 18:18:18 +01:00
parent 9fa00533b2
commit 40ef1335a1
7 changed files with 321 additions and 10 deletions

View File

@ -2831,6 +2831,11 @@ static void readmaincfg(MYFILE *f)
bootmap = (INT16)value;
//titlechanged = true;
}
else if (fastcmp(word, "STARTCHAR"))
{
startchar = (INT16)value;
char_on = -1;
}
else
deh_warning("Maincfg: unknown word '%s'", word);
}
@ -3527,6 +3532,20 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_PLAY_NIGHTS_FLYC",
"S_PLAY_NIGHTS_DRILLC",
// c:
"S_TAILSOVERLAY_STAND",
"S_TAILSOVERLAY_0DEGREES",
"S_TAILSOVERLAY_PLUS30DEGREES",
"S_TAILSOVERLAY_PLUS60DEGREES",
"S_TAILSOVERLAY_MINUS30DEGREES",
"S_TAILSOVERLAY_MINUS60DEGREES",
"S_TAILSOVERLAY_RUN",
"S_TAILSOVERLAY_FLY",
"S_TAILSOVERLAY_TIRE",
"S_TAILSOVERLAY_PAIN",
"S_TAILSOVERLAY_GASP",
"S_TAILSOVERLAY_EDGE",
// Blue Crawla
"S_POSS_STND",
"S_POSS_RUN1",
@ -5881,6 +5900,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_THOK", // Thok! mobj
"MT_PLAYER",
"MT_TAILSOVERLAY", // c:
// Enemies
"MT_BLUECRAWLA",

View File

@ -479,6 +479,19 @@ char spr2names[NUMPLAYERSPRITES][5] =
"DRLB",
"DRLC",
"TAL0",
"TAL1",
"TAL2",
"TAL3",
"TAL4",
"TAL5",
"TAL6",
"TAL7",
"TAL8",
"TAL9",
"TALA",
"TALB",
"SIGN",
"LIFE"
};
@ -562,8 +575,21 @@ playersprite_t spr2defaults[NUMPLAYERSPRITES] = {
SPR2_NGTB, // SPR2_DRLB,
SPR2_NGTC, // SPR2_DRLC,
0, // SPR2_TAL0,
SPR2_TAL0, // SPR2_TAL1,
SPR2_TAL1, // SPR2_TAL2,
SPR2_TAL2, // SPR2_TAL3,
SPR2_TAL1, // SPR2_TAL4,
SPR2_TAL4, // SPR2_TAL5,
SPR2_TAL0, // SPR2_TAL6,
SPR2_TAL3, // SPR2_TAL7,
SPR2_TAL7, // SPR2_TAL8,
SPR2_TAL0, // SPR2_TAL9,
SPR2_TAL9, // SPR2_TALA,
SPR2_TAL0, // SPR2_TALB,
0, // SPR2_SIGN,
0, // SPR2_LIFE
0, // SPR2_LIFE,
};
// Doesn't work with g++, needs actionf_p1 (don't modify this comment)
@ -712,6 +738,20 @@ state_t states[NUMSTATES] =
{SPR_PLAY, SPR2_NGTC, 2, {NULL}, 0, 0, S_PLAY_NIGHTS_FLYC}, // S_PLAY_NIGHTS_FLYC
{SPR_PLAY, SPR2_DRLC, 2, {NULL}, 0, 0, S_PLAY_NIGHTS_DRILLC}, // S_PLAY_NIGHTS_DRILLC
// c:
{SPR_PLAY, SPR2_TAL0|FF_SPR2MIDSTART, 5, {NULL}, 0, 0, S_TAILSOVERLAY_STAND}, // S_TAILSOVERLAY_STAND
{SPR_PLAY, SPR2_TAL1|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_0DEGREES}, // S_TAILSOVERLAY_0DEGREES
{SPR_PLAY, SPR2_TAL2|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_PLUS30DEGREES}, // S_TAILSOVERLAY_PLUS30DEGREES
{SPR_PLAY, SPR2_TAL3|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_PLUS60DEGREES}, // S_TAILSOVERLAY_PLUS60DEGREES
{SPR_PLAY, SPR2_TAL4|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_MINUS30DEGREES}, // S_TAILSOVERLAY_MINUS30DEGREES
{SPR_PLAY, SPR2_TAL5|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_MINUS60DEGREES}, // S_TAILSOVERLAY_MINUS60DEGREES
{SPR_PLAY, SPR2_TAL6|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_RUN}, // S_TAILSOVERLAY_RUN
{SPR_PLAY, SPR2_TAL7|FF_SPR2MIDSTART, 4, {NULL}, 0, 0, S_TAILSOVERLAY_FLY}, // S_TAILSOVERLAY_FLY
{SPR_PLAY, SPR2_TAL8|FF_SPR2MIDSTART, 4, {NULL}, 0, 0, S_TAILSOVERLAY_TIRE}, // S_TAILSOVERLAY_TIRE
{SPR_PLAY, SPR2_TAL9|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_PAIN}, // S_TAILSOVERLAY_PAIN
{SPR_PLAY, SPR2_TALA|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_GASP}, // S_TAILSOVERLAY_GASP
{SPR_PLAY, SPR2_TALB , 35, {NULL}, 0, 0, S_TAILSOVERLAY_EDGE}, // S_TAILSOVERLAY_EDGE
// Blue Crawla
{SPR_POSS, 0, 5, {A_Look}, 0, 0, S_POSS_STND}, // S_POSS_STND
{SPR_POSS, 0, 3, {A_Chase}, 0, 0, S_POSS_RUN2}, // S_POSS_RUN1
@ -3235,6 +3275,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
(statenum_t)MT_NULL // raisestate
},
{ // MT_TAILSOVERLAY
-1, // doomednum
S_INVISIBLE, // spawnstate
1000, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
8, // 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
8, // speed
16*FRACUNIT, // radius
48*FRACUNIT, // height
1, // display offset
16, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags
S_NULL // raisestate
},
{ // MT_BLUECRAWLA
100, // doomednum
S_POSS_STND, // spawnstate

View File

@ -685,6 +685,20 @@ typedef enum playersprite
SPR2_DRLB,
SPR2_DRLC,
// c:
SPR2_TAL0,
SPR2_TAL1,
SPR2_TAL2,
SPR2_TAL3,
SPR2_TAL4,
SPR2_TAL5,
SPR2_TAL6,
SPR2_TAL7,
SPR2_TAL8,
SPR2_TAL9,
SPR2_TALA,
SPR2_TALB,
SPR2_SIGN, // end sign head
SPR2_LIFE, // life monitor icon
@ -830,6 +844,20 @@ typedef enum state
S_PLAY_NIGHTS_FLYC,
S_PLAY_NIGHTS_DRILLC,
// c:
S_TAILSOVERLAY_STAND,
S_TAILSOVERLAY_0DEGREES,
S_TAILSOVERLAY_PLUS30DEGREES,
S_TAILSOVERLAY_PLUS60DEGREES,
S_TAILSOVERLAY_MINUS30DEGREES,
S_TAILSOVERLAY_MINUS60DEGREES,
S_TAILSOVERLAY_RUN,
S_TAILSOVERLAY_FLY,
S_TAILSOVERLAY_TIRE,
S_TAILSOVERLAY_PAIN,
S_TAILSOVERLAY_GASP,
S_TAILSOVERLAY_EDGE,
// Blue Crawla
S_POSS_STND,
S_POSS_RUN1,
@ -3206,6 +3234,7 @@ typedef enum mobj_type
MT_THOK, // Thok! mobj
MT_PLAYER,
MT_TAILSOVERLAY, // c:
// Enemies
MT_BLUECRAWLA,

View File

@ -149,7 +149,7 @@ description_t description[32] =
{false, "???", "", "", 0, 0},
{false, "???", "", "", 0, 0}
};
static INT16 char_on = 0;
INT16 char_on = -1, startchar = 1;
static char *char_notes = NULL;
static fixed_t char_scroll = 0;
@ -6738,7 +6738,15 @@ static void M_SetupChoosePlayer(INT32 choice)
SP_PlayerDef.prevMenu = currentMenu;
M_SetupNextMenu(&SP_PlayerDef);
if (!allowed)
{
char_on = firstvalid;
if (startchar > 0 && startchar < 32)
{
INT16 workchar = startchar;
while (workchar--)
char_on = description[char_on].next;
}
}
char_scroll = 0; // finish scrolling the menu
Z_Free(char_notes);
char_notes = V_WordWrap(0, 21*8, V_ALLOWLOWERCASE, description[char_on].notes);

View File

@ -232,6 +232,7 @@ extern CV_PossibleValue_t gametype_cons_t[];
extern INT16 startmap;
extern INT32 ultimate_selectable;
extern INT16 char_on, startchar;
#define MAXSAVEGAMES 31 //note: last save game is "no save"
#define NOSAVESLOT 0 //slot where Play Without Saving appears

View File

@ -10502,15 +10502,201 @@ void P_PlayerAfterThink(player_t *player)
else
#endif
{
/*switch (player->followmobj->type)
switch (player->followmobj->type)
{
case MT_ALTVIEWMAN:
case MT_TAILSOVERLAY: // c:
{
// init...
boolean smilesonground = P_IsObjectOnGround(player->mo);
angle_t horizangle = player->drawangle;
fixed_t zoffs = 0;
fixed_t backwards = -1*FRACUNIT;
boolean doroll = (player->panim == PA_ROLL || player->panim == PA_JUMP);
angle_t rollangle;
boolean panimchange;
INT32 ticnum = 0;
statenum_t chosenstate;
if (!player->followmobj->skin)
{
player->followmobj->skin = player->mo->skin;
P_SetMobjState(player->followmobj, S_TAILSOVERLAY_STAND);
player->followmobj->movecount = -1;
}
panimchange = (player->followmobj->movecount != (INT32)player->panim);
// initial position...
if (doroll)
{
fixed_t testval, zdist;
if (player->speed < FRACUNIT)
testval = FRACUNIT;
else
{
testval = (FixedMul(player->speed, FINECOSINE((horizangle - R_PointToAngle2(0, 0, player->rmomx, player->rmomy)) >> ANGLETOFINESHIFT)));
if (testval < FRACUNIT)
testval = FRACUNIT;
}
if (smilesonground && !player->mo->reactiontime)
zdist = (player->mo->z - player->followmobj->threshold);
else
zdist = player->mo->momz;
rollangle = R_PointToAngle2(0, 0, testval, -P_MobjFlip(player->mo)*zdist);
zoffs = 3*FRACUNIT + 12*FINESINE(rollangle >> ANGLETOFINESHIFT);
backwards = -12*FINECOSINE(rollangle >> ANGLETOFINESHIFT);
}
else if (player->panim == PA_RUN)
backwards = -5*FRACUNIT;
else if (player->panim == PA_SPRING)
{
zoffs += 4*FRACUNIT;
backwards /= 2;
}
else if (player->panim == PA_PAIN)
backwards /= 16;
else if (player->mo->state-states == S_PLAY_GASP)
{
backwards /= 16;
zoffs += 12*FRACUNIT;
}
else if (player->mo->state-states == S_PLAY_EDGE)
{
backwards /= 16;
zoffs = 3*FRACUNIT;
}
else if (player->panim == PA_ABILITY2)
{
zoffs = -7*FRACUNIT;
backwards = -9*FRACUNIT;
}
else if (player->mo->sprite2 == SPR2_FLY || player->mo->sprite2 == SPR2_TIRE)
backwards = -5*FRACUNIT;
// sprite...
if (doroll)
{
statenum_t add = ((rollangle > ANGLE_180) ? 2 : 0);
if (add)
rollangle = InvAngle(rollangle);
rollangle += ANG15; // modify the thresholds to be nice clean numbers
if (rollangle > ANG60)
chosenstate = S_TAILSOVERLAY_PLUS60DEGREES + add;
else if (rollangle > ANG30)
chosenstate = S_TAILSOVERLAY_PLUS30DEGREES + add;
else
chosenstate = S_TAILSOVERLAY_0DEGREES;
}
else if (player->panim == PA_SPRING)
chosenstate = S_TAILSOVERLAY_MINUS60DEGREES;
else if (player->panim == PA_FALL || player->mo->state-states == S_PLAY_RIDE)
chosenstate = S_TAILSOVERLAY_PLUS60DEGREES;
else if (player->panim == PA_PAIN)
chosenstate = S_TAILSOVERLAY_PAIN;
else if (player->mo->state-states == S_PLAY_GASP)
chosenstate = S_TAILSOVERLAY_GASP;
else if (player->mo->state-states == S_PLAY_EDGE)
chosenstate = S_TAILSOVERLAY_EDGE;
else if (player->panim == PA_RUN)
chosenstate = S_TAILSOVERLAY_RUN;
else if (player->panim == PA_WALK)
{
if (player->speed >= FixedMul(player->runspeed/2, player->mo->scale))
chosenstate = S_TAILSOVERLAY_0DEGREES;
else
chosenstate = S_TAILSOVERLAY_MINUS30DEGREES;
}
else if (player->mo->sprite2 == SPR2_FLY)
chosenstate = S_TAILSOVERLAY_FLY;
else if (player->mo->sprite2 == SPR2_TIRE)
chosenstate = S_TAILSOVERLAY_TIRE;
else if (player->panim == PA_ABILITY2)
chosenstate = S_TAILSOVERLAY_PLUS30DEGREES;
else if (player->panim == PA_IDLE)
chosenstate = S_TAILSOVERLAY_STAND;
else
chosenstate = S_INVISIBLE;
// state...
if (panimchange)
{
player->followmobj->sprite2 = -1;
P_SetMobjState(player->followmobj, chosenstate);
}
else
{
if (player->followmobj->state != states+chosenstate)
{
if (states[chosenstate].sprite == SPR_PLAY)
player->followmobj->sprite2 = P_GetSkinSprite2(((skin_t *)player->followmobj->skin), (states[chosenstate].frame & FF_FRAMEMASK), player);
P_SetMobjState(player->followmobj, chosenstate);
}
}
if (player->fly1 != 0 && player->powers[pw_tailsfly] != 0 && !smilesonground)
P_SetMobjState(player->followmobj, chosenstate);
// animation...
if (player->panim == PA_SPRING || player->panim == PA_FALL || player->mo->state-states == S_PLAY_RIDE)
{
if (FixedDiv(abs(player->mo->momz), player->mo->scale) < 20<<FRACBITS)
ticnum = 2;
else
ticnum = 1;
}
else if (player->panim == PA_PAIN)
ticnum = 2;
else if (player->mo->state-states == S_PLAY_GASP)
player->followmobj->tics = -1;
else if (player->mo->sprite2 == SPR2_TIRE)
ticnum = 4;
else if (player->panim != PA_IDLE)
ticnum = player->mo->tics;
if (ticnum && player->followmobj->tics > ticnum)
player->followmobj->tics = ticnum;
// final handling...
player->followmobj->color = player->mo->color;
player->followmobj->threshold = player->mo->z;
player->followmobj->movecount = player->panim;
player->followmobj->angle = horizangle;
player->followmobj->scale = player->mo->scale;
P_SetScale(player->followmobj, player->mo->scale);
player->followmobj->destscale = player->mo->destscale;
player->followmobj->radius = player->mo->radius;
player->followmobj->height = player->mo->height;
zoffs = FixedMul(zoffs, player->followmobj->scale);
if (player->mo->eflags & MFE_VERTICALFLIP)
{
player->followmobj->eflags |= MFE_VERTICALFLIP;
player->followmobj->flags2 |= MF2_OBJECTFLIP;
zoffs = player->mo->height - player->followmobj->height - zoffs;
}
else
{
player->followmobj->eflags &= ~MFE_VERTICALFLIP;
player->followmobj->flags2 &= ~MF2_OBJECTFLIP;
}
P_UnsetThingPosition(player->followmobj);
player->followmobj->x = player->mo->x + P_ReturnThrustX(player->followmobj, player->followmobj->angle, FixedMul(backwards, player->followmobj->scale));
player->followmobj->y = player->mo->y + P_ReturnThrustY(player->followmobj, player->followmobj->angle, FixedMul(backwards, player->followmobj->scale));
player->followmobj->z = player->mo->z + zoffs;
P_SetThingPosition(player->followmobj);
}
break;
;
}*/
default:
var1 = 1;
var2 = 0;
A_CapeChase(player->followmobj);
break;
}
if (player->followmobj && !P_MobjWasRemoved(player->followmobj))
{
player->followmobj->flags2 = (player->followmobj->flags2 & ~(MF2_SHADOW|MF2_DONTDRAW))|(player->mo->flags2 & (MF2_SHADOW|MF2_DONTDRAW));
player->followmobj->flags2 = (player->followmobj->flags2 & ~MF2_DONTDRAW)|(player->mo->flags2 & MF2_DONTDRAW);
}
}
}

View File

@ -1385,12 +1385,12 @@ static void R_ProjectSprite(mobj_t *thing)
// specific translucency
if (!cv_translucency.value)
; // no translucency
else if (oldthing->flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility)
else if (oldthing->flags2 & MF2_SHADOW || thing->flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility)
vis->transmap = transtables + ((tr_trans80-1)<<FF_TRANSSHIFT); // because now the translucency is set through FF_TRANSMASK
else if (oldthing->frame & FF_TRANSMASK)
vis->transmap = transtables + (oldthing->frame & FF_TRANSMASK) - 0x10000;
if ((oldthing->frame & FF_FULLBRIGHT) || (oldthing->flags2 & MF2_SHADOW))
if (oldthing->frame & FF_FULLBRIGHT || oldthing->flags2 & MF2_SHADOW || thing->flags2 & MF2_SHADOW)
vis->cut |= SC_FULLBRIGHT;
if (vis->cut & SC_FULLBRIGHT
@ -2438,7 +2438,7 @@ UINT8 P_GetSkinSprite2(skin_t *skin, UINT8 spr2, player_t *player)
while (!(skin->sprites[spr2].numframes)
&& spr2 != SPR2_STND
&& ++i != 32) // recursion limiter
&& ++i < 32) // recursion limiter
{
if (spr2 & FF_SPR2SUPER)
{