alufolie91 committed 2023-08-30 19:12:56 +02:00
1 parent 76b66b41b6
commit 71e4005226
6 files changed
+128 -71

No files matched your search

+11 -11
View File
@@ -294,10 +294,6 @@ consvar_t cv_skin3 = {"skin3", DEFAULTSKIN3, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Sk
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 = {"internal___localskin", "none", CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_localskin2 = {"internal___localskin2", "none", CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_localskin3 = {"internal___localskin3", "none", CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_localskin4 = {"internal___localskin4", "none", CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_localskinall = {"internal___localskinall", "none", CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -456,6 +452,7 @@ static CV_PossibleValue_t basenumlaps_cons_t[] = {{1, "MIN"}, {50, "MAX"}, {0, "
consvar_t cv_basenumlaps = {"basenumlaps", "Map default", CV_NETVAR|CV_CALL|CV_CHEAT, basenumlaps_cons_t, BaseNumLaps_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_forceskin = {"forceskin", "Off", CV_NETVAR|CV_CALL|CV_CHEAT, Forceskin_cons_t, ForceSkin_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_fakelocalskin = {"fakelocalskin", "None", CV_SAVE, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_downloading = {"downloading", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_allowexitlevel = {"allowexitlevel", "No", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -477,6 +474,7 @@ consvar_t cv_showping = {"showping", "Always", CV_SAVE, showping_cons_t, NULL, 0
static CV_PossibleValue_t pingmeasurement_cons_t[] = {{0, "Frames"}, {1, "Milliseconds"}, {0, NULL}};
consvar_t cv_pingmeasurement = {"pingmeasurement", "Frames", CV_SAVE, pingmeasurement_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_luaimmersion = {"luaimmersion", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_minihead = {"smallminimapplayers", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -788,6 +786,9 @@ void D_RegisterServerCommands(void)
CV_RegisterVar(&cv_showping);
CV_RegisterVar(&cv_pingmeasurement);
CV_RegisterVar(&cv_luaimmersion);
CV_RegisterVar(&cv_fakelocalskin);
CV_RegisterVar(&cv_minihead);
CV_RegisterVar(&cv_showminimapnames);
@@ -901,18 +902,14 @@ void D_RegisterClientCommands(void)
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);
CV_RegisterVar(&cv_localskinall);
// preferred number of players
CV_RegisterVar(&cv_splitplayers);
@@ -4706,15 +4703,18 @@ static void Command_GLocalSkin (void) {
for (idx = 0; idx < ap_count_args(parser); idx++) {
if (disply) {
SetLocalPlayerSkin(displayplayers[0], ap_arg(parser, idx), &cv_localskin);
SetLocalPlayerSkin(displayplayers[0], ap_arg(parser, idx), NULL);
return;
} else {
for (i = 0; i < MAXPLAYERS; i++) {
if (allp) {
SetLocalPlayerSkin(i, ap_arg(parser, idx), &cv_localskinall);
SetLocalPlayerSkin(i, ap_arg(parser, idx), NULL);
} else {
if (fasticmp(player_names[i], ap_str_value(parser, "player"))) {
SetLocalPlayerSkin(i, ap_arg(parser, idx), &cv_localskin);
if (fasticmp(player_names[i], cv_playername.string))
SetLocalPlayerSkin(i, ap_arg(parser, idx), &cv_localskin);
else
SetLocalPlayerSkin(i, ap_arg(parser, idx), NULL);
break;
}
}
+2 -4
View File
@@ -26,18 +26,14 @@ extern consvar_t cv_localskin;
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;
extern consvar_t cv_localskinall;
// preferred number of players
extern consvar_t cv_splitplayers;
@@ -162,6 +158,8 @@ extern consvar_t cv_minihead;
extern consvar_t cv_showlapemblem;
extern consvar_t cv_showviewpointtext;
extern consvar_t cv_luaimmersion;
extern consvar_t cv_fakelocalskin;
extern consvar_t cv_skipmapcheck;
+8 -10
View File
@@ -20,6 +20,7 @@
#include "g_game.h"
#include "p_setup.h"
#include "doomdef.h"
#include "d_netcmd.h"
#include "lua_script.h"
#include "lua_libs.h"
@@ -351,11 +352,14 @@ int mobj_skin_getter(lua_State *L)
if (!mo->skin)
return 0;
if (mo->localskin) // pretty cool, but also destructive
lua_pushstring(L, ((skin_t *)mo->localskin)->name);
else
if (hud_running && cv_luaimmersion.value) {
if (mo->localskin) // HUD ONLY!!!!!!!!!!
lua_pushstring(L, ((skin_t *)mo->localskin)->name);
else
lua_pushstring(L, ((skin_t *)mo->skin)->name);
} else {
lua_pushstring(L, ((skin_t *)mo->skin)->name);
}
return 1;
}
@@ -367,12 +371,6 @@ int mobj_skin_setter(lua_State *L)
char skin[SKINNAMESIZE+1]; // all skin names are limited to this length
strlcpy(skin, luaL_checkstring(L, 2), sizeof skin);
strlwr(skin); // all skin names are lowercase
// nope, not this time chief.
if (fastcmp(localskins[players[consoleplayer].localskin - 1].name, skin))
{
mo->skin = &skins[players[consoleplayer].skin]; // we dont want to use our local skin for this!!!!!!!!!
return 0;
}
for (i = 0; i < numskins; i++) {
{
if (fastcmp(skins[i].name, skin))
+67 -15
View File
@@ -234,6 +234,8 @@ menu_t SR_MainDef, SR_UnlockChecklistDef;
static void M_SinglePlayerMenu(INT32 choice);
#endif
static void M_Options(INT32 choice);
static void M_LocalSkinMenu(INT32 choice);
static void M_LocalSkinChange(INT32 choice);
static void M_Manual(INT32 choice);
static void M_SelectableClearMenus(INT32 choice);
static void M_Retry(INT32 choice);
@@ -350,6 +352,9 @@ menu_t OP_SaturnCreditsDef;
// Bird
menu_t OP_BirdDef;
// Stuff, yknow.
menu_t OP_ForkedBirdDef;
menu_t OP_LocalSkinDef;
menu_t OP_TiltDef;
menu_t OP_AdvancedBirdDef;
@@ -407,6 +412,7 @@ static void M_DrawConnectMenu(void);
#endif
static void M_DrawJoystick(void);
static void M_DrawSetupMultiPlayerMenu(void);
static void M_DrawLocalSkinMenu(void);
// Handling functions
#ifndef NONET
@@ -647,10 +653,11 @@ static menuitem_t MPauseMenu[] =
{IT_STRING | IT_SUBMENU, NULL, "Switch Team...", &MISC_ChangeTeamDef, 48},
{IT_STRING | IT_SUBMENU, NULL, "Enter/Spectate...", &MISC_ChangeSpectateDef,48},
{IT_CALL | IT_STRING, NULL, "Player Setup...", M_SetupMultiPlayer, 56}, // alone
{IT_CALL | IT_STRING, NULL, "Options", M_Options, 64},
{IT_CALL | IT_STRING, NULL, "Local Skin...", M_LocalSkinMenu, 64}, // alone
{IT_CALL | IT_STRING, NULL, "Options", M_Options, 72},
{IT_CALL | IT_STRING, NULL, "Return to Title", M_EndGame, 80},
{IT_CALL | IT_STRING, NULL, "Quit Game", M_QuitSRB2, 88},
{IT_CALL | IT_STRING, NULL, "Return to Title", M_EndGame, 88},
{IT_CALL | IT_STRING, NULL, "Quit Game", M_QuitSRB2, 96},
};
typedef enum
@@ -674,6 +681,7 @@ typedef enum
mpause_switchteam,
mpause_switchspectate,
mpause_psetup,
mpause_localskin,
mpause_options,
mpause_title,
@@ -1128,6 +1136,7 @@ static menuitem_t OP_MainMenu[] =
{IT_SUBMENU|IT_STRING, NULL, "Saturn Options...", &OP_SaturnDef, 140},
{IT_SUBMENU|IT_STRING, NULL, "Bird", &OP_BirdDef, 150},
{IT_CALL|IT_STRING, NULL, "Fork Options...", M_LocalSkinMenu, 160},
};
static menuitem_t OP_ControlsMenu[] =
@@ -1812,6 +1821,17 @@ static menuitem_t OP_BirdMenu[] =
{IT_STRING | IT_SUBMENU, NULL, "Advanced Music Options...", &OP_AdvancedBirdDef, 120},
};
static menuitem_t OP_ForkedBirdMenu[] =
{
{IT_HEADER, NULL, "Local Skins", NULL, 0},
{IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "Local Skin Name", &cv_fakelocalskin, 10},
{IT_STRING2 | IT_SPACE, NULL, "Set to None for no Local Skin", NULL, 50},
{IT_STRING | IT_CALL, NULL, "Apply to All Players", M_LocalSkinChange, 50},
{IT_STRING | IT_CALL, NULL, "Apply to Displaying Player", M_LocalSkinChange, 60},
{IT_STRING | IT_CALL, NULL, "Apply to Yourself", M_LocalSkinChange, 70},
{IT_STRING | IT_CVAR, NULL, "Lua Immersion", &cv_luaimmersion, 90},
};
static menuitem_t OP_TiltMenu[] =
{
{IT_STRING | IT_CVAR, NULL, "Camera Tilting", &cv_tilting, 0},
@@ -2375,6 +2395,10 @@ menu_t OP_BirdDef = DEFAULTMENUSTYLE(NULL, OP_BirdMenu, &OP_MainDef, 30, 30);
menu_t OP_TiltDef = DEFAULTMENUSTYLE(NULL, OP_TiltMenu, &OP_BirdDef, 30, 60);
menu_t OP_AdvancedBirdDef = DEFAULTMENUSTYLE(NULL, OP_AdvancedBirdMenu, &OP_BirdDef, 30, 60);
menu_t OP_ForkedBirdDef = DEFAULTMENUSTYLE(NULL, OP_ForkedBirdMenu, &OP_MainDef, 30, 30);
menu_t OP_LocalSkinDef = DEFAULTMENUSTYLE(NULL, OP_TiltMenu, &OP_ForkedBirdDef, 30, 60);
// ==========================================================================
// CVAR ONCHANGE EVENTS GO HERE
// ==========================================================================
@@ -3571,7 +3595,7 @@ void M_StartControlPanel(void)
else // multiplayer
{
MPauseMenu[mpause_switchmap].status = IT_DISABLED;
//MPauseMenu[mpause_addons].status = IT_DISABLED;
MPauseMenu[mpause_addons].status = IT_DISABLED;
MPauseMenu[mpause_scramble].status = IT_DISABLED;
MPauseMenu[mpause_psetupsplit].status = IT_DISABLED;
MPauseMenu[mpause_psetupsplit2].status = IT_DISABLED;
@@ -3593,9 +3617,10 @@ void M_StartControlPanel(void)
MPauseMenu[mpause_switchteam].alphaKey = 48;
MPauseMenu[mpause_switchspectate].alphaKey = 48;
MPauseMenu[mpause_options].alphaKey = 64;
MPauseMenu[mpause_title].alphaKey = 80;
MPauseMenu[mpause_quit].alphaKey = 88;
MPauseMenu[mpause_localskin].alphaKey = 64;
MPauseMenu[mpause_options].alphaKey = 72;
MPauseMenu[mpause_title].alphaKey = 88;
MPauseMenu[mpause_quit].alphaKey = 96;
Dummymenuplayer_OnChange();
@@ -3605,6 +3630,9 @@ void M_StartControlPanel(void)
MPauseMenu[mpause_addons].status = IT_STRING | IT_CALL;
if (G_GametypeHasTeams())
MPauseMenu[mpause_scramble].status = IT_STRING | IT_SUBMENU;
} else {
MPauseMenu[mpause_addons].status = IT_STRING | IT_CALL;
MPauseMenu[mpause_addons].alphaKey += 8;
}
if (splitscreen)
@@ -3618,6 +3646,7 @@ void M_StartControlPanel(void)
{
MPauseMenu[mpause_switchteam].status = IT_STRING | IT_SUBMENU;
MPauseMenu[mpause_switchteam].alphaKey += ((splitscreen+1) * 8);
MPauseMenu[mpause_localskin].alphaKey += 8;
MPauseMenu[mpause_options].alphaKey += 8;
MPauseMenu[mpause_title].alphaKey += 8;
MPauseMenu[mpause_quit].alphaKey += 8;
@@ -3626,6 +3655,7 @@ void M_StartControlPanel(void)
{
MPauseMenu[mpause_switchspectate].status = IT_STRING | IT_SUBMENU;
MPauseMenu[mpause_switchspectate].alphaKey += ((splitscreen+1) * 8);
MPauseMenu[mpause_localskin].alphaKey += 8;
MPauseMenu[mpause_options].alphaKey += 8;
MPauseMenu[mpause_title].alphaKey += 8;
MPauseMenu[mpause_quit].alphaKey += 8;
@@ -3636,6 +3666,7 @@ void M_StartControlPanel(void)
{
MPauseMenu[mpause_psetupsplit3].status = IT_STRING | IT_CALL;
MPauseMenu[mpause_localskin].alphaKey += 8;
MPauseMenu[mpause_options].alphaKey += 8;
MPauseMenu[mpause_title].alphaKey += 8;
MPauseMenu[mpause_quit].alphaKey += 8;
@@ -3643,6 +3674,7 @@ void M_StartControlPanel(void)
if (splitscreen > 2)
{
MPauseMenu[mpause_psetupsplit4].status = IT_STRING | IT_CALL;
MPauseMenu[mpause_localskin].alphaKey += 8;
MPauseMenu[mpause_options].alphaKey += 8;
MPauseMenu[mpause_title].alphaKey += 8;
MPauseMenu[mpause_quit].alphaKey += 8;
@@ -4283,7 +4315,7 @@ static void M_DrawGenericMenu(void)
y += STRINGHEIGHT;
break;
case IT_STRING2:
V_DrawString(x, y, lowercase, currentMenu->menuitems[i].text);
V_DrawString(((BASEVIDWIDTH - V_StringWidth(currentMenu->menuitems[i].text, 0))>>1), y, 0, currentMenu->menuitems[i].text);
/* FALLTHRU */
case IT_DYLITLSPACE:
y += SMALLLINEHEIGHT;
@@ -6691,6 +6723,33 @@ static void M_Options(INT32 choice)
OP_MainDef.prevMenu = currentMenu;
M_SetupNextMenu(&OP_MainDef);
}
static void M_LocalSkinMenu(INT32 choice)
{
(void)choice;
OP_ForkedBirdDef.prevMenu = currentMenu;
M_SetupNextMenu(&OP_ForkedBirdDef);
}
static void M_LocalSkinChange(INT32 choice)
{
(void)choice;
switch (itemOn) {
case 3:
COM_BufAddText(va("localskin -a %s", cv_fakelocalskin.string));
break;
case 4:
COM_BufAddText(va("localskin -d %s", cv_fakelocalskin.string));
break;
case 5:
COM_BufAddText(va("localskin %s", cv_fakelocalskin.string));
break;
default:
break;
}
S_StartSound(NULL, sfx_s221);
}
static void M_Manual(INT32 choice)
{
@@ -10470,13 +10529,6 @@ static void M_DrawSetupMultiPlayerMenu(void)
// draw box around guy
V_DrawFill(mx + 43 - (charw/2), my+65, charw, 84, 239);
if (setupm_skinlocal)
{
UINT8 *colmap;
colmap = R_GetTranslationColormap(setupm_fakeskin, setupm_fakecolor, GTC_MENUCACHE);
V_DrawFixedPatch(( mx + 43 - (charw/2) + 1 )<<FRACBITS, ( my+65+2 )<<FRACBITS, FRACUNIT, 0, facerankprefix[setupm_fakeskin], colmap);
}
// draw player sprite
if (setupm_fakecolor) // inverse should never happen
+38 -31
View File
@@ -2883,6 +2883,7 @@ void R_InitSkins(void)
skin->wadnum = 0; // god what have you brought to this world
skin->prefcolor = SKINCOLOR_BLUE;
skin->localskin = false;
skin->localnum = 0;
// SRB2kart
skin->kartspeed = 8;
@@ -2922,6 +2923,20 @@ INT32 R_SkinAvailable(const char *name)
return -1;
}
// returns true if the skin name is found (loaded from pwad)
// warning return -1 if not found
INT32 R_AnySkinAvailable(const char *name)
{
INT32 i;
for (i = 0; i < numallskins; i++)
{
if (stricmp(allskins[i].name,name)==0)
return i;
}
return -1;
}
INT32 R_LocalSkinAvailable(const char *name, boolean local)
{
INT32 i;
@@ -2968,13 +2983,6 @@ void SetLocalPlayerSkin(INT32 playernum, const char *skinname, consvar_t *cvar)
{
player_t *player = &players[playernum];
INT32 i;
// this is where we're gonna use major mod for.
if (wadfiles[skins[player->skin].wadnum]->majormod && !demo.playback)
{
CONS_Alert(CONS_ERROR, M_GetText("Cannot set localskin to %s because the player's skin is modifying the game.\n"), skinname);
return;
}
if (strcasecmp(skinname, "none"))
{
@@ -2984,12 +2992,6 @@ void SetLocalPlayerSkin(INT32 playernum, const char *skinname, consvar_t *cvar)
if (stricmp(localskins[i].name, skinname) == 0)
{
player->localskin = 1 + i;
if (wadfiles[localskins[player->localskin - 1].wadnum]->majormod && !demo.playback)
{
CONS_Alert(CONS_ERROR, M_GetText("Cannot set localskin to %s because the localskin is a gameplay-modifying addon.\n"), skinname);
player->localskin = 0;
return;
}
player->skinlocal = true;
if (player->mo)
{
@@ -3005,12 +3007,6 @@ void SetLocalPlayerSkin(INT32 playernum, const char *skinname, consvar_t *cvar)
if (stricmp(skins[i].name, skinname) == 0)
{
player->localskin = 1 + i;
if (wadfiles[skins[player->localskin - 1].wadnum]->majormod && !demo.playback)
{
CONS_Alert(CONS_ERROR, M_GetText("Cannot set localskin to %s because the skin is a gameplay-modifying addon.\n"), skinname);
player->localskin = 0;
return;
}
player->skinlocal = false;
if (player->mo)
{
@@ -3032,12 +3028,16 @@ void SetLocalPlayerSkin(INT32 playernum, const char *skinname, consvar_t *cvar)
}
}
/*
if (player->localskin > 0)
CV_StealthSet(cvar, ( (player->skinlocal) ? localskins : skins )[player->localskin - 1].name);
else
CV_StealthSet(cvar, "none");
*/
if (cvar != NULL) {
if (player->localskin > 0) {
CV_StealthSet(&cv_fakelocalskin, ( (player->skinlocal) ? localskins : skins )[player->localskin - 1].name);
CV_StealthSet(cvar, ( (player->skinlocal) ? localskins : skins )[player->localskin - 1].name);
}
else {
CV_StealthSet(&cv_fakelocalskin, "none");
CV_StealthSet(cvar, "none");
}
}
}
// Same as SetPlayerSkin, but uses the skin #.
@@ -3495,6 +3495,11 @@ next_token:
}
skin->localskin = local;
// so we dont have to guess
if (local)
skin->localnum = numlocalskins;
else
skin->localnum = numskins;
// add face graphics
if (local) {
@@ -3507,12 +3512,14 @@ next_token:
if (rendermode == render_opengl)
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);
skinstatscount[skin->kartspeed-1][skin->kartweight-1]++;
CONS_Debug(DBG_SETUP, M_GetText("Incremented %d, %d to %d\n"), skin->kartspeed, skin->kartweight, skinstatscount[skin->kartspeed - 1][skin->kartweight - 1]);
skinsorted[numskins] = numskins;
if (!local) {
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);
skinstatscount[skin->kartspeed-1][skin->kartweight-1]++;
CONS_Debug(DBG_SETUP, M_GetText("Incremented %d, %d to %d\n"), skin->kartspeed, skin->kartweight, skinstatscount[skin->kartspeed - 1][skin->kartweight - 1]);
skinsorted[numskins] = numskins;
}
allskins[numallskins] = ( (local) ? localskins : skins )[( (local) ? numlocalskins : numskins )];
+2
View File
@@ -99,6 +99,7 @@ typedef struct
sfxenum_t soundsid[NUMSKINSOUNDS]; // sound # in S_sfx table
boolean localskin;
INT32 localnum;
} skin_t;
extern CV_PossibleValue_t Forceskin_cons_t[];
@@ -218,6 +219,7 @@ 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);
INT32 R_AnySkinAvailable(const char *name);
INT32 R_LocalSkinAvailable(const char *name, boolean local);
void R_AddSkins(UINT16 wadnum, boolean local);