Merge branch 'backport_state-animations' into 'next'

BACKPORT: FF_ANIMATE simplistic state animations

this is a lot more complex due to the need to remove the dispoffset related code as well as a lot of the redefinitions; combined with the code changes due to the sprite2 system in internal master.

~~BEFORE ACCEPTING THIS: get sryder to look at and fix any possible brokenness with OpenGL MD2s~~

See merge request !45
This commit is contained in:
Inuyasha 2016-02-29 03:04:00 -05:00
commit 372002d2ad
11 changed files with 365 additions and 1884 deletions

View file

@ -4596,30 +4596,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_MSSHIELD_F12",
// Ring
"S_RING1",
"S_RING2",
"S_RING3",
"S_RING4",
"S_RING5",
"S_RING6",
"S_RING7",
"S_RING8",
"S_RING9",
"S_RING10",
"S_RING11",
"S_RING12",
"S_RING13",
"S_RING14",
"S_RING15",
"S_RING16",
"S_RING17",
"S_RING18",
"S_RING19",
"S_RING20",
"S_RING21",
"S_RING22",
"S_RING23",
"S_RING24",
"S_RING",
// Blue Sphere for special stages
"S_BLUEBALL",
@ -4635,39 +4612,10 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_GRAVWELLRED3",
// Individual Team Rings
"S_TEAMRING1",
"S_TEAMRING2",
"S_TEAMRING3",
"S_TEAMRING4",
"S_TEAMRING5",
"S_TEAMRING6",
"S_TEAMRING7",
"S_TEAMRING8",
"S_TEAMRING9",
"S_TEAMRING10",
"S_TEAMRING11",
"S_TEAMRING12",
"S_TEAMRING13",
"S_TEAMRING14",
"S_TEAMRING15",
"S_TEAMRING16",
"S_TEAMRING17",
"S_TEAMRING18",
"S_TEAMRING19",
"S_TEAMRING20",
"S_TEAMRING21",
"S_TEAMRING22",
"S_TEAMRING23",
"S_TEAMRING24",
"S_TEAMRING",
// Special Stage Token
"S_EMMY1",
"S_EMMY2",
"S_EMMY3",
"S_EMMY4",
"S_EMMY5",
"S_EMMY6",
"S_EMMY7",
"S_EMMY",
// Special Stage Token
"S_TOKEN",
@ -4821,40 +4769,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_SPIKED2",
// Starpost
"S_STARPOST1",
"S_STARPOST2",
"S_STARPOST3",
"S_STARPOST4",
"S_STARPOST5",
"S_STARPOST6",
"S_STARPOST7",
"S_STARPOST8",
"S_STARPOST9",
"S_STARPOST10",
"S_STARPOST11",
"S_STARPOST12",
"S_STARPOST13",
"S_STARPOST14",
"S_STARPOST15",
"S_STARPOST16",
"S_STARPOST17",
"S_STARPOST18",
"S_STARPOST19",
"S_STARPOST20",
"S_STARPOST21",
"S_STARPOST22",
"S_STARPOST23",
"S_STARPOST24",
"S_STARPOST25",
"S_STARPOST26",
"S_STARPOST27",
"S_STARPOST28",
"S_STARPOST29",
"S_STARPOST30",
"S_STARPOST31",
"S_STARPOST32",
"S_STARPOST33",
"S_STARPOST34",
"S_STARPOST_IDLE",
"S_STARPOST_FLASH",
"S_STARPOST_SPIN",
// Big floating mine
"S_BIGMINE1",
@ -5462,38 +5379,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_PITY10",
// Invincibility Sparkles
"S_IVSP1",
"S_IVSP2",
"S_IVSP3",
"S_IVSP4",
"S_IVSP5",
"S_IVSP6",
"S_IVSP7",
"S_IVSP8",
"S_IVSP9",
"S_IVSP10",
"S_IVSP11",
"S_IVSP12",
"S_IVSP13",
"S_IVSP14",
"S_IVSP15",
"S_IVSP16",
"S_IVSP17",
"S_IVSP18",
"S_IVSP19",
"S_IVSP20",
"S_IVSP21",
"S_IVSP22",
"S_IVSP23",
"S_IVSP24",
"S_IVSP25",
"S_IVSP26",
"S_IVSP27",
"S_IVSP28",
"S_IVSP29",
"S_IVSP30",
"S_IVSP31",
"S_IVSP32",
"S_IVSP",
// Super Sonic Spark
"S_SSPK1",
@ -5680,283 +5566,17 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_RRNG6",
"S_RRNG7",
// Bounce Ring
"S_BOUNCERING1",
"S_BOUNCERING2",
"S_BOUNCERING3",
"S_BOUNCERING4",
"S_BOUNCERING5",
"S_BOUNCERING6",
"S_BOUNCERING7",
"S_BOUNCERING8",
"S_BOUNCERING9",
"S_BOUNCERING10",
"S_BOUNCERING11",
"S_BOUNCERING12",
"S_BOUNCERING13",
"S_BOUNCERING14",
"S_BOUNCERING15",
"S_BOUNCERING16",
"S_BOUNCERING17",
"S_BOUNCERING18",
"S_BOUNCERING19",
"S_BOUNCERING20",
"S_BOUNCERING21",
"S_BOUNCERING22",
"S_BOUNCERING23",
"S_BOUNCERING24",
"S_BOUNCERING25",
"S_BOUNCERING26",
"S_BOUNCERING27",
"S_BOUNCERING28",
"S_BOUNCERING29",
"S_BOUNCERING30",
"S_BOUNCERING31",
"S_BOUNCERING32",
"S_BOUNCERING33",
"S_BOUNCERING34",
"S_BOUNCERING35",
// Rail Ring
"S_RAILRING1",
"S_RAILRING2",
"S_RAILRING3",
"S_RAILRING4",
"S_RAILRING5",
"S_RAILRING6",
"S_RAILRING7",
"S_RAILRING8",
"S_RAILRING9",
"S_RAILRING10",
"S_RAILRING11",
"S_RAILRING12",
"S_RAILRING13",
"S_RAILRING14",
"S_RAILRING15",
"S_RAILRING16",
"S_RAILRING17",
"S_RAILRING18",
"S_RAILRING19",
"S_RAILRING20",
"S_RAILRING21",
"S_RAILRING22",
"S_RAILRING23",
"S_RAILRING24",
"S_RAILRING25",
"S_RAILRING26",
"S_RAILRING27",
"S_RAILRING28",
"S_RAILRING29",
"S_RAILRING30",
"S_RAILRING31",
"S_RAILRING32",
"S_RAILRING33",
"S_RAILRING34",
"S_RAILRING35",
// Infinity ring
"S_INFINITYRING1",
"S_INFINITYRING2",
"S_INFINITYRING3",
"S_INFINITYRING4",
"S_INFINITYRING5",
"S_INFINITYRING6",
"S_INFINITYRING7",
"S_INFINITYRING8",
"S_INFINITYRING9",
"S_INFINITYRING10",
"S_INFINITYRING11",
"S_INFINITYRING12",
"S_INFINITYRING13",
"S_INFINITYRING14",
"S_INFINITYRING15",
"S_INFINITYRING16",
"S_INFINITYRING17",
"S_INFINITYRING18",
"S_INFINITYRING19",
"S_INFINITYRING20",
"S_INFINITYRING21",
"S_INFINITYRING22",
"S_INFINITYRING23",
"S_INFINITYRING24",
"S_INFINITYRING25",
"S_INFINITYRING26",
"S_INFINITYRING27",
"S_INFINITYRING28",
"S_INFINITYRING29",
"S_INFINITYRING30",
"S_INFINITYRING31",
"S_INFINITYRING32",
"S_INFINITYRING33",
"S_INFINITYRING34",
"S_INFINITYRING35",
// Automatic Ring
"S_AUTOMATICRING1",
"S_AUTOMATICRING2",
"S_AUTOMATICRING3",
"S_AUTOMATICRING4",
"S_AUTOMATICRING5",
"S_AUTOMATICRING6",
"S_AUTOMATICRING7",
"S_AUTOMATICRING8",
"S_AUTOMATICRING9",
"S_AUTOMATICRING10",
"S_AUTOMATICRING11",
"S_AUTOMATICRING12",
"S_AUTOMATICRING13",
"S_AUTOMATICRING14",
"S_AUTOMATICRING15",
"S_AUTOMATICRING16",
"S_AUTOMATICRING17",
"S_AUTOMATICRING18",
"S_AUTOMATICRING19",
"S_AUTOMATICRING20",
"S_AUTOMATICRING21",
"S_AUTOMATICRING22",
"S_AUTOMATICRING23",
"S_AUTOMATICRING24",
"S_AUTOMATICRING25",
"S_AUTOMATICRING26",
"S_AUTOMATICRING27",
"S_AUTOMATICRING28",
"S_AUTOMATICRING29",
"S_AUTOMATICRING30",
"S_AUTOMATICRING31",
"S_AUTOMATICRING32",
"S_AUTOMATICRING33",
"S_AUTOMATICRING34",
"S_AUTOMATICRING35",
// Explosion Ring
"S_EXPLOSIONRING1",
"S_EXPLOSIONRING2",
"S_EXPLOSIONRING3",
"S_EXPLOSIONRING4",
"S_EXPLOSIONRING5",
"S_EXPLOSIONRING6",
"S_EXPLOSIONRING7",
"S_EXPLOSIONRING8",
"S_EXPLOSIONRING9",
"S_EXPLOSIONRING10",
"S_EXPLOSIONRING11",
"S_EXPLOSIONRING12",
"S_EXPLOSIONRING13",
"S_EXPLOSIONRING14",
"S_EXPLOSIONRING15",
"S_EXPLOSIONRING16",
"S_EXPLOSIONRING17",
"S_EXPLOSIONRING18",
"S_EXPLOSIONRING19",
"S_EXPLOSIONRING20",
"S_EXPLOSIONRING21",
"S_EXPLOSIONRING22",
"S_EXPLOSIONRING23",
"S_EXPLOSIONRING24",
"S_EXPLOSIONRING25",
"S_EXPLOSIONRING26",
"S_EXPLOSIONRING27",
"S_EXPLOSIONRING28",
"S_EXPLOSIONRING29",
"S_EXPLOSIONRING30",
"S_EXPLOSIONRING31",
"S_EXPLOSIONRING32",
"S_EXPLOSIONRING33",
"S_EXPLOSIONRING34",
"S_EXPLOSIONRING35",
// Scatter Ring
"S_SCATTERRING1",
"S_SCATTERRING2",
"S_SCATTERRING3",
"S_SCATTERRING4",
"S_SCATTERRING5",
"S_SCATTERRING6",
"S_SCATTERRING7",
"S_SCATTERRING8",
"S_SCATTERRING9",
"S_SCATTERRING10",
"S_SCATTERRING11",
"S_SCATTERRING12",
"S_SCATTERRING13",
"S_SCATTERRING14",
"S_SCATTERRING15",
"S_SCATTERRING16",
"S_SCATTERRING17",
"S_SCATTERRING18",
"S_SCATTERRING19",
"S_SCATTERRING20",
"S_SCATTERRING21",
"S_SCATTERRING22",
"S_SCATTERRING23",
"S_SCATTERRING24",
"S_SCATTERRING25",
"S_SCATTERRING26",
"S_SCATTERRING27",
"S_SCATTERRING28",
"S_SCATTERRING29",
"S_SCATTERRING30",
"S_SCATTERRING31",
"S_SCATTERRING32",
"S_SCATTERRING33",
"S_SCATTERRING34",
"S_SCATTERRING35",
// Grenade Ring
"S_GRENADERING1",
"S_GRENADERING2",
"S_GRENADERING3",
"S_GRENADERING4",
"S_GRENADERING5",
"S_GRENADERING6",
"S_GRENADERING7",
"S_GRENADERING8",
"S_GRENADERING9",
"S_GRENADERING10",
"S_GRENADERING11",
"S_GRENADERING12",
"S_GRENADERING13",
"S_GRENADERING14",
"S_GRENADERING15",
"S_GRENADERING16",
"S_GRENADERING17",
"S_GRENADERING18",
"S_GRENADERING19",
"S_GRENADERING20",
"S_GRENADERING21",
"S_GRENADERING22",
"S_GRENADERING23",
"S_GRENADERING24",
"S_GRENADERING25",
"S_GRENADERING26",
"S_GRENADERING27",
"S_GRENADERING28",
"S_GRENADERING29",
"S_GRENADERING30",
"S_GRENADERING31",
"S_GRENADERING32",
"S_GRENADERING33",
"S_GRENADERING34",
"S_GRENADERING35",
// Weapon Ring Ammo
"S_BOUNCERINGAMMO",
"S_RAILRINGAMMO",
"S_INFINITYRINGAMMO",
"S_AUTOMATICRINGAMMO",
"S_EXPLOSIONRINGAMMO",
"S_SCATTERRINGAMMO",
"S_GRENADERINGAMMO",
// Weapon pickup
"S_BOUNCEPICKUP1",
"S_BOUNCEPICKUP2",
"S_BOUNCEPICKUP3",
"S_BOUNCEPICKUP4",
"S_BOUNCEPICKUP5",
"S_BOUNCEPICKUP6",
"S_BOUNCEPICKUP7",
"S_BOUNCEPICKUP8",
"S_BOUNCEPICKUP9",
"S_BOUNCEPICKUP10",
"S_BOUNCEPICKUP11",
"S_BOUNCEPICKUP12",
"S_BOUNCEPICKUP13",
"S_BOUNCEPICKUP14",
"S_BOUNCEPICKUP15",
"S_BOUNCEPICKUP16",
"S_BOUNCEPICKUP",
"S_BOUNCEPICKUPFADE1",
"S_BOUNCEPICKUPFADE2",
"S_BOUNCEPICKUPFADE3",
@ -5966,23 +5586,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_BOUNCEPICKUPFADE7",
"S_BOUNCEPICKUPFADE8",
"S_RAILPICKUP1",
"S_RAILPICKUP2",
"S_RAILPICKUP3",
"S_RAILPICKUP4",
"S_RAILPICKUP5",
"S_RAILPICKUP6",
"S_RAILPICKUP7",
"S_RAILPICKUP8",
"S_RAILPICKUP9",
"S_RAILPICKUP10",
"S_RAILPICKUP11",
"S_RAILPICKUP12",
"S_RAILPICKUP13",
"S_RAILPICKUP14",
"S_RAILPICKUP15",
"S_RAILPICKUP16",
"S_RAILPICKUP",
"S_RAILPICKUPFADE1",
"S_RAILPICKUPFADE2",
"S_RAILPICKUPFADE3",
@ -5992,23 +5596,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_RAILPICKUPFADE7",
"S_RAILPICKUPFADE8",
"S_AUTOPICKUP1",
"S_AUTOPICKUP2",
"S_AUTOPICKUP3",
"S_AUTOPICKUP4",
"S_AUTOPICKUP5",
"S_AUTOPICKUP6",
"S_AUTOPICKUP7",
"S_AUTOPICKUP8",
"S_AUTOPICKUP9",
"S_AUTOPICKUP10",
"S_AUTOPICKUP11",
"S_AUTOPICKUP12",
"S_AUTOPICKUP13",
"S_AUTOPICKUP14",
"S_AUTOPICKUP15",
"S_AUTOPICKUP16",
"S_AUTOPICKUP",
"S_AUTOPICKUPFADE1",
"S_AUTOPICKUPFADE2",
"S_AUTOPICKUPFADE3",
@ -6018,23 +5606,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_AUTOPICKUPFADE7",
"S_AUTOPICKUPFADE8",
"S_EXPLODEPICKUP1",
"S_EXPLODEPICKUP2",
"S_EXPLODEPICKUP3",
"S_EXPLODEPICKUP4",
"S_EXPLODEPICKUP5",
"S_EXPLODEPICKUP6",
"S_EXPLODEPICKUP7",
"S_EXPLODEPICKUP8",
"S_EXPLODEPICKUP9",
"S_EXPLODEPICKUP10",
"S_EXPLODEPICKUP11",
"S_EXPLODEPICKUP12",
"S_EXPLODEPICKUP13",
"S_EXPLODEPICKUP14",
"S_EXPLODEPICKUP15",
"S_EXPLODEPICKUP16",
"S_EXPLODEPICKUP",
"S_EXPLODEPICKUPFADE1",
"S_EXPLODEPICKUPFADE2",
"S_EXPLODEPICKUPFADE3",
@ -6044,23 +5616,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_EXPLODEPICKUPFADE7",
"S_EXPLODEPICKUPFADE8",
"S_SCATTERPICKUP1",
"S_SCATTERPICKUP2",
"S_SCATTERPICKUP3",
"S_SCATTERPICKUP4",
"S_SCATTERPICKUP5",
"S_SCATTERPICKUP6",
"S_SCATTERPICKUP7",
"S_SCATTERPICKUP8",
"S_SCATTERPICKUP9",
"S_SCATTERPICKUP10",
"S_SCATTERPICKUP11",
"S_SCATTERPICKUP12",
"S_SCATTERPICKUP13",
"S_SCATTERPICKUP14",
"S_SCATTERPICKUP15",
"S_SCATTERPICKUP16",
"S_SCATTERPICKUP",
"S_SCATTERPICKUPFADE1",
"S_SCATTERPICKUPFADE2",
"S_SCATTERPICKUPFADE3",
@ -6070,23 +5626,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_SCATTERPICKUPFADE7",
"S_SCATTERPICKUPFADE8",
"S_GRENADEPICKUP1",
"S_GRENADEPICKUP2",
"S_GRENADEPICKUP3",
"S_GRENADEPICKUP4",
"S_GRENADEPICKUP5",
"S_GRENADEPICKUP6",
"S_GRENADEPICKUP7",
"S_GRENADEPICKUP8",
"S_GRENADEPICKUP9",
"S_GRENADEPICKUP10",
"S_GRENADEPICKUP11",
"S_GRENADEPICKUP12",
"S_GRENADEPICKUP13",
"S_GRENADEPICKUP14",
"S_GRENADEPICKUP15",
"S_GRENADEPICKUP16",
"S_GRENADEPICKUP",
"S_GRENADEPICKUPFADE1",
"S_GRENADEPICKUPFADE2",
"S_GRENADEPICKUPFADE3",
@ -6467,101 +6007,22 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_ROCKSPAWN",
"S_ROCKCRUMBLEA1",
"S_ROCKCRUMBLEA2",
"S_ROCKCRUMBLEA3",
"S_ROCKCRUMBLEA4",
"S_ROCKCRUMBLEA5",
"S_ROCKCRUMBLEB1",
"S_ROCKCRUMBLEB2",
"S_ROCKCRUMBLEB3",
"S_ROCKCRUMBLEB4",
"S_ROCKCRUMBLEB5",
"S_ROCKCRUMBLEC1",
"S_ROCKCRUMBLEC2",
"S_ROCKCRUMBLEC3",
"S_ROCKCRUMBLEC4",
"S_ROCKCRUMBLEC5",
"S_ROCKCRUMBLED1",
"S_ROCKCRUMBLED2",
"S_ROCKCRUMBLED3",
"S_ROCKCRUMBLED4",
"S_ROCKCRUMBLED5",
"S_ROCKCRUMBLEE1",
"S_ROCKCRUMBLEE2",
"S_ROCKCRUMBLEE3",
"S_ROCKCRUMBLEE4",
"S_ROCKCRUMBLEE5",
"S_ROCKCRUMBLEF1",
"S_ROCKCRUMBLEF2",
"S_ROCKCRUMBLEF3",
"S_ROCKCRUMBLEF4",
"S_ROCKCRUMBLEF5",
"S_ROCKCRUMBLEG1",
"S_ROCKCRUMBLEG2",
"S_ROCKCRUMBLEG3",
"S_ROCKCRUMBLEG4",
"S_ROCKCRUMBLEG5",
"S_ROCKCRUMBLEH1",
"S_ROCKCRUMBLEH2",
"S_ROCKCRUMBLEH3",
"S_ROCKCRUMBLEH4",
"S_ROCKCRUMBLEH5",
"S_ROCKCRUMBLEI1",
"S_ROCKCRUMBLEI2",
"S_ROCKCRUMBLEI3",
"S_ROCKCRUMBLEI4",
"S_ROCKCRUMBLEI5",
"S_ROCKCRUMBLEJ1",
"S_ROCKCRUMBLEJ2",
"S_ROCKCRUMBLEJ3",
"S_ROCKCRUMBLEJ4",
"S_ROCKCRUMBLEJ5",
"S_ROCKCRUMBLEK1",
"S_ROCKCRUMBLEK2",
"S_ROCKCRUMBLEK3",
"S_ROCKCRUMBLEK4",
"S_ROCKCRUMBLEK5",
"S_ROCKCRUMBLEL1",
"S_ROCKCRUMBLEL2",
"S_ROCKCRUMBLEL3",
"S_ROCKCRUMBLEL4",
"S_ROCKCRUMBLEL5",
"S_ROCKCRUMBLEM1",
"S_ROCKCRUMBLEM2",
"S_ROCKCRUMBLEM3",
"S_ROCKCRUMBLEM4",
"S_ROCKCRUMBLEM5",
"S_ROCKCRUMBLEN1",
"S_ROCKCRUMBLEN2",
"S_ROCKCRUMBLEN3",
"S_ROCKCRUMBLEN4",
"S_ROCKCRUMBLEN5",
"S_ROCKCRUMBLEO1",
"S_ROCKCRUMBLEO2",
"S_ROCKCRUMBLEO3",
"S_ROCKCRUMBLEO4",
"S_ROCKCRUMBLEO5",
"S_ROCKCRUMBLEP1",
"S_ROCKCRUMBLEP2",
"S_ROCKCRUMBLEP3",
"S_ROCKCRUMBLEP4",
"S_ROCKCRUMBLEP5",
"S_ROCKCRUMBLEA",
"S_ROCKCRUMBLEB",
"S_ROCKCRUMBLEC",
"S_ROCKCRUMBLED",
"S_ROCKCRUMBLEE",
"S_ROCKCRUMBLEF",
"S_ROCKCRUMBLEG",
"S_ROCKCRUMBLEH",
"S_ROCKCRUMBLEI",
"S_ROCKCRUMBLEJ",
"S_ROCKCRUMBLEK",
"S_ROCKCRUMBLEL",
"S_ROCKCRUMBLEM",
"S_ROCKCRUMBLEN",
"S_ROCKCRUMBLEO",
"S_ROCKCRUMBLEP",
"S_SRB1_CRAWLA1",
"S_SRB1_CRAWLA2",
@ -7492,6 +6953,7 @@ struct {
// Frame settings
{"FF_FRAMEMASK",FF_FRAMEMASK},
{"FF_ANIMATE",FF_ANIMATE},
{"FF_FULLBRIGHT",FF_FULLBRIGHT},
{"FF_TRANSMASK",FF_TRANSMASK},
{"FF_TRANSSHIFT",FF_TRANSSHIFT},

View file

@ -1503,16 +1503,37 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
HWR_GetMappedPatch(gpatch, spr->colormap);
}
if (spr->mobj->frame & FF_ANIMATE)
{
// set duration and tics to be the correct values for FF_ANIMATE states
durs = spr->mobj->state->var2;
tics = spr->mobj->anim_duration;
}
//FIXME: this is not yet correct
frame = (spr->mobj->frame & FF_FRAMEMASK) % md2->model->header.numFrames;
buff = md2->model->glCommandBuffer;
curr = &md2->model->frames[frame];
if (cv_grmd2.value == 1
&& spr->mobj->state->nextstate != S_NULL && states[spr->mobj->state->nextstate].sprite != SPR_NULL
&& !(spr->mobj->player && (spr->mobj->state->nextstate == S_PLAY_TAP1 || spr->mobj->state->nextstate == S_PLAY_TAP2) && spr->mobj->state == &states[S_PLAY_STND]))
if (cv_grmd2.value == 1)
{
const INT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames;
next = &md2->model->frames[nextframe];
// frames are handled differently for states with FF_ANIMATE, so get the next frame differently for the interpolation
if (spr->mobj->frame & FF_ANIMATE)
{
UINT32 nextframe = (spr->mobj->frame & FF_FRAMEMASK) + 1;
if (nextframe >= (UINT32)spr->mobj->state->var1)
nextframe = (spr->mobj->state->frame & FF_FRAMEMASK);
nextframe %= md2->model->header.numFrames;
next = &md2->model->frames[nextframe];
}
else
{
if (spr->mobj->state->nextstate != S_NULL && states[spr->mobj->state->nextstate].sprite != SPR_NULL
&& !(spr->mobj->player && (spr->mobj->state->nextstate == S_PLAY_TAP1 || spr->mobj->state->nextstate == S_PLAY_TAP2) && spr->mobj->state == &states[S_PLAY_STND]))
{
const UINT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames;
next = &md2->model->frames[nextframe];
}
}
}
//Hurdler: it seems there is still a small problem with mobj angle

File diff suppressed because it is too large Load diff

View file

@ -1433,30 +1433,7 @@ typedef enum state
S_MSSHIELD_F12,
// Ring
S_RING1,
S_RING2,
S_RING3,
S_RING4,
S_RING5,
S_RING6,
S_RING7,
S_RING8,
S_RING9,
S_RING10,
S_RING11,
S_RING12,
S_RING13,
S_RING14,
S_RING15,
S_RING16,
S_RING17,
S_RING18,
S_RING19,
S_RING20,
S_RING21,
S_RING22,
S_RING23,
S_RING24,
S_RING,
// Blue Sphere for special stages
S_BLUEBALL,
@ -1472,39 +1449,10 @@ typedef enum state
S_GRAVWELLRED3,
// Individual Team Rings
S_TEAMRING1,
S_TEAMRING2,
S_TEAMRING3,
S_TEAMRING4,
S_TEAMRING5,
S_TEAMRING6,
S_TEAMRING7,
S_TEAMRING8,
S_TEAMRING9,
S_TEAMRING10,
S_TEAMRING11,
S_TEAMRING12,
S_TEAMRING13,
S_TEAMRING14,
S_TEAMRING15,
S_TEAMRING16,
S_TEAMRING17,
S_TEAMRING18,
S_TEAMRING19,
S_TEAMRING20,
S_TEAMRING21,
S_TEAMRING22,
S_TEAMRING23,
S_TEAMRING24,
S_TEAMRING,
// Special Stage Token
S_EMMY1,
S_EMMY2,
S_EMMY3,
S_EMMY4,
S_EMMY5,
S_EMMY6,
S_EMMY7,
S_EMMY,
// Special Stage Token
S_TOKEN,
@ -1658,40 +1606,9 @@ typedef enum state
S_SPIKED2,
// Starpost
S_STARPOST1,
S_STARPOST2,
S_STARPOST3,
S_STARPOST4,
S_STARPOST5,
S_STARPOST6,
S_STARPOST7,
S_STARPOST8,
S_STARPOST9,
S_STARPOST10,
S_STARPOST11,
S_STARPOST12,
S_STARPOST13,
S_STARPOST14,
S_STARPOST15,
S_STARPOST16,
S_STARPOST17,
S_STARPOST18,
S_STARPOST19,
S_STARPOST20,
S_STARPOST21,
S_STARPOST22,
S_STARPOST23,
S_STARPOST24,
S_STARPOST25,
S_STARPOST26,
S_STARPOST27,
S_STARPOST28,
S_STARPOST29,
S_STARPOST30,
S_STARPOST31,
S_STARPOST32,
S_STARPOST33,
S_STARPOST34,
S_STARPOST_IDLE,
S_STARPOST_FLASH,
S_STARPOST_SPIN,
// Big floating mine
S_BIGMINE1,
@ -2299,38 +2216,7 @@ typedef enum state
S_PITY10,
// Invincibility Sparkles
S_IVSP1,
S_IVSP2,
S_IVSP3,
S_IVSP4,
S_IVSP5,
S_IVSP6,
S_IVSP7,
S_IVSP8,
S_IVSP9,
S_IVSP10,
S_IVSP11,
S_IVSP12,
S_IVSP13,
S_IVSP14,
S_IVSP15,
S_IVSP16,
S_IVSP17,
S_IVSP18,
S_IVSP19,
S_IVSP20,
S_IVSP21,
S_IVSP22,
S_IVSP23,
S_IVSP24,
S_IVSP25,
S_IVSP26,
S_IVSP27,
S_IVSP28,
S_IVSP29,
S_IVSP30,
S_IVSP31,
S_IVSP32,
S_IVSP,
// Super Sonic Spark
S_SSPK1,
@ -2517,283 +2403,17 @@ typedef enum state
S_RRNG6,
S_RRNG7,
// Bounce Ring
S_BOUNCERING1,
S_BOUNCERING2,
S_BOUNCERING3,
S_BOUNCERING4,
S_BOUNCERING5,
S_BOUNCERING6,
S_BOUNCERING7,
S_BOUNCERING8,
S_BOUNCERING9,
S_BOUNCERING10,
S_BOUNCERING11,
S_BOUNCERING12,
S_BOUNCERING13,
S_BOUNCERING14,
S_BOUNCERING15,
S_BOUNCERING16,
S_BOUNCERING17,
S_BOUNCERING18,
S_BOUNCERING19,
S_BOUNCERING20,
S_BOUNCERING21,
S_BOUNCERING22,
S_BOUNCERING23,
S_BOUNCERING24,
S_BOUNCERING25,
S_BOUNCERING26,
S_BOUNCERING27,
S_BOUNCERING28,
S_BOUNCERING29,
S_BOUNCERING30,
S_BOUNCERING31,
S_BOUNCERING32,
S_BOUNCERING33,
S_BOUNCERING34,
S_BOUNCERING35,
// Rail Ring
S_RAILRING1,
S_RAILRING2,
S_RAILRING3,
S_RAILRING4,
S_RAILRING5,
S_RAILRING6,
S_RAILRING7,
S_RAILRING8,
S_RAILRING9,
S_RAILRING10,
S_RAILRING11,
S_RAILRING12,
S_RAILRING13,
S_RAILRING14,
S_RAILRING15,
S_RAILRING16,
S_RAILRING17,
S_RAILRING18,
S_RAILRING19,
S_RAILRING20,
S_RAILRING21,
S_RAILRING22,
S_RAILRING23,
S_RAILRING24,
S_RAILRING25,
S_RAILRING26,
S_RAILRING27,
S_RAILRING28,
S_RAILRING29,
S_RAILRING30,
S_RAILRING31,
S_RAILRING32,
S_RAILRING33,
S_RAILRING34,
S_RAILRING35,
// Infinity Ring
S_INFINITYRING1,
S_INFINITYRING2,
S_INFINITYRING3,
S_INFINITYRING4,
S_INFINITYRING5,
S_INFINITYRING6,
S_INFINITYRING7,
S_INFINITYRING8,
S_INFINITYRING9,
S_INFINITYRING10,
S_INFINITYRING11,
S_INFINITYRING12,
S_INFINITYRING13,
S_INFINITYRING14,
S_INFINITYRING15,
S_INFINITYRING16,
S_INFINITYRING17,
S_INFINITYRING18,
S_INFINITYRING19,
S_INFINITYRING20,
S_INFINITYRING21,
S_INFINITYRING22,
S_INFINITYRING23,
S_INFINITYRING24,
S_INFINITYRING25,
S_INFINITYRING26,
S_INFINITYRING27,
S_INFINITYRING28,
S_INFINITYRING29,
S_INFINITYRING30,
S_INFINITYRING31,
S_INFINITYRING32,
S_INFINITYRING33,
S_INFINITYRING34,
S_INFINITYRING35,
// Automatic Ring
S_AUTOMATICRING1,
S_AUTOMATICRING2,
S_AUTOMATICRING3,
S_AUTOMATICRING4,
S_AUTOMATICRING5,
S_AUTOMATICRING6,
S_AUTOMATICRING7,
S_AUTOMATICRING8,
S_AUTOMATICRING9,
S_AUTOMATICRING10,
S_AUTOMATICRING11,
S_AUTOMATICRING12,
S_AUTOMATICRING13,
S_AUTOMATICRING14,
S_AUTOMATICRING15,
S_AUTOMATICRING16,
S_AUTOMATICRING17,
S_AUTOMATICRING18,
S_AUTOMATICRING19,
S_AUTOMATICRING20,
S_AUTOMATICRING21,
S_AUTOMATICRING22,
S_AUTOMATICRING23,
S_AUTOMATICRING24,
S_AUTOMATICRING25,
S_AUTOMATICRING26,
S_AUTOMATICRING27,
S_AUTOMATICRING28,
S_AUTOMATICRING29,
S_AUTOMATICRING30,
S_AUTOMATICRING31,
S_AUTOMATICRING32,
S_AUTOMATICRING33,
S_AUTOMATICRING34,
S_AUTOMATICRING35,
// Explosion Ring
S_EXPLOSIONRING1,
S_EXPLOSIONRING2,
S_EXPLOSIONRING3,
S_EXPLOSIONRING4,
S_EXPLOSIONRING5,
S_EXPLOSIONRING6,
S_EXPLOSIONRING7,
S_EXPLOSIONRING8,
S_EXPLOSIONRING9,
S_EXPLOSIONRING10,
S_EXPLOSIONRING11,
S_EXPLOSIONRING12,
S_EXPLOSIONRING13,
S_EXPLOSIONRING14,
S_EXPLOSIONRING15,
S_EXPLOSIONRING16,
S_EXPLOSIONRING17,
S_EXPLOSIONRING18,
S_EXPLOSIONRING19,
S_EXPLOSIONRING20,
S_EXPLOSIONRING21,
S_EXPLOSIONRING22,
S_EXPLOSIONRING23,
S_EXPLOSIONRING24,
S_EXPLOSIONRING25,
S_EXPLOSIONRING26,
S_EXPLOSIONRING27,
S_EXPLOSIONRING28,
S_EXPLOSIONRING29,
S_EXPLOSIONRING30,
S_EXPLOSIONRING31,
S_EXPLOSIONRING32,
S_EXPLOSIONRING33,
S_EXPLOSIONRING34,
S_EXPLOSIONRING35,
// Scatter Ring
S_SCATTERRING1,
S_SCATTERRING2,
S_SCATTERRING3,
S_SCATTERRING4,
S_SCATTERRING5,
S_SCATTERRING6,
S_SCATTERRING7,
S_SCATTERRING8,
S_SCATTERRING9,
S_SCATTERRING10,
S_SCATTERRING11,
S_SCATTERRING12,
S_SCATTERRING13,
S_SCATTERRING14,
S_SCATTERRING15,
S_SCATTERRING16,
S_SCATTERRING17,
S_SCATTERRING18,
S_SCATTERRING19,
S_SCATTERRING20,
S_SCATTERRING21,
S_SCATTERRING22,
S_SCATTERRING23,
S_SCATTERRING24,
S_SCATTERRING25,
S_SCATTERRING26,
S_SCATTERRING27,
S_SCATTERRING28,
S_SCATTERRING29,
S_SCATTERRING30,
S_SCATTERRING31,
S_SCATTERRING32,
S_SCATTERRING33,
S_SCATTERRING34,
S_SCATTERRING35,
// Grenade Ring
S_GRENADERING1,
S_GRENADERING2,
S_GRENADERING3,
S_GRENADERING4,
S_GRENADERING5,
S_GRENADERING6,
S_GRENADERING7,
S_GRENADERING8,
S_GRENADERING9,
S_GRENADERING10,
S_GRENADERING11,
S_GRENADERING12,
S_GRENADERING13,
S_GRENADERING14,
S_GRENADERING15,
S_GRENADERING16,
S_GRENADERING17,
S_GRENADERING18,
S_GRENADERING19,
S_GRENADERING20,
S_GRENADERING21,
S_GRENADERING22,
S_GRENADERING23,
S_GRENADERING24,
S_GRENADERING25,
S_GRENADERING26,
S_GRENADERING27,
S_GRENADERING28,
S_GRENADERING29,
S_GRENADERING30,
S_GRENADERING31,
S_GRENADERING32,
S_GRENADERING33,
S_GRENADERING34,
S_GRENADERING35,
// Weapon Ring Ammo
S_BOUNCERINGAMMO,
S_RAILRINGAMMO,
S_INFINITYRINGAMMO,
S_AUTOMATICRINGAMMO,
S_EXPLOSIONRINGAMMO,
S_SCATTERRINGAMMO,
S_GRENADERINGAMMO,
// Weapon pickup
S_BOUNCEPICKUP1,
S_BOUNCEPICKUP2,
S_BOUNCEPICKUP3,
S_BOUNCEPICKUP4,
S_BOUNCEPICKUP5,
S_BOUNCEPICKUP6,
S_BOUNCEPICKUP7,
S_BOUNCEPICKUP8,
S_BOUNCEPICKUP9,
S_BOUNCEPICKUP10,
S_BOUNCEPICKUP11,
S_BOUNCEPICKUP12,
S_BOUNCEPICKUP13,
S_BOUNCEPICKUP14,
S_BOUNCEPICKUP15,
S_BOUNCEPICKUP16,
S_BOUNCEPICKUP,
S_BOUNCEPICKUPFADE1,
S_BOUNCEPICKUPFADE2,
S_BOUNCEPICKUPFADE3,
@ -2803,23 +2423,7 @@ typedef enum state
S_BOUNCEPICKUPFADE7,
S_BOUNCEPICKUPFADE8,
S_RAILPICKUP1,
S_RAILPICKUP2,
S_RAILPICKUP3,
S_RAILPICKUP4,
S_RAILPICKUP5,
S_RAILPICKUP6,
S_RAILPICKUP7,
S_RAILPICKUP8,
S_RAILPICKUP9,
S_RAILPICKUP10,
S_RAILPICKUP11,
S_RAILPICKUP12,
S_RAILPICKUP13,
S_RAILPICKUP14,
S_RAILPICKUP15,
S_RAILPICKUP16,
S_RAILPICKUP,
S_RAILPICKUPFADE1,
S_RAILPICKUPFADE2,
S_RAILPICKUPFADE3,
@ -2829,23 +2433,7 @@ typedef enum state
S_RAILPICKUPFADE7,
S_RAILPICKUPFADE8,
S_AUTOPICKUP1,
S_AUTOPICKUP2,
S_AUTOPICKUP3,
S_AUTOPICKUP4,
S_AUTOPICKUP5,
S_AUTOPICKUP6,
S_AUTOPICKUP7,
S_AUTOPICKUP8,
S_AUTOPICKUP9,
S_AUTOPICKUP10,
S_AUTOPICKUP11,
S_AUTOPICKUP12,
S_AUTOPICKUP13,
S_AUTOPICKUP14,
S_AUTOPICKUP15,
S_AUTOPICKUP16,
S_AUTOPICKUP,
S_AUTOPICKUPFADE1,
S_AUTOPICKUPFADE2,
S_AUTOPICKUPFADE3,
@ -2855,23 +2443,7 @@ typedef enum state
S_AUTOPICKUPFADE7,
S_AUTOPICKUPFADE8,
S_EXPLODEPICKUP1,
S_EXPLODEPICKUP2,
S_EXPLODEPICKUP3,
S_EXPLODEPICKUP4,
S_EXPLODEPICKUP5,
S_EXPLODEPICKUP6,
S_EXPLODEPICKUP7,
S_EXPLODEPICKUP8,
S_EXPLODEPICKUP9,
S_EXPLODEPICKUP10,
S_EXPLODEPICKUP11,
S_EXPLODEPICKUP12,
S_EXPLODEPICKUP13,
S_EXPLODEPICKUP14,
S_EXPLODEPICKUP15,
S_EXPLODEPICKUP16,
S_EXPLODEPICKUP,
S_EXPLODEPICKUPFADE1,
S_EXPLODEPICKUPFADE2,
S_EXPLODEPICKUPFADE3,
@ -2881,23 +2453,7 @@ typedef enum state
S_EXPLODEPICKUPFADE7,
S_EXPLODEPICKUPFADE8,
S_SCATTERPICKUP1,
S_SCATTERPICKUP2,
S_SCATTERPICKUP3,
S_SCATTERPICKUP4,
S_SCATTERPICKUP5,
S_SCATTERPICKUP6,
S_SCATTERPICKUP7,
S_SCATTERPICKUP8,
S_SCATTERPICKUP9,
S_SCATTERPICKUP10,
S_SCATTERPICKUP11,
S_SCATTERPICKUP12,
S_SCATTERPICKUP13,
S_SCATTERPICKUP14,
S_SCATTERPICKUP15,
S_SCATTERPICKUP16,
S_SCATTERPICKUP,
S_SCATTERPICKUPFADE1,
S_SCATTERPICKUPFADE2,
S_SCATTERPICKUPFADE3,
@ -2907,23 +2463,7 @@ typedef enum state
S_SCATTERPICKUPFADE7,
S_SCATTERPICKUPFADE8,
S_GRENADEPICKUP1,
S_GRENADEPICKUP2,
S_GRENADEPICKUP3,
S_GRENADEPICKUP4,
S_GRENADEPICKUP5,
S_GRENADEPICKUP6,
S_GRENADEPICKUP7,
S_GRENADEPICKUP8,
S_GRENADEPICKUP9,
S_GRENADEPICKUP10,
S_GRENADEPICKUP11,
S_GRENADEPICKUP12,
S_GRENADEPICKUP13,
S_GRENADEPICKUP14,
S_GRENADEPICKUP15,
S_GRENADEPICKUP16,
S_GRENADEPICKUP,
S_GRENADEPICKUPFADE1,
S_GRENADEPICKUPFADE2,
S_GRENADEPICKUPFADE3,
@ -3304,101 +2844,22 @@ typedef enum state
S_ROCKSPAWN,
S_ROCKCRUMBLEA1,
S_ROCKCRUMBLEA2,
S_ROCKCRUMBLEA3,
S_ROCKCRUMBLEA4,
S_ROCKCRUMBLEA5,
S_ROCKCRUMBLEB1,
S_ROCKCRUMBLEB2,
S_ROCKCRUMBLEB3,
S_ROCKCRUMBLEB4,
S_ROCKCRUMBLEB5,
S_ROCKCRUMBLEC1,
S_ROCKCRUMBLEC2,
S_ROCKCRUMBLEC3,
S_ROCKCRUMBLEC4,
S_ROCKCRUMBLEC5,
S_ROCKCRUMBLED1,
S_ROCKCRUMBLED2,
S_ROCKCRUMBLED3,
S_ROCKCRUMBLED4,
S_ROCKCRUMBLED5,
S_ROCKCRUMBLEE1,
S_ROCKCRUMBLEE2,
S_ROCKCRUMBLEE3,
S_ROCKCRUMBLEE4,
S_ROCKCRUMBLEE5,
S_ROCKCRUMBLEF1,
S_ROCKCRUMBLEF2,
S_ROCKCRUMBLEF3,
S_ROCKCRUMBLEF4,
S_ROCKCRUMBLEF5,
S_ROCKCRUMBLEG1,
S_ROCKCRUMBLEG2,
S_ROCKCRUMBLEG3,
S_ROCKCRUMBLEG4,
S_ROCKCRUMBLEG5,
S_ROCKCRUMBLEH1,
S_ROCKCRUMBLEH2,
S_ROCKCRUMBLEH3,
S_ROCKCRUMBLEH4,
S_ROCKCRUMBLEH5,
S_ROCKCRUMBLEI1,
S_ROCKCRUMBLEI2,
S_ROCKCRUMBLEI3,
S_ROCKCRUMBLEI4,
S_ROCKCRUMBLEI5,
S_ROCKCRUMBLEJ1,
S_ROCKCRUMBLEJ2,
S_ROCKCRUMBLEJ3,
S_ROCKCRUMBLEJ4,
S_ROCKCRUMBLEJ5,
S_ROCKCRUMBLEK1,
S_ROCKCRUMBLEK2,
S_ROCKCRUMBLEK3,
S_ROCKCRUMBLEK4,
S_ROCKCRUMBLEK5,
S_ROCKCRUMBLEL1,
S_ROCKCRUMBLEL2,
S_ROCKCRUMBLEL3,
S_ROCKCRUMBLEL4,
S_ROCKCRUMBLEL5,
S_ROCKCRUMBLEM1,
S_ROCKCRUMBLEM2,
S_ROCKCRUMBLEM3,
S_ROCKCRUMBLEM4,
S_ROCKCRUMBLEM5,
S_ROCKCRUMBLEN1,
S_ROCKCRUMBLEN2,
S_ROCKCRUMBLEN3,
S_ROCKCRUMBLEN4,
S_ROCKCRUMBLEN5,
S_ROCKCRUMBLEO1,
S_ROCKCRUMBLEO2,
S_ROCKCRUMBLEO3,
S_ROCKCRUMBLEO4,
S_ROCKCRUMBLEO5,
S_ROCKCRUMBLEP1,
S_ROCKCRUMBLEP2,
S_ROCKCRUMBLEP3,
S_ROCKCRUMBLEP4,
S_ROCKCRUMBLEP5,
S_ROCKCRUMBLEA,
S_ROCKCRUMBLEB,
S_ROCKCRUMBLEC,
S_ROCKCRUMBLED,
S_ROCKCRUMBLEE,
S_ROCKCRUMBLEF,
S_ROCKCRUMBLEG,
S_ROCKCRUMBLEH,
S_ROCKCRUMBLEI,
S_ROCKCRUMBLEJ,
S_ROCKCRUMBLEK,
S_ROCKCRUMBLEL,
S_ROCKCRUMBLEM,
S_ROCKCRUMBLEN,
S_ROCKCRUMBLEO,
S_ROCKCRUMBLEP,
S_SRB1_CRAWLA1,
S_SRB1_CRAWLA2,

View file

@ -34,6 +34,7 @@ enum mobj_e {
mobj_angle,
mobj_sprite,
mobj_frame,
mobj_anim_duration,
mobj_touching_sectorlist,
mobj_subsector,
mobj_floorz,
@ -92,6 +93,7 @@ static const char *const mobj_opt[] = {
"angle",
"sprite",
"frame",
"anim_duration",
"touching_sectorlist",
"subsector",
"floorz",
@ -187,6 +189,9 @@ static int mobj_get(lua_State *L)
case mobj_frame:
lua_pushinteger(L, mo->frame);
break;
case mobj_anim_duration:
lua_pushinteger(L, mo->anim_duration);
break;
case mobj_touching_sectorlist:
return UNIMPLEMENTED;
case mobj_subsector:
@ -406,6 +411,9 @@ static int mobj_set(lua_State *L)
case mobj_frame:
mo->frame = (UINT32)luaL_checkinteger(L, 3);
break;
case mobj_anim_duration:
mo->anim_duration = (UINT16)luaL_checkinteger(L, 3);
break;
case mobj_touching_sectorlist:
return UNIMPLEMENTED;
case mobj_subsector:

View file

@ -212,6 +212,7 @@ void P_RemoveSavegameMobj(mobj_t *th);
boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state);
boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
void P_RunShields(void);
void P_RunOverlays(void);
void P_MobjThinker(mobj_t *mobj);
boolean P_RailThinker(mobj_t *mobj);
void P_PushableThinker(mobj_t *mobj);

View file

@ -79,11 +79,31 @@ void P_AddCachedAction(mobj_t *mobj, INT32 statenum)
actioncachehead.prev = newaction;
}
//
// P_CycleStateAnimation
//
FUNCINLINE static ATTRINLINE void P_CycleStateAnimation(mobj_t *mobj)
{
// var2 determines delay between animation frames
if (!(mobj->frame & FF_ANIMATE) || --mobj->anim_duration != 0)
return;
mobj->anim_duration = (UINT16)mobj->state->var2;
// compare the current sprite frame to the one we started from
// if more than var1 away from it, swap back to the original
// else just advance by one
if (((++mobj->frame) & FF_FRAMEMASK) - (mobj->state->frame & FF_FRAMEMASK) > (UINT32)mobj->state->var1)
mobj->frame = (mobj->state->frame & FF_FRAMEMASK) | (mobj->frame & ~FF_FRAMEMASK);
}
//
// P_CycleMobjState
//
static void P_CycleMobjState(mobj_t *mobj)
{
// state animations
P_CycleStateAnimation(mobj);
// cycle through states,
// calling action functions at transitions
if (mobj->tics != -1)
@ -102,6 +122,9 @@ static void P_CycleMobjState(mobj_t *mobj)
//
static void P_CyclePlayerMobjState(mobj_t *mobj)
{
// state animations
P_CycleStateAnimation(mobj);
// cycle through states,
// calling action functions at transitions
if (mobj->tics != -1)
@ -279,6 +302,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
mobj->sprite = st->sprite;
mobj->frame = st->frame;
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
// Modified handling.
// Call action functions when the state is set
@ -346,6 +370,7 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame;
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
// Modified handling.
// Call action functions when the state is set
@ -399,6 +424,8 @@ boolean P_SetMobjStateNF(mobj_t *mobj, statenum_t state)
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame;
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
return true;
}
@ -416,6 +443,8 @@ static boolean P_SetPrecipMobjState(precipmobj_t *mobj, statenum_t state)
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame;
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
return true;
}
@ -3716,6 +3745,8 @@ void P_NullPrecipThinker(precipmobj_t *mobj)
void P_SnowThinker(precipmobj_t *mobj)
{
P_CycleStateAnimation((mobj_t *)mobj);
// adjust height
if ((mobj->z += mobj->momz) <= mobj->floorz)
mobj->z = mobj->ceilingz;
@ -3723,6 +3754,8 @@ void P_SnowThinker(precipmobj_t *mobj)
void P_RainThinker(precipmobj_t *mobj)
{
P_CycleStateAnimation((mobj_t *)mobj);
if (mobj->state != &states[S_RAIN1])
{
// cycle through states,
@ -5833,8 +5866,6 @@ INT32 numshields = 0;
void P_RunShields(void)
{
INT32 i;
mobj_t *mo, *next;
fixed_t destx,desty,zoffs;
// run shields
for (i = 0; i < numshields; i++)
@ -5843,60 +5874,6 @@ void P_RunShields(void)
P_SetTarget(&shields[i], NULL);
}
numshields = 0;
// run overlays
next = NULL;
for (mo = overlaycap; mo; mo = next)
{
I_Assert(!P_MobjWasRemoved(mo));
// grab next in chain, then unset the chain target
next = mo->hnext;
P_SetTarget(&mo->hnext, NULL);
if (!mo->target)
continue;
if (!splitscreen /*&& rendermode != render_soft*/)
{
angle_t viewingangle;
if (players[displayplayer].awayviewtics)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y);
else if (!camera.chase && players[displayplayer].mo)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].mo->x, players[displayplayer].mo->y);
else
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, camera.x, camera.y);
if (mo->state->var1)
viewingangle += ANGLE_180;
destx = mo->target->x + P_ReturnThrustX(mo->target, viewingangle, FixedMul(FRACUNIT/4, mo->scale));
desty = mo->target->y + P_ReturnThrustY(mo->target, viewingangle, FixedMul(FRACUNIT/4, mo->scale));
}
else
{
destx = mo->target->x;
desty = mo->target->y;
}
mo->eflags = (mo->eflags & ~MFE_VERTICALFLIP) | (mo->target->eflags & MFE_VERTICALFLIP);
mo->scale = mo->destscale = mo->target->scale;
zoffs = FixedMul(((signed)mo->state->var2)*FRACUNIT, mo->scale);
mo->angle = mo->target->angle;
P_UnsetThingPosition(mo);
mo->x = destx;
mo->y = desty;
if (mo->eflags & MFE_VERTICALFLIP)
mo->z = (mo->target->z + mo->target->height - mo->height) - zoffs;
else
mo->z = mo->target->z + zoffs;
if (mo->state->var1)
P_SetUnderlayPosition(mo);
else
P_SetThingPosition(mo);
P_CheckPosition(mo, mo->x, mo->y);
}
P_SetTarget(&overlaycap, NULL);
}
static boolean P_AddShield(mobj_t *thing)
@ -5933,6 +5910,71 @@ static boolean P_AddShield(mobj_t *thing)
return true;
}
void P_RunOverlays(void)
{
// run overlays
mobj_t *mo, *next = NULL;
fixed_t destx,desty,zoffs;
for (mo = overlaycap; mo; mo = next)
{
I_Assert(!P_MobjWasRemoved(mo));
// grab next in chain, then unset the chain target
next = mo->hnext;
P_SetTarget(&mo->hnext, NULL);
if (!mo->target)
continue;
if (!splitscreen /*&& rendermode != render_soft*/)
{
angle_t viewingangle;
if (players[displayplayer].awayviewtics)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y);
else if (!camera.chase && players[displayplayer].mo)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].mo->x, players[displayplayer].mo->y);
else
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, camera.x, camera.y);
if (!(mo->state->frame & FF_ANIMATE) && mo->state->var1)
viewingangle += ANGLE_180;
destx = mo->target->x + P_ReturnThrustX(mo->target, viewingangle, FixedMul(FRACUNIT/4, mo->scale));
desty = mo->target->y + P_ReturnThrustY(mo->target, viewingangle, FixedMul(FRACUNIT/4, mo->scale));
}
else
{
destx = mo->target->x;
desty = mo->target->y;
}
mo->eflags = (mo->eflags & ~MFE_VERTICALFLIP) | (mo->target->eflags & MFE_VERTICALFLIP);
mo->scale = mo->destscale = mo->target->scale;
mo->angle = mo->target->angle;
if (!(mo->state->frame & FF_ANIMATE))
zoffs = FixedMul(((signed)mo->state->var2)*FRACUNIT, mo->scale);
// if you're using FF_ANIMATE on an overlay,
// then you're on your own.
else
zoffs = 0;
P_UnsetThingPosition(mo);
mo->x = destx;
mo->y = desty;
if (mo->eflags & MFE_VERTICALFLIP)
mo->z = (mo->target->z + mo->target->height - mo->height) - zoffs;
else
mo->z = mo->target->z + zoffs;
if (mo->state->var1)
P_SetUnderlayPosition(mo);
else
P_SetThingPosition(mo);
P_CheckPosition(mo, mo->x, mo->y);
}
P_SetTarget(&overlaycap, NULL);
}
// Called only when MT_OVERLAY thinks.
static void P_AddOverlay(mobj_t *thing)
{
@ -7502,6 +7544,8 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame; // FF_FRAMEMASK for frame, and other bits..
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
mobj->friction = ORIG_FRICTION;
mobj->movefactor = ORIG_FRICTION_FACTOR;
@ -7727,6 +7771,7 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame; // FF_FRAMEMASK for frame, and other bits..
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
// set subsector and/or block links
P_SetPrecipitationThingPosition(mobj);

View file

@ -270,6 +270,7 @@ typedef struct mobj_s
angle_t angle; // orientation
spritenum_t sprite; // used to find patch_t and flip value
UINT32 frame; // frame number, plus bits see p_pspr.h
UINT16 anim_duration; // for FF_ANIMATE states
struct msecnode_s *touching_sectorlist; // a linked list of sectors where this object appears
@ -383,7 +384,8 @@ typedef struct precipmobj_s
// More drawing info: to determine current sprite.
angle_t angle; // orientation
spritenum_t sprite; // used to find patch_t and flip value
INT32 frame; // frame number, plus bits see p_pspr.h
UINT32 frame; // frame number, plus bits see p_pspr.h
UINT16 anim_duration; // for FF_ANIMATE states
struct mprecipsecnode_s *touching_sectorlist; // a linked list of sectors where this object appears

View file

@ -36,9 +36,11 @@
#endif
/// \brief Frame flags: only the frame number
#define FF_FRAMEMASK 0x7fff
#define FF_FRAMEMASK 0x3fff
/// \brief Frame flags: Simple stateless animation
#define FF_ANIMATE 0x4000
/// \brief Frame flags: frame always appears full bright
#define FF_FULLBRIGHT 0x8000 //
#define FF_FULLBRIGHT 0x8000
/// \brief Frame flags: 0 = no trans(opaque), 1-15 = transl. table
#define FF_TRANSMASK 0xf0000
/// \brief shift for FF_TRANSMASK

View file

@ -1058,6 +1058,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
diff |= MD_SPRITE;
if (mobj->frame != mobj->state->frame)
diff |= MD_FRAME;
if (mobj->anim_duration != (UINT16)mobj->state->var2)
diff |= MD_FRAME;
if (mobj->eflags)
diff |= MD_EFLAGS;
if (mobj->player)
@ -1178,7 +1180,10 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
if (diff & MD_SPRITE)
WRITEUINT16(save_p, mobj->sprite);
if (diff & MD_FRAME)
{
WRITEUINT32(save_p, mobj->frame);
WRITEUINT16(save_p, mobj->anim_duration);
}
if (diff & MD_EFLAGS)
WRITEUINT16(save_p, mobj->eflags);
if (diff & MD_PLAYER)
@ -2004,9 +2009,15 @@ static void LoadMobjThinker(actionf_p1 thinker)
else
mobj->sprite = mobj->state->sprite;
if (diff & MD_FRAME)
{
mobj->frame = READUINT32(save_p);
mobj->anim_duration = READUINT16(save_p);
}
else
{
mobj->frame = mobj->state->frame;
mobj->anim_duration = (UINT16)mobj->state->var2;
}
if (diff & MD_EFLAGS)
mobj->eflags = READUINT16(save_p);
if (diff & MD_PLAYER)

View file

@ -631,6 +631,7 @@ void P_Ticker(boolean run)
// Run shield positioning
P_RunShields();
P_RunOverlays();
P_UpdateSpecials();
P_RespawnSpecials();
@ -742,6 +743,7 @@ void P_PreTicker(INT32 frames)
// Run shield positioning
P_RunShields();
P_RunOverlays();
P_UpdateSpecials();
P_RespawnSpecials();