From c6f494bbd2116e7b1d6ea4aec74339fe6df236b8 Mon Sep 17 00:00:00 2001 From: Alam Arias Date: Sat, 2 Mar 2019 18:57:52 -0500 Subject: [PATCH] fixed compiling for MSVC --- src/d_netcmd.c | 26 ++++++++++++++------------ src/dehacked.c | 20 +++++++++++--------- src/m_menu.c | 3 ++- src/p_user.c | 11 +++++++---- 4 files changed, 34 insertions(+), 26 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index ea8b0db8..0d5a93e1 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -5162,22 +5162,24 @@ static void Name4_OnChange(void) // sends the follower change for players static void Follower_OnChange(void) { + char str[SKINNAMESIZE+1], cpy[SKINNAMESIZE+1]; + if (!Playing()) return; // do whatever you want // there is a slight chance that we will actually use a string instead so... // let's investigate the string... - char str[SKINNAMESIZE+1], cpy[SKINNAMESIZE+1]; strcpy(str, cv_follower.string); strcpy(cpy, cv_follower.string); strlwr(str); if (stricmp(cpy,"0") !=0 && !atoi(cpy)) // yep, that's a string alright... { INT32 num = R_FollowerAvailable(str); - if (num == -1) // that's an error. + char set[10]; + + if (num == -1) // that's an error. CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found\n"), str); - char set[10]; sprintf(set, "%d", num); CV_StealthSet(&cv_follower, set); // set it to a number. It's easier for us to send later :) } @@ -5186,20 +5188,20 @@ static void Follower_OnChange(void) static void Follower2_OnChange(void) { + char str[SKINNAMESIZE+1], cpy[SKINNAMESIZE+1]; if (!Playing() || !splitscreen) return; // do whatever you want - char str[SKINNAMESIZE+1], cpy[SKINNAMESIZE+1]; strcpy(str, cv_follower2.string); strcpy(cpy, cv_follower2.string); strlwr(str); if (stricmp(cpy,"0") !=0 && !atoi(cpy)) // yep, that's a string alright... { INT32 num = R_FollowerAvailable(str); - if (num == -1) // that's an error. + char set[10]; + if (num == -1) // that's an error. CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found\n"), str); - char set[10]; sprintf(set, "%d", num); CV_StealthSet(&cv_follower2, set); // set it to a number. It's easier for us to send later :) } @@ -5208,20 +5210,20 @@ static void Follower2_OnChange(void) static void Follower3_OnChange(void) { + char str[SKINNAMESIZE+1], cpy[SKINNAMESIZE+1]; if (!Playing() || !splitscreen) return; // do whatever you want - char str[SKINNAMESIZE+1], cpy[SKINNAMESIZE+1]; strcpy(str, cv_follower3.string); strcpy(cpy, cv_follower3.string); strlwr(str); if (stricmp(cpy,"0") !=0 && !atoi(cpy)) // yep, that's a string alright... { INT32 num = R_FollowerAvailable(str); - if (num == -1) // that's an error. + char set[10]; + if (num == -1) // that's an error. CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found\n"), str); - char set[10]; sprintf(set, "%d", num); CV_StealthSet(&cv_follower3, set); // set it to a number. It's easier for us to send later :) } @@ -5230,20 +5232,20 @@ static void Follower3_OnChange(void) static void Follower4_OnChange(void) { + char str[SKINNAMESIZE+1], cpy[SKINNAMESIZE+1]; if (!Playing() || !splitscreen) return; // do whatever you want - char str[SKINNAMESIZE+1], cpy[SKINNAMESIZE+1]; strcpy(str, cv_follower4.string); strcpy(cpy, cv_follower4.string); strlwr(str); if (stricmp(cpy,"0") !=0 && !atoi(cpy)) // yep, that's a string alright... { INT32 num = R_FollowerAvailable(str); - if (num == -1) // that's an error. + char set[10]; + if (num == -1) // that's an error. CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found\n"), str); - char set[10]; sprintf(set, "%d", num); CV_StealthSet(&cv_follower4, set); // set it to a number. It's easier for us to send later :) } diff --git a/src/dehacked.c b/src/dehacked.c index 2ed609e6..3a766df3 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -699,6 +699,14 @@ 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; if (numfollowers > MAXSKINS) { @@ -706,12 +714,7 @@ static void readfollower(MYFILE *f) return; } - char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); - char *word, *word2, dname[SKINNAMESIZE+1]; - char *tmp; - - boolean nameset; - INT32 fallbackstate = 0; + s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); CONS_Printf("Adding follower...\n"); @@ -812,17 +815,16 @@ static void readfollower(MYFILE *f) // 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... - char testname[SKINNAMESIZE]; strcpy(testname, followers[numfollowers].name); // lower testname for skin checks... strlwr(testname); - INT32 res = R_FollowerAvailable(testname); + res = R_FollowerAvailable(testname); if (res > -1) // yikes, someone else has stolen our name already { - deh_warning("There was already a follower with the same name. (%s)", testname); INT32 startlen = strlen(testname); char cpy[2]; + deh_warning("There was already a follower with the same name. (%s)", testname); 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. diff --git a/src/m_menu.c b/src/m_menu.c index 528e9c5f..82df9020 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -8077,6 +8077,7 @@ static void M_DrawSetupMultiPlayerMenu(void) UINT8 i; const UINT8 *flashcol = V_GetStringColormap(highlightflags); INT32 statx, staty; + char *fname; mx = MP_PlayerSetupDef.x; my = MP_PlayerSetupDef.y; @@ -8109,7 +8110,7 @@ static void M_DrawSetupMultiPlayerMenu(void) } // draw follower string - char *fname = malloc(SKINNAMESIZE+1); + fname = malloc(SKINNAMESIZE+1); if (setupm_fakefollower == -1) strcpy(fname, "None"); diff --git a/src/p_user.c b/src/p_user.c index bfc9d8c4..7ca368b7 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8940,6 +8940,10 @@ static void P_SetFollowerState(mobj_t *f, INT32 state) //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. @@ -8959,13 +8963,12 @@ static void P_HandleFollower(player_t *player) return; // Before we do anything, let's be sure of where we're supposed to be - follower_t fl = followers[player->followerskin]; + fl = followers[player->followerskin]; - angle_t an = player->mo->angle + (fl.atangle)*ANG1; // it's aproximative but it really doesn't matter in the grand scheme of things... - fixed_t zoffs = (fl.zoffs)*FRACUNIT; + 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... - fixed_t sx, sy, sz; 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));