* Made what MI had compile.

* Added the ability to read in mobjtypes as well as from a short list of flicky constants.
* Added a new state, S_XPLD_FLICKY, which is the new deathstate of all badniks.
* Put the disabled animal-spawn-on-P_KillMobj behind a #define.
* Renamed the branch and associated properties to something not rife with sin.
This commit is contained in:
toasterbabe 2016-12-29 17:02:05 +00:00
parent 7711f64eb7
commit d9177f778f
7 changed files with 116 additions and 82 deletions

View File

@ -371,7 +371,10 @@ static void clear_levels(void)
// (no need to set num to 0, we're freeing the entire header shortly)
Z_Free(mapheaderinfo[i]->customopts);
if (mapheaderinfo[i]->flickies)
Z_Free(mapheaderinfo[i]->flickies);
P_DeleteGrades(i);
Z_Free(mapheaderinfo[i]);
mapheaderinfo[i] = NULL;
}
@ -993,7 +996,7 @@ static const struct {
static const struct {
const char *name;
const mobjtype_t type;
} ANIMALTYPES[] = {
} FLICKYTYPES[] = {
{"BLUEBIRD", MT_BIRD}, //MT_FLICKY_A},
{"RABBIT", MT_BUNNY}, //MT_FLICKY_B},
{"CHICKEN", MT_CHICKEN}, //MT_FLICKY_C},
@ -1013,7 +1016,7 @@ static const struct {
//{"FLICKER", MT_FLICKER},
//{"SEED", MT_CDSEED},
{NULL, 0}
}
};
static void readlevelheader(MYFILE *f, INT32 num)
{
@ -1113,50 +1116,71 @@ static void readlevelheader(MYFILE *f, INT32 num)
// Now go to uppercase
strupr(word2);
// List of animals that are be freed in this level
if (fastcmp(word, "ANIMALLIST") || fastcmp(word, "FLICKYLIST"))
// List of flickies that are be freed in this map
if (fastcmp(word, "FLICKYLIST") || fastcmp(word, "ANIMALLIST"))
{
if (fastcmp(word2, "NONE"))
{
if (mapheaderinfo[num-1]->animals)
Z_Free(mapheaderinfo[num-1]->animals);
mapheaderinfo[num-1]->animals = NULL;
mapheaderinfo[num-1]->numAnimals = 0;
if (mapheaderinfo[num-1]->flickies)
Z_Free(mapheaderinfo[num-1]->flickies);
mapheaderinfo[num-1]->flickies = NULL;
mapheaderinfo[num-1]->numFlickies = 0;
}
else
{
mapheaderinfo[num-1]->numAnimals = 0;
#define MAXFLICKIES 64
mobjtype_t tmpflickies[MAXFLICKIES];
mapheaderinfo[num-1]->numFlickies = 0;
tmp = strtok(word2,",");
// count how many animals there are first
// get up to the first MAXFLICKIES flickies, then run the rest of the tokens out.
do {
for (i = 0; ANIMALTYPES[i].name; i++)
if (fastcmp(tmp, ANIMALTYPES[i].name))
break;
if (!TYPEOFLEVEL[i].name)
deh_warning("Level header %d: unknown animal type %s\n", num, tmp);
else
mapheaderinfo[num-1]->numAnimals++;
} while((tmp = strtok(NULL,",")) != NULL);
if (mapheaderinfo[num-1]->numFlickies == MAXFLICKIES) // never going to get above that number
{
deh_warning("Level header %d: too many flickies\n", num);
continue;
}
if (!mapheaderinfo[num-1]->numAnimals)
deh_warning("Level header %d: no valid animal types found\n", num);
else
{
mapheaderinfo[num-1]->animals = Z_Realloc(mapheaderinfo[num-1]->animals, sizeof(mobjtype_t) * mapheaderinfo[num-1]->numAnimals, PU_STATIC, NULL);
mapheaderinfo[num-1]->numAnimals = 0; // reset count
// now we add them to the list!
do {
for (i = 0; ANIMALTYPES[i].name; i++)
if (fastcmp(tmp, ANIMALTYPES[i].name))
if (fastncmp(tmp, "MT_", 3)) // support for specified mobjtypes...
{
i = get_mobjtype(tmp);
if (!i)
{
//deh_warning("Level header %d: unknown flicky mobj type %s\n", num, tmp); -- no need for this line as get_mobjtype complains too
continue;
}
tmpflickies[mapheaderinfo[num-1]->numFlickies] = i;
}
else // ...or a quick, limited selection of default flickies!
{
for (i = 0; FLICKYTYPES[i].name; i++)
if (fastcmp(tmp, FLICKYTYPES[i].name))
break;
if (TYPEOFLEVEL[i].name)
mapheaderinfo[num-1]->animals[mapheaderinfo[num-1]->numAnimals++] = ANIMALTYPES[i].type;
} while((tmp = strtok(NULL,",")) != NULL);
if (!FLICKYTYPES[i].name)
{
deh_warning("Level header %d: unknown flicky selection %s\n", num, tmp);
continue;
}
tmpflickies[mapheaderinfo[num-1]->numFlickies] = FLICKYTYPES[i].type;
}
mapheaderinfo[num-1]->numFlickies++;
} while ((tmp = strtok(NULL,",")) != NULL);
if (mapheaderinfo[num-1]->numFlickies) // now let's do it again - except this time we add them to the list!
{
size_t newsize = sizeof(mobjtype_t) * mapheaderinfo[num-1]->numFlickies;
mapheaderinfo[num-1]->flickies = Z_Realloc(mapheaderinfo[num-1]->flickies, newsize, PU_STATIC, NULL);
// now we add them to the list!
M_Memcpy(mapheaderinfo[num-1]->flickies, tmpflickies, newsize);
}
else
deh_warning("Level header %d: no valid flicky types found\n", num);
#undef MAXFLICKIES
}
}
// NiGHTS grades
if (fastncmp(word, "GRADES", 6))
else if (fastncmp(word, "GRADES", 6))
{
UINT8 mare = (UINT8)atoi(word + 6);
@ -3449,11 +3473,11 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
{
if (i == 0 && word2[0] != '0') // If word2 isn't a number
i = get_mobjtype(word2); // find a thing by name
if (i < NUMMOBJTYPES && i >= 0)
if (i < NUMMOBJTYPES && i > 0)
readthing(f, i);
else
{
deh_warning("Thing %d out of range (0 - %d)", i, NUMMOBJTYPES-1);
deh_warning("Thing %d out of range (1 - %d)", i, NUMMOBJTYPES-1);
ignorelines(f);
}
DEH_WriteUndoline(word, word2, UNDO_HEADER);
@ -6147,6 +6171,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_SPRK16",
// Robot Explosion
"S_XPLD_FLICKY",
"S_XPLD1",
"S_XPLD2",
"S_XPLD3",
@ -7574,7 +7599,7 @@ static mobjtype_t get_mobjtype(const char *word)
if (fastcmp(word, MOBJTYPE_LIST[i]+3))
return i;
deh_warning("Couldn't find mobjtype named 'MT_%s'",word);
return MT_BLUECRAWLA;
return MT_NULL;
}
static statenum_t get_state(const char *word)

View File

@ -242,8 +242,8 @@ typedef struct
UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus
// Freed animals stuff.
UINT8 numAnimals; ///< Internal. For freed animal support.
mobjtype_t *animals; ///< List of freeable animals in this level. Allocated dynamically for space reasons. Be careful.
UINT8 numFlickies; ///< Internal. For freed flicky support.
mobjtype_t *flickies; ///< List of freeable flickies in this level. Allocated dynamically for space reasons. Be careful.
// NiGHTS stuff.
UINT8 numGradedMares; ///< Internal. For grade support.

View File

@ -2847,10 +2847,11 @@ state_t states[NUMSTATES] =
{SPR_SPRK, FF_TRANS90|3, 1, {NULL}, 0, 0, S_NULL}, // S_SPRK16
// Robot Explosion
{SPR_BOM1, 0, 1, {A_Scream}, 0, 0, S_XPLD2}, // S_XPLD1
{SPR_BOM1, 1, 5, {NULL}, 0, 0, S_XPLD3}, // S_XPLD2
{SPR_BOM1, 2, 5, {NULL}, 0, 0, S_XPLD4}, // S_XPLD3
{SPR_BOM1, 3, 5, {NULL}, 0, 0, S_NULL}, // S_XPLD4
{SPR_BOM1, 0, 0, {A_FlickySpawn}, 0, 0, S_XPLD1}, // S_XPLD_FLICKY
{SPR_BOM1, 0, 1, {A_Scream}, 0, 0, S_XPLD2}, // S_XPLD1
{SPR_BOM1, 1, 5, {NULL}, 0, 0, S_XPLD3}, // S_XPLD2
{SPR_BOM1, 2, 5, {NULL}, 0, 0, S_XPLD4}, // S_XPLD3
{SPR_BOM1, 3, 5, {NULL}, 0, 0, S_NULL}, // S_XPLD4
// Underwater Explosion
{SPR_BOM4, 0, 3, {A_Scream}, 0, 0, S_WPLD2}, // S_WPLD1
@ -3007,7 +3008,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
3, // speed
@ -3034,7 +3035,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
3, // speed
@ -3061,7 +3062,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_FISH3, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_FISH4, // xdeathstate
sfx_pop, // deathsound
0, // speed
@ -3088,7 +3089,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
4*FRACUNIT, // speed
@ -3115,7 +3116,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
8*FRACUNIT, // speed
@ -3142,7 +3143,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
6*FRACUNIT, // speed
@ -3169,7 +3170,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
1*FRACUNIT, // speed
@ -3196,7 +3197,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_NULL, // meleestate
S_JETGSHOOT1, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
1*FRACUNIT, // speed
@ -3223,7 +3224,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_dmpain, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
3, // speed
@ -3250,7 +3251,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_DETON16, // xdeathstate
sfx_pop, // deathsound
1*FRACUNIT, // speed
@ -3277,7 +3278,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_SKIM3, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
8, // speed
@ -3331,7 +3332,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_s3k64, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
0, // speed
@ -3358,7 +3359,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_NULL, // meleestate
S_SHARP_AIM1, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_SHARP_SPIN, // xdeathstate
sfx_pop, // deathsound
2, // speed
@ -3385,7 +3386,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
8, // speed
@ -3412,7 +3413,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
FRACUNIT, // speed
@ -3439,7 +3440,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_NULL, // meleestate
S_VULTURE_ZOOM1,// missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
3, // speed
@ -3466,7 +3467,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
5*FRACUNIT, // speed
@ -3520,7 +3521,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_NULL, // meleestate
S_ROBOHOOD_SHOOT, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_ROBOHOOD_JUMP2, // xdeathstate
sfx_pop, // deathsound
0, // speed
@ -3547,7 +3548,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_FACESTABBER_CHARGE1, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
3, // speed
@ -3574,7 +3575,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_EGGGUARD_RUN1, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
6, // speed
@ -3601,7 +3602,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_s3k7b, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_wbreak, // deathsound
3, // speed
@ -3628,7 +3629,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
3, // speed
@ -3655,7 +3656,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_MINUS_DOWNWARD1,// meleestate
S_MINUS_POPUP, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
12, // speed
@ -3682,7 +3683,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_spring, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
6, // speed
@ -3709,7 +3710,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_spring, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
6, // speed
@ -3736,7 +3737,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_XPLD_FLICKY, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
2, // speed

View File

@ -2979,6 +2979,7 @@ typedef enum state
S_SPRK16,
// Robot Explosion
S_XPLD_FLICKY,
S_XPLD1,
S_XPLD2,
S_XPLD3,

View File

@ -10356,25 +10356,28 @@ void A_FlickySpawn(mobj_t *actor)
if (LUA_CallAction("A_FlickySpawn", actor))
return;
#endif
if (mariomode) // No animals in Mario mode
if (!mapheaderinfo[gamemap-1]) // No mapheader, no shoes, no service.
return;
if (mariomode) // No flickies in Mario mode
return;
if (locvar1 >> 16) {
A_Scream(actor);
A_Scream(actor); // A shortcut for the truly lazy.
locvar1 &= 65535;
}
if (cv_soniccd.value)
locvar1 = MT_SEED;
locvar1 = MT_SEED; // MT_CDSEED
else if (!locvar1) {
if (!mapheaderinfo[gamemap-1]->numAnimals)
if (!mapheaderinfo[gamemap-1]->numFlickies)
return;
else {
INT32 prandom = P_RandomKey(mapheaderinfo[gamemap-1]->numAnimals);
locvar1 = mapheaderinfo[gamemap-1]->animals[prandom];
INT32 prandom = P_RandomKey(mapheaderinfo[gamemap-1]->numFlickies);
locvar1 = mapheaderinfo[gamemap-1]->flickies[prandom];
}
}
if (locvar1 == MT_SEED)
if (locvar1 == MT_SEED) // MT_CDSEED
{
flicky = P_SpawnMobj(actor->x, actor->y, actor->z + (actor->height / 2) - FixedMul(mobjinfo[locvar1].height / 2, actor->scale), locvar1);
flicky->destscale = actor->scale;

View File

@ -2043,7 +2043,6 @@ boolean P_CheckRacers(void)
*/
void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype)
{
mobjtype_t item;
mobj_t *mo;
if (inflictor && (inflictor->type == MT_SHELL || inflictor->type == MT_FIREBALL))
@ -2259,12 +2258,14 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
if (source && target && target->player && source->player)
P_PlayVictorySound(source); // Killer laughs at you. LAUGHS! BWAHAHAHA!
#ifdef OLDANIMALSPAWNING
// Drop stuff.
// This determines the kind of object spawned
// during the death frame of a thing.
/*if (!mariomode // Don't show birds, etc. in Mario Mode Tails 12-23-2001
if (!mariomode // Don't show birds, etc. in Mario Mode Tails 12-23-2001
&& target->flags & MF_ENEMY)
{
mobjtype_t item;
if (cv_soniccd.value)
item = MT_SEED;
else
@ -2332,8 +2333,10 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
mo->destscale = target->scale;
P_SetScale(mo, mo->destscale);
}
else
#endif
// Other death animation effects
else */switch(target->type)
switch(target->type)
{
case MT_BOUNCEPICKUP:
case MT_RAILPICKUP:

View File

@ -223,11 +223,11 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
mapheaderinfo[num]->levelflags = 0;
DEH_WriteUndoline("MENUFLAGS", va("%d", mapheaderinfo[num]->menuflags), UNDO_NONE);
mapheaderinfo[num]->menuflags = 0;
// Animals. Nope, no delfile support here either
if (mapheaderinfo[i]->animals)
Z_Free(mapheaderinfo[i]->animals);
mapheaderinfo[num]->animals = NULL;
mapheaderinfo[num]->numAnimals = 0;
// Flickies. Nope, no delfile support here either
if (mapheaderinfo[num]->flickies)
Z_Free(mapheaderinfo[i]->flickies);
mapheaderinfo[num]->flickies = NULL;
mapheaderinfo[num]->numFlickies = 0;
// TODO grades support for delfile (pfft yeah right)
P_DeleteGrades(num);
// an even further impossibility, delfile custom opts support
@ -246,6 +246,7 @@ void P_AllocMapHeader(INT16 i)
if (!mapheaderinfo[i])
{
mapheaderinfo[i] = Z_Malloc(sizeof(mapheader_t), PU_STATIC, NULL);
mapheaderinfo[i]->flickies = NULL;
mapheaderinfo[i]->grades = NULL;
}
P_ClearSingleMapHeaderInfo(i + 1);