I hate everything
This commit is contained in:
1 parent
ba6ae7b351
commit
a464df2165
19 files changed
+342
-83
No files matched your search
+63
-2
@@ -109,6 +109,10 @@ static void Skin_OnChange(void);
|
||||
static void Skin2_OnChange(void);
|
||||
static void Skin3_OnChange(void);
|
||||
static void Skin4_OnChange(void);
|
||||
static void Localskin_OnChange(void);
|
||||
static void Localskin2_OnChange(void);
|
||||
static void Localskin3_OnChange(void);
|
||||
static void Localskin4_OnChange(void);
|
||||
static void Color_OnChange(void);
|
||||
static void Color2_OnChange(void);
|
||||
static void Color3_OnChange(void);
|
||||
@@ -139,6 +143,7 @@ static void Command_View_f (void);
|
||||
static void Command_SetViews_f(void);
|
||||
|
||||
static void Command_Addfile(void);
|
||||
static void Command_Addskins(void);
|
||||
static void Command_ListWADS_f(void);
|
||||
#ifdef DELFILE
|
||||
static void Command_Delfile(void);
|
||||
@@ -284,6 +289,11 @@ consvar_t cv_skin = {"skin", DEFAULTSKIN, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin_
|
||||
consvar_t cv_skin2 = {"skin2", DEFAULTSKIN2, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_skin3 = {"skin3", DEFAULTSKIN3, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin3_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_skin4 = {"skin4", DEFAULTSKIN4, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Skin4_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
// haha I've beaten you now, ONLINE
|
||||
consvar_t cv_localskin = {"localskin", "none", CV_CALL|CV_NOINIT, NULL, Localskin_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_localskin2 = {"localskin2", "none", CV_CALL|CV_NOINIT, NULL, Localskin2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_localskin3 = {"localskin3", "none", CV_CALL|CV_NOINIT, NULL, Localskin3_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_localskin4 = {"localskin4", "none", CV_CALL|CV_NOINIT, NULL, Localskin4_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -614,6 +624,7 @@ void D_RegisterServerCommands(void)
|
||||
COM_AddCommand("mapmd5", Command_Mapmd5_f);
|
||||
|
||||
COM_AddCommand("addfile", Command_Addfile);
|
||||
COM_AddCommand("addskins", Command_Addskins);
|
||||
COM_AddCommand("listwad", Command_ListWADS_f);
|
||||
|
||||
#ifdef DELFILE
|
||||
@@ -846,18 +857,22 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_playername);
|
||||
CV_RegisterVar(&cv_playercolor);
|
||||
CV_RegisterVar(&cv_skin); // r_things.c (skin NAME)
|
||||
CV_RegisterVar(&cv_localskin);
|
||||
// secondary player (splitscreen)
|
||||
CV_RegisterVar(&cv_playername2);
|
||||
CV_RegisterVar(&cv_playercolor2);
|
||||
CV_RegisterVar(&cv_skin2);
|
||||
CV_RegisterVar(&cv_localskin2);
|
||||
// third player
|
||||
CV_RegisterVar(&cv_playername3);
|
||||
CV_RegisterVar(&cv_playercolor3);
|
||||
CV_RegisterVar(&cv_skin3);
|
||||
CV_RegisterVar(&cv_localskin3);
|
||||
// fourth player
|
||||
CV_RegisterVar(&cv_playername4);
|
||||
CV_RegisterVar(&cv_playercolor4);
|
||||
CV_RegisterVar(&cv_skin4);
|
||||
CV_RegisterVar(&cv_localskin4);
|
||||
// preferred number of players
|
||||
CV_RegisterVar(&cv_splitplayers);
|
||||
|
||||
@@ -4418,7 +4433,7 @@ static void Command_Addfile(void)
|
||||
// Add file on your client directly if it is trivial, or you aren't in a netgame.
|
||||
if (!(netgame || multiplayer) || musiconly)
|
||||
{
|
||||
P_AddWadFile(fn);
|
||||
P_AddWadFile(fn, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4467,6 +4482,20 @@ static void Command_Addfile(void)
|
||||
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);
|
||||
}
|
||||
|
||||
/** Adds something at runtime.
|
||||
*/
|
||||
static void
|
||||
Command_Addskins (void)
|
||||
{
|
||||
if (COM_Argc() != 2)
|
||||
{
|
||||
CONS_Printf(
|
||||
"addskins <file>: load skins bro\n");
|
||||
return;
|
||||
}
|
||||
P_AddWadFile(COM_Argv(1), true);
|
||||
}
|
||||
|
||||
#ifdef DELFILE
|
||||
/** removes the last added pwad at runtime.
|
||||
* Searches for sounds, maps, music and images to remove
|
||||
@@ -4623,7 +4652,7 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
|
||||
|
||||
ncs = findfile(filename,md5sum,true);
|
||||
|
||||
if (ncs != FS_FOUND || !P_AddWadFile(filename))
|
||||
if (ncs != FS_FOUND || !P_AddWadFile(filename, false))
|
||||
{
|
||||
Command_ExitGame_f();
|
||||
if (ncs == FS_FOUND)
|
||||
@@ -5704,6 +5733,38 @@ static void Skin4_OnChange(void)
|
||||
}
|
||||
}
|
||||
|
||||
/** bruh
|
||||
*/
|
||||
static void Localskin_OnChange(void)
|
||||
{
|
||||
if (!Playing())
|
||||
return; // do whatever you want
|
||||
SetLocalPlayerSkin(consoleplayer, cv_localskin.string, &cv_localskin);
|
||||
}
|
||||
|
||||
/** two bruh machine gun
|
||||
*/
|
||||
static void Localskin2_OnChange(void)
|
||||
{
|
||||
if (!Playing())
|
||||
return; // do whatever you want
|
||||
SetLocalPlayerSkin(displayplayers[1], cv_localskin2.string, &cv_localskin2);
|
||||
}
|
||||
|
||||
static void Localskin3_OnChange(void)
|
||||
{
|
||||
if (!Playing())
|
||||
return; // do whatever you want
|
||||
SetLocalPlayerSkin(displayplayers[2], cv_localskin3.string, &cv_localskin3);
|
||||
}
|
||||
|
||||
static void Localskin4_OnChange(void)
|
||||
{
|
||||
if (!Playing())
|
||||
return; // do whatever you want
|
||||
SetLocalPlayerSkin(displayplayers[3], cv_localskin4.string, &cv_localskin4);
|
||||
}
|
||||
|
||||
/** Sends a color change for the console player, unless that player is moving.
|
||||
* \sa cv_playercolor, Color2_OnChange, Skin_OnChange
|
||||
* \author Graue <graue@oceanbase.org>
|
||||
|
||||
@@ -21,18 +21,22 @@
|
||||
extern consvar_t cv_playername;
|
||||
extern consvar_t cv_playercolor;
|
||||
extern consvar_t cv_skin;
|
||||
extern consvar_t cv_localskin;
|
||||
// secondary splitscreen player
|
||||
extern consvar_t cv_playername2;
|
||||
extern consvar_t cv_playercolor2;
|
||||
extern consvar_t cv_skin2;
|
||||
extern consvar_t cv_localskin2;
|
||||
// third splitscreen player
|
||||
extern consvar_t cv_playername3;
|
||||
extern consvar_t cv_playercolor3;
|
||||
extern consvar_t cv_skin3;
|
||||
extern consvar_t cv_localskin3;
|
||||
// fourth splitscreen player
|
||||
extern consvar_t cv_playername4;
|
||||
extern consvar_t cv_playercolor4;
|
||||
extern consvar_t cv_skin4;
|
||||
extern consvar_t cv_localskin4;
|
||||
// preferred number of players
|
||||
extern consvar_t cv_splitplayers;
|
||||
|
||||
|
||||
+1
-1
@@ -581,7 +581,7 @@ boolean CL_LoadServerFiles(void)
|
||||
continue; // Already loaded
|
||||
else if (fileneeded[i].status == FS_FOUND)
|
||||
{
|
||||
P_PartialAddWadFile(fileneeded[i].filename);
|
||||
P_PartialAddWadFile(fileneeded[i].filename, false);
|
||||
G_SetGameModified(true, false);
|
||||
fileneeded[i].status = FS_OPEN;
|
||||
return false;
|
||||
|
||||
@@ -410,6 +410,8 @@ typedef struct player_s
|
||||
UINT8 skincolor;
|
||||
|
||||
INT32 skin;
|
||||
INT32 localskin;
|
||||
boolean skinlocal;
|
||||
|
||||
UINT32 score; // player score
|
||||
fixed_t dashspeed; // dashing speed
|
||||
|
||||
+7
-1
@@ -2680,6 +2680,8 @@ void G_PlayerReborn(INT32 player)
|
||||
UINT8 mare;
|
||||
UINT8 skincolor;
|
||||
INT32 skin;
|
||||
int localskin;
|
||||
boolean skinlocal;
|
||||
tic_t jointime;
|
||||
UINT8 splitscreenindex;
|
||||
boolean spectator;
|
||||
@@ -2726,6 +2728,8 @@ void G_PlayerReborn(INT32 player)
|
||||
|
||||
skincolor = players[player].skincolor;
|
||||
skin = players[player].skin;
|
||||
localskin = players[player].localskin;
|
||||
skinlocal = players[player].skinlocal;
|
||||
// SRB2kart
|
||||
kartspeed = players[player].kartspeed;
|
||||
kartweight = players[player].kartweight;
|
||||
@@ -2815,6 +2819,8 @@ void G_PlayerReborn(INT32 player)
|
||||
// save player config truth reborn
|
||||
p->skincolor = skincolor;
|
||||
p->skin = skin;
|
||||
p->localskin = localskin;
|
||||
p->skinlocal = skinlocal;
|
||||
// SRB2kart
|
||||
p->kartspeed = kartspeed;
|
||||
p->kartweight = kartweight;
|
||||
@@ -7055,7 +7061,7 @@ static void G_LoadDemoExtraFiles(UINT8 **pp)
|
||||
}
|
||||
else
|
||||
{
|
||||
P_PartialAddWadFile(filename);
|
||||
P_PartialAddWadFile(filename, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+19
-12
@@ -3180,7 +3180,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
||||
FOutVector baseWallVerts[4]; // This is what the verts should end up as
|
||||
GLPatch_t *gpatch;
|
||||
FSurfaceInfo Surf;
|
||||
const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)spr->mobj->skin)->flags & SF_HIRES);
|
||||
const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ))->flags & SF_HIRES);
|
||||
extracolormap_t *colormap;
|
||||
FUINT lightlevel;
|
||||
FBITFIELD blend = 0;
|
||||
@@ -3204,7 +3204,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
|
||||
this_scale = FIXED_TO_FLOAT(spr->mobj->scale);
|
||||
|
||||
if (hires)
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)spr->mobj->skin)->highresscale);
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ))->highresscale);
|
||||
|
||||
gpatch = W_CachePatchNum(spr->patchlumpnum, PU_CACHE);
|
||||
|
||||
@@ -3529,11 +3529,11 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
|
||||
FOutVector wallVerts[4];
|
||||
GLPatch_t *gpatch; // sprite patch converted to hardware
|
||||
FSurfaceInfo Surf;
|
||||
const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)spr->mobj->skin)->flags & SF_HIRES);
|
||||
const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ))->flags & SF_HIRES);
|
||||
if (spr->mobj)
|
||||
this_scale = FIXED_TO_FLOAT(spr->mobj->scale);
|
||||
if (hires)
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)spr->mobj->skin)->highresscale);
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ))->highresscale);
|
||||
|
||||
if (!spr->mobj)
|
||||
return;
|
||||
@@ -4115,8 +4115,18 @@ void HWR_DrawSprites(void)
|
||||
else
|
||||
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||
{
|
||||
md2_t *md2;
|
||||
if (spr->mobj->localskin)
|
||||
{
|
||||
if (spr->mobj->skinlocal)
|
||||
md2 = &md2_localplayermodels[(skin_t *)spr->mobj->localskin - localskins];
|
||||
else
|
||||
md2 = &md2_playermodels [(skin_t *)spr->mobj->localskin - skins];
|
||||
}
|
||||
else
|
||||
md2 = &md2_playermodels[(skin_t *)spr->mobj->skin - skins];
|
||||
// 8/1/19: Only don't display player models if no default SPR_PLAY is found.
|
||||
if (!cv_grmdls.value || ((md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound || md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale < 0.0f) && ((!cv_grfallbackplayermodel.value) || md2_models[SPR_PLAY].notfound || md2_models[SPR_PLAY].scale < 0.0f)) || spr->mobj->state == &states[S_PLAY_SIGN])
|
||||
if (!cv_grmdls.value || ((md2->notfound || md2->scale < 0.0f) && ((!cv_grfallbackplayermodel.value) || md2_models[SPR_PLAY].notfound || md2_models[SPR_PLAY].scale < 0.0f)) || spr->mobj->state == &states[S_PLAY_SIGN])
|
||||
HWR_DrawSprite(spr);
|
||||
else
|
||||
HWR_DrawMD2(spr);
|
||||
@@ -4340,7 +4350,7 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
|
||||
//Fab : 02-08-98: 'skin' override spritedef currently used for skin
|
||||
if (thing->skin && thing->sprite == SPR_PLAY)
|
||||
sprdef = &((skin_t *)thing->skin)->spritedef;
|
||||
sprdef = &((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->spritedef;
|
||||
else
|
||||
sprdef = &sprites[thing->sprite];
|
||||
|
||||
@@ -4403,8 +4413,8 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
}
|
||||
}
|
||||
|
||||
if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES)
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)thing->skin)->highresscale);
|
||||
if (thing->skin && ((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->flags & SF_HIRES)
|
||||
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->highresscale);
|
||||
|
||||
if (papersprite)
|
||||
{
|
||||
@@ -4498,10 +4508,7 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
if (thing->colorized)
|
||||
vis->colormap = R_GetTranslationColormap(TC_RAINBOW, thing->color, GTC_CACHE);
|
||||
else if (thing->skin && thing->sprite == SPR_PLAY) // This thing is a player!
|
||||
{
|
||||
size_t skinnum = (skin_t*)thing->skin-skins;
|
||||
vis->colormap = R_GetTranslationColormap((INT32)skinnum, thing->color, GTC_CACHE);
|
||||
}
|
||||
vis->colormap = R_GetLocalTranslationColormap(thing->skin, thing->localskin, thing->color, GTC_CACHE, thing->skinlocal);
|
||||
else
|
||||
vis->colormap = R_GetTranslationColormap(TC_DEFAULT, thing->color, GTC_CACHE);
|
||||
}
|
||||
|
||||
+46
-14
@@ -74,6 +74,7 @@
|
||||
|
||||
md2_t md2_models[NUMSPRITES];
|
||||
md2_t md2_playermodels[MAXSKINS];
|
||||
md2_t md2_localplayermodels[MAXSKINS];
|
||||
|
||||
|
||||
/*
|
||||
@@ -486,6 +487,13 @@ void HWR_InitMD2(void)
|
||||
md2_playermodels[s].skin = -1;
|
||||
md2_playermodels[s].notfound = true;
|
||||
md2_playermodels[s].error = false;
|
||||
|
||||
md2_localplayermodels[s].scale = -1.0f;
|
||||
md2_localplayermodels[s].model = NULL;
|
||||
md2_localplayermodels[s].grpatch = NULL;
|
||||
md2_localplayermodels[s].skin = -1;
|
||||
md2_localplayermodels[s].notfound = true;
|
||||
md2_localplayermodels[s].error = false;
|
||||
}
|
||||
for (i = 0; i < NUMSPRITES; i++)
|
||||
{
|
||||
@@ -558,11 +566,12 @@ md2found:
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void HWR_AddPlayerMD2(int skin) // For MD2's that were added after startup
|
||||
void HWR_AddPlayerMD2(int skin, boolean local) // For MD2's that were added after startup
|
||||
{
|
||||
FILE *f;
|
||||
char name[20], filename[32];
|
||||
float scale, offset;
|
||||
md2_t *md2s;
|
||||
|
||||
if (nomd2s)
|
||||
return;
|
||||
@@ -584,22 +593,23 @@ void HWR_AddPlayerMD2(int skin) // For MD2's that were added after startup
|
||||
}
|
||||
}
|
||||
|
||||
// Check for any MD2s that match the names of sprite names!
|
||||
md2s = ( (local) ? md2_localplayermodels : md2_playermodels );
|
||||
// Check for any MD2s that match the names of player skins!
|
||||
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
|
||||
{
|
||||
if (stricmp(name, skins[skin].name) == 0)
|
||||
if (stricmp(name, ( (local) ? localskins : skins )[skin].name) == 0)
|
||||
{
|
||||
md2_playermodels[skin].skin = skin;
|
||||
md2_playermodels[skin].scale = scale;
|
||||
md2_playermodels[skin].offset = offset;
|
||||
md2_playermodels[skin].notfound = false;
|
||||
strcpy(md2_playermodels[skin].filename, filename);
|
||||
md2s[skin].skin = skin;
|
||||
md2s[skin].scale = scale;
|
||||
md2s[skin].offset = offset;
|
||||
md2s[skin].notfound = false;
|
||||
strcpy(md2s[skin].filename, filename);
|
||||
goto playermd2found;
|
||||
}
|
||||
}
|
||||
|
||||
//CONS_Printf("MD2 for player skin %s not found\n", skins[skin].name);
|
||||
md2_playermodels[skin].notfound = true;
|
||||
md2s[skin].notfound = true;
|
||||
playermd2found:
|
||||
fclose(f);
|
||||
}
|
||||
@@ -1151,6 +1161,8 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
{
|
||||
R_InterpolateMobjState(spr->mobj, FRACUNIT, &interp);
|
||||
}
|
||||
md2_t *md2s;
|
||||
int skinnum;
|
||||
|
||||
// Apparently people don't like jump frames like that, so back it goes
|
||||
//if (tics > durs)
|
||||
@@ -1166,12 +1178,32 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
// dont forget to enabled the depth test because we can't do this like
|
||||
// before: polygons models are not sorted
|
||||
|
||||
/* fuck you */
|
||||
if (spr->mobj->localskin)
|
||||
{
|
||||
if (spr->mobj->skinlocal)
|
||||
{
|
||||
md2s = md2_localplayermodels;
|
||||
skinnum = (skin_t *)spr->mobj->localskin - localskins;
|
||||
}
|
||||
else
|
||||
{
|
||||
md2s = md2_playermodels;
|
||||
skinnum = (skin_t *)spr->mobj->localskin - skins;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
md2s = md2_playermodels;
|
||||
skinnum = (skin_t *)spr->mobj->skin - skins;
|
||||
}
|
||||
|
||||
// 1. load model+texture if not already loaded
|
||||
// 2. draw model with correct position, rotation,...
|
||||
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY && !md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound) // Use the player MD2 list if the mobj has a skin and is using the player sprites
|
||||
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY && !md2s[skinnum].notfound) // Use the player MD2 list if the mobj has a skin and is using the player sprites
|
||||
{
|
||||
md2 = &md2_playermodels[(skin_t*)spr->mobj->skin-skins];
|
||||
md2->skin = (skin_t*)spr->mobj->skin-skins;
|
||||
md2 = &md2s[skinnum];
|
||||
md2->skin = skinnum;
|
||||
}
|
||||
else // if we can't find the player md2, use SPR_PLAY's MD2.
|
||||
md2 = &md2_models[spr->mobj->sprite];
|
||||
@@ -1233,7 +1265,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
skinnum = TC_RAINBOW;
|
||||
else
|
||||
{
|
||||
skinnum = (INT32)((skin_t*)spr->mobj->skin-skins);
|
||||
skinnum = (INT32)((skin_t*)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ) - ( (spr->mobj->skinlocal) ? localskins : skins ));
|
||||
}
|
||||
}
|
||||
else skinnum = TC_DEFAULT;
|
||||
@@ -1300,7 +1332,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
p.z = FIXED_TO_FLOAT(interp.z);
|
||||
|
||||
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
|
||||
sprdef = &((skin_t *)spr->mobj->skin)->spritedef;
|
||||
sprdef = &((skin_t *)( (spr->mobj->localskin) ? spr->mobj->localskin : spr->mobj->skin ))->spritedef;
|
||||
else
|
||||
sprdef = &sprites[spr->mobj->sprite];
|
||||
|
||||
|
||||
@@ -37,10 +37,11 @@ typedef struct
|
||||
|
||||
extern md2_t md2_models[NUMSPRITES];
|
||||
extern md2_t md2_playermodels[MAXSKINS];
|
||||
extern md2_t md2_localplayermodels[MAXSKINS];
|
||||
|
||||
void HWR_InitMD2(void);
|
||||
void HWR_DrawMD2(gr_vissprite_t *spr);
|
||||
void HWR_AddPlayerMD2(INT32 skin);
|
||||
void HWR_AddPlayerMD2(INT32 skin, boolean local);
|
||||
void HWR_AddSpriteMD2(size_t spritenum);
|
||||
|
||||
#endif // _HW_MD2_H_
|
||||
@@ -8245,6 +8245,7 @@ void A_ItemPop(mobj_t *actor)
|
||||
remains->fuse = actor->fuse; // Transfer respawn timer
|
||||
remains->threshold = (actor->threshold == 69 ? 69 : 68);
|
||||
remains->skin = NULL;
|
||||
remains->localskin = NULL;
|
||||
remains->spawnpoint = actor->spawnpoint;
|
||||
|
||||
P_SetTarget(&tmthing, remains);
|
||||
|
||||
@@ -10762,6 +10762,16 @@ void P_SpawnPlayer(INT32 playernum)
|
||||
// (usefulness: when body mobj is detached from player (who respawns),
|
||||
// the dead body mobj retains the skin through the 'spritedef' override).
|
||||
mobj->skin = &skins[p->skin];
|
||||
if (p->localskin > 0)
|
||||
{
|
||||
if (p->skinlocal)
|
||||
mobj->localskin = &localskins[p->localskin - 1];
|
||||
else
|
||||
mobj->localskin = & skins[p->localskin - 1];
|
||||
}
|
||||
else
|
||||
mobj->localskin = 0;
|
||||
mobj->skinlocal = p->skinlocal;
|
||||
|
||||
mobj->health = p->health;
|
||||
p->playerstate = PST_LIVE;
|
||||
|
||||
@@ -312,6 +312,8 @@ typedef struct mobj_s
|
||||
UINT16 eflags; // extra flags
|
||||
|
||||
void *skin; // overrides 'sprite' when non-NULL (for player bodies to 'remember' the skin)
|
||||
void *localskin;
|
||||
boolean skinlocal;
|
||||
// Player and mobj sprites in multiplayer modes are modified
|
||||
// using an internal color lookup table for re-indexing.
|
||||
UINT8 color; // This replaces MF_TRANSLATION. Use 0 for default (no translation).
|
||||
|
||||
+5
-5
@@ -3433,7 +3433,7 @@ boolean P_RunSOC(const char *socfilename)
|
||||
lumpnum_t lump;
|
||||
|
||||
if (strstr(socfilename, ".soc") != NULL)
|
||||
return P_AddWadFile(socfilename);
|
||||
return P_AddWadFile(socfilename, false);
|
||||
|
||||
lump = W_CheckNumForName(socfilename);
|
||||
if (lump == LUMPERROR)
|
||||
@@ -3449,11 +3449,11 @@ boolean P_RunSOC(const char *socfilename)
|
||||
// Add a wadfile to the active wad files,
|
||||
// replace sounds, musics, patches, textures, sprites and maps
|
||||
//
|
||||
boolean P_AddWadFile(const char *wadfilename)
|
||||
boolean P_AddWadFile(const char *wadfilename, boolean local)
|
||||
{
|
||||
UINT16 wadnum;
|
||||
|
||||
if ((wadnum = P_PartialAddWadFile(wadfilename)) == UINT16_MAX)
|
||||
if ((wadnum = P_PartialAddWadFile(wadfilename, local)) == UINT16_MAX)
|
||||
return false;
|
||||
|
||||
P_MultiSetupWadFiles(true);
|
||||
@@ -3464,7 +3464,7 @@ boolean P_AddWadFile(const char *wadfilename)
|
||||
// Add a WAD file and do the per-WAD setup stages.
|
||||
// Call P_MultiSetupWadFiles as soon as possible after any number of these.
|
||||
//
|
||||
UINT16 P_PartialAddWadFile(const char *wadfilename)
|
||||
UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
{
|
||||
size_t i, j, sreplaces = 0, mreplaces = 0, digmreplaces = 0;
|
||||
UINT16 numlumps, wadnum;
|
||||
@@ -3534,7 +3534,7 @@ UINT16 P_PartialAddWadFile(const char *wadfilename)
|
||||
//
|
||||
// look for skins
|
||||
//
|
||||
R_AddSkins(wadnum); // faB: wadfile index in wadfiles[]
|
||||
R_AddSkins(wadnum, local); // faB: wadfile index in wadfiles[]
|
||||
|
||||
//
|
||||
// edit music defs
|
||||
|
||||
+2
-2
@@ -60,7 +60,7 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum);
|
||||
#endif
|
||||
void P_LoadThingsOnly(void);
|
||||
boolean P_SetupLevel(boolean skipprecip);
|
||||
boolean P_AddWadFile(const char *wadfilename);
|
||||
boolean P_AddWadFile(const char *wadfilename, boolean local);
|
||||
#ifdef DELFILE
|
||||
boolean P_DelWadFile(void);
|
||||
#endif
|
||||
@@ -68,7 +68,7 @@ boolean P_DelWadFile(void);
|
||||
// WARNING: The following functions should be grouped as follows:
|
||||
// any amount of PartialAdds followed by MultiSetups until returned true,
|
||||
// as soon as possible.
|
||||
UINT16 P_PartialAddWadFile(const char *wadfilename);
|
||||
UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local);
|
||||
// Run a single stage of multisetup, or all of them if fullsetup set.
|
||||
// fullsetup true: run everything
|
||||
// otherwise
|
||||
|
||||
+42
-13
@@ -18,6 +18,7 @@
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "r_local.h"
|
||||
#include "r_things.h"
|
||||
#include "st_stuff.h" // need ST_HEIGHT
|
||||
#include "i_video.h"
|
||||
#include "v_video.h"
|
||||
@@ -141,6 +142,7 @@ UINT32 nflatxshift, nflatyshift, nflatshiftup, nflatmask;
|
||||
#define NUM_PALETTE_ENTRIES 256
|
||||
|
||||
static UINT8** translationtablecache[TT_CACHE_SIZE] = {NULL};
|
||||
static UINT8** localtranslationtablecache[MAXSKINS] = {NULL};
|
||||
|
||||
|
||||
// See also the enum skincolors_t
|
||||
@@ -519,29 +521,39 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U
|
||||
|
||||
\return Colormap. If not cached, caller should Z_Free.
|
||||
*/
|
||||
UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags)
|
||||
static UINT8* RGetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags, boolean local)
|
||||
{
|
||||
UINT8 ***tt;
|
||||
UINT8* ret;
|
||||
INT32 skintableindex;
|
||||
|
||||
// Adjust if we want the default colormap
|
||||
if (skinnum == TC_DEFAULT) skintableindex = DEFAULT_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_BOSS) skintableindex = BOSS_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_METALSONIC) skintableindex = METALSONIC_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_ALLWHITE) skintableindex = ALLWHITE_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_RAINBOW) skintableindex = RAINBOW_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_BLINK) skintableindex = BLINK_TT_CACHE_INDEX;
|
||||
else skintableindex = skinnum;
|
||||
if (local)
|
||||
{
|
||||
tt = localtranslationtablecache;
|
||||
skintableindex = skinnum;
|
||||
}
|
||||
else
|
||||
{
|
||||
tt = translationtablecache;
|
||||
// Adjust if we want the default colormap
|
||||
if (skinnum == TC_DEFAULT) skintableindex = DEFAULT_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_BOSS) skintableindex = BOSS_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_METALSONIC) skintableindex = METALSONIC_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_ALLWHITE) skintableindex = ALLWHITE_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_RAINBOW) skintableindex = RAINBOW_TT_CACHE_INDEX;
|
||||
else if (skinnum == TC_BLINK) skintableindex = BLINK_TT_CACHE_INDEX;
|
||||
else skintableindex = skinnum;
|
||||
}
|
||||
|
||||
if (flags & GTC_CACHE)
|
||||
{
|
||||
|
||||
// Allocate table for skin if necessary
|
||||
if (!translationtablecache[skintableindex])
|
||||
translationtablecache[skintableindex] = Z_Calloc(MAXTRANSLATIONS * sizeof(UINT8**), PU_STATIC, NULL);
|
||||
if (!tt[skintableindex])
|
||||
tt[skintableindex] = Z_Calloc(MAXTRANSLATIONS * sizeof(UINT8**), PU_STATIC, NULL);
|
||||
|
||||
// Get colormap
|
||||
ret = translationtablecache[skintableindex][color];
|
||||
ret = tt[skintableindex][color];
|
||||
}
|
||||
else ret = NULL;
|
||||
|
||||
@@ -553,12 +565,25 @@ UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags)
|
||||
|
||||
// Cache the colormap if desired
|
||||
if (flags & GTC_CACHE)
|
||||
translationtablecache[skintableindex][color] = ret;
|
||||
tt[skintableindex][color] = ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags)
|
||||
{
|
||||
return RGetTranslationColormap(skinnum, color, flags, false);
|
||||
}
|
||||
|
||||
UINT8* R_GetLocalTranslationColormap(skin_t *skin, skin_t *localskin, skincolors_t color, UINT8 flags, boolean local)
|
||||
{
|
||||
if (localskin)
|
||||
return RGetTranslationColormap(( localskin - ( (local) ? localskins : skins ) ), color, flags, local);
|
||||
else
|
||||
return RGetTranslationColormap(( skin - skins ), color, flags, false);
|
||||
}
|
||||
|
||||
/** \brief Flushes cache of translation colormaps.
|
||||
|
||||
Flushes cache of translation colormaps, but doesn't actually free the
|
||||
@@ -574,6 +599,10 @@ void R_FlushTranslationColormapCache(void)
|
||||
for (i = 0; i < (INT32)(sizeof(translationtablecache) / sizeof(translationtablecache[0])); i++)
|
||||
if (translationtablecache[i])
|
||||
memset(translationtablecache[i], 0, MAXTRANSLATIONS * sizeof(UINT8**));
|
||||
|
||||
for (i = 0; i < (INT32)(sizeof(localtranslationtablecache) / sizeof(localtranslationtablecache[0])); i++)
|
||||
if (localtranslationtablecache[i])
|
||||
memset(localtranslationtablecache[i], 0, MAXTRANSLATIONS * sizeof(UINT8**));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#define __R_DRAW__
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "r_things.h"
|
||||
|
||||
// -------------------------------
|
||||
// COMMON STUFF FOR 8bpp AND 16bpp
|
||||
@@ -115,6 +116,7 @@ extern lumpnum_t viewborderlump[8];
|
||||
// Initialize color translation tables, for player rendering etc.
|
||||
void R_InitTranslationTables(void);
|
||||
UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags);
|
||||
UINT8* R_GetLocalTranslationColormap(skin_t *skin, skin_t *localskin, skincolors_t color, UINT8 flags, boolean local);
|
||||
void R_FlushTranslationColormapCache(void);
|
||||
UINT8 R_GetColorByName(const char *name);
|
||||
|
||||
|
||||
+109
-31
@@ -616,7 +616,7 @@ void R_InitSprites(void)
|
||||
// it can be is do before loading config for skin cvar possible value
|
||||
R_InitSkins();
|
||||
for (i = 0; i < numwadfiles; i++)
|
||||
R_AddSkins((UINT16)i);
|
||||
R_AddSkins((UINT16)i, false);
|
||||
|
||||
//
|
||||
// check if all sprites have frames
|
||||
@@ -841,10 +841,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
if (vis->mobj->colorized)
|
||||
dc_translation = R_GetTranslationColormap(TC_RAINBOW, vis->mobj->color, GTC_CACHE);
|
||||
else if (vis->mobj->skin && vis->mobj->sprite == SPR_PLAY) // MT_GHOST LOOKS LIKE A PLAYER SO USE THE PLAYER TRANSLATION TABLES. >_>
|
||||
{
|
||||
size_t skinnum = (skin_t*)vis->mobj->skin-skins;
|
||||
dc_translation = R_GetTranslationColormap((INT32)skinnum, vis->mobj->color, GTC_CACHE);
|
||||
}
|
||||
dc_translation = R_GetLocalTranslationColormap(vis->mobj->skin, vis->mobj->localskin, vis->mobj->color, GTC_CACHE, vis->mobj->skinlocal);
|
||||
else // Use the defaults
|
||||
dc_translation = R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color, GTC_CACHE);
|
||||
}
|
||||
@@ -862,10 +859,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
if (vis->mobj->colorized)
|
||||
dc_translation = R_GetTranslationColormap(TC_RAINBOW, vis->mobj->color, GTC_CACHE);
|
||||
else if (vis->mobj->skin && vis->mobj->sprite == SPR_PLAY) // This thing is a player!
|
||||
{
|
||||
size_t skinnum = (skin_t*)vis->mobj->skin-skins;
|
||||
dc_translation = R_GetTranslationColormap((INT32)skinnum, vis->mobj->color, GTC_CACHE);
|
||||
}
|
||||
dc_translation = R_GetLocalTranslationColormap(vis->mobj->skin, vis->mobj->localskin, vis->mobj->color, GTC_CACHE, vis->mobj->skinlocal);
|
||||
else // Use the defaults
|
||||
dc_translation = R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color, GTC_CACHE);
|
||||
}
|
||||
@@ -894,7 +888,9 @@ static void R_DrawVisSprite(vissprite_t *vis)
|
||||
frac = vis->startfrac;
|
||||
windowtop = windowbottom = sprbotscreen = INT32_MAX;
|
||||
|
||||
if (vis->mobj->skin && ((skin_t *)vis->mobj->skin)->flags & SF_HIRES)
|
||||
if (vis->mobj->localskin && ((skin_t *)vis->mobj->localskin)->flags & SF_HIRES)
|
||||
this_scale = FixedMul(this_scale, ((skin_t *)vis->mobj->localskin)->highresscale);
|
||||
else if (vis->mobj->skin && ((skin_t *)vis->mobj->skin)->flags & SF_HIRES)
|
||||
this_scale = FixedMul(this_scale, ((skin_t *)vis->mobj->skin)->highresscale);
|
||||
if (this_scale <= 0)
|
||||
this_scale = 1;
|
||||
@@ -1218,7 +1214,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
//Fab : 02-08-98: 'skin' override spritedef currently used for skin
|
||||
if (thing->skin && thing->sprite == SPR_PLAY)
|
||||
{
|
||||
sprdef = &((skin_t *)thing->skin)->spritedef;
|
||||
sprdef = &((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->spritedef;
|
||||
if (rot >= sprdef->numframes)
|
||||
sprdef = &sprites[thing->sprite];
|
||||
}
|
||||
@@ -1280,7 +1276,9 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
|
||||
I_Assert(lump < max_spritelumps);
|
||||
|
||||
if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES)
|
||||
if (thing->localskin && ((skin_t *)thing->localskin)->flags & SF_HIRES)
|
||||
this_scale = FixedMul(this_scale, ((skin_t *)thing->localskin)->highresscale);
|
||||
else if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES)
|
||||
this_scale = FixedMul(this_scale, ((skin_t *)thing->skin)->highresscale);
|
||||
|
||||
// calculate edges of the shape
|
||||
@@ -2631,6 +2629,7 @@ void R_DrawMasked(void)
|
||||
// ==========================================================================
|
||||
|
||||
INT32 numskins = 0;
|
||||
INT32 numlocalskins = 0;
|
||||
skin_t skins[MAXSKINS];
|
||||
UINT8 skinstats[9][9][MAXSKINS];
|
||||
UINT8 skinstatscount[9][9] = {
|
||||
@@ -2645,13 +2644,15 @@ UINT8 skinstatscount[9][9] = {
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
UINT8 skinsorted[MAXSKINS];
|
||||
skin_t localskins[MAXSKINS];
|
||||
// FIXTHIS: don't work because it must be inistilised before the config load
|
||||
//#define SKINVALUES
|
||||
#ifdef SKINVALUES
|
||||
CV_PossibleValue_t skin_cons_t[MAXSKINS+1];
|
||||
CV_PossibleValue_t localskin_cons_t[MAXSKINS+1];
|
||||
#endif
|
||||
|
||||
static void Sk_SetDefaultValue(skin_t *skin)
|
||||
static void Sk_SetDefaultValue(skin_t *skin, boolean local)
|
||||
{
|
||||
INT32 i;
|
||||
//
|
||||
@@ -2659,7 +2660,7 @@ static void Sk_SetDefaultValue(skin_t *skin)
|
||||
//
|
||||
memset(skin, 0, sizeof (skin_t));
|
||||
snprintf(skin->name,
|
||||
sizeof skin->name, "skin %u", (UINT32)(skin-skins));
|
||||
sizeof skin->name, "skin %u", (UINT32)(skin-( (local) ? localskins : skins )));
|
||||
skin->name[sizeof skin->name - 1] = '\0';
|
||||
skin->wadnum = INT16_MAX;
|
||||
strcpy(skin->sprite, "");
|
||||
@@ -2700,13 +2701,15 @@ void R_InitSkins(void)
|
||||
{
|
||||
skin_cons_t[i].value = 0;
|
||||
skin_cons_t[i].strvalue = NULL;
|
||||
localskin_cons_t[i].value = 0;
|
||||
localskin_cons_t[i].strvalue = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
// skin[0] = Sonic skin
|
||||
skin = &skins[0];
|
||||
numskins = 1;
|
||||
Sk_SetDefaultValue(skin);
|
||||
Sk_SetDefaultValue(skin, false);
|
||||
memset(skinstats, 0, sizeof(skinstats));
|
||||
memset(skinsorted, 0, sizeof(skinsorted));
|
||||
|
||||
@@ -2740,7 +2743,7 @@ void R_InitSkins(void)
|
||||
//MD2 for sonic doesn't want to load in Linux.
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
HWR_AddPlayerMD2(0);
|
||||
HWR_AddPlayerMD2(0, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2758,6 +2761,23 @@ INT32 R_SkinAvailable(const char *name)
|
||||
return -1;
|
||||
}
|
||||
|
||||
INT32 R_LocalSkinAvailable(const char *name, boolean local)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
if (local)
|
||||
{
|
||||
for (i = 0; i < numlocalskins; i++)
|
||||
{
|
||||
if (stricmp(localskins[i].name,name)==0)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
return R_SkinAvailable(name);
|
||||
}
|
||||
|
||||
// network code calls this when a 'skin change' is received
|
||||
boolean SetPlayerSkin(INT32 playernum, const char *skinname)
|
||||
{
|
||||
@@ -2783,6 +2803,61 @@ boolean SetPlayerSkin(INT32 playernum, const char *skinname)
|
||||
return false;
|
||||
}
|
||||
|
||||
void SetLocalPlayerSkin(INT32 playernum, const char *skinname, consvar_t *cvar)
|
||||
{
|
||||
player_t *player = &players[playernum];
|
||||
INT32 i;
|
||||
|
||||
if (strcasecmp(skinname, "none"))
|
||||
{
|
||||
for (i = 0; i < numlocalskins; i++)
|
||||
{
|
||||
// search in the skin list
|
||||
if (stricmp(localskins[i].name, skinname) == 0)
|
||||
{
|
||||
player->localskin = 1 + i;
|
||||
player->skinlocal = true;
|
||||
if (player->mo)
|
||||
{
|
||||
player->mo->localskin = &localskins[i];
|
||||
player->mo->skinlocal = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < numskins; i++)
|
||||
{
|
||||
// search in the skin list
|
||||
if (stricmp(skins[i].name, skinname) == 0)
|
||||
{
|
||||
player->localskin = 1 + i;
|
||||
player->skinlocal = false;
|
||||
if (player->mo)
|
||||
{
|
||||
player->mo->localskin = &skins[i];
|
||||
player->mo->skinlocal = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player->localskin = 0;
|
||||
player->skinlocal = false;
|
||||
if (player->mo)
|
||||
{
|
||||
player->mo->localskin = 0;
|
||||
player->mo->skinlocal = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (player->localskin > 0)
|
||||
CV_StealthSet(cvar, ( (player->skinlocal) ? localskins : skins )[player->localskin - 1].name);
|
||||
else
|
||||
CV_StealthSet(cvar, "none");
|
||||
}
|
||||
|
||||
// Same as SetPlayerSkin, but uses the skin #.
|
||||
// network code calls this when a 'skin change' is received
|
||||
void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
|
||||
@@ -2967,7 +3042,7 @@ void sortSkinGrid(void)
|
||||
//
|
||||
// Find skin sprites, sounds & optional status bar face, & add them
|
||||
//
|
||||
void R_AddSkins(UINT16 wadnum)
|
||||
void R_AddSkins(UINT16 wadnum, boolean local)
|
||||
{
|
||||
UINT16 lump, lastlump = 0;
|
||||
char *buf;
|
||||
@@ -2987,7 +3062,7 @@ void R_AddSkins(UINT16 wadnum)
|
||||
// advance by default
|
||||
lastlump = lump + 1;
|
||||
|
||||
if (numskins >= MAXSKINS)
|
||||
if (( (local) ? numlocalskins : numskins ) >= MAXSKINS)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Unable to add skin, too many characters are loaded (%d maximum)\n"), MAXSKINS);
|
||||
continue; // so we know how many skins couldn't be added
|
||||
@@ -3003,8 +3078,8 @@ void R_AddSkins(UINT16 wadnum)
|
||||
buf2[size] = '\0';
|
||||
|
||||
// set defaults
|
||||
skin = &skins[numskins];
|
||||
Sk_SetDefaultValue(skin);
|
||||
skin = &( (local) ? localskins : skins )[( (local) ? numlocalskins : numskins )];
|
||||
Sk_SetDefaultValue(skin, local);
|
||||
skin->wadnum = wadnum;
|
||||
hudname = realname = false;
|
||||
// parse
|
||||
@@ -3028,7 +3103,7 @@ void R_AddSkins(UINT16 wadnum)
|
||||
// the skin name must uniquely identify a single skin
|
||||
// I'm lazy so if name is already used I leave the 'skin x'
|
||||
// default skin name set in Sk_SetDefaultValue
|
||||
if (R_SkinAvailable(value) == -1)
|
||||
if (R_LocalSkinAvailable(value, local) == -1)
|
||||
{
|
||||
STRBUFCPY(skin->name, value);
|
||||
strlwr(skin->name);
|
||||
@@ -3038,12 +3113,12 @@ void R_AddSkins(UINT16 wadnum)
|
||||
else
|
||||
{
|
||||
const size_t stringspace =
|
||||
strlen(value) + sizeof (numskins) + 1;
|
||||
strlen(value) + sizeof (( (local) ? numlocalskins : numskins )) + 1;
|
||||
char *value2 = Z_Malloc(stringspace, PU_STATIC, NULL);
|
||||
snprintf(value2, stringspace,
|
||||
"%s%d", value, numskins);
|
||||
"%s%d", value, ( (local) ? numlocalskins : numskins ));
|
||||
value2[stringspace - 1] = '\0';
|
||||
if (R_SkinAvailable(value2) == -1)
|
||||
if (R_LocalSkinAvailable(value2, local) == -1)
|
||||
{
|
||||
STRBUFCPY(skin->name,
|
||||
value2);
|
||||
@@ -3226,20 +3301,23 @@ next_token:
|
||||
|
||||
CONS_Printf(M_GetText("Added skin '%s'\n"), skin->name);
|
||||
#ifdef SKINVALUES
|
||||
skin_cons_t[numskins].value = numskins;
|
||||
skin_cons_t[numskins].strvalue = skin->name;
|
||||
( (local) ? localskin_cons_t : skin_cons_t )[( (local) ? numlocalskins : numskins )].value = ( (local) ? numlocalskins : numskins );
|
||||
( (local) ? localskin_cons_t : skin_cons_t )[( (local) ? numlocalskins : numskins )].strvalue = skin->name;
|
||||
#endif
|
||||
|
||||
// Update the forceskin possiblevalues
|
||||
Forceskin_cons_t[numskins+1].value = numskins;
|
||||
Forceskin_cons_t[numskins+1].strvalue = skins[numskins].name;
|
||||
if (! local)
|
||||
{
|
||||
Forceskin_cons_t[numskins+1].value = numskins;
|
||||
Forceskin_cons_t[numskins+1].strvalue = skins[numskins].name;
|
||||
}
|
||||
|
||||
// add face graphics
|
||||
ST_LoadFaceGraphics(skin->facerank, skin->facewant, skin->facemmap, numskins);
|
||||
ST_LoadLocalFaceGraphics(skin->facerank, skin->facewant, skin->facemmap, numskins, local);
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
HWR_AddPlayerMD2(numskins);
|
||||
HWR_AddPlayerMD2(( (local) ? numlocalskins : numskins ), local);
|
||||
#endif
|
||||
skinstats[skin->kartspeed-1][skin->kartweight-1][skinstatscount[skin->kartspeed-1][skin->kartweight-1]] = numskins;
|
||||
CONS_Debug(DBG_SETUP, M_GetText("Added %d to %d, %d\n"), numskins, skin->kartweight, skin->kartweight);
|
||||
@@ -3248,7 +3326,7 @@ next_token:
|
||||
|
||||
skinsorted[numskins] = numskins;
|
||||
|
||||
numskins++;
|
||||
( (local) ? numlocalskins++ : numskins++ );
|
||||
}
|
||||
|
||||
sortSkinGrid();
|
||||
|
||||
+5
-1
@@ -188,17 +188,21 @@ typedef struct drawnode_s
|
||||
} drawnode_t;
|
||||
|
||||
extern INT32 numskins;
|
||||
extern INT32 numlocalskins;
|
||||
extern skin_t skins[MAXSKINS];
|
||||
extern UINT8 skinstats[9][9][MAXSKINS];
|
||||
extern UINT8 skinstatscount[9][9];
|
||||
extern UINT8 skinsorted[MAXSKINS];
|
||||
|
||||
void sortSkinGrid(void);
|
||||
extern skin_t localskins[MAXSKINS];
|
||||
|
||||
boolean SetPlayerSkin(INT32 playernum,const char *skinname);
|
||||
void SetPlayerSkinByNum(INT32 playernum,INT32 skinnum); // Tails 03-16-2002
|
||||
void SetLocalPlayerSkin(INT32 playernum,const char *skinname, consvar_t *cvar);
|
||||
INT32 R_SkinAvailable(const char *name);
|
||||
void R_AddSkins(UINT16 wadnum);
|
||||
INT32 R_LocalSkinAvailable(const char *name, boolean local);
|
||||
void R_AddSkins(UINT16 wadnum, boolean local);
|
||||
|
||||
#ifdef DELFILE
|
||||
void R_DelSkins(UINT16 wadnum);
|
||||
|
||||
@@ -58,6 +58,10 @@ patch_t *facerankprefix[MAXSKINS]; // ranking
|
||||
patch_t *facewantprefix[MAXSKINS]; // wanted
|
||||
patch_t *facemmapprefix[MAXSKINS]; // minimap
|
||||
|
||||
patch_t *localfacerankprefix[MAXSKINS]; // ranking
|
||||
patch_t *localfacewantprefix[MAXSKINS]; // wanted
|
||||
patch_t *localfacemmapprefix[MAXSKINS]; // minimap
|
||||
|
||||
// ------------------------------------------
|
||||
// status bar overlay
|
||||
// ------------------------------------------
|
||||
@@ -380,12 +384,27 @@ void ST_LoadFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32 skin
|
||||
facemmapprefix[skinnum] = W_CachePatchName(mmapstr, PU_HUDGFX);
|
||||
}
|
||||
|
||||
void ST_LoadLocalFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32 skinnum, boolean local)
|
||||
{
|
||||
if (local)
|
||||
{
|
||||
localfacerankprefix[skinnum] = W_CachePatchName(rankstr, PU_HUDGFX);
|
||||
localfacewantprefix[skinnum] = W_CachePatchName(wantstr, PU_HUDGFX);
|
||||
localfacemmapprefix[skinnum] = W_CachePatchName(mmapstr, PU_HUDGFX);
|
||||
}
|
||||
else
|
||||
ST_LoadFaceGraphics(rankstr, wantstr, mmapstr, skinnum);
|
||||
}
|
||||
|
||||
void ST_ReloadSkinFaceGraphics(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < numskins; i++)
|
||||
ST_LoadFaceGraphics(skins[i].facerank, skins[i].facewant, skins[i].facemmap, i);
|
||||
|
||||
for (i = 0; i < numlocalskins; i++)
|
||||
ST_LoadLocalFaceGraphics(skins[i].facerank, skins[i].facewant, skins[i].facemmap, i, true);
|
||||
}
|
||||
|
||||
static inline void ST_InitData(void)
|
||||
|
||||
@@ -51,6 +51,7 @@ void ST_LoadGraphics(void);
|
||||
|
||||
// face load graphics, called when skin changes
|
||||
void ST_LoadFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32 playernum);
|
||||
void ST_LoadLocalFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32 playernum, boolean local);
|
||||
void ST_ReloadSkinFaceGraphics(void);
|
||||
#ifdef DELFILE
|
||||
void ST_UnLoadFaceGraphics(INT32 skinnum);
|
||||
|
||||
Reference in new issue
Block a user