fixed compiling for MSVC

This commit is contained in:
Alam Arias 2019-03-02 18:57:52 -05:00
parent d22cb88bca
commit c6f494bbd2
4 changed files with 34 additions and 26 deletions

View file

@ -5162,22 +5162,24 @@ static void Name4_OnChange(void)
// sends the follower change for players // sends the follower change for players
static void Follower_OnChange(void) static void Follower_OnChange(void)
{ {
char str[SKINNAMESIZE+1], cpy[SKINNAMESIZE+1];
if (!Playing()) if (!Playing())
return; // do whatever you want return; // do whatever you want
// there is a slight chance that we will actually use a string instead so... // there is a slight chance that we will actually use a string instead so...
// let's investigate the string... // let's investigate the string...
char str[SKINNAMESIZE+1], cpy[SKINNAMESIZE+1];
strcpy(str, cv_follower.string); strcpy(str, cv_follower.string);
strcpy(cpy, cv_follower.string); strcpy(cpy, cv_follower.string);
strlwr(str); strlwr(str);
if (stricmp(cpy,"0") !=0 && !atoi(cpy)) // yep, that's a string alright... if (stricmp(cpy,"0") !=0 && !atoi(cpy)) // yep, that's a string alright...
{ {
INT32 num = R_FollowerAvailable(str); INT32 num = R_FollowerAvailable(str);
char set[10];
if (num == -1) // that's an error. if (num == -1) // that's an error.
CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found\n"), str); CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found\n"), str);
char set[10];
sprintf(set, "%d", num); sprintf(set, "%d", num);
CV_StealthSet(&cv_follower, set); // set it to a number. It's easier for us to send later :) 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) static void Follower2_OnChange(void)
{ {
char str[SKINNAMESIZE+1], cpy[SKINNAMESIZE+1];
if (!Playing() || !splitscreen) if (!Playing() || !splitscreen)
return; // do whatever you want return; // do whatever you want
char str[SKINNAMESIZE+1], cpy[SKINNAMESIZE+1];
strcpy(str, cv_follower2.string); strcpy(str, cv_follower2.string);
strcpy(cpy, cv_follower2.string); strcpy(cpy, cv_follower2.string);
strlwr(str); strlwr(str);
if (stricmp(cpy,"0") !=0 && !atoi(cpy)) // yep, that's a string alright... if (stricmp(cpy,"0") !=0 && !atoi(cpy)) // yep, that's a string alright...
{ {
INT32 num = R_FollowerAvailable(str); INT32 num = R_FollowerAvailable(str);
char set[10];
if (num == -1) // that's an error. if (num == -1) // that's an error.
CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found\n"), str); CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found\n"), str);
char set[10];
sprintf(set, "%d", num); sprintf(set, "%d", num);
CV_StealthSet(&cv_follower2, set); // set it to a number. It's easier for us to send later :) 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) static void Follower3_OnChange(void)
{ {
char str[SKINNAMESIZE+1], cpy[SKINNAMESIZE+1];
if (!Playing() || !splitscreen) if (!Playing() || !splitscreen)
return; // do whatever you want return; // do whatever you want
char str[SKINNAMESIZE+1], cpy[SKINNAMESIZE+1];
strcpy(str, cv_follower3.string); strcpy(str, cv_follower3.string);
strcpy(cpy, cv_follower3.string); strcpy(cpy, cv_follower3.string);
strlwr(str); strlwr(str);
if (stricmp(cpy,"0") !=0 && !atoi(cpy)) // yep, that's a string alright... if (stricmp(cpy,"0") !=0 && !atoi(cpy)) // yep, that's a string alright...
{ {
INT32 num = R_FollowerAvailable(str); INT32 num = R_FollowerAvailable(str);
char set[10];
if (num == -1) // that's an error. if (num == -1) // that's an error.
CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found\n"), str); CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found\n"), str);
char set[10];
sprintf(set, "%d", num); sprintf(set, "%d", num);
CV_StealthSet(&cv_follower3, set); // set it to a number. It's easier for us to send later :) 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) static void Follower4_OnChange(void)
{ {
char str[SKINNAMESIZE+1], cpy[SKINNAMESIZE+1];
if (!Playing() || !splitscreen) if (!Playing() || !splitscreen)
return; // do whatever you want return; // do whatever you want
char str[SKINNAMESIZE+1], cpy[SKINNAMESIZE+1];
strcpy(str, cv_follower4.string); strcpy(str, cv_follower4.string);
strcpy(cpy, cv_follower4.string); strcpy(cpy, cv_follower4.string);
strlwr(str); strlwr(str);
if (stricmp(cpy,"0") !=0 && !atoi(cpy)) // yep, that's a string alright... if (stricmp(cpy,"0") !=0 && !atoi(cpy)) // yep, that's a string alright...
{ {
INT32 num = R_FollowerAvailable(str); INT32 num = R_FollowerAvailable(str);
char set[10];
if (num == -1) // that's an error. if (num == -1) // that's an error.
CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found\n"), str); CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found\n"), str);
char set[10];
sprintf(set, "%d", num); sprintf(set, "%d", num);
CV_StealthSet(&cv_follower4, set); // set it to a number. It's easier for us to send later :) CV_StealthSet(&cv_follower4, set); // set it to a number. It's easier for us to send later :)
} }

View file

@ -699,6 +699,14 @@ INT32 numfollowers = 0;
static void readfollower(MYFILE *f) 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) if (numfollowers > MAXSKINS)
{ {
@ -706,12 +714,7 @@ static void readfollower(MYFILE *f)
return; return;
} }
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
char *word, *word2, dname[SKINNAMESIZE+1];
char *tmp;
boolean nameset;
INT32 fallbackstate = 0;
CONS_Printf("Adding follower...\n"); 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): // 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... // 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); strcpy(testname, followers[numfollowers].name);
// lower testname for skin checks... // lower testname for skin checks...
strlwr(testname); strlwr(testname);
INT32 res = R_FollowerAvailable(testname); res = R_FollowerAvailable(testname);
if (res > -1) // yikes, someone else has stolen our name already 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); INT32 startlen = strlen(testname);
char cpy[2]; char cpy[2];
deh_warning("There was already a follower with the same name. (%s)", testname);
sprintf(cpy, "%d", numfollowers); sprintf(cpy, "%d", numfollowers);
memcpy(&testname[startlen], cpy, 2); memcpy(&testname[startlen], cpy, 2);
// in that case, we'll be very lazy and copy numfollowers to the end of our skin name. // in that case, we'll be very lazy and copy numfollowers to the end of our skin name.

View file

@ -8077,6 +8077,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
UINT8 i; UINT8 i;
const UINT8 *flashcol = V_GetStringColormap(highlightflags); const UINT8 *flashcol = V_GetStringColormap(highlightflags);
INT32 statx, staty; INT32 statx, staty;
char *fname;
mx = MP_PlayerSetupDef.x; mx = MP_PlayerSetupDef.x;
my = MP_PlayerSetupDef.y; my = MP_PlayerSetupDef.y;
@ -8109,7 +8110,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
} }
// draw follower string // draw follower string
char *fname = malloc(SKINNAMESIZE+1); fname = malloc(SKINNAMESIZE+1);
if (setupm_fakefollower == -1) if (setupm_fakefollower == -1)
strcpy(fname, "None"); strcpy(fname, "None");

View file

@ -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. //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) static void P_HandleFollower(player_t *player)
{ {
follower_t fl;
angle_t an;
fixed_t zoffs;
fixed_t sx, sy, sz;
if (!player->followerready) if (!player->followerready)
return; // we aren't ready to perform anything follower related yet. return; // we aren't ready to perform anything follower related yet.
@ -8959,13 +8963,12 @@ static void P_HandleFollower(player_t *player)
return; return;
// Before we do anything, let's be sure of where we're supposed to be // 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... 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; zoffs = (fl.zoffs)*FRACUNIT;
// do you like angle maths? I certainly don't... // 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)); 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)); sy = player->mo->y + FixedMul((player->mo->scale*fl.dist), FINESINE((an)>>ANGLETOFINESHIFT));