diff --git a/src/d_main.c b/src/d_main.c index 8739aecd6..7feb1cf30 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1137,9 +1137,6 @@ static void IdentifyVersion(void) #ifdef USE_PATCH_KART D_AddFile(va(pandf,srb2waddir,"patch.kart"), startupwadfiles); #endif - - D_AddFile(va(pandf,srb2waddir,"followers.kart"), startupwadfiles); // merge this in GFX later, this is mostly to avoid uploading a MASSIVE patch.kart /gfx.kart for testing. -Lat' - // completely optional if (FIL_ReadFileOK(va(pandf,srb2waddir,"extra.kart"))) { D_AddFile(va(pandf,srb2waddir,"extra.kart"), startupwadfiles); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index f797fdf03..3d1dbf5d8 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -107,7 +107,6 @@ static void Skin_OnChange(void); static void Skin2_OnChange(void); static void Skin3_OnChange(void); static void Skin4_OnChange(void); -static void Follower_OnChange(void); static void Color_OnChange(void); static void Color2_OnChange(void); static void Color3_OnChange(void); @@ -286,9 +285,6 @@ 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}; -// player's followers. Also saved. -consvar_t cv_follower = {"follower", "-1", CV_SAVE|CV_CALL, NULL, Follower_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}; @@ -909,7 +905,6 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_playername); CV_RegisterVar(&cv_playercolor); CV_RegisterVar(&cv_skin); // r_things.c (skin NAME) - CV_RegisterVar(&cv_follower); CV_RegisterVar(&cv_localskin); // secondary player (splitscreen) CV_RegisterVar(&cv_playername2); @@ -1572,15 +1567,10 @@ static void SendNameAndColor(void) else CV_StealthSet(&cv_playercolor, cv_playercolor.defaultvalue); } - - // so like, this is sent before we even use anything like cvars or w/e so it's possible that follower is set to a pretty yikes value, so let's fix that before we send garbage that could crash the game: - if (cv_follower.value > numfollowers-1 || cv_follower.value < -1) - CV_StealthSet(&cv_follower, "-1"); if (!strcmp(cv_playername.string, player_names[consoleplayer]) && cv_playercolor.value == players[consoleplayer].skincolor - && !strcmp(cv_skin.string, skins[players[consoleplayer].skin].name) - && cv_follower.value == players[consoleplayer].followerskin) + && !strcmp(cv_skin.string, skins[players[consoleplayer].skin].name)) return; // We'll handle it later if we're not playing. @@ -1600,10 +1590,6 @@ static void SendNameAndColor(void) if (players[consoleplayer].mo) players[consoleplayer].mo->color = players[consoleplayer].skincolor; - // Update follower for local games: - if (cv_follower.value >= -1 && cv_follower.value != players[consoleplayer].followerskin) - SetFollower(consoleplayer, cv_follower.value); - if (metalrecording) { // Metal Sonic is Sonic, obviously. SetPlayerSkinByNum(consoleplayer, 0); @@ -2143,8 +2129,6 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) else SetPlayerSkinByNum(playernum, skin); - SetFollower(consoleplayer, cv_follower.value); - #ifdef HAVE_DISCORDRPC if (playernum == consoleplayer) DRPC_UpdatePresence(); @@ -5888,16 +5872,6 @@ static void Name4_OnChange(void) SendNameAndColor4(); } -// sends the follower change for players -static void Follower_OnChange(void) -{ - if (!Playing()) - return; // do whatever you want - - SendNameAndColor(); -} - - /** Sends a skin change for the console player, unless that player is moving. * \sa cv_skin, Skin2_OnChange, Color_OnChange * \author Graue diff --git a/src/d_netcmd.h b/src/d_netcmd.h index c2bdd120a..e9934e237 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -21,7 +21,6 @@ extern consvar_t cv_playername; extern consvar_t cv_playercolor; extern consvar_t cv_skin; -extern consvar_t cv_follower; extern consvar_t cv_localskin; // secondary splitscreen player extern consvar_t cv_playername2; diff --git a/src/d_player.h b/src/d_player.h index 97366fe2e..4d61474fb 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -426,10 +426,6 @@ typedef struct player_s // SRB2kart UINT8 kartspeed; // Kart speed stat between 1 and 9 UINT8 kartweight; // Kart weight stat between 1 and 9 - - INT32 followerskin; // Kart: This player's follower "skin" - boolean followerready; // Kart: Used to know when we can have a follower or not. (This is set on the first NameAndColor follower update) - mobj_t *follower; // Kart: This is the follower object we have. (If any) // UINT32 charflags; // Extra abilities/settings for skins (combinable stuff) diff --git a/src/dehacked.c b/src/dehacked.c index 0d8f9b0ef..82dc9477e 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -38,7 +38,6 @@ #include "lua_hook.h" #include "d_clisrv.h" #include "v_video.h" // video flags (for lua) -#include "r_things.h" // for followers #include "lua_script.h" #include "lua_libs.h" @@ -523,242 +522,6 @@ static void readfreeslots(MYFILE *f) Z_Free(s); } -// This here is our current only way to make followers. -INT32 numfollowers = 0; - -static void readfollower(MYFILE *f) -{ - char *s; - char *word, *word2, dname[SKINNAMESIZE+1]; - char *tmp; - char testname[SKINNAMESIZE]; - - boolean nameset; - INT32 fallbackstate = 0; - INT32 res; - INT32 i; - - if (numfollowers > MAXSKINS) - { - deh_warning("Error: Too many followers, cannot add anymore.\n"); - return; - } - - s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); - - // Ready the default variables for followers. We will overwrite them as we go! We won't set the name or states RIGHT HERE as this is handled down instead. - followers[numfollowers].scale = FRACUNIT; - followers[numfollowers].atangle = 230; - followers[numfollowers].dist = 16; - followers[numfollowers].zoffs = 32; - followers[numfollowers].horzlag = 2; - followers[numfollowers].vertlag = 6; - followers[numfollowers].bobspeed = TICRATE*2; - followers[numfollowers].bobamp = 4; - followers[numfollowers].hitconfirmtime = TICRATE; - - do - { - if (myfgets(s, MAXLINELEN, f)) - { - if (s[0] == '\n') - break; - - tmp = strchr(s, '#'); - if (tmp) - *tmp = '\0'; - if (s == tmp) - continue; // Skip comment lines, but don't break. - - word = strtok(s, " "); - if (word) - strupr(word); - else - break; - - word2 = strtok(NULL, " = "); - - if (!word2) - break; - - if (word2[strlen(word2)-1] == '\n') - word2[strlen(word2)-1] = '\0'; - - if (fastcmp(word, "NAME")) - { - DEH_WriteUndoline(word, va("%s", followers[numfollowers].name), UNDO_NONE); - strcpy(followers[numfollowers].name, word2); - nameset = true; - } - else if (fastcmp(word, "SCALE")) - { - DEH_WriteUndoline(word, va("%d", followers[numfollowers].scale), UNDO_NONE); - followers[numfollowers].scale = get_number(word2); - } - else if (fastcmp(word, "ATANGLE")) - { - DEH_WriteUndoline(word, va("%d", followers[numfollowers].atangle), UNDO_NONE); - followers[numfollowers].atangle = (INT32)atoi(word2); - } - else if (fastcmp(word, "HORZLAG")) - { - DEH_WriteUndoline(word, va("%d", followers[numfollowers].horzlag), UNDO_NONE); - followers[numfollowers].horzlag = (INT32)atoi(word2); - } - else if (fastcmp(word, "VERTLAG")) - { - DEH_WriteUndoline(word, va("%d", followers[numfollowers].vertlag), UNDO_NONE); - followers[numfollowers].vertlag = (INT32)atoi(word2); - } - else if (fastcmp(word, "BOBSPEED")) - { - DEH_WriteUndoline(word, va("%d", followers[numfollowers].bobspeed), UNDO_NONE); - followers[numfollowers].bobspeed = (INT32)atoi(word2); - } - else if (fastcmp(word, "BOBAMP")) - { - DEH_WriteUndoline(word, va("%d", followers[numfollowers].bobamp), UNDO_NONE); - followers[numfollowers].bobamp = (INT32)atoi(word2); - } - else if (fastcmp(word, "ZOFFSET") || (fastcmp(word, "ZOFFS"))) - { - DEH_WriteUndoline(word, va("%d", followers[numfollowers].zoffs), UNDO_NONE); - followers[numfollowers].zoffs = (INT32)atoi(word2); - } - else if (fastcmp(word, "DISTANCE") || (fastcmp(word, "DIST"))) - { - DEH_WriteUndoline(word, va("%d", followers[numfollowers].dist), UNDO_NONE); - followers[numfollowers].dist = (INT32)atoi(word2); - } - else if (fastcmp(word, "IDLESTATE")) - { - if (word2) - strupr(word2); - DEH_WriteUndoline(word, va("%d", followers[numfollowers].idlestate), UNDO_NONE); - followers[numfollowers].idlestate = get_number(word2); - fallbackstate = followers[numfollowers].idlestate; - } - else if (fastcmp(word, "FOLLOWSTATE")) - { - if (word2) - strupr(word2); - DEH_WriteUndoline(word, va("%d", followers[numfollowers].followstate), UNDO_NONE); - followers[numfollowers].followstate = get_number(word2); - } - else if (fastcmp(word, "HURTSTATE")) - { - if (word2) - strupr(word2); - DEH_WriteUndoline(word, va("%d", followers[numfollowers].hurtstate), UNDO_NONE); - followers[numfollowers].hurtstate = get_number(word2); - } - else if (fastcmp(word, "LOSESTATE")) - { - if (word2) - strupr(word2); - DEH_WriteUndoline(word, va("%d", followers[numfollowers].losestate), UNDO_NONE); - followers[numfollowers].losestate = get_number(word2); - } - else if (fastcmp(word, "WINSTATE")) - { - if (word2) - strupr(word2); - DEH_WriteUndoline(word, va("%d", followers[numfollowers].winstate), UNDO_NONE); - followers[numfollowers].winstate = get_number(word2); - } - else if (fastcmp(word, "HITSTATE") || (fastcmp(word, "HITCONFIRMSTATE"))) - { - if (word2) - strupr(word2); - DEH_WriteUndoline(word, va("%d", followers[numfollowers].hitconfirmstate), UNDO_NONE); - followers[numfollowers].hitconfirmstate = get_number(word2); - } - else if (fastcmp(word, "HITTIME") || (fastcmp(word, "HITCONFIRMTIME"))) - { - DEH_WriteUndoline(word, va("%d", followers[numfollowers].hitconfirmtime), UNDO_NONE); - followers[numfollowers].hitconfirmtime = (INT32)atoi(word2); - } - else - deh_warning("Follower %d: unknown word '%s'", numfollowers, word); - } - } while (!myfeof(f)); // finish when the line is empty - - if (!nameset) // well this is problematic. - { - strcpy(followers[numfollowers].name, va("Follower%d", numfollowers)); // this is lazy, so what - } - - // set skin name (this is just the follower's name in lowercases): - // but before we do, let's... actually check if another follower isn't doing the same shit... - - strcpy(testname, followers[numfollowers].name); - - // lower testname for skin checks... - strlwr(testname); - res = R_FollowerAvailable(testname); - if (res > -1) // yikes, someone else has stolen our name already - { - INT32 startlen = strlen(testname); - char cpy[2]; - //deh_warning("There was already a follower with the same name. (%s)", testname); This warning probably isn't necessary anymore? - sprintf(cpy, "%d", numfollowers); - memcpy(&testname[startlen], cpy, 2); - // in that case, we'll be very lazy and copy numfollowers to the end of our skin name. - } - - strcpy(followers[numfollowers].skinname, testname); - strcpy(dname, followers[numfollowers].skinname); // display name, just used for printing succesful stuff or errors later down the line. - - // now that the skin name is ready, post process the actual name to turn the underscores into spaces! - for (i = 0; followers[numfollowers].name[i]; i++) - { - if (followers[numfollowers].name[i] == '_') - followers[numfollowers].name[i] = ' '; - } - - // fallbacks for variables - // Print a warning if the variable is on a weird value and set it back to the minimum available if that's the case. -#define FALLBACK(field, field2, threshold, set) \ -if (followers[numfollowers].field < threshold) \ -{ \ - followers[numfollowers].field = set; \ - deh_warning("Follower '%s': Value for '%s' is too low! Minimum should be %d. Value was overwritten to %d.", dname, field2, set, set); \ -} \ - - FALLBACK(dist, "DIST", 0, 0); - FALLBACK(zoffs, "ZOFFS", 0, 0); - FALLBACK(horzlag, "HORZLAG", 1, 1); - FALLBACK(vertlag, "VERTLAG", 1, 1); - FALLBACK(bobamp, "BOBAMP", 0, 0); - FALLBACK(bobspeed, "BOBSPEED", 0, 0); - FALLBACK(hitconfirmtime, "HITCONFIRMTIME", 1, 1); -#undef FALLBACK - - // also check if we forgot states. If we did, we will set any missing state to the follower's idlestate. - // Print a warning in case we don't have a fallback and set the state to S_INVISIBLE (rather than S_NULL) if unavailable. - -#define NOSTATE(field, field2) \ -if (!followers[numfollowers].field) \ -{ \ - followers[numfollowers].field = fallbackstate ? fallbackstate : S_INVISIBLE; \ - if (!fallbackstate) \ - deh_warning("Follower '%s' is missing state definition for '%s', no idlestate fallback was found", dname, field2); \ -} \ - - NOSTATE(idlestate, "IDLESTATE"); - NOSTATE(followstate, "FOLLOWSTATE"); - NOSTATE(hurtstate, "HURTSTATE"); - NOSTATE(losestate, "LOSESTATE"); - NOSTATE(winstate, "WINSTATE"); - NOSTATE(hitconfirmstate, "HITCONFIRMSTATE"); -#undef NOSTATE - - CONS_Printf("Added follower '%s'\n", dname); - numfollowers++; // add 1 follower - Z_Free(s); -} - - static void readthing(MYFILE *f, INT32 num) { char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); @@ -3227,13 +2990,6 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) // This is not a major mod. continue; } - else if (fastcmp(word, "FOLLOWER")) - { - readfollower(f); // at the same time this will be our only way to ADD followers for now. Yikes. - DEH_WriteUndoline(word, "", UNDO_HEADER); - // This is not a major mod either. - continue; // continue so that we don't error. - } word2 = strtok(NULL, " "); if (fastcmp(word, "CHARACTER")) { @@ -6769,16 +6525,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_WATERTRAILUNDERLAY7", "S_WATERTRAILUNDERLAY8", - "S_GCHAOIDLE", - "S_GCHAOFLY", - "S_GCHAOSAD1", - "S_GCHAOSAD2", - "S_GCHAOSAD3", - "S_GCHAOSAD4", - "S_GCHAOHAPPY1", - "S_GCHAOHAPPY2", - "S_GCHAOHAPPY3", - "S_GCHAOHAPPY4", #ifdef SEENAMES "S_NAMECHECK", #endif @@ -7576,7 +7322,6 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_WATERTRAIL", "MT_WATERTRAILUNDERLAY", - "MT_FOLLOWER", #ifdef SEENAMES "MT_NAMECHECK", #endif diff --git a/src/g_game.c b/src/g_game.c index 4aca57177..d692863e9 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2439,9 +2439,6 @@ void G_PlayerReborn(INT32 player) // SRB2kart UINT8 kartspeed; UINT8 kartweight; - boolean followerready; - INT32 followerskin; - mobj_t *follower; // old follower, will probably be removed by the time we're dead but you never know. // INT32 charflags; INT32 pflags; @@ -2512,9 +2509,6 @@ void G_PlayerReborn(INT32 player) // SRB2kart kartspeed = players[player].kartspeed; kartweight = players[player].kartweight; - follower = players[player].follower; - followerready = players[player].followerready; - followerskin = players[player].followerskin; // charflags = players[player].charflags; @@ -2640,13 +2634,6 @@ void G_PlayerReborn(INT32 player) p->kartstuff[k_eggmanblame] = -1; p->kartstuff[k_starpostflip] = respawnflip; - if (follower) - P_RemoveMobj(follower); - - p->followerready = followerready; - p->followerskin = followerskin; - p->follower = NULL; // respawn a new one with you, it looks better. - p->spectatorreentry = spectatorreentry; p->grieftime = grieftime; p->griefstrikes = griefstrikes; diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 2df40aeda..5317ec183 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3354,7 +3354,7 @@ static void HWR_Subsector(size_t num) if (centerHeight >= locFloorHeight && centerHeight <= locCeilingHeight && - ((viewz > topCullHeight &&!(rover->flags & FF_INVERTPLANES)) || + ((viewz > topCullHeight && !(rover->flags & FF_INVERTPLANES)) || (viewz < topCullHeight && (rover->flags & FF_BOTHPLANES || rover->flags & FF_INVERTPLANES)))) { if (rover->flags & FF_FOG) diff --git a/src/info.c b/src/info.c index ebfbdbed3..ac60182ec 100644 --- a/src/info.c +++ b/src/info.c @@ -3425,18 +3425,6 @@ state_t states[NUMSTATES] = {SPR_WTRL, FF_TRANS50|FF_PAPERSPRITE|14, 2, {NULL}, 0, 0, S_NULL}, // S_WATERTRAILUNDERLAY7 {SPR_WTRL, FF_TRANS50|FF_PAPERSPRITE|15, 2, {NULL}, 0, 0, S_NULL}, // S_WATERTRAILUNDERLAY8 - // followers: - // generic chao: - {SPR_GCHA, FF_ANIMATE, -1, {NULL}, 1, 4, S_GCHAOIDLE}, //S_GCHAOIDLE - {SPR_GCHA, 2|FF_ANIMATE, -1, {NULL}, 1, 2, S_GCHAOFLY}, //S_GCHAOFLY - {SPR_GCHA, 7, 5, {NULL}, 0, 0, S_GCHAOSAD2}, //S_GCHAOSAD1 - {SPR_GCHA, 8, 3, {NULL}, 0, 0, S_GCHAOSAD3}, //S_GCHAOSAD2 - {SPR_GCHA, 9, 6, {NULL}, 0, 0, S_GCHAOSAD4}, //S_GCHAOSAD3 - {SPR_GCHA, 8, 3, {NULL}, 0, 0, S_GCHAOSAD1}, //S_GCHAOSAD4 - {SPR_GCHA, 4, 8, {NULL}, 0, 0, S_GCHAOHAPPY2}, //S_GCHAOHAPPY1 - {SPR_GCHA, 5, 4, {NULL}, 0, 0, S_GCHAOHAPPY3}, //S_GCHAOHAPPY2 - {SPR_GCHA, 6, 8, {NULL}, 0, 0, S_GCHAOHAPPY4}, //S_GCHAOHAPPY3 - {SPR_GCHA, 5, 4, {NULL}, 0, 0, S_GCHAOHAPPY1}, //S_GCHAOHAPPY4 #ifdef SEENAMES {SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK @@ -20204,32 +20192,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_FOLLOWER - -1, // doomednum - S_INVISIBLE, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 8<player->follower) - { - follower_t fl = followers[source->player->followerskin]; - source->player->follower->movecount = fl.hitconfirmtime; // movecount is used to play the hitconfirm animation for followers. - } - if (cv_kartvoices.value) S_StartSound(source, sfx_khitem); else diff --git a/src/m_menu.c b/src/m_menu.c index 695510abf..aaee3bed6 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2351,7 +2351,7 @@ static menuitem_t OP_DriftGaugeMenu[] = {IT_HEADER, NULL, "Driftgauge", NULL, 0}, {IT_STRING | IT_CVAR, NULL, "Driftgauge", &cv_driftgauge, 20}, {IT_STRING | IT_CVAR, NULL, "Driftgauge Transparency", &cv_driftgaugetrans, 30}, - {IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Driftgauge Offset", &cv_driftgaugeofs, 40}, + {IT_STRING | IT_CVAR, NULL, "Driftgauge Offset", &cv_driftgaugeofs, 40}, {IT_STRING | IT_CVAR, NULL, "Driftgauge Style", &cv_driftgaugestyle, 50}, }; diff --git a/src/p_mobj.c b/src/p_mobj.c index 7ef1e978f..65f0bdb6d 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6113,12 +6113,6 @@ void P_MobjThinker(mobj_t *mobj) switch (mobj->type) { - case MT_FOLLOWER: - // small thinker for follower: - // We cleanse ourselves from existence if our target player doesn't exist for whatever reason. (generally players leaving) - if (!mobj->target || P_MobjWasRemoved(mobj->target) || !mobj->target->player || mobj->target->player->spectator || mobj->target->player->followerskin < 0) - P_RemoveMobj(mobj); - return; case MT_HOOP: if (mobj->fuse > 1) P_MoveHoop(mobj); @@ -10576,8 +10570,6 @@ void P_SpawnPlayer(INT32 playernum) p->awayviewmobj = NULL; p->awayviewtics = 0; - p->follower = NULL; // cleanse follower from existence - // set the scale to the mobj's destscale so settings get correctly set. if we don't, they sometimes don't. if (cv_kartdebugshrink.value && !modeattacking && !p->bot) mobj->destscale = 6*mobj->destscale/8; diff --git a/src/p_setup.c b/src/p_setup.c index 11779b2e1..cb1e0f799 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2363,9 +2363,6 @@ static void P_LevelInitStuff(void) // and this stupid flag as a result players[i].pflags &= ~PF_TRANSFERTOCLOSEST; - - // Wipe follower from existence to avoid crashes - players[i].follower = NULL; } // SRB2Kart: map load variables diff --git a/src/p_user.c b/src/p_user.c index 35ca14f1b..826c19d6f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4299,193 +4299,6 @@ DoABarrelRoll (player_t *player) } } -/* set follower state with our weird hacks - the reason we do this is to avoid followers ever using actions (majormods, yikes!) - without having to touch p_mobj.c. - so we give it 1more tic and change the state when tic == 1 instead of 0 - cool beans? - cool beans. -*/ -static void P_SetFollowerState(mobj_t *f, INT32 state) -{ - // extravalue2 stores the last "first state" we used. - // because states default to idlestates, if we use an animation that uses an "ongoing" state line, don't reset it! - // this prevents it from looking very dumb - if (state == f->extravalue2) - return; - - // we will save the state into extravalue2. - f->extravalue2 = state; - - P_SetMobjStateNF(f, state); - if (f->state->tics > 0) - f->tics++; -} - -// -//P_HandleFollower -// -//Handle the follower's spawning and moving along with the player. Do note that some of the stuff like the removal if a player doesn't exist anymore is handled in MT_FOLLOWER's thinker. -static void P_HandleFollower(player_t *player) -{ - follower_t fl; - angle_t an; - fixed_t zoffs; - fixed_t sx, sy, sz; - - if (!player->followerready) - return; // we aren't ready to perform anything follower related yet. - - // How about making sure our follower exists and is added before trying to spawn it n' all? - if (player->followerskin > numfollowers-1 || player->followerskin < -1) - { - //CONS_Printf("Follower skin invlaid. Setting to -1.\n"); - player->followerskin = -1; - return; - } - - // don't do anything if we can't have a follower to begin with. (It gets removed under those conditions) - if (player->spectator) - return; - if (player->followerskin < 0) - return; - // Before we do anything, let's be sure of where we're supposed to be - fl = followers[player->followerskin]; - - an = player->mo->angle + (fl.atangle)*ANG1; // it's aproximative but it really doesn't matter in the grand scheme of things... - zoffs = (fl.zoffs)*FRACUNIT; - - // do you like angle maths? I certainly don't... - sx = player->mo->x + FixedMul((player->mo->scale*fl.dist), FINECOSINE((an)>>ANGLETOFINESHIFT)); - sy = player->mo->y + FixedMul((player->mo->scale*fl.dist), FINESINE((an)>>ANGLETOFINESHIFT)); - - // for the z coordinate, don't be a doof like Steel and forget that MFE_VERTICALFLIP exists :P - sz = player->mo->z + FixedMul(player->mo->scale, zoffs); - /*if (player->mo->eflags & MFE_VERTICALFLIP) // it's safe to assume that VERTICALFLIP accounts for MF2_OBJECTFLIP too - sz -= (player->mo->height + FixedMul(player->mo->scale, zoffs*2));*/ - // ^ handled by K_matchgenericextraflags oops - - - // finally, add a cool floating effect to the z height. - // not stolen from k_kart I swear!! - const fixed_t pi = (22<>ANGLETOFINESHIFT) & FINEMASK); - sz += sine; - - if (!player->follower) // follower doesn't exist / isn't valid - { - //CONS_Printf("Spawning follower...\n"); - // so let's spawn one! - player->follower = P_SpawnMobj(sx, sy, sz, MT_FOLLOWER); - P_SetFollowerState(player->follower, fl.idlestate); - P_SetTarget(&player->follower->target, player->mo); // we need that to know when we need to disappear - - player->follower->extravalue1 = 0; // extravalue1 is used to know what "state set" to use. - /* - 0 = idle - 1 = forwards - 2 = hurt - 3 = win - 4 = lose - 5 = hitconfirm (< this one uses ->movecount as timer to know when to end, and goes back to normal states afterwards, unless hurt) - */ - } - else // follower exists, woo! - { - // first of all, handle states following the same model as above: - if (player->follower->tics == 1) - P_SetFollowerState(player->follower, player->follower->state->nextstate); - - // move the follower next to us (yes, this is really basic maths but it looks pretty damn clean in practice)! - player->follower->momx = (sx - player->follower->x)/fl.horzlag; - player->follower->momy = (sy - player->follower->y)/fl.horzlag; - player->follower->momz = (sz - player->follower->z)/fl.vertlag; // make z momentum a bit floatier, it'll look cute I promise! - player->follower->angle = player->mo->angle; - player->follower->color = player->mo->color; - player->follower->colorized = player->mo->colorized; - - P_SetScale(player->follower, FixedMul(fl.scale, player->mo->scale)); - K_MatchGenericExtraFlags(player->follower, player->mo); - - // For comeback in battle. - player->follower->flags2 = (player->follower->flags2 & ~MF2_SHADOW)|(player->mo->flags2 & MF2_SHADOW); - - // Make the follower invisible if we no contest'd rather than removing it. No one will notice the diff seriously. - - if (player->pflags & PF_TIMEOVER) // there is more to it than that to check for a full no contest but this isn't used for anything else. - player->follower->flags2 &= MF2_DONTDRAW; - - if (player->speed) - player->follower->angle = R_PointToAngle2(0, 0, player->follower->momx, player->follower->momy); - // if we're moving let's make the angle the direction we're moving towards. This is to avoid drifting / reverse looking awkward. - - // handle follower animations. Yes, it looks like very bad kiddie script so what, do you have any better idea genius? Go get a life instead of criticizing my unpaid work!!!!!! - // hurt or dead - if (player->kartstuff[k_spinouttimer] || player->mo->state == &states[S_KART_SPIN] || player->mo->health <= 0) - { - player->follower->movecount = 0; // cancel hit confirm. - player->follower->angle = player->frameangle; // spin out - if (player->follower->extravalue1 != 2) - { - player->follower->extravalue1 = 2; - P_SetFollowerState(player->follower, fl.hurtstate); - } - if (player->mo->health <= 0) // if dead, follow the player's z momentum exactly so they both look like they die at the same speed. - player->follower->momz = player->mo->momz; - } - else if (player->follower->movecount) - { - if (player->follower->extravalue1 != 5) - { - player->follower->extravalue1 = 5; - P_SetFollowerState(player->follower, fl.hitconfirmstate); - } - player->follower->movecount--; - } - else if (player->speed > 10*player->mo->scale) // animation for moving fast enough - { - - if (player->follower->extravalue1 != 1) - { - player->follower->extravalue1 = 1; - P_SetFollowerState(player->follower, fl.followstate); - } - } - else // animations when nearly still. This includes winning and losing. - { - if (player->follower->extravalue1 != 0) - { - - if (player->exiting) // win/ loss animations - { - if (K_IsPlayerLosing(player)) // L - { - if (player->follower->extravalue1 != 4) - { - player->follower->extravalue1 = 4; - P_SetFollowerState(player->follower, fl.losestate); - } - } - else // W - { - if (player->follower->extravalue1 != 3) - { - player->follower->extravalue1 = 3; - P_SetFollowerState(player->follower, fl.winstate); - } - } - } - else // normal standstill - { - player->follower->extravalue1 = 0; - P_SetFollowerState(player->follower, fl.idlestate); - } - } - } - } -} - - // // P_PlayerThink // @@ -4558,10 +4371,6 @@ void P_PlayerThink(player_t *player) P_SetTarget(&player->awayviewmobj, NULL); // remove awayviewmobj asap if invalid player->awayviewtics = 0; // reset to zero } - - // Run followes here. We need them to run even when we're dead to follow through what we're doing. - P_HandleFollower(player); - if (player->flashcount) player->flashcount--; diff --git a/src/r_things.c b/src/r_things.c index ec6da8c44..d068da46f 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2864,9 +2864,6 @@ void R_DrawMasked(void) // ========================================================================== INT32 numskins = 0; -follower_t followers[MAXSKINS]; -// default followers are defined in SOC_FLWR in followers.kart / gfx.kart (depending on what exe this is, at this point) - INT32 numallskins = 0; INT32 numlocalskins = 0; skin_t skins[MAXSKINS]; @@ -3041,20 +3038,6 @@ INT32 R_LocalSkinAvailable(const char *name, boolean local) return R_SkinAvailable(name); } -// same thing but for followers: -INT32 R_FollowerAvailable(const char *name) -{ - INT32 i; - - for (i = 0; i < numfollowers; i++) - { - if (stricmp(followers[i].skinname,name)==0) - return i; - } - return -1; -} - - // network code calls this when a 'skin change' is received boolean SetPlayerSkin(INT32 playernum, const char *skinname) { @@ -3141,32 +3124,6 @@ void SetLocalPlayerSkin(INT32 playernum, const char *skinname, consvar_t *cvar) } } -// Again, same thing but for followers; -boolean SetPlayerFollower(INT32 playernum, const char *skinname) -{ - INT32 i; - player_t *player = &players[playernum]; - - for (i = 0; i < numfollowers; i++) - { - // search in the skin list - if (stricmp(followers[i].skinname, skinname) == 0) - { - SetFollower(playernum, i); - return true; - } - } - - if (P_IsLocalPlayer(player)) - CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found.\n"), skinname); - else if(server || IsPlayerAdmin(consoleplayer)) - CONS_Alert(CONS_WARNING, M_GetText("Player %d (%s) follower '%s' not found\n"), playernum, player_names[playernum], skinname); - - SetFollower(playernum, -1); // reminder that -1 is nothing - return false; -} - - // Same as SetPlayerSkin, but uses the skin #. // network code calls this when a 'skin change' is received void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum) @@ -3216,37 +3173,6 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum) SetPlayerSkinByNum(playernum, 0); // not found put the sonic skin } -// you get the drill, now we do the same for followers: -void SetFollower(INT32 playernum, INT32 skinnum) -{ - player_t *player = &players[playernum]; - - player->followerready = true; // we are ready to perform follower related actions in the player thinker, now. - if (skinnum >= -1 && skinnum <= numfollowers) // Make sure it exists! - { - player->followerskin = skinnum; - //CONS_Printf("Updated player follower num\n"); - /* - We don't spawn the follower here since it'll be easier to handle all of it in the Player thinker itself. - However, we will despawn it right here if there's any to make it easy for the player thinker to replace it or delete it. - */ - if (player->follower) - { - P_RemoveMobj(player->follower); - player->follower = NULL; - } - - return; - } - - if (P_IsLocalPlayer(player)) - CONS_Alert(CONS_WARNING, M_GetText("Follower %d not found\n"), skinnum); - else if(server || IsPlayerAdmin(consoleplayer)) - CONS_Alert(CONS_WARNING, "Player %d (%s) follower %d not found\n", playernum, player_names[playernum], skinnum); - SetFollower(playernum, -1); // Not found, then set -1 (nothing) as our follower. -} - - // // Add skins from a pwad, each skin preceded by 'S_SKIN' marker // diff --git a/src/r_things.h b/src/r_things.h index 25efc8dee..0d0572fa1 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -113,42 +113,6 @@ typedef struct extern CV_PossibleValue_t Forceskin_cons_t[]; -// for followers. -// -// We'll define these here because they're really just a mobj that'll follow some rules behind a player -// -typedef struct follower_s -{ - char skinname[SKINNAMESIZE+1]; // Skin Name. This is what to refer to when asking the commands anything. - char name[SKINNAMESIZE+1]; // Name. This is used for the menus. We'll just follow the same rules as skins for this. - - fixed_t scale; // Scale relative to the player's. - - // some position shenanigans: - INT32 atangle; // angle the object will be at around the player. The object itself will always face the same direction as the player. - INT32 dist; // distance relative to the player. (In a circle) - INT32 zoffs; // Z offset relative to the player's height. Cannot be negative. - - // movement options - - INT32 horzlag; // Lag for X/Y displacement. Default is 2. Must be > 0 because we divide by this number. - INT32 vertlag; // not Vert from Neptunia lagging, this is for Z displacement lag Default is 6. Must be > 0 because we divide by this number. - INT32 bobamp; // Bob amplitude. Default is 4. - INT32 bobspeed; // Arbitrary modifier for bobbing speed, default is TICRATE*2 (70). - - // from there on out, everything is STATES to allow customization - // these are only set once when the action is performed and are then free to animate however they want. - - INT32 idlestate; // state when the player is at a standstill - INT32 followstate; // state when the player is moving - INT32 hurtstate; // state when the player is being hurt - INT32 winstate; // state when the player has won - INT32 losestate; // state when the player has lost - INT32 hitconfirmstate; // state for hit confirm - INT32 hitconfirmtime; // time to keep the above playing for -} follower_t; - - // ----------- // NOT SKINS STUFF ! // ----------- @@ -251,9 +215,6 @@ extern INT32 numskins; extern INT32 numlocalskins; extern INT32 numallskins; extern skin_t skins[MAXSKINS]; -extern INT32 numfollowers; -extern follower_t followers[MAXSKINS]; // again, use the same rules as skins, no reason not to. - extern UINT8 skinstats[9][9][MAXSKINS]; extern UINT8 skinstatscount[9][9]; extern UINT8 skinsorted[MAXSKINS]; @@ -270,11 +231,6 @@ INT32 R_AnySkinAvailable(const char *name); INT32 R_LocalSkinAvailable(const char *name, boolean local); void R_AddSkins(UINT16 wadnum, boolean local); -INT32 R_FollowerAvailable(const char *name); -boolean SetPlayerFollower(INT32 playernum,const char *skinname); -void SetFollower(INT32 playernum,INT32 skinnum); - - void R_InitDrawNodes(void); char *GetPlayerFacePic(INT32 skinnum);