mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-12 22:02:12 +00:00
Merge branch 'master' of http://git.magicalgirl.moe/STJr/SRB2Internal.git into new_coop
# Conflicts: # src/r_things.h
This commit is contained in:
commit
f6670fea76
13 changed files with 308 additions and 824 deletions
|
@ -61,9 +61,6 @@ static void Got_WeaponPref(UINT8 **cp, INT32 playernum);
|
|||
static void Got_Mapcmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum);
|
||||
#ifdef DELFILE
|
||||
static void Got_Delfilecmd(UINT8 **cp, INT32 playernum);
|
||||
#endif
|
||||
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Pause(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Suicide(UINT8 **cp, INT32 playernum);
|
||||
|
@ -115,9 +112,6 @@ static void Command_ResetCamera_f(void);
|
|||
|
||||
static void Command_Addfile(void);
|
||||
static void Command_ListWADS_f(void);
|
||||
#ifdef DELFILE
|
||||
static void Command_Delfile(void);
|
||||
#endif
|
||||
static void Command_RunSOC(void);
|
||||
static void Command_Pause(void);
|
||||
static void Command_Suicide(void);
|
||||
|
@ -403,7 +397,7 @@ const char *netxcmdnames[MAXNETXCMD - 1] =
|
|||
"RANDOMSEED",
|
||||
"RUNSOC",
|
||||
"REQADDFILE",
|
||||
"DELFILE",
|
||||
"DELFILE", // replace next time we add an XD
|
||||
"SETMOTD",
|
||||
"SUICIDE",
|
||||
#ifdef HAVE_BLUA
|
||||
|
@ -429,9 +423,6 @@ void D_RegisterServerCommands(void)
|
|||
RegisterNetXCmd(XD_EXITLEVEL, Got_ExitLevelcmd);
|
||||
RegisterNetXCmd(XD_ADDFILE, Got_Addfilecmd);
|
||||
RegisterNetXCmd(XD_REQADDFILE, Got_RequestAddfilecmd);
|
||||
#ifdef DELFILE
|
||||
RegisterNetXCmd(XD_DELFILE, Got_Delfilecmd);
|
||||
#endif
|
||||
RegisterNetXCmd(XD_PAUSE, Got_Pause);
|
||||
RegisterNetXCmd(XD_SUICIDE, Got_Suicide);
|
||||
RegisterNetXCmd(XD_RUNSOC, Got_RunSOCcmd);
|
||||
|
@ -465,9 +456,6 @@ void D_RegisterServerCommands(void)
|
|||
COM_AddCommand("addfile", Command_Addfile);
|
||||
COM_AddCommand("listwad", Command_ListWADS_f);
|
||||
|
||||
#ifdef DELFILE
|
||||
COM_AddCommand("delfile", Command_Delfile);
|
||||
#endif
|
||||
COM_AddCommand("runsoc", Command_RunSOC);
|
||||
COM_AddCommand("pause", Command_Pause);
|
||||
COM_AddCommand("suicide", Command_Suicide);
|
||||
|
@ -3114,42 +3102,6 @@ static void Command_Addfile(void)
|
|||
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);
|
||||
}
|
||||
|
||||
#ifdef DELFILE
|
||||
/** removes the last added pwad at runtime.
|
||||
* Searches for sounds, maps, music and images to remove
|
||||
*/
|
||||
static void Command_Delfile(void)
|
||||
{
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
CONS_Printf(M_GetText("You must NOT be in a level to use this.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (netgame && !(server || adminplayer == consoleplayer))
|
||||
{
|
||||
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (numwadfiles <= mainwads)
|
||||
{
|
||||
CONS_Printf(M_GetText("No additional WADs are loaded.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(netgame || multiplayer))
|
||||
{
|
||||
P_DelWadFile();
|
||||
if (mainwads == numwadfiles && modifiedgame)
|
||||
modifiedgame = false;
|
||||
return;
|
||||
}
|
||||
|
||||
SendNetXCmd(XD_DELFILE, NULL, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
char filename[241];
|
||||
|
@ -3224,33 +3176,6 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
|
|||
COM_BufAddText(va("addfile %s\n", filename));
|
||||
}
|
||||
|
||||
#ifdef DELFILE
|
||||
static void Got_Delfilecmd(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
if (playernum != serverplayer && playernum != adminplayer)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal delfile command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
(void)cp;
|
||||
|
||||
if (numwadfiles <= mainwads) //sanity
|
||||
return;
|
||||
|
||||
P_DelWadFile();
|
||||
if (mainwads == numwadfiles && modifiedgame)
|
||||
modifiedgame = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
char filename[241];
|
||||
|
|
|
@ -136,7 +136,7 @@ typedef enum
|
|||
XD_RANDOMSEED, // 15
|
||||
XD_RUNSOC, // 16
|
||||
XD_REQADDFILE, // 17
|
||||
XD_DELFILE, // 18
|
||||
XD_DELFILE, // 18 - replace next time we add an XD
|
||||
XD_SETMOTD, // 19
|
||||
XD_SUICIDE, // 20
|
||||
#ifdef HAVE_BLUA
|
||||
|
|
315
src/dehacked.c
315
src/dehacked.c
|
@ -78,97 +78,6 @@ static int dbg_line;
|
|||
|
||||
static boolean gamedataadded = false;
|
||||
|
||||
#ifdef DELFILE
|
||||
typedef struct undehacked_s
|
||||
{
|
||||
char *undata;
|
||||
struct undehacked_s *next;
|
||||
} undehacked_t;
|
||||
|
||||
static UINT16 unsocwad;
|
||||
static undehacked_t *unsocdata[MAX_WADFILES];
|
||||
static boolean disableundo = false;
|
||||
|
||||
void DEH_WriteUndoline(const char *value, const char *data, undotype_f flags)
|
||||
{
|
||||
const char *eqstr = " = ";
|
||||
const char *space = " ";
|
||||
const char *pader = eqstr;
|
||||
undehacked_t *newdata;
|
||||
|
||||
if (disableundo || !unsocwad)
|
||||
return;
|
||||
|
||||
if ((newdata = malloc(sizeof(*newdata))) == NULL)
|
||||
I_Error("Out of memory for unsoc line");
|
||||
|
||||
if (flags & UNDO_SPACE)
|
||||
pader = space;
|
||||
|
||||
if (flags & UNDO_ENDTEXT && !data)
|
||||
data = space;
|
||||
|
||||
if (value)
|
||||
{
|
||||
const size_t plen = strlen(pader);
|
||||
const char *pound = "#";
|
||||
char *undata = NULL;
|
||||
const size_t elen = strlen(pound);
|
||||
size_t vlen = strlen(value), dlen = 0, len = 1;
|
||||
|
||||
if (*(value+vlen-1) == '\n')
|
||||
vlen--; // lnet not copy the ending \n
|
||||
|
||||
if (flags & UNDO_ENDTEXT)
|
||||
len += elen; // let malloc more space
|
||||
|
||||
if (flags & UNDO_NEWLINE)
|
||||
len++; // more space for the beginning \n
|
||||
|
||||
if (data)
|
||||
{
|
||||
dlen = strlen(data);
|
||||
if (flags & UNDO_CUTLINE && *(data+dlen-1) == '\n')
|
||||
dlen--; // let not copy the ending \n
|
||||
newdata->undata = malloc(vlen+plen+dlen+len);
|
||||
newdata->undata[vlen+plen+dlen+len-1] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
newdata->undata = malloc(vlen+len);
|
||||
newdata->undata[vlen+len-1] = '\0';
|
||||
}
|
||||
|
||||
if (newdata->undata)
|
||||
{
|
||||
undata = newdata->undata;
|
||||
*undata = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
free(newdata);
|
||||
I_Error("Out of memory for unsoc data");
|
||||
}
|
||||
|
||||
if (flags & UNDO_NEWLINE) // let start with \n
|
||||
strcat(undata, "\n");
|
||||
|
||||
strncat(undata, value, vlen);
|
||||
|
||||
if (data) // value+pader+data
|
||||
strncat(strncat(undata, pader, plen), data, dlen);
|
||||
|
||||
if (flags & UNDO_ENDTEXT) // let end the text
|
||||
strncat(undata, pound, elen);
|
||||
}
|
||||
else
|
||||
newdata->undata = NULL;
|
||||
|
||||
newdata->next = unsocdata[unsocwad];
|
||||
unsocdata[unsocwad] = newdata;
|
||||
}
|
||||
#endif
|
||||
|
||||
ATTRINLINE static FUNCINLINE char myfget_color(MYFILE *f)
|
||||
{
|
||||
char c = *f->curpos++;
|
||||
|
@ -408,8 +317,6 @@ static void readPlayer(MYFILE *f, INT32 num)
|
|||
INT32 i;
|
||||
boolean slotfound = false;
|
||||
|
||||
DEH_WriteUndoline("PLAYERTEXT", description[num].notes, UNDO_ENDTEXT);
|
||||
|
||||
do
|
||||
{
|
||||
if (myfgets(s, MAXLINELEN, f))
|
||||
|
@ -478,7 +385,6 @@ static void readPlayer(MYFILE *f, INT32 num)
|
|||
{
|
||||
if (!slotfound && (slotfound = findFreeSlot(&num)) == false)
|
||||
goto done;
|
||||
DEH_WriteUndoline(word, &description[num].picname[0], UNDO_NONE);
|
||||
|
||||
strncpy(description[num].picname, word2, 8);
|
||||
}
|
||||
|
@ -493,7 +399,7 @@ static void readPlayer(MYFILE *f, INT32 num)
|
|||
*/
|
||||
if (i && !slotfound && (slotfound = findFreeSlot(&num)) == false)
|
||||
goto done;
|
||||
DEH_WriteUndoline(word, va("%d", description[num].used), UNDO_NONE);
|
||||
|
||||
description[num].used = (!!i);
|
||||
}
|
||||
else if (fastcmp(word, "SKINNAME"))
|
||||
|
@ -501,7 +407,6 @@ static void readPlayer(MYFILE *f, INT32 num)
|
|||
// Send to free slot.
|
||||
if (!slotfound && (slotfound = findFreeSlot(&num)) == false)
|
||||
goto done;
|
||||
DEH_WriteUndoline(word, description[num].skinname, UNDO_NONE);
|
||||
|
||||
strlcpy(description[num].skinname, word2, sizeof description[num].skinname);
|
||||
strlwr(description[num].skinname);
|
||||
|
@ -511,11 +416,6 @@ static void readPlayer(MYFILE *f, INT32 num)
|
|||
}
|
||||
} while (!myfeof(f)); // finish when the line is empty
|
||||
|
||||
#ifdef DELFILE
|
||||
if (slotfound)
|
||||
DEH_WriteUndoline("MENUPOSITION", va("%d", num), UNDO_NONE);
|
||||
#endif
|
||||
|
||||
done:
|
||||
Z_Free(s);
|
||||
}
|
||||
|
@ -653,122 +553,98 @@ static void readthing(MYFILE *f, INT32 num)
|
|||
|
||||
if (fastcmp(word, "MAPTHINGNUM") || fastcmp(word, "DOOMEDNUM"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].doomednum), UNDO_NONE);
|
||||
mobjinfo[num].doomednum = (INT32)atoi(word2);
|
||||
}
|
||||
else if (fastcmp(word, "SPAWNSTATE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].spawnstate), UNDO_NONE);
|
||||
mobjinfo[num].spawnstate = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "SPAWNHEALTH"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].spawnhealth), UNDO_NONE);
|
||||
mobjinfo[num].spawnhealth = (INT32)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "SEESTATE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].seestate), UNDO_NONE);
|
||||
mobjinfo[num].seestate = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "SEESOUND"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].seesound), UNDO_NONE);
|
||||
mobjinfo[num].seesound = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "REACTIONTIME"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].reactiontime), UNDO_NONE);
|
||||
mobjinfo[num].reactiontime = (INT32)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "ATTACKSOUND"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].attacksound), UNDO_NONE);
|
||||
mobjinfo[num].attacksound = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "PAINSTATE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].painstate), UNDO_NONE);
|
||||
mobjinfo[num].painstate = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "PAINCHANCE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].painchance), UNDO_NONE);
|
||||
mobjinfo[num].painchance = (INT32)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "PAINSOUND"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].painsound), UNDO_NONE);
|
||||
mobjinfo[num].painsound = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "MELEESTATE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].meleestate), UNDO_NONE);
|
||||
mobjinfo[num].meleestate = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "MISSILESTATE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].missilestate), UNDO_NONE);
|
||||
mobjinfo[num].missilestate = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "DEATHSTATE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].deathstate), UNDO_NONE);
|
||||
mobjinfo[num].deathstate = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "DEATHSOUND"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].deathsound), UNDO_NONE);
|
||||
mobjinfo[num].deathsound = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "XDEATHSTATE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].xdeathstate), UNDO_NONE);
|
||||
mobjinfo[num].xdeathstate = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "SPEED"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].speed), UNDO_NONE);
|
||||
mobjinfo[num].speed = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "RADIUS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].radius), UNDO_NONE);
|
||||
mobjinfo[num].radius = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "HEIGHT"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].height), UNDO_NONE);
|
||||
mobjinfo[num].height = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "DISPOFFSET"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].dispoffset), UNDO_NONE);
|
||||
mobjinfo[num].dispoffset = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "MASS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].mass), UNDO_NONE);
|
||||
mobjinfo[num].mass = (INT32)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "DAMAGE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].damage), UNDO_NONE);
|
||||
mobjinfo[num].damage = (INT32)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "ACTIVESOUND"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].activesound), UNDO_NONE);
|
||||
mobjinfo[num].activesound = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "FLAGS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].flags), UNDO_NONE);
|
||||
mobjinfo[num].flags = (INT32)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "RAISESTATE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", mobjinfo[num].raisestate), UNDO_NONE);
|
||||
mobjinfo[num].raisestate = get_number(word2);
|
||||
}
|
||||
else
|
||||
|
@ -812,37 +688,30 @@ static void readlight(MYFILE *f, INT32 num)
|
|||
|
||||
if (fastcmp(word, "TYPE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", lspr[num].type), UNDO_NONE);
|
||||
lspr[num].type = (UINT16)value;
|
||||
}
|
||||
else if (fastcmp(word, "OFFSETX"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%f", lspr[num].light_xoffset), UNDO_NONE);
|
||||
lspr[num].light_xoffset = fvalue;
|
||||
}
|
||||
else if (fastcmp(word, "OFFSETY"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%f", lspr[num].light_yoffset), UNDO_NONE);
|
||||
lspr[num].light_yoffset = fvalue;
|
||||
}
|
||||
else if (fastcmp(word, "CORONACOLOR"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", lspr[num].corona_color), UNDO_NONE);
|
||||
lspr[num].corona_color = value;
|
||||
}
|
||||
else if (fastcmp(word, "CORONARADIUS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%f", lspr[num].corona_radius), UNDO_NONE);
|
||||
lspr[num].corona_radius = fvalue;
|
||||
}
|
||||
else if (fastcmp(word, "DYNAMICCOLOR"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", lspr[num].dynamic_color), UNDO_NONE);
|
||||
lspr[num].dynamic_color = value;
|
||||
}
|
||||
else if (fastcmp(word, "DYNAMICRADIUS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%f", lspr[num].dynamic_radius), UNDO_NONE);
|
||||
lspr[num].dynamic_radius = fvalue;
|
||||
|
||||
/// \note Update the sqrradius! unnecessary?
|
||||
|
@ -889,7 +758,6 @@ static void readspritelight(MYFILE *f, INT32 num)
|
|||
INT32 oldvar;
|
||||
for (oldvar = 0; t_lspr[num] != &lspr[oldvar]; oldvar++)
|
||||
;
|
||||
DEH_WriteUndoline(word, va("%d", oldvar), UNDO_NONE);
|
||||
t_lspr[num] = &lspr[value];
|
||||
}
|
||||
else
|
||||
|
@ -972,8 +840,6 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
INT32 i;
|
||||
|
||||
// Reset all previous map header information
|
||||
// This call automatically saves all previous information when DELFILE is defined.
|
||||
// We don't need to do it ourselves.
|
||||
P_AllocMapHeader((INT16)(num-1));
|
||||
|
||||
do
|
||||
|
@ -1399,8 +1265,6 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
|
|||
UINT16 usi;
|
||||
UINT8 picid;
|
||||
|
||||
DEH_WriteUndoline("SCENETEXT", cutscenes[num]->scene[scenenum].text, UNDO_ENDTEXT);
|
||||
|
||||
do
|
||||
{
|
||||
if (myfgets(s, MAXLINELEN, f))
|
||||
|
@ -1477,7 +1341,6 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
|
|||
|
||||
if (fastcmp(word, "NUMBEROFPICS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", cutscenes[num]->scene[scenenum].numpics), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].numpics = (UINT8)i;
|
||||
}
|
||||
else if (fastncmp(word, "PIC", 3))
|
||||
|
@ -1492,27 +1355,22 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
|
|||
|
||||
if (fastcmp(word+4, "NAME"))
|
||||
{
|
||||
DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].picname[picid], UNDO_NONE);
|
||||
strncpy(cutscenes[num]->scene[scenenum].picname[picid], word2, 8);
|
||||
}
|
||||
else if (fastcmp(word+4, "HIRES"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", cutscenes[num]->scene[scenenum].pichires[picid]), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].pichires[picid] = (UINT8)(i || word2[0] == 'T' || word2[0] == 'Y');
|
||||
}
|
||||
else if (fastcmp(word+4, "DURATION"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].picduration[picid]), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].picduration[picid] = usi;
|
||||
}
|
||||
else if (fastcmp(word+4, "XCOORD"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].xcoord[picid]), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].xcoord[picid] = usi;
|
||||
}
|
||||
else if (fastcmp(word+4, "YCOORD"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].ycoord[picid]), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].ycoord[picid] = usi;
|
||||
}
|
||||
else
|
||||
|
@ -1520,14 +1378,12 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
|
|||
}
|
||||
else if (fastcmp(word, "MUSIC"))
|
||||
{
|
||||
DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].musswitch, UNDO_NONE);
|
||||
strncpy(cutscenes[num]->scene[scenenum].musswitch, word2, 7);
|
||||
cutscenes[num]->scene[scenenum].musswitch[6] = 0;
|
||||
}
|
||||
#ifdef MUSICSLOT_COMPATIBILITY
|
||||
else if (fastcmp(word, "MUSICSLOT"))
|
||||
{
|
||||
DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].musswitch, UNDO_NONE);
|
||||
i = get_mus(word2, true);
|
||||
if (i && i <= 1035)
|
||||
snprintf(cutscenes[num]->scene[scenenum].musswitch, 7, "%sM", G_BuildMapName(i));
|
||||
|
@ -1540,37 +1396,30 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum)
|
|||
#endif
|
||||
else if (fastcmp(word, "MUSICTRACK"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].musswitchflags), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK;
|
||||
}
|
||||
else if (fastcmp(word, "MUSICLOOP"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].musicloop), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].musicloop = (UINT8)(i || word2[0] == 'T' || word2[0] == 'Y');
|
||||
}
|
||||
else if (fastcmp(word, "TEXTXPOS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].textxpos), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].textxpos = usi;
|
||||
}
|
||||
else if (fastcmp(word, "TEXTYPOS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].textypos), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].textypos = usi;
|
||||
}
|
||||
else if (fastcmp(word, "FADEINID"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].fadenum), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].fadeinid = (UINT8)i;
|
||||
}
|
||||
else if (fastcmp(word, "FADEOUTID"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].fadenum), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].fadeoutid = (UINT8)i;
|
||||
}
|
||||
else if (fastcmp(word, "FADECOLOR"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].fadenum), UNDO_NONE);
|
||||
cutscenes[num]->scene[scenenum].fadecolor = (UINT8)i;
|
||||
}
|
||||
else
|
||||
|
@ -1588,9 +1437,6 @@ static void readcutscene(MYFILE *f, INT32 num)
|
|||
char *word2;
|
||||
char *tmp;
|
||||
INT32 value;
|
||||
#ifdef DELFILE
|
||||
const INT32 oldnumscenes = cutscenes[num]->numscenes;
|
||||
#endif
|
||||
|
||||
// Allocate memory for this cutscene if we don't yet have any
|
||||
if (!cutscenes[num])
|
||||
|
@ -1633,8 +1479,6 @@ static void readcutscene(MYFILE *f, INT32 num)
|
|||
if (1 <= value && value <= 128)
|
||||
{
|
||||
readcutscenescene(f, num, value - 1);
|
||||
DEH_WriteUndoline(word, word2, UNDO_SPACE|UNDO_CUTLINE);
|
||||
DEH_WriteUndoline("NUMSCENES", va("%d", oldnumscenes), UNDO_SPACE);
|
||||
}
|
||||
else
|
||||
deh_warning("Scene number %d out of range (1 - 128)", value);
|
||||
|
@ -1687,12 +1531,10 @@ static void readhuditem(MYFILE *f, INT32 num)
|
|||
|
||||
if (fastcmp(word, "X"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", hudinfo[num].x), UNDO_NONE);
|
||||
hudinfo[num].x = i;
|
||||
}
|
||||
else if (fastcmp(word, "Y"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", hudinfo[num].y), UNDO_NONE);
|
||||
hudinfo[num].y = i;
|
||||
}
|
||||
else
|
||||
|
@ -1977,32 +1819,26 @@ static void readframe(MYFILE *f, INT32 num)
|
|||
|
||||
if (fastcmp(word1, "SPRITENUMBER") || fastcmp(word1, "SPRITENAME"))
|
||||
{
|
||||
DEH_WriteUndoline(word1, va("%u", states[num].sprite), UNDO_NONE);
|
||||
states[num].sprite = get_sprite(word2);
|
||||
}
|
||||
else if (fastcmp(word1, "SPRITESUBNUMBER") || fastcmp(word1, "SPRITEFRAME"))
|
||||
{
|
||||
DEH_WriteUndoline(word1, va("%d", states[num].frame), UNDO_NONE);
|
||||
states[num].frame = (INT32)get_number(word2); // So the FF_ flags get calculated
|
||||
}
|
||||
else if (fastcmp(word1, "DURATION"))
|
||||
{
|
||||
DEH_WriteUndoline(word1, va("%u", states[num].tics), UNDO_NONE);
|
||||
states[num].tics = (INT32)get_number(word2); // So TICRATE can be used
|
||||
}
|
||||
else if (fastcmp(word1, "NEXT"))
|
||||
{
|
||||
DEH_WriteUndoline(word1, va("%d", states[num].nextstate), UNDO_NONE);
|
||||
states[num].nextstate = get_state(word2);
|
||||
}
|
||||
else if (fastcmp(word1, "VAR1"))
|
||||
{
|
||||
DEH_WriteUndoline(word1, va("%d", states[num].var1), UNDO_NONE);
|
||||
states[num].var1 = (INT32)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word1, "VAR2"))
|
||||
{
|
||||
DEH_WriteUndoline(word1, va("%d", states[num].var2), UNDO_NONE);
|
||||
states[num].var2 = (INT32)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word1, "ACTION"))
|
||||
|
@ -2027,10 +1863,7 @@ static void readframe(MYFILE *f, INT32 num)
|
|||
for (z = 0; actionpointers[z].name; z++)
|
||||
{
|
||||
if (actionpointers[z].action.acv == states[num].action.acv)
|
||||
{
|
||||
DEH_WriteUndoline(word1, actionpointers[z].name, UNDO_NONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
z = 0;
|
||||
|
@ -2100,17 +1933,14 @@ static void readsound(MYFILE *f, INT32 num)
|
|||
|
||||
if (fastcmp(word, "SINGULAR"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", S_sfx[num].singularity), UNDO_NONE);
|
||||
S_sfx[num].singularity = value;
|
||||
}
|
||||
else if (fastcmp(word, "PRIORITY"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", S_sfx[num].priority), UNDO_NONE);
|
||||
S_sfx[num].priority = value;
|
||||
}
|
||||
else if (fastcmp(word, "FLAGS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", S_sfx[num].pitch), UNDO_NONE);
|
||||
S_sfx[num].pitch = value;
|
||||
}
|
||||
else if (fastcmp(word, "CAPTION") || fastcmp(word, "DESCRIPTION"))
|
||||
|
@ -2154,11 +1984,7 @@ static boolean GoodDataFileName(const char *s)
|
|||
p = s + strlen(s) - strlen(tail);
|
||||
if (p <= s) return false; // too short
|
||||
if (!fasticmp(p, tail)) return false; // doesn't end in .dat
|
||||
#ifdef DELFILE
|
||||
if (fasticmp(s, "gamedata.dat") && !disableundo) return false;
|
||||
#else
|
||||
if (fasticmp(s, "gamedata.dat")) return false;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2171,17 +1997,6 @@ static void reademblemdata(MYFILE *f, INT32 num)
|
|||
char *tmp;
|
||||
INT32 value;
|
||||
|
||||
// Reset all data initially
|
||||
DEH_WriteUndoline("TYPE", va("%d", emblemlocations[num-1].type), UNDO_NONE);
|
||||
DEH_WriteUndoline("X", va("%d", emblemlocations[num-1].x), UNDO_NONE);
|
||||
DEH_WriteUndoline("Y", va("%d", emblemlocations[num-1].y), UNDO_NONE);
|
||||
DEH_WriteUndoline("Z", va("%d", emblemlocations[num-1].z), UNDO_NONE);
|
||||
DEH_WriteUndoline("MAPNUM", va("%d", emblemlocations[num-1].level), UNDO_NONE);
|
||||
DEH_WriteUndoline("VAR", va("%d", emblemlocations[num-1].var), UNDO_NONE);
|
||||
DEH_WriteUndoline("SPRITE", va("%d", emblemlocations[num-1].sprite), UNDO_NONE);
|
||||
DEH_WriteUndoline("COLOR", va("%d", emblemlocations[num-1].color), UNDO_NONE);
|
||||
DEH_WriteUndoline("HINT", extraemblems[num-1].hint, UNDO_NONE);
|
||||
|
||||
memset(&emblemlocations[num-1], 0, sizeof(emblem_t));
|
||||
|
||||
do
|
||||
|
@ -2317,13 +2132,6 @@ static void readextraemblemdata(MYFILE *f, INT32 num)
|
|||
char *tmp;
|
||||
INT32 value;
|
||||
|
||||
// Reset all data initially
|
||||
DEH_WriteUndoline("NAME", extraemblems[num-1].name, UNDO_NONE);
|
||||
DEH_WriteUndoline("OBJECTIVE", extraemblems[num-1].description, UNDO_NONE);
|
||||
DEH_WriteUndoline("CONDITIONSET", va("%d", extraemblems[num-1].conditionset), UNDO_NONE);
|
||||
DEH_WriteUndoline("SPRITE", va("%d", extraemblems[num-1].sprite), UNDO_NONE);
|
||||
DEH_WriteUndoline("COLOR", va("%d", extraemblems[num-1].color), UNDO_NONE);
|
||||
|
||||
memset(&extraemblems[num-1], 0, sizeof(extraemblem_t));
|
||||
|
||||
do
|
||||
|
@ -2398,16 +2206,6 @@ static void readunlockable(MYFILE *f, INT32 num)
|
|||
char *tmp;
|
||||
INT32 i;
|
||||
|
||||
// Same deal with unlockables, clear all first
|
||||
DEH_WriteUndoline("NAME", unlockables[num].name, UNDO_NONE);
|
||||
DEH_WriteUndoline("OBJECTIVE", unlockables[num].objective, UNDO_NONE);
|
||||
DEH_WriteUndoline("HEIGHT", va("%d", unlockables[num].height), UNDO_NONE);
|
||||
DEH_WriteUndoline("CONDITIONSET", va("%d", unlockables[num].conditionset), UNDO_NONE);
|
||||
DEH_WriteUndoline("TYPE", va("%d", unlockables[num].type), UNDO_NONE);
|
||||
DEH_WriteUndoline("NOCECHO", va("%d", unlockables[num].nocecho), UNDO_NONE);
|
||||
DEH_WriteUndoline("NOCHECKLIST", va("%d", unlockables[num].nochecklist), UNDO_NONE);
|
||||
DEH_WriteUndoline("VAR", va("%d", unlockables[num].variable), UNDO_NONE);
|
||||
|
||||
memset(&unlockables[num], 0, sizeof(unlockable_t));
|
||||
unlockables[num].objective[0] = '/';
|
||||
|
||||
|
@ -2802,7 +2600,6 @@ static void readmaincfg(MYFILE *f)
|
|||
else
|
||||
value = get_number(word2);
|
||||
|
||||
DEH_WriteUndoline(word, va("%d", spstage_start), UNDO_NONE);
|
||||
spstage_start = (INT16)value;
|
||||
}
|
||||
else if (fastcmp(word, "SSTAGE_START"))
|
||||
|
@ -2816,79 +2613,64 @@ static void readmaincfg(MYFILE *f)
|
|||
else
|
||||
value = get_number(word2);
|
||||
|
||||
DEH_WriteUndoline(word, va("%d", sstage_start), UNDO_NONE);
|
||||
sstage_start = (INT16)value;
|
||||
sstage_end = (INT16)(sstage_start+6); // 7 special stages total
|
||||
}
|
||||
else if (fastcmp(word, "USENIGHTSSS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", useNightsSS), UNDO_NONE);
|
||||
useNightsSS = (UINT8)(value || word2[0] == 'T' || word2[0] == 'Y');
|
||||
}
|
||||
else if (fastcmp(word, "REDTEAM"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", skincolor_redteam), UNDO_NONE);
|
||||
skincolor_redteam = (UINT8)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "BLUETEAM"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", skincolor_blueteam), UNDO_NONE);
|
||||
skincolor_blueteam = (UINT8)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "REDRING"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", skincolor_redring), UNDO_NONE);
|
||||
skincolor_redring = (UINT8)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "BLUERING"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", skincolor_bluering), UNDO_NONE);
|
||||
skincolor_bluering = (UINT8)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "INVULNTICS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", invulntics), UNDO_NONE);
|
||||
invulntics = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "SNEAKERTICS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", sneakertics), UNDO_NONE);
|
||||
sneakertics = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "FLASHINGTICS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", flashingtics), UNDO_NONE);
|
||||
flashingtics = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "TAILSFLYTICS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", tailsflytics), UNDO_NONE);
|
||||
tailsflytics = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "UNDERWATERTICS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", underwatertics), UNDO_NONE);
|
||||
underwatertics = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "SPACETIMETICS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", spacetimetics), UNDO_NONE);
|
||||
spacetimetics = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "EXTRALIFETICS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", extralifetics), UNDO_NONE);
|
||||
extralifetics = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "GAMEOVERTICS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", gameovertics), UNDO_NONE);
|
||||
gameovertics = get_number(word2);
|
||||
}
|
||||
|
||||
else if (fastcmp(word, "INTROTOPLAY"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", introtoplay), UNDO_NONE);
|
||||
introtoplay = (UINT8)get_number(word2);
|
||||
// range check, you morons.
|
||||
if (introtoplay > 128)
|
||||
|
@ -2896,17 +2678,14 @@ static void readmaincfg(MYFILE *f)
|
|||
}
|
||||
else if (fastcmp(word, "LOOPTITLE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", looptitle), UNDO_NONE);
|
||||
looptitle = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y');
|
||||
}
|
||||
else if (fastcmp(word, "TITLESCROLLSPEED"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", titlescrollspeed), UNDO_NONE);
|
||||
titlescrollspeed = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "CREDITSCUTSCENE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", creditscutscene), UNDO_NONE);
|
||||
creditscutscene = (UINT8)get_number(word2);
|
||||
// range check, you morons.
|
||||
if (creditscutscene > 128)
|
||||
|
@ -2914,32 +2693,26 @@ static void readmaincfg(MYFILE *f)
|
|||
}
|
||||
else if (fastcmp(word, "DISABLESPEEDADJUST"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", disableSpeedAdjust), UNDO_NONE);
|
||||
disableSpeedAdjust = (UINT8)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "NUMDEMOS"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", numDemos), UNDO_NONE);
|
||||
numDemos = (UINT8)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "DEMODELAYTIME"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", demoDelayTime), UNDO_NONE);
|
||||
demoDelayTime = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "DEMOIDLETIME"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", demoIdleTime), UNDO_NONE);
|
||||
demoIdleTime = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "USE1UPSOUND"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", use1upSound), UNDO_NONE);
|
||||
use1upSound = (UINT8)(value || word2[0] == 'T' || word2[0] == 'Y');
|
||||
}
|
||||
else if (fastcmp(word, "MAXXTRALIFE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%u", maxXtraLife), UNDO_NONE);
|
||||
maxXtraLife = (UINT8)get_number(word2);
|
||||
}
|
||||
|
||||
|
@ -2953,7 +2726,6 @@ static void readmaincfg(MYFILE *f)
|
|||
I_Error("Maincfg: bad data file name '%s'\n", word2);
|
||||
|
||||
G_SaveGameData();
|
||||
DEH_WriteUndoline(word, gamedatafilename, UNDO_NONE);
|
||||
strlcpy(gamedatafilename, word2, sizeof (gamedatafilename));
|
||||
strlwr(gamedatafilename);
|
||||
savemoddata = true;
|
||||
|
@ -2970,12 +2742,10 @@ static void readmaincfg(MYFILE *f)
|
|||
}
|
||||
else if (fastcmp(word, "RESETDATA"))
|
||||
{
|
||||
DEH_WriteUndoline(word, "0", UNDO_TODO); /// \todo
|
||||
P_ResetData(value);
|
||||
}
|
||||
else if (fastcmp(word, "CUSTOMVERSION"))
|
||||
{
|
||||
DEH_WriteUndoline(word, customversionstring, UNDO_NONE);
|
||||
strlcpy(customversionstring, word2, sizeof (customversionstring));
|
||||
}
|
||||
else
|
||||
|
@ -3213,13 +2983,11 @@ static void DEH_LoadDehackedFile(MYFILE *f)
|
|||
else if (fastcmp(word, "MAINCFG"))
|
||||
{
|
||||
readmaincfg(f);
|
||||
DEH_WriteUndoline(word, "", UNDO_HEADER);
|
||||
continue;
|
||||
}
|
||||
else if (fastcmp(word, "WIPES"))
|
||||
{
|
||||
readwipes(f);
|
||||
DEH_WriteUndoline(word, "", UNDO_HEADER);
|
||||
continue;
|
||||
}
|
||||
word2 = strtok(NULL, " ");
|
||||
|
@ -3239,7 +3007,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
|
|||
deh_warning("Character %d out of range (0 - 31)", i);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
continue;
|
||||
}
|
||||
if (word2)
|
||||
|
@ -3248,6 +3015,7 @@ static void DEH_LoadDehackedFile(MYFILE *f)
|
|||
if (word2[strlen(word2)-1] == '\n')
|
||||
word2[strlen(word2)-1] = '\0';
|
||||
i = atoi(word2);
|
||||
|
||||
if (fastcmp(word, "THING") || fastcmp(word, "MOBJ") || fastcmp(word, "OBJECT"))
|
||||
{
|
||||
if (i == 0 && word2[0] != '0') // If word2 isn't a number
|
||||
|
@ -3259,7 +3027,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
|
|||
deh_warning("Thing %d out of range (1 - %d)", i, NUMMOBJTYPES-1);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
else if (fastcmp(word, "LIGHT"))
|
||||
{
|
||||
|
@ -3272,7 +3039,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
|
|||
deh_warning("Light number %d out of range (1 - %d)", i, NUMLIGHTS-1);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
#endif
|
||||
}
|
||||
else if (fastcmp(word, "SPRITE"))
|
||||
|
@ -3287,7 +3053,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
|
|||
deh_warning("Sprite number %d out of range (0 - %d)", i, NUMSPRITES-1);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
#endif
|
||||
}
|
||||
else if (fastcmp(word, "LEVEL"))
|
||||
|
@ -3306,7 +3071,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
|
|||
deh_warning("Level number %d out of range (1 - %d)", i, NUMMAPS);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
else if (fastcmp(word, "CUTSCENE"))
|
||||
{
|
||||
|
@ -3317,7 +3081,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
|
|||
deh_warning("Cutscene number %d out of range (1 - 128)", i);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
else if (fastcmp(word, "FRAME") || fastcmp(word, "STATE"))
|
||||
{
|
||||
|
@ -3330,7 +3093,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
|
|||
deh_warning("Frame %d out of range (0 - %d)", i, NUMSTATES-1);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
else if (fastcmp(word, "SOUND"))
|
||||
{
|
||||
|
@ -3343,7 +3105,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
|
|||
deh_warning("Sound %d out of range (1 - %d)", i, NUMSFX-1);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
else if (fastcmp(word, "HUDITEM"))
|
||||
{
|
||||
|
@ -3356,7 +3117,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
|
|||
deh_warning("HUD item number %d out of range (0 - %d)", i, NUMHUDITEMS-1);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
else if (fastcmp(word, "EMBLEM"))
|
||||
{
|
||||
|
@ -3376,7 +3136,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
|
|||
deh_warning("Emblem number %d out of range (1 - %d)", i, MAXEMBLEMS);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
else if (fastcmp(word, "EXTRAEMBLEM"))
|
||||
{
|
||||
|
@ -3396,7 +3155,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
|
|||
deh_warning("Extra emblem number %d out of range (1 - %d)", i, MAXEXTRAEMBLEMS);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
else if (fastcmp(word, "UNLOCKABLE"))
|
||||
{
|
||||
|
@ -3412,7 +3170,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
|
|||
deh_warning("Unlockable number %d out of range (1 - %d)", i, MAXUNLOCKABLES);
|
||||
ignorelines(f);
|
||||
}
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
else if (fastcmp(word, "CONDITIONSET"))
|
||||
{
|
||||
|
@ -3428,8 +3185,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
|
|||
deh_warning("Condition set number %d out of range (1 - %d)", i, MAXCONDITIONSETS);
|
||||
ignorelines(f);
|
||||
}
|
||||
// no undo support for this insanity yet
|
||||
//DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
// Last I heard this crashes the game if you try to use it
|
||||
// so this is disabled for now
|
||||
|
@ -3439,7 +3194,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
|
|||
INT32 ver = searchvalue(strtok(NULL, "\n"));
|
||||
if (ver != PATCHVERSION)
|
||||
deh_warning("Patch is for SRB2 version %d,\nonly version %d is supported", ver, PATCHVERSION);
|
||||
//DEH_WriteUndoline(word, va("%d", ver), UNDO_NONE);
|
||||
}
|
||||
// Clear all data in certain locations (mostly for unlocks)
|
||||
// Unless you REALLY want to piss people off,
|
||||
|
@ -3510,9 +3264,6 @@ static void DEH_LoadDehackedFile(MYFILE *f)
|
|||
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump)
|
||||
{
|
||||
MYFILE f;
|
||||
#ifdef DELFILE
|
||||
unsocwad = wad;
|
||||
#endif
|
||||
f.wad = wad;
|
||||
f.size = W_LumpLengthPwad(wad, lump);
|
||||
f.data = Z_Malloc(f.size + 1, PU_STATIC, NULL);
|
||||
|
@ -3520,7 +3271,6 @@ void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump)
|
|||
f.curpos = f.data;
|
||||
f.data[f.size] = 0;
|
||||
DEH_LoadDehackedFile(&f);
|
||||
DEH_WriteUndoline(va("# uload for wad: %u, lump: %u", wad, lump), NULL, UNDO_DONE);
|
||||
Z_Free(f.data);
|
||||
}
|
||||
|
||||
|
@ -3529,67 +3279,6 @@ void DEH_LoadDehackedLump(lumpnum_t lumpnum)
|
|||
DEH_LoadDehackedLumpPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum));
|
||||
}
|
||||
|
||||
#ifdef DELFILE
|
||||
#define DUMPUNDONE
|
||||
|
||||
// read (un)dehacked lump in wad's memory
|
||||
void DEH_UnloadDehackedWad(UINT16 wad)
|
||||
{
|
||||
undehacked_t *tmp, *curundo = unsocdata[wad];
|
||||
MYFILE f;
|
||||
size_t len = 0;
|
||||
char *data;
|
||||
#ifdef DUMPUNDONE
|
||||
FILE *UNDO = fopen("undo.soc", "wt");
|
||||
#endif
|
||||
CONS_Printf(M_GetText("Unloading WAD SOC edits\n"));
|
||||
while (curundo)
|
||||
{
|
||||
data = curundo->undata;
|
||||
curundo = curundo->next;
|
||||
if (data)
|
||||
len += strlen(data);
|
||||
len += 1;
|
||||
#ifdef DUMPUNDONE
|
||||
if (UNDO)
|
||||
{
|
||||
if (data)
|
||||
fprintf(UNDO, "%s\n", data);
|
||||
else
|
||||
fprintf(UNDO, "\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifndef DUMPUNDONE
|
||||
if (UNDO) fclose(UNDO);
|
||||
#endif
|
||||
if (!len) return;
|
||||
f.size = len;
|
||||
data = f.data = Z_Malloc(f.size + 1, PU_STATIC, NULL);
|
||||
curundo = unsocdata[wad];
|
||||
unsocdata[wad] = NULL;
|
||||
while (curundo)
|
||||
{
|
||||
tmp = curundo;
|
||||
curundo = curundo->next;
|
||||
if (tmp->undata)
|
||||
data += sprintf(data, "%s\n", tmp->undata);
|
||||
else
|
||||
data += sprintf(data, "\n");
|
||||
if (tmp->undata) free(tmp->undata);
|
||||
free(tmp);
|
||||
}
|
||||
f.wad = wad;
|
||||
f.curpos = f.data;
|
||||
f.data[f.size] = 0;
|
||||
disableundo = true;
|
||||
DEH_LoadDehackedFile(&f);
|
||||
disableundo = false;
|
||||
Z_Free(f.data);
|
||||
}
|
||||
#endif //DELFILE
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// CRAZY LIST OF STATE NAMES AND ALL FROM HERE DOWN
|
||||
// TODO: Make this all a seperate file or something, like part of info.c??
|
||||
|
|
|
@ -27,13 +27,6 @@ typedef enum
|
|||
UNDO_DONE = 0,
|
||||
} undotype_f;
|
||||
|
||||
#ifdef DELFILE
|
||||
void DEH_WriteUndoline(const char *value, const char *data, undotype_f flags);
|
||||
void DEH_UnloadDehackedWad(UINT16 wad);
|
||||
#else // null the undo lines
|
||||
#define DEH_WriteUndoline(a,b,c)
|
||||
#endif
|
||||
|
||||
void DEH_LoadDehackedLump(lumpnum_t lumpnum);
|
||||
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump);
|
||||
|
||||
|
|
|
@ -521,10 +521,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
#define ESLOPE_TYPESHIM
|
||||
#endif
|
||||
|
||||
/// Delete file while the game is running.
|
||||
/// \note EXTREMELY buggy, tends to crash game.
|
||||
//#define DELFILE
|
||||
|
||||
/// Allows the use of devmode in multiplayer. AKA "fishcake"
|
||||
//#define NETGAME_DEVMODE
|
||||
|
||||
|
|
|
@ -199,74 +199,42 @@ void P_DeleteFlickies(INT16 i)
|
|||
static void P_ClearSingleMapHeaderInfo(INT16 i)
|
||||
{
|
||||
const INT16 num = (INT16)(i-1);
|
||||
DEH_WriteUndoline("LEVELNAME", mapheaderinfo[num]->lvlttl, UNDO_NONE);
|
||||
mapheaderinfo[num]->lvlttl[0] = '\0';
|
||||
DEH_WriteUndoline("SELECTHEADING", mapheaderinfo[num]->selectheading, UNDO_NONE);
|
||||
mapheaderinfo[num]->selectheading[0] = '\0';
|
||||
DEH_WriteUndoline("SUBTITLE", mapheaderinfo[num]->subttl, UNDO_NONE);
|
||||
mapheaderinfo[num]->subttl[0] = '\0';
|
||||
DEH_WriteUndoline("ACT", va("%d", mapheaderinfo[num]->actnum), UNDO_NONE);
|
||||
mapheaderinfo[num]->actnum = 0;
|
||||
DEH_WriteUndoline("TYPEOFLEVEL", va("%d", mapheaderinfo[num]->typeoflevel), UNDO_NONE);
|
||||
mapheaderinfo[num]->typeoflevel = 0;
|
||||
DEH_WriteUndoline("NEXTLEVEL", va("%d", mapheaderinfo[num]->nextlevel), UNDO_NONE);
|
||||
mapheaderinfo[num]->nextlevel = (INT16)(i + 1);
|
||||
DEH_WriteUndoline("MUSIC", mapheaderinfo[num]->musname, UNDO_NONE);
|
||||
snprintf(mapheaderinfo[num]->musname, 7, "%sM", G_BuildMapName(i));
|
||||
mapheaderinfo[num]->musname[6] = 0;
|
||||
DEH_WriteUndoline("MUSICTRACK", va("%d", mapheaderinfo[num]->mustrack), UNDO_NONE);
|
||||
mapheaderinfo[num]->mustrack = 0;
|
||||
DEH_WriteUndoline("FORCECHARACTER", va("%d", mapheaderinfo[num]->forcecharacter), UNDO_NONE);
|
||||
mapheaderinfo[num]->forcecharacter[0] = '\0';
|
||||
DEH_WriteUndoline("WEATHER", va("%d", mapheaderinfo[num]->weather), UNDO_NONE);
|
||||
mapheaderinfo[num]->weather = 0;
|
||||
DEH_WriteUndoline("SKYNUM", va("%d", mapheaderinfo[num]->skynum), UNDO_NONE);
|
||||
mapheaderinfo[num]->skynum = 1;
|
||||
DEH_WriteUndoline("SKYBOXSCALEX", va("%d", mapheaderinfo[num]->skybox_scalex), UNDO_NONE);
|
||||
mapheaderinfo[num]->skybox_scalex = 16;
|
||||
DEH_WriteUndoline("SKYBOXSCALEY", va("%d", mapheaderinfo[num]->skybox_scaley), UNDO_NONE);
|
||||
mapheaderinfo[num]->skybox_scaley = 16;
|
||||
DEH_WriteUndoline("SKYBOXSCALEZ", va("%d", mapheaderinfo[num]->skybox_scalez), UNDO_NONE);
|
||||
mapheaderinfo[num]->skybox_scalez = 16;
|
||||
DEH_WriteUndoline("INTERSCREEN", mapheaderinfo[num]->interscreen, UNDO_NONE);
|
||||
mapheaderinfo[num]->interscreen[0] = '#';
|
||||
DEH_WriteUndoline("RUNSOC", mapheaderinfo[num]->runsoc, UNDO_NONE);
|
||||
mapheaderinfo[num]->runsoc[0] = '#';
|
||||
DEH_WriteUndoline("SCRIPTNAME", mapheaderinfo[num]->scriptname, UNDO_NONE);
|
||||
mapheaderinfo[num]->scriptname[0] = '#';
|
||||
DEH_WriteUndoline("PRECUTSCENENUM", va("%d", mapheaderinfo[num]->precutscenenum), UNDO_NONE);
|
||||
mapheaderinfo[num]->precutscenenum = 0;
|
||||
DEH_WriteUndoline("CUTSCENENUM", va("%d", mapheaderinfo[num]->cutscenenum), UNDO_NONE);
|
||||
mapheaderinfo[num]->cutscenenum = 0;
|
||||
DEH_WriteUndoline("COUNTDOWN", va("%d", mapheaderinfo[num]->countdown), UNDO_NONE);
|
||||
mapheaderinfo[num]->countdown = 0;
|
||||
DEH_WriteUndoline("PALLETE", va("%u", mapheaderinfo[num]->palette), UNDO_NONE);
|
||||
mapheaderinfo[num]->palette = UINT16_MAX;
|
||||
DEH_WriteUndoline("NUMLAPS", va("%u", mapheaderinfo[num]->numlaps), UNDO_NONE);
|
||||
mapheaderinfo[num]->numlaps = NUMLAPS_DEFAULT;
|
||||
DEH_WriteUndoline("UNLOCKABLE", va("%s", mapheaderinfo[num]->unlockrequired), UNDO_NONE);
|
||||
mapheaderinfo[num]->unlockrequired = -1;
|
||||
DEH_WriteUndoline("LEVELSELECT", va("%d", mapheaderinfo[num]->levelselect), UNDO_NONE);
|
||||
mapheaderinfo[num]->levelselect = 0;
|
||||
DEH_WriteUndoline("BONUSTYPE", va("%d", mapheaderinfo[num]->bonustype), UNDO_NONE);
|
||||
mapheaderinfo[num]->bonustype = 0;
|
||||
DEH_WriteUndoline("LEVELFLAGS", va("%d", mapheaderinfo[num]->levelflags), UNDO_NONE);
|
||||
mapheaderinfo[num]->levelflags = 0;
|
||||
DEH_WriteUndoline("MENUFLAGS", va("%d", mapheaderinfo[num]->menuflags), UNDO_NONE);
|
||||
mapheaderinfo[num]->menuflags = 0;
|
||||
// Flickies. Nope, no delfile support here either
|
||||
#if 1 // equivalent to "FlickyList = DEMO"
|
||||
P_SetDemoFlickies(num);
|
||||
#else // equivalent to "FlickyList = NONE"
|
||||
P_DeleteFlickies(num);
|
||||
#endif
|
||||
// TODO grades support for delfile (pfft yeah right)
|
||||
P_DeleteGrades(num);
|
||||
// an even further impossibility, delfile custom opts support
|
||||
mapheaderinfo[num]->customopts = NULL;
|
||||
mapheaderinfo[num]->numCustomOptions = 0;
|
||||
|
||||
DEH_WriteUndoline(va("# uload for map %d", i), NULL, UNDO_DONE);
|
||||
}
|
||||
|
||||
/** Allocates a new map-header structure.
|
||||
|
@ -3205,6 +3173,7 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
|
|||
// look for skins
|
||||
//
|
||||
R_AddSkins(wadnum); // faB: wadfile index in wadfiles[]
|
||||
R_PatchSkins(wadnum); // toast: PATCH PATCH
|
||||
|
||||
//
|
||||
// search for maps
|
||||
|
@ -3255,31 +3224,3 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef DELFILE
|
||||
boolean P_DelWadFile(void)
|
||||
{
|
||||
sfxenum_t i;
|
||||
const UINT16 wadnum = (UINT16)(numwadfiles - 1);
|
||||
const lumpnum_t lumpnum = numwadfiles<<16;
|
||||
//lumpinfo_t *lumpinfo = wadfiles[wadnum]->lumpinfo;
|
||||
R_DelSkins(wadnum); // only used by DELFILE
|
||||
R_DelSpriteDefs(wadnum); // only used by DELFILE
|
||||
for (i = 0; i < NUMSFX; i++)
|
||||
{
|
||||
if (S_sfx[i].lumpnum != LUMPERROR && S_sfx[i].lumpnum >= lumpnum)
|
||||
{
|
||||
S_StopSoundByNum(i);
|
||||
S_RemoveSoundFx(i);
|
||||
if (S_sfx[i].lumpnum != LUMPERROR)
|
||||
{
|
||||
I_FreeSfx(&S_sfx[i]);
|
||||
S_sfx[i].lumpnum = LUMPERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
W_UnloadWadFile(wadnum); // only used by DELFILE
|
||||
R_LoadTextures();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -60,9 +60,6 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum);
|
|||
void P_LoadThingsOnly(void);
|
||||
boolean P_SetupLevel(boolean skipprecip);
|
||||
boolean P_AddWadFile(const char *wadfilename, char **firstmapname);
|
||||
#ifdef DELFILE
|
||||
boolean P_DelWadFile(void);
|
||||
#endif
|
||||
boolean P_RunSOC(const char *socfilename);
|
||||
void P_WriteThings(lumpnum_t lump);
|
||||
size_t P_PrecacheLevelFlats(void);
|
||||
|
|
607
src/r_things.c
607
src/r_things.c
|
@ -20,6 +20,7 @@
|
|||
#include "z_zone.h"
|
||||
#include "m_menu.h" // character select
|
||||
#include "m_misc.h"
|
||||
#include "info.h" // spr2names
|
||||
#include "i_video.h" // rendermode
|
||||
#include "r_things.h"
|
||||
#include "r_plane.h"
|
||||
|
@ -30,6 +31,7 @@
|
|||
#include "d_netfil.h" // blargh. for nameonly().
|
||||
#include "m_cheat.h" // objectplace
|
||||
#include "m_cond.h"
|
||||
#include "fastcmp.h"
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_md2.h"
|
||||
#endif
|
||||
|
@ -429,117 +431,6 @@ void R_AddSpriteDefs(UINT16 wadnum)
|
|||
CONS_Printf(M_GetText("%s added %d frames in %s sprites\n"), wadname, end-start, sizeu1(addsprites));
|
||||
}
|
||||
|
||||
#ifdef DELFILE
|
||||
static void R_RemoveSpriteLump(UINT16 wad, // graphics patch
|
||||
UINT16 lump,
|
||||
size_t lumpid, // identifier
|
||||
UINT8 frame,
|
||||
UINT8 rotation,
|
||||
UINT8 flipped)
|
||||
{
|
||||
(void)wad; /// \todo: how do I remove sprites?
|
||||
(void)lump;
|
||||
(void)lumpid;
|
||||
(void)frame;
|
||||
(void)rotation;
|
||||
(void)flipped;
|
||||
}
|
||||
|
||||
static boolean R_DelSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16 wadnum, UINT16 startlump, UINT16 endlump)
|
||||
{
|
||||
UINT16 l;
|
||||
UINT8 frame;
|
||||
UINT8 rotation;
|
||||
lumpinfo_t *lumpinfo;
|
||||
|
||||
maxframe = (size_t)-1;
|
||||
|
||||
// scan the lumps,
|
||||
// filling in the frames for whatever is found
|
||||
lumpinfo = wadfiles[wadnum]->lumpinfo;
|
||||
if (endlump > wadfiles[wadnum]->numlumps)
|
||||
endlump = wadfiles[wadnum]->numlumps;
|
||||
|
||||
for (l = startlump; l < endlump; l++)
|
||||
{
|
||||
if (memcmp(lumpinfo[l].name,sprname,4)==0)
|
||||
{
|
||||
frame = (UINT8)(lumpinfo[l].name[4] - 'A');
|
||||
rotation = (UINT8)(lumpinfo[l].name[5] - '0');
|
||||
|
||||
// skip NULL sprites from very old dmadds pwads
|
||||
if (W_LumpLengthPwad(wadnum,l)<=8)
|
||||
continue;
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
R_RemoveSpriteLump(wadnum, l, numspritelumps, frame, rotation, 0);
|
||||
|
||||
if (lumpinfo[l].name[6])
|
||||
{
|
||||
frame = (UINT8)(lumpinfo[l].name[6] - 'A');
|
||||
rotation = (UINT8)(lumpinfo[l].name[7] - '0');
|
||||
R_RemoveSpriteLump(wadnum, l, numspritelumps, frame, rotation, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (maxframe == (size_t)-1)
|
||||
return false;
|
||||
|
||||
spritedef->numframes = 0;
|
||||
Z_Free(spritedef->spriteframes);
|
||||
spritedef->spriteframes = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
void R_DelSpriteDefs(UINT16 wadnum)
|
||||
{
|
||||
size_t i, delsprites = 0;
|
||||
UINT16 start, end;
|
||||
|
||||
// find the sprites section in this pwad
|
||||
// we need at least the S_END
|
||||
// (not really, but for speedup)
|
||||
|
||||
start = W_CheckNumForNamePwad("S_START", wadnum, 0);
|
||||
if (start == INT16_MAX)
|
||||
start = W_CheckNumForNamePwad("SS_START", wadnum, 0); //deutex compatib.
|
||||
if (start == INT16_MAX)
|
||||
start = 0; //let say S_START is lump 0
|
||||
else
|
||||
start++; // just after S_START
|
||||
|
||||
end = W_CheckNumForNamePwad("S_END",wadnum,start);
|
||||
if (end == INT16_MAX)
|
||||
end = W_CheckNumForNamePwad("SS_END",wadnum,start); //deutex compatib.
|
||||
if (end == INT16_MAX)
|
||||
{
|
||||
CONS_Debug(DBG_SETUP, "no sprites in pwad %d\n", wadnum);
|
||||
return;
|
||||
//I_Error("R_DelSpriteDefs: S_END, or SS_END missing for sprites "
|
||||
// "in pwad %d\n",wadnum);
|
||||
}
|
||||
|
||||
//
|
||||
// scan through lumps, for each sprite, find all the sprite frames
|
||||
//
|
||||
for (i = 0; i < numsprites; i++)
|
||||
{
|
||||
spritename = sprnames[i];
|
||||
|
||||
if (R_DelSingleSpriteDef(spritename, &sprites[i], wadnum, start, end))
|
||||
{
|
||||
// if a new sprite was removed (not just replaced)
|
||||
delsprites++;
|
||||
CONS_Debug(DBG_SETUP, "sprite %s set in pwad %d\n", spritename, wadnum);
|
||||
}
|
||||
}
|
||||
|
||||
CONS_Printf(M_GetText("%s sprites removed from file %s\n"), sizeu1(delsprites), wadfiles[wadnum]->filename);
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// GAME FUNCTIONS
|
||||
//
|
||||
|
@ -2966,6 +2857,189 @@ static UINT16 W_CheckForSkinMarkerInPwad(UINT16 wadid, UINT16 startlump)
|
|||
#define HUDNAMEWRITE(value) STRBUFCPY(skin->hudname, value)
|
||||
#endif
|
||||
|
||||
// turn _ into spaces and . into katana dot
|
||||
#define SYMBOLCONVERT(name) for (value = name; *value; value++)\
|
||||
{\
|
||||
if (*value == '_') *value = ' ';\
|
||||
else if (*value == '.') *value = '\x1E';\
|
||||
}
|
||||
|
||||
//
|
||||
// Patch skins from a pwad, each skin preceded by 'P_SKIN' marker
|
||||
//
|
||||
|
||||
// Does the same is in w_wad, but check only for
|
||||
// the first 6 characters (this is so we can have P_SKIN1, P_SKIN2..
|
||||
// for wad editors that don't like multiple resources of the same name)
|
||||
//
|
||||
static UINT16 W_CheckForPatchSkinMarkerInPwad(UINT16 wadid, UINT16 startlump)
|
||||
{
|
||||
UINT16 i;
|
||||
const char *P_SKIN = "P_SKIN";
|
||||
lumpinfo_t *lump_p;
|
||||
|
||||
// scan forward, start at <startlump>
|
||||
if (startlump < wadfiles[wadid]->numlumps)
|
||||
{
|
||||
lump_p = wadfiles[wadid]->lumpinfo + startlump;
|
||||
for (i = startlump; i < wadfiles[wadid]->numlumps; i++, lump_p++)
|
||||
if (memcmp(lump_p->name,P_SKIN,6)==0)
|
||||
return i;
|
||||
}
|
||||
return INT16_MAX; // not found
|
||||
}
|
||||
|
||||
static void R_LoadSkinSprites(UINT16 wadnum, UINT16 *lump, UINT16 *lastlump, skin_t *skin)
|
||||
{
|
||||
UINT16 newlastlump;
|
||||
UINT8 sprite2;
|
||||
|
||||
*lump += 1; // start after S_SKIN
|
||||
*lastlump = W_CheckNumForNamePwad("S_END",wadnum,*lump); // stop at S_END
|
||||
|
||||
// old wadding practices die hard -- stop at S_SKIN (or P_SKIN) or S_START if they come before S_END.
|
||||
newlastlump = W_CheckForSkinMarkerInPwad(wadnum,*lump);
|
||||
if (newlastlump < *lastlump) *lastlump = newlastlump;
|
||||
newlastlump = W_CheckForPatchSkinMarkerInPwad(wadnum,*lump);
|
||||
if (newlastlump < *lastlump) *lastlump = newlastlump;
|
||||
newlastlump = W_CheckNumForNamePwad("S_START",wadnum,*lump);
|
||||
if (newlastlump < *lastlump) *lastlump = newlastlump;
|
||||
|
||||
// ...and let's handle super, too
|
||||
newlastlump = W_CheckNumForNamePwad("S_SUPER",wadnum,*lump);
|
||||
if (newlastlump < *lastlump)
|
||||
{
|
||||
newlastlump++;
|
||||
// load all sprite sets we are aware of... for super!
|
||||
for (sprite2 = 0; sprite2 < free_spr2; sprite2++)
|
||||
R_AddSingleSpriteDef((spritename = spr2names[sprite2]), &skin->sprites[FF_SPR2SUPER|sprite2], wadnum, newlastlump, *lastlump);
|
||||
|
||||
newlastlump--;
|
||||
*lastlump = newlastlump; // okay, make the normal sprite set loading end there
|
||||
}
|
||||
|
||||
// load all sprite sets we are aware of... for normal stuff.
|
||||
for (sprite2 = 0; sprite2 < free_spr2; sprite2++)
|
||||
R_AddSingleSpriteDef((spritename = spr2names[sprite2]), &skin->sprites[sprite2], wadnum, *lump, *lastlump);
|
||||
|
||||
}
|
||||
|
||||
// returns whether found appropriate property
|
||||
static boolean R_ProcessPatchableFields(skin_t *skin, char *stoken, char *value)
|
||||
{
|
||||
// custom translation table
|
||||
if (!stricmp(stoken, "startcolor"))
|
||||
skin->starttranscolor = atoi(value);
|
||||
|
||||
#define FULLPROCESS(field) else if (!stricmp(stoken, #field)) skin->field = get_number(value);
|
||||
// character type identification
|
||||
FULLPROCESS(flags)
|
||||
FULLPROCESS(ability)
|
||||
FULLPROCESS(ability2)
|
||||
|
||||
FULLPROCESS(thokitem)
|
||||
FULLPROCESS(spinitem)
|
||||
FULLPROCESS(revitem)
|
||||
#undef FULLPROCESS
|
||||
|
||||
#define GETFRACBITS(field) else if (!stricmp(stoken, #field)) skin->field = atoi(value)<<FRACBITS;
|
||||
GETFRACBITS(normalspeed)
|
||||
GETFRACBITS(runspeed)
|
||||
|
||||
GETFRACBITS(mindash)
|
||||
GETFRACBITS(maxdash)
|
||||
GETFRACBITS(actionspd)
|
||||
|
||||
GETFRACBITS(radius)
|
||||
GETFRACBITS(height)
|
||||
GETFRACBITS(spinheight)
|
||||
#undef GETFRACBITS
|
||||
|
||||
#define GETINT(field) else if (!stricmp(stoken, #field)) skin->field = atoi(value);
|
||||
GETINT(thrustfactor)
|
||||
GETINT(accelstart)
|
||||
GETINT(acceleration)
|
||||
#undef GETINT
|
||||
|
||||
#define GETSKINCOLOR(field) else if (!stricmp(stoken, #field)) skin->field = R_GetColorByName(value);
|
||||
GETSKINCOLOR(prefcolor)
|
||||
GETSKINCOLOR(prefoppositecolor)
|
||||
#undef GETSKINCOLOR
|
||||
else if (!stricmp(stoken, "supercolor"))
|
||||
skin->supercolor = R_GetSuperColorByName(value);
|
||||
|
||||
#define GETFLOAT(field) else if (!stricmp(stoken, #field)) skin->field = FLOAT_TO_FIXED(atof(value));
|
||||
GETFLOAT(jumpfactor)
|
||||
GETFLOAT(highresscale)
|
||||
GETFLOAT(shieldscale)
|
||||
GETFLOAT(camerascale)
|
||||
#undef GETFLOAT
|
||||
|
||||
#define GETFLAG(field) else if (!stricmp(stoken, #field)) { \
|
||||
strupr(value); \
|
||||
if (atoi(value) || value[0] == 'T' || value[0] == 'Y') \
|
||||
skin->flags |= (SF_##field); \
|
||||
else \
|
||||
skin->flags &= ~(SF_##field); \
|
||||
}
|
||||
// parameters for individual character flags
|
||||
// these are uppercase so they can be concatenated with SF_
|
||||
// 1, true, yes are all valid values
|
||||
GETFLAG(SUPER)
|
||||
GETFLAG(NOSUPERSPIN)
|
||||
GETFLAG(NOSPINDASHDUST)
|
||||
GETFLAG(HIRES)
|
||||
GETFLAG(NOSKID)
|
||||
GETFLAG(NOSPEEDADJUST)
|
||||
GETFLAG(RUNONWATER)
|
||||
GETFLAG(NOJUMPSPIN)
|
||||
GETFLAG(NOJUMPDAMAGE)
|
||||
GETFLAG(STOMPDAMAGE)
|
||||
GETFLAG(MARIODAMAGE)
|
||||
GETFLAG(MACHINE)
|
||||
GETFLAG(DASHMODE)
|
||||
GETFLAG(FASTEDGE)
|
||||
GETFLAG(MULTIABILITY)
|
||||
#undef GETFLAG
|
||||
|
||||
else // let's check if it's a sound, otherwise error out
|
||||
{
|
||||
boolean found = false;
|
||||
sfxenum_t i;
|
||||
size_t stokenadjust;
|
||||
|
||||
// Remove the prefix. (We need to affect an adjusting variable so that we can print error messages if it's not actually a sound.)
|
||||
if ((stoken[0] == 'D' || stoken[0] == 'd') && (stoken[1] == 'S' || stoken[1] == 's')) // DS*
|
||||
stokenadjust = 2;
|
||||
else // sfx_*
|
||||
stokenadjust = 4;
|
||||
|
||||
// Remove the prefix. (We can affect this directly since we're not going to use it again.)
|
||||
if ((value[0] == 'D' || value[0] == 'd') && (value[1] == 'S' || value[1] == 's')) // DS*
|
||||
value += 2;
|
||||
else // sfx_*
|
||||
value += 4;
|
||||
|
||||
// copy name of sounds that are remapped
|
||||
// for this skin
|
||||
for (i = 0; i < sfx_skinsoundslot0; i++)
|
||||
{
|
||||
if (!S_sfx[i].name)
|
||||
continue;
|
||||
if (S_sfx[i].skinsound != -1
|
||||
&& !stricmp(S_sfx[i].name,
|
||||
stoken + stokenadjust))
|
||||
{
|
||||
skin->soundsid[S_sfx[i].skinsound] =
|
||||
S_AddSoundFx(value, S_sfx[i].singularity, S_sfx[i].pitch, true);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// Find skin sprites, sounds & optional status bar face, & add them
|
||||
//
|
||||
|
@ -3025,6 +3099,8 @@ void R_AddSkins(UINT16 wadnum)
|
|||
if (!value)
|
||||
I_Error("R_AddSkins: syntax error in S_SKIN lump# %d(%s) in WAD %s\n", lump, W_CheckNameForNumPwad(wadnum,lump), wadfiles[wadnum]->filename);
|
||||
|
||||
// Some of these can't go in R_ProcessPatchableFields because they have side effects for future lines.
|
||||
// Others can't go in there because we don't want them to be patchable.
|
||||
if (!stricmp(stoken, "name"))
|
||||
{
|
||||
INT32 skinnum = R_SkinAvailable(value);
|
||||
|
@ -3063,22 +3139,14 @@ void R_AddSkins(UINT16 wadnum)
|
|||
{
|
||||
HUDNAMEWRITE(skin->name);
|
||||
strupr(skin->hudname);
|
||||
for (value = skin->hudname; *value; value++)
|
||||
{
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
else if (*value == '.') *value = '\x1E'; // turn . into katana dot.
|
||||
}
|
||||
SYMBOLCONVERT(skin->hudname)
|
||||
}
|
||||
}
|
||||
else if (!stricmp(stoken, "realname"))
|
||||
{ // Display name (eg. "Knuckles")
|
||||
realname = true;
|
||||
STRBUFCPY(skin->realname, value);
|
||||
for (value = skin->realname; *value; value++)
|
||||
{
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
else if (*value == '.') *value = '\x1E'; // turn . into katana dot.
|
||||
}
|
||||
SYMBOLCONVERT(skin->realname)
|
||||
if (!hudname)
|
||||
HUDNAMEWRITE(skin->realname);
|
||||
}
|
||||
|
@ -3086,15 +3154,10 @@ void R_AddSkins(UINT16 wadnum)
|
|||
{ // Life icon name (eg. "K.T.E")
|
||||
hudname = true;
|
||||
HUDNAMEWRITE(value);
|
||||
for (value = skin->hudname; *value; value++)
|
||||
{
|
||||
if (*value == '_') *value = ' '; // turn _ into spaces.
|
||||
else if (*value == '.') *value = '\x1E'; // turn . into katana dot.
|
||||
}
|
||||
SYMBOLCONVERT(skin->hudname)
|
||||
if (!realname)
|
||||
STRBUFCPY(skin->realname, skin->hudname);
|
||||
}
|
||||
|
||||
else if (!stricmp(stoken, "charsel"))
|
||||
{
|
||||
strupr(value);
|
||||
|
@ -3113,37 +3176,6 @@ void R_AddSkins(UINT16 wadnum)
|
|||
strupr(value);
|
||||
strncpy(skin->superface, value, sizeof skin->superface);
|
||||
}
|
||||
|
||||
#define FULLPROCESS(field) else if (!stricmp(stoken, #field)) skin->field = get_number(value);
|
||||
// character type identification
|
||||
FULLPROCESS(flags)
|
||||
FULLPROCESS(ability)
|
||||
FULLPROCESS(ability2)
|
||||
|
||||
FULLPROCESS(thokitem)
|
||||
FULLPROCESS(spinitem)
|
||||
FULLPROCESS(revitem)
|
||||
#undef FULLPROCESS
|
||||
|
||||
#define GETFRACBITS(field) else if (!stricmp(stoken, #field)) skin->field = atoi(value)<<FRACBITS;
|
||||
GETFRACBITS(normalspeed)
|
||||
GETFRACBITS(runspeed)
|
||||
|
||||
GETFRACBITS(mindash)
|
||||
GETFRACBITS(maxdash)
|
||||
GETFRACBITS(actionspd)
|
||||
|
||||
GETFRACBITS(radius)
|
||||
GETFRACBITS(height)
|
||||
GETFRACBITS(spinheight)
|
||||
#undef GETFRACBITS
|
||||
|
||||
#define GETINT(field) else if (!stricmp(stoken, #field)) skin->field = atoi(value);
|
||||
GETINT(thrustfactor)
|
||||
GETINT(accelstart)
|
||||
GETINT(acceleration)
|
||||
#undef GETINT
|
||||
|
||||
else if (!stricmp(stoken, "availability"))
|
||||
{
|
||||
skin->availability = atoi(value);
|
||||
|
@ -3152,125 +3184,16 @@ void R_AddSkins(UINT16 wadnum)
|
|||
if (skin->availability)
|
||||
STRBUFCPY(unlockables[skin->availability - 1].name, skin->realname);
|
||||
}
|
||||
else if (!R_ProcessPatchableFields(skin, stoken, value))
|
||||
CONS_Debug(DBG_SETUP, "R_AddSkins: Unknown keyword '%s' in S_SKIN lump #%d (WAD %s)\n", stoken, lump, wadfiles[wadnum]->filename);
|
||||
|
||||
// custom translation table
|
||||
else if (!stricmp(stoken, "startcolor"))
|
||||
skin->starttranscolor = atoi(value);
|
||||
|
||||
#define GETSKINCOLOR(field) else if (!stricmp(stoken, #field)) skin->field = R_GetColorByName(value);
|
||||
GETSKINCOLOR(prefcolor)
|
||||
GETSKINCOLOR(prefoppositecolor)
|
||||
#undef GETSKINCOLOR
|
||||
else if (!stricmp(stoken, "supercolor"))
|
||||
skin->supercolor = R_GetSuperColorByName(value);
|
||||
|
||||
#define GETFLOAT(field) else if (!stricmp(stoken, #field)) skin->field = FLOAT_TO_FIXED(atof(value));
|
||||
GETFLOAT(jumpfactor)
|
||||
GETFLOAT(highresscale)
|
||||
GETFLOAT(shieldscale)
|
||||
GETFLOAT(camerascale)
|
||||
#undef GETFLOAT
|
||||
|
||||
#define GETFLAG(field) else if (!stricmp(stoken, #field)) { \
|
||||
strupr(value); \
|
||||
if (atoi(value) || value[0] == 'T' || value[0] == 'Y') \
|
||||
skin->flags |= (SF_##field); \
|
||||
else \
|
||||
skin->flags &= ~(SF_##field); \
|
||||
}
|
||||
// parameters for individual character flags
|
||||
// these are uppercase so they can be concatenated with SF_
|
||||
// 1, true, yes are all valid values
|
||||
GETFLAG(SUPER)
|
||||
GETFLAG(NOSUPERSPIN)
|
||||
GETFLAG(NOSPINDASHDUST)
|
||||
GETFLAG(HIRES)
|
||||
GETFLAG(NOSKID)
|
||||
GETFLAG(NOSPEEDADJUST)
|
||||
GETFLAG(RUNONWATER)
|
||||
GETFLAG(NOJUMPSPIN)
|
||||
GETFLAG(NOJUMPDAMAGE)
|
||||
GETFLAG(STOMPDAMAGE)
|
||||
GETFLAG(MARIODAMAGE)
|
||||
GETFLAG(MACHINE)
|
||||
GETFLAG(DASHMODE)
|
||||
GETFLAG(FASTEDGE)
|
||||
GETFLAG(MULTIABILITY)
|
||||
#undef GETFLAG
|
||||
|
||||
else // let's check if it's a sound, otherwise error out
|
||||
{
|
||||
boolean found = false;
|
||||
sfxenum_t i;
|
||||
size_t stokenadjust;
|
||||
|
||||
// Remove the prefix. (We need to affect an adjusting variable so that we can print error messages if it's not actually a sound.)
|
||||
if ((stoken[0] == 'D' || stoken[0] == 'd') && (stoken[1] == 'S' || stoken[1] == 's')) // DS*
|
||||
stokenadjust = 2;
|
||||
else // sfx_*
|
||||
stokenadjust = 4;
|
||||
|
||||
// Remove the prefix. (We can affect this directly since we're not going to use it again.)
|
||||
if ((value[0] == 'D' || value[0] == 'd') && (value[1] == 'S' || value[1] == 's')) // DS*
|
||||
value += 2;
|
||||
else // sfx_*
|
||||
value += 4;
|
||||
|
||||
// copy name of sounds that are remapped
|
||||
// for this skin
|
||||
for (i = 0; i < sfx_skinsoundslot0; i++)
|
||||
{
|
||||
if (!S_sfx[i].name)
|
||||
continue;
|
||||
if (S_sfx[i].skinsound != -1
|
||||
&& !stricmp(S_sfx[i].name,
|
||||
stoken + stokenadjust))
|
||||
{
|
||||
skin->soundsid[S_sfx[i].skinsound] =
|
||||
S_AddSoundFx(value, S_sfx[i].singularity, S_sfx[i].pitch, true);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
CONS_Debug(DBG_SETUP, "R_AddSkins: Unknown keyword '%s' in S_SKIN lump #%d (WAD %s)\n", stoken, lump, wadfiles[wadnum]->filename);
|
||||
}
|
||||
next_token:
|
||||
stoken = strtok(NULL, "\r\n= ");
|
||||
}
|
||||
free(buf2);
|
||||
|
||||
// Add sprites
|
||||
{
|
||||
UINT16 newlastlump;
|
||||
UINT8 sprite2;
|
||||
|
||||
lump++; // start after S_SKIN
|
||||
lastlump = W_CheckNumForNamePwad("S_END",wadnum,lump); // stop at S_END
|
||||
|
||||
// old wadding practices die hard -- stop at S_SKIN or S_START if they come before S_END.
|
||||
newlastlump = W_CheckNumForNamePwad("S_SKIN",wadnum,lump);
|
||||
if (newlastlump < lastlump) lastlump = newlastlump;
|
||||
newlastlump = W_CheckNumForNamePwad("S_START",wadnum,lump);
|
||||
if (newlastlump < lastlump) lastlump = newlastlump;
|
||||
|
||||
// ...and let's handle super, too
|
||||
newlastlump = W_CheckNumForNamePwad("S_SUPER",wadnum,lump);
|
||||
if (newlastlump < lastlump)
|
||||
{
|
||||
newlastlump++;
|
||||
// load all sprite sets we are aware of... for super!
|
||||
for (sprite2 = 0; sprite2 < free_spr2; sprite2++)
|
||||
R_AddSingleSpriteDef(spr2names[sprite2], &skin->sprites[FF_SPR2SUPER|sprite2], wadnum, newlastlump, lastlump);
|
||||
|
||||
newlastlump--;
|
||||
lastlump = newlastlump; // okay, make the normal sprite set loading end there
|
||||
}
|
||||
|
||||
// load all sprite sets we are aware of... for normal stuff.
|
||||
for (sprite2 = 0; sprite2 < free_spr2; sprite2++)
|
||||
R_AddSingleSpriteDef(spr2names[sprite2], &skin->sprites[sprite2], wadnum, lump, lastlump);
|
||||
|
||||
}
|
||||
R_LoadSkinSprites(wadnum, &lump, &lastlump, skin);
|
||||
|
||||
R_FlushTranslationColormapCache();
|
||||
|
||||
|
@ -3294,50 +3217,124 @@ next_token:
|
|||
return;
|
||||
}
|
||||
|
||||
#undef HUDNAMEWRITE
|
||||
|
||||
#ifdef DELFILE
|
||||
void R_DelSkins(UINT16 wadnum)
|
||||
//
|
||||
// Patch skin sprites
|
||||
//
|
||||
void R_PatchSkins(UINT16 wadnum)
|
||||
{
|
||||
UINT16 lump, lastlump = 0;
|
||||
while ((lump = W_CheckForSkinMarkerInPwad(wadnum, lastlump)) != INT16_MAX)
|
||||
char *buf;
|
||||
char *buf2;
|
||||
char *stoken;
|
||||
char *value;
|
||||
size_t size;
|
||||
skin_t *skin;
|
||||
boolean noskincomplain, realname, hudname;
|
||||
|
||||
//
|
||||
// search for all skin patch markers in pwad
|
||||
//
|
||||
|
||||
while ((lump = W_CheckForPatchSkinMarkerInPwad(wadnum, lastlump)) != INT16_MAX)
|
||||
{
|
||||
if (skins[numskins].wadnum != wadnum)
|
||||
break;
|
||||
numskins--;
|
||||
ST_UnLoadFaceGraphics(numskins); // only used by DELFILE
|
||||
if (skins[numskins].sprite[0] != '\0')
|
||||
{
|
||||
const char *csprname = W_CheckNameForNumPwad(wadnum, lump);
|
||||
INT32 skinnum = 0;
|
||||
|
||||
// skip to end of this skin's frames
|
||||
lastlump = lump;
|
||||
while (W_CheckNameForNumPwad(wadnum,lastlump) && memcmp(W_CheckNameForNumPwad(wadnum, lastlump),csprname,4)==0)
|
||||
lastlump++;
|
||||
// allocate (or replace) sprite frames, and set spritedef
|
||||
R_DelSingleSpriteDef(csprname, &skins[numskins].spritedef, wadnum, lump, lastlump);
|
||||
}
|
||||
else
|
||||
// advance by default
|
||||
lastlump = lump + 1;
|
||||
|
||||
buf = W_CacheLumpNumPwad(wadnum, lump, PU_CACHE);
|
||||
size = W_LumpLengthPwad(wadnum, lump);
|
||||
|
||||
// for strtok
|
||||
buf2 = malloc(size+1);
|
||||
if (!buf2)
|
||||
I_Error("R_PatchSkins: No more free memory\n");
|
||||
M_Memcpy(buf2,buf,size);
|
||||
buf2[size] = '\0';
|
||||
|
||||
skin = NULL;
|
||||
noskincomplain = realname = hudname = false;
|
||||
|
||||
/*
|
||||
Parse. Has more phases than the parser in R_AddSkins because it needs to have the patching name first (no default skin name is acceptible for patching, unlike skin creation)
|
||||
*/
|
||||
|
||||
stoken = strtok(buf2, "\r\n= ");
|
||||
while (stoken)
|
||||
{
|
||||
// search in the normal sprite tables
|
||||
size_t name;
|
||||
boolean found = false;
|
||||
const char *sprname = skins[numskins].sprite;
|
||||
for (name = 0;sprnames[name][0] != '\0';name++)
|
||||
if (strcmp(sprnames[name], sprname) == 0)
|
||||
if ((stoken[0] == '/' && stoken[1] == '/')
|
||||
|| (stoken[0] == '#'))// skip comments
|
||||
{
|
||||
stoken = strtok(NULL, "\r\n"); // skip end of line
|
||||
goto next_token; // find the real next token
|
||||
}
|
||||
|
||||
value = strtok(NULL, "\r\n= ");
|
||||
|
||||
if (!value)
|
||||
I_Error("R_PatchSkins: syntax error in P_SKIN lump# %d(%s) in WAD %s\n", lump, W_CheckNameForNumPwad(wadnum,lump), wadfiles[wadnum]->filename);
|
||||
|
||||
if (!skin) // Get the name!
|
||||
{
|
||||
if (!stricmp(stoken, "name"))
|
||||
{
|
||||
found = true;
|
||||
skins[numskins].spritedef = sprites[name];
|
||||
strlwr(value);
|
||||
skinnum = R_SkinAvailable(value);
|
||||
if (skinnum != -1)
|
||||
skin = &skins[skinnum];
|
||||
else
|
||||
{
|
||||
CONS_Debug(DBG_SETUP, "R_PatchSkins: unknown skin name in P_SKIN lump# %d(%s) in WAD %s\n", lump, W_CheckNameForNumPwad(wadnum,lump), wadfiles[wadnum]->filename);
|
||||
noskincomplain = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Get the properties!
|
||||
{
|
||||
// Some of these can't go in R_ProcessPatchableFields because they have side effects for future lines.
|
||||
if (!stricmp(stoken, "realname"))
|
||||
{ // Display name (eg. "Knuckles")
|
||||
realname = true;
|
||||
STRBUFCPY(skin->realname, value);
|
||||
SYMBOLCONVERT(skin->realname)
|
||||
if (!hudname)
|
||||
HUDNAMEWRITE(skin->realname);
|
||||
}
|
||||
else if (!stricmp(stoken, "hudname"))
|
||||
{ // Life icon name (eg. "K.T.E")
|
||||
hudname = true;
|
||||
HUDNAMEWRITE(value);
|
||||
SYMBOLCONVERT(skin->hudname)
|
||||
if (!realname)
|
||||
STRBUFCPY(skin->realname, skin->hudname);
|
||||
}
|
||||
else if (!R_ProcessPatchableFields(skin, stoken, value))
|
||||
CONS_Debug(DBG_SETUP, "R_PatchSkins: Unknown keyword '%s' in P_SKIN lump #%d (WAD %s)\n", stoken, lump, wadfiles[wadnum]->filename);
|
||||
}
|
||||
|
||||
// not found so make a new one
|
||||
if (!found)
|
||||
R_DelSingleSpriteDef(sprname, &skins[numskins].spritedef, wadnum, 0, INT16_MAX);
|
||||
if (!skin)
|
||||
break;
|
||||
|
||||
while (W_CheckNameForNumPwad(wadnum,lastlump) && memcmp(W_CheckNameForNumPwad(wadnum, lastlump),sprname,4)==0)
|
||||
lastlump++;
|
||||
next_token:
|
||||
stoken = strtok(NULL, "\r\n= ");
|
||||
}
|
||||
CONS_Printf(M_GetText("Removed skin '%s'\n"), skins[numskins].name);
|
||||
free(buf2);
|
||||
|
||||
if (!skin) // Didn't include a name parameter? What a waste.
|
||||
{
|
||||
if (!noskincomplain)
|
||||
CONS_Debug(DBG_SETUP, "R_PatchSkins: no skin name given in P_SKIN lump #%d (WAD %s)\n", lump, wadfiles[wadnum]->filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Patch sprites
|
||||
R_LoadSkinSprites(wadnum, &lump, &lastlump, skin);
|
||||
|
||||
if (!skin->availability) // Safe to print...
|
||||
CONS_Printf(M_GetText("Patched skin '%s'\n"), skin->name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef HUDNAMEWRITE
|
||||
#undef SYMBOLCONVERT
|
||||
|
|
|
@ -51,10 +51,6 @@ void R_SortVisSprites(void);
|
|||
// (only sprites from namelist are added or replaced)
|
||||
void R_AddSpriteDefs(UINT16 wadnum);
|
||||
|
||||
#ifdef DELFILE
|
||||
void R_DelSpriteDefs(UINT16 wadnum);
|
||||
#endif
|
||||
|
||||
//SoM: 6/5/2000: Light sprites correctly!
|
||||
void R_AddSprites(sector_t *sec, INT32 lightlevel);
|
||||
void R_InitSprites(void);
|
||||
|
@ -216,14 +212,11 @@ void SetPlayerSkinByNum(INT32 playernum,INT32 skinnum); // Tails 03-16-2002
|
|||
boolean R_SkinUsable(INT32 playernum, INT32 skinnum);
|
||||
UINT32 R_GetSkinAvailabilities(void);
|
||||
INT32 R_SkinAvailable(const char *name);
|
||||
void R_PatchSkins(UINT16 wadnum);
|
||||
void R_AddSkins(UINT16 wadnum);
|
||||
|
||||
UINT8 P_GetSkinSprite2(skin_t *skin, UINT8 spr2, player_t *player);
|
||||
|
||||
#ifdef DELFILE
|
||||
void R_DelSkins(UINT16 wadnum);
|
||||
#endif
|
||||
|
||||
void R_InitDrawNodes(void);
|
||||
|
||||
char *GetPlayerFacePic(INT32 skinnum);
|
||||
|
|
|
@ -346,15 +346,6 @@ void ST_LoadFaceGraphics(char *facestr, char *superstr, INT32 skinnum)
|
|||
facefreed[skinnum] = false;
|
||||
}
|
||||
|
||||
#ifdef DELFILE
|
||||
void ST_UnLoadFaceGraphics(INT32 skinnum)
|
||||
{
|
||||
Z_Free(faceprefix[skinnum]);
|
||||
Z_Free(superprefix[skinnum]);
|
||||
facefreed[skinnum] = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void ST_ReloadSkinFaceGraphics(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
|
|
@ -44,9 +44,6 @@ void ST_LoadGraphics(void);
|
|||
// face load graphics, called when skin changes
|
||||
void ST_LoadFaceGraphics(char *facestr, char *superstr, INT32 playernum);
|
||||
void ST_ReloadSkinFaceGraphics(void);
|
||||
#ifdef DELFILE
|
||||
void ST_UnLoadFaceGraphics(INT32 skinnum);
|
||||
#endif
|
||||
|
||||
void ST_doPaletteStuff(void);
|
||||
|
||||
|
|
32
src/w_wad.c
32
src/w_wad.c
|
@ -505,38 +505,6 @@ UINT16 W_LoadWadFile(const char *filename)
|
|||
return wadfile->numlumps;
|
||||
}
|
||||
|
||||
#ifdef DELFILE
|
||||
void W_UnloadWadFile(UINT16 num)
|
||||
{
|
||||
INT32 i;
|
||||
wadfile_t *delwad = wadfiles[num];
|
||||
lumpcache_t *lumpcache;
|
||||
if (num == 0)
|
||||
return;
|
||||
CONS_Printf(M_GetText("Removing WAD %s...\n"), wadfiles[num]->filename);
|
||||
|
||||
DEH_UnloadDehackedWad(num);
|
||||
wadfiles[num] = NULL;
|
||||
lumpcache = delwad->lumpcache;
|
||||
numwadfiles--;
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
HWR_FreeTextureCache();
|
||||
M_AATreeFree(delwad->hwrcache);
|
||||
#endif
|
||||
if (*lumpcache)
|
||||
{
|
||||
for (i = 0;i < delwad->numlumps;i++)
|
||||
Z_ChangeTag(lumpcache[i], PU_PURGELEVEL);
|
||||
}
|
||||
Z_Free(lumpcache);
|
||||
fclose(delwad->handle);
|
||||
Z_Free(delwad->filename);
|
||||
Z_Free(delwad);
|
||||
CONS_Printf(M_GetText("Done unloading WAD.\n"));
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Tries to load a series of files.
|
||||
* All files are wads unless they have an extension of ".soc" or ".lua".
|
||||
*
|
||||
|
|
|
@ -87,9 +87,6 @@ void W_Shutdown(void);
|
|||
FILE *W_OpenWadFile(const char **filename, boolean useerrors);
|
||||
// Load and add a wadfile to the active wad files, returns numbers of lumps, INT16_MAX on error
|
||||
UINT16 W_LoadWadFile(const char *filename);
|
||||
#ifdef DELFILE
|
||||
void W_UnloadWadFile(UINT16 num);
|
||||
#endif
|
||||
|
||||
// W_InitMultipleFiles returns 1 if all is okay, 0 otherwise,
|
||||
// so that it stops with a message if a file was not found, but not if all is okay.
|
||||
|
|
Loading…
Reference in a new issue