diff --git a/Source/am_map.c b/Source/am_map.c index 45bf7a2c..6c90d425 100644 --- a/Source/am_map.c +++ b/Source/am_map.c @@ -686,7 +686,6 @@ boolean AM_Responder ( event_t* ev ) { int rc; - static int cheatstate=0; static int bigstate=0; static char buffer[20]; int ch; // phares @@ -780,7 +779,6 @@ boolean AM_Responder } // | else // phares { - cheatstate=0; rc = false; } } diff --git a/Source/d_deh.c b/Source/d_deh.c index 87cfa056..1d983ee4 100644 --- a/Source/d_deh.c +++ b/Source/d_deh.c @@ -1535,7 +1535,7 @@ void ProcessDehFile(char *filename, char *outfilename, int lumpnum) void deh_procBexCodePointers(DEHFILE *fpin, FILE* fpout, char *line) { char key[DEH_MAXKEYLEN]; - char inbuffer[DEH_BUFFERMAX]; + char inbuffer[DEH_BUFFERMAX+1]; int indexnum; char mnemonic[DEH_MAXKEYLEN]; // to hold the codepointer mnemonic int i; // looper @@ -1611,7 +1611,7 @@ void deh_procBexCodePointers(DEHFILE *fpin, FILE* fpout, char *line) void deh_procThing(DEHFILE *fpin, FILE* fpout, char *line) { char key[DEH_MAXKEYLEN]; - char inbuffer[DEH_BUFFERMAX]; + char inbuffer[DEH_BUFFERMAX+1]; long value; // All deh values are ints or longs int indexnum; int ix; @@ -1703,7 +1703,7 @@ void deh_procThing(DEHFILE *fpin, FILE* fpout, char *line) void deh_procFrame(DEHFILE *fpin, FILE* fpout, char *line) { char key[DEH_MAXKEYLEN]; - char inbuffer[DEH_BUFFERMAX]; + char inbuffer[DEH_BUFFERMAX+1]; long value; // All deh values are ints or longs int indexnum; @@ -1783,7 +1783,7 @@ void deh_procFrame(DEHFILE *fpin, FILE* fpout, char *line) void deh_procPointer(DEHFILE *fpin, FILE* fpout, char *line) // done { char key[DEH_MAXKEYLEN]; - char inbuffer[DEH_BUFFERMAX]; + char inbuffer[DEH_BUFFERMAX+1]; long value; // All deh values are ints or longs int indexnum; int i; // looper @@ -1857,7 +1857,7 @@ void deh_procPointer(DEHFILE *fpin, FILE* fpout, char *line) // done void deh_procSounds(DEHFILE *fpin, FILE* fpout, char *line) { char key[DEH_MAXKEYLEN]; - char inbuffer[DEH_BUFFERMAX]; + char inbuffer[DEH_BUFFERMAX+1]; long value; // All deh values are ints or longs int indexnum; @@ -1925,7 +1925,7 @@ void deh_procSounds(DEHFILE *fpin, FILE* fpout, char *line) void deh_procAmmo(DEHFILE *fpin, FILE* fpout, char *line) { char key[DEH_MAXKEYLEN]; - char inbuffer[DEH_BUFFERMAX]; + char inbuffer[DEH_BUFFERMAX+1]; long value; // All deh values are ints or longs int indexnum; @@ -1971,7 +1971,7 @@ void deh_procAmmo(DEHFILE *fpin, FILE* fpout, char *line) void deh_procWeapon(DEHFILE *fpin, FILE* fpout, char *line) { char key[DEH_MAXKEYLEN]; - char inbuffer[DEH_BUFFERMAX]; + char inbuffer[DEH_BUFFERMAX+1]; long value; // All deh values are ints or longs int indexnum; @@ -2029,7 +2029,7 @@ void deh_procWeapon(DEHFILE *fpin, FILE* fpout, char *line) void deh_procSprite(DEHFILE *fpin, FILE* fpout, char *line) // Not supported { char key[DEH_MAXKEYLEN]; - char inbuffer[DEH_BUFFERMAX]; + char inbuffer[DEH_BUFFERMAX+1]; int indexnum; // Too little is known about what this is supposed to do, and @@ -2063,7 +2063,7 @@ void deh_procSprite(DEHFILE *fpin, FILE* fpout, char *line) // Not supported void deh_procPars(DEHFILE *fpin, FILE* fpout, char *line) // extension { char key[DEH_MAXKEYLEN]; - char inbuffer[DEH_BUFFERMAX]; + char inbuffer[DEH_BUFFERMAX+1]; int indexnum; int episode, level, partime, oldpar; @@ -2149,7 +2149,7 @@ void deh_procPars(DEHFILE *fpin, FILE* fpout, char *line) // extension void deh_procCheat(DEHFILE *fpin, FILE* fpout, char *line) // done { char key[DEH_MAXKEYLEN]; - char inbuffer[DEH_BUFFERMAX]; + char inbuffer[DEH_BUFFERMAX+1]; long value; // All deh values are ints or longs char *strval = ""; // pointer to the value area int ix, iy; // array indices @@ -2223,7 +2223,7 @@ void deh_procCheat(DEHFILE *fpin, FILE* fpout, char *line) // done void deh_procMisc(DEHFILE *fpin, FILE* fpout, char *line) // done { char key[DEH_MAXKEYLEN]; - char inbuffer[DEH_BUFFERMAX]; + char inbuffer[DEH_BUFFERMAX+1]; long value; // All deh values are ints or longs strncpy(inbuffer,line,DEH_BUFFERMAX); @@ -2430,7 +2430,7 @@ void deh_procText(DEHFILE *fpin, FILE* fpout, char *line) void deh_procError(DEHFILE *fpin, FILE* fpout, char *line) { - char inbuffer[DEH_BUFFERMAX]; + char inbuffer[DEH_BUFFERMAX+1]; strncpy(inbuffer,line,DEH_BUFFERMAX); if (fpout) fprintf(fpout,"Unmatched Block: '%s'\n",inbuffer); @@ -2448,7 +2448,7 @@ void deh_procError(DEHFILE *fpin, FILE* fpout, char *line) void deh_procStrings(DEHFILE *fpin, FILE* fpout, char *line) { char key[DEH_MAXKEYLEN]; - char inbuffer[DEH_BUFFERMAX]; + char inbuffer[DEH_BUFFERMAX+1]; long value; // All deh values are ints or longs char *strval; // holds the string value of the line static int maxstrlen = 128; // maximum string length, bumped 128 at diff --git a/Source/d_net.c b/Source/d_net.c index f48c6296..16c98f50 100644 --- a/Source/d_net.c +++ b/Source/d_net.c @@ -459,7 +459,7 @@ void CheckAbort (void) I_StartTic (); I_StartTic (); - for ( ; eventtail != eventhead ; eventtail = (++eventtail)&(MAXEVENTS-1) ) + for ( ; eventtail != eventhead ; eventtail = (eventtail+1)&(MAXEVENTS-1) ) { ev = &events[eventtail]; if (ev->type == ev_keydown && ev->data1 == key_escape) // phares @@ -504,7 +504,7 @@ void D_ArbitrateNetStart (void) // killough 11/98: NOTE: this code produces no inconsistency errors. // However, TeamTNT's code =does= produce inconsistencies. Go figur. - G_ReadOptions((char *) netbuffer->cmds); + G_ReadOptions((byte *) netbuffer->cmds); // killough 12/98: removed obsolete compatibility flag and // removed printf()'s, since there are too many options to @@ -544,7 +544,7 @@ void D_ArbitrateNetStart (void) I_Error("D_ArbitrateNetStart: GAME_OPTION_SIZE" " too large w.r.t. BACKUPTICS"); - G_WriteOptions((char *) netbuffer->cmds); // killough 12/98 + G_WriteOptions((byte *) netbuffer->cmds); // killough 12/98 // killough 5/2/98: Always write the maximum number of tics. netbuffer->numtics = BACKUPTICS; diff --git a/Source/g_game.c b/Source/g_game.c index 10b666e4..87bf3fb9 100644 --- a/Source/g_game.c +++ b/Source/g_game.c @@ -689,8 +689,8 @@ static void G_DoLoadLevel(void) joyxmove = joyymove = 0; mousex = mousey = 0; sendpause = sendsave = paused = false; - memset (mousebuttons, 0, sizeof(mousebuttons)); - memset (joybuttons, 0, sizeof(joybuttons)); + memset (mousearray, 0, sizeof(mousearray)); + memset (joyarray, 0, sizeof(joyarray)); //jff 4/26/98 wake up the status bar in case were coming out of a DM demo // killough 5/13/98: in case netdemo has consoleplayer other than green @@ -808,7 +808,9 @@ boolean G_Responder(event_t* ev) } if (gamestate == GS_FINALE && F_Responder(ev)) + { return true; // finale ate the event + } // If the next/previous weapon keys are pressed, set the next_weapon // variable to change weapons when the next ticcmd is generated. @@ -1384,9 +1386,9 @@ static void G_DoSaveGame(void) for (*save_p = 0; *w; w++) { CheckSaveGame(strlen(*w)+2); - strcat(strcat(save_p, *w), "\n"); + strcat(strcat((char *) save_p, *w), "\n"); } - save_p += strlen(save_p)+1; + save_p += strlen((char *) save_p)+1; } CheckSaveGame(GAME_OPTION_SIZE+MIN_MAXPLAYERS+10); @@ -1440,13 +1442,12 @@ static void G_DoSaveGame(void) static void G_DoLoadGame(void) { - int length, i; + int i; char vcheck[VERSIONSIZE]; ULong64 checksum; gameaction = ga_nothing; - length = M_ReadFile(savename, &savebuffer); save_p = savebuffer + SAVESTRINGSIZE; // skip the description field @@ -1455,7 +1456,7 @@ static void G_DoLoadGame(void) sprintf (vcheck,VERSIONID,MBFVERSION); // killough 2/22/98: Friendly savegame version difference message - if (!forced_loadgame && strncmp(save_p, vcheck, VERSIONSIZE)) + if (!forced_loadgame && strncmp((char *) save_p, vcheck, VERSIONSIZE)) { G_LoadGameErr("Different Savegame Version!!!\n\nAre you sure?"); return; @@ -1476,10 +1477,10 @@ static void G_DoLoadGame(void) checksum = G_Signature(); if (memcmp(&checksum, save_p, sizeof checksum)) { - char *msg = malloc(strlen(save_p + sizeof checksum) + 128); + char *msg = malloc(strlen((char *) save_p + sizeof checksum) + 128); strcpy(msg,"Incompatible Savegame!!!\n"); if (save_p[sizeof checksum]) - strcat(strcat(msg,"Wads expected:\n\n"), save_p + sizeof checksum); + strcat(strcat(msg,"Wads expected:\n\n"), (char *) save_p + sizeof checksum); strcat(msg, "\nAre you sure?"); G_LoadGameErr(msg); free(msg); diff --git a/Source/i_system.c b/Source/i_system.c index 1393b0cd..1c9ae0ca 100644 --- a/Source/i_system.c +++ b/Source/i_system.c @@ -105,7 +105,6 @@ int (*I_GetTime)() = I_GetTime_Error; // killough int mousepresent; int joystickpresent; // phares 4/3/98 -static int orig_key_shifts; // killough 3/6/98: original keyboard shift state int leds_always_off; // Tells it not to update LEDs // haleyjd: SDL joystick support diff --git a/Source/i_video.c b/Source/i_video.c index b2cc528e..7008a2d0 100644 --- a/Source/i_video.c +++ b/Source/i_video.c @@ -83,8 +83,6 @@ void I_JoystickEvents(void) int joy_b1, joy_b2, joy_b3, joy_b4; int joy_b5, joy_b6, joy_b7, joy_b8; Sint16 joy_x, joy_y; - static int old_joy_b1, old_joy_b2, old_joy_b3, old_joy_b4; - static int old_joy_b5, old_joy_b6, old_joy_b7, old_joy_b8; if(!joystickpresent || !usejoystick || !sdlJoystick) return; @@ -468,8 +466,6 @@ static void I_HandleKeyboardEvent(SDL_Event *sdlevent) static void HandleWindowEvent(SDL_WindowEvent *event) { - int i; - switch (event->event) { // Don't render the screen when the window is minimized: @@ -680,10 +676,7 @@ int hires; boolean noblit; static int in_graphics_mode; -static int in_page_flip, in_hires, linear; -static int scroll_offset; -static unsigned long screen_base_addr; -static unsigned destscreen; +static int in_page_flip, in_hires; void I_FinishUpdate(void) { @@ -849,6 +842,8 @@ boolean I_WritePNGfile(char *filename) { #ifdef HAVE_SDL_IMAGE return IMG_SavePNG(sdlscreen, filename) == 0; +#else + return false; #endif } diff --git a/Source/m_cheat.c b/Source/m_cheat.c index d43cf116..417f9fc9 100644 --- a/Source/m_cheat.c +++ b/Source/m_cheat.c @@ -715,7 +715,7 @@ boolean M_FindCheats(int key) for (i=0;cheat[i].cheat;i++) { ULong64 c=0, m=0; - const unsigned char *p; + const char *p; for (p=cheat[i].cheat; *p; p++) { unsigned key = tolower(*p)-'a'; // convert to 0-31 diff --git a/Source/m_cheat.h b/Source/m_cheat.h index c9007fe5..ea32dee6 100644 --- a/Source/m_cheat.h +++ b/Source/m_cheat.h @@ -34,7 +34,7 @@ // killough 4/16/98: Cheat table structure extern struct cheat_s { - const unsigned char *cheat; + const char *cheat; const char *const deh_cheat; enum { always = 0, diff --git a/Source/m_menu.c b/Source/m_menu.c index e9d35896..3c54ea49 100644 --- a/Source/m_menu.c +++ b/Source/m_menu.c @@ -1869,7 +1869,7 @@ void M_DrawSetting(setup_menu_t* s) strcpy(menu_buffer, gather_buffer); } else - sprintf(menu_buffer,"%d",*s->var.def->location); + sprintf(menu_buffer,"%d",s->var.def->location->i); M_DrawMenuString(x,y,color); return; } @@ -1927,7 +1927,7 @@ void M_DrawSetting(setup_menu_t* s) if (flags & (S_WEAP|S_CRITEM)) // weapon number or color range { - sprintf(menu_buffer,"%d", *s->var.def->location); + sprintf(menu_buffer,"%d", s->var.def->location->i); M_DrawMenuString(x,y, flags & S_CRITEM ? s->var.def->location->i : color); return; } @@ -1937,7 +1937,7 @@ void M_DrawSetting(setup_menu_t* s) if (flags & S_COLOR) // Automap paint chip { int i, ch; - char *ptr = colorblock; + byte *ptr = colorblock; // draw the border of the paint chip diff --git a/Source/m_misc.c b/Source/m_misc.c index 35be1ebc..bf156eec 100644 --- a/Source/m_misc.c +++ b/Source/m_misc.c @@ -1847,12 +1847,12 @@ void M_SaveDefaults (void) fprintf(f,"[(\"%s\")]", (char *) dp->defaultvalue.s) : dp->limit.min == UL ? dp->limit.max == UL ? - fprintf(f, "[?-?(%d)]", dp->defaultvalue) : - fprintf(f, "[?-%d(%d)]", dp->limit.max, dp->defaultvalue) : + fprintf(f, "[?-?(%d)]", dp->defaultvalue.i) : + fprintf(f, "[?-%d(%d)]", dp->limit.max, dp->defaultvalue.i) : dp->limit.max == UL ? - fprintf(f, "[%d-?(%d)]", dp->limit.min, dp->defaultvalue) : + fprintf(f, "[%d-?(%d)]", dp->limit.min, dp->defaultvalue.i) : fprintf(f, "[%d-%d(%d)]", dp->limit.min, dp->limit.max, - dp->defaultvalue)) == EOF || + dp->defaultvalue.i)) == EOF || fprintf(f," %s %s\n", dp->help, dp->wad_allowed ? "*" :"") == EOF) goto error; diff --git a/Source/mmus2mid.c b/Source/mmus2mid.c index 895e85e1..903c15a9 100644 --- a/Source/mmus2mid.c +++ b/Source/mmus2mid.c @@ -601,6 +601,7 @@ int MidiToMIDI(UBYTE *mid,MIDI *mididata) return 0; } +#if 0 //#ifdef STANDALONE /* this code unused by BOOM provided for future portability */ // /* it also provides a MUS to MID file converter*/ // proff: I moved this down, because I need MIDItoMidi @@ -627,6 +628,7 @@ static void FreeTracks(MIDI *mididata) mididata->track[i].len = 0; } } +#endif // // TWriteLength() diff --git a/Source/p_doors.c b/Source/p_doors.c index 3b96e406..fe6dc8a2 100644 --- a/Source/p_doors.c +++ b/Source/p_doors.c @@ -390,7 +390,6 @@ int EV_DoDoor(line_t *line, vldoor_e type) int EV_VerticalDoor(line_t *line, mobj_t *thing) { player_t* player; - int secnum; sector_t* sec; vldoor_t* door; @@ -448,7 +447,6 @@ int EV_VerticalDoor(line_t *line, mobj_t *thing) // get the sector on the second side of activating linedef sec = sides[line->sidenum[1]].sector; - secnum = sec-sectors; // if door already has a thinker, use it if (sec->ceilingdata) //jff 2/22/98 diff --git a/Source/p_floor.c b/Source/p_floor.c index ac0dd66e..481ad81d 100644 --- a/Source/p_floor.c +++ b/Source/p_floor.c @@ -853,7 +853,7 @@ int EV_DoDonut(line_t* line) //jff 3/29/98 use true two-sidedness, not the flag if (comp[comp_model]) { - if ((!s2->lines[i]->flags & ML_TWOSIDED) || + if ((!(s2->lines[i]->flags & ML_TWOSIDED)) || (s2->lines[i]->backsector == s1)) continue; } diff --git a/Source/p_inter.c b/Source/p_inter.c index 5d57944f..77347c50 100644 --- a/Source/p_inter.c +++ b/Source/p_inter.c @@ -129,8 +129,10 @@ boolean P_GiveAmmo(player_t *player, ammotype_t ammo, int num) case am_shell: if (player->readyweapon == wp_fist || player->readyweapon == wp_pistol) + { if (player->weaponowned[wp_shotgun]) player->pendingweapon = wp_shotgun; + } break; case am_cell: diff --git a/Source/p_spec.c b/Source/p_spec.c index 73e00edc..33e25122 100644 --- a/Source/p_spec.c +++ b/Source/p_spec.c @@ -2269,11 +2269,6 @@ void P_SpawnSpecials (void) { sector_t* sector; int i; - int episode; - - episode = 1; - if (W_CheckNumForName("texture2") >= 0) - episode = 2; // See if -timer needs to be used. levelTimer = false; diff --git a/Source/r_main.c b/Source/r_main.c index e57ef970..b4abe1ee 100644 --- a/Source/r_main.c +++ b/Source/r_main.c @@ -508,7 +508,7 @@ void R_RenderPlayerView (player_t* player) if (autodetect_hom) { // killough 2/10/98: add flashing red HOM indicators - char c[47*47]; + byte c[47*47]; extern int lastshottic; int i , color = !flashing_hom || (gametic % 20) < 9 ? 0xb0 : 0; memset(*screens+viewwindowy*linesize,color,viewheight*linesize); diff --git a/Source/w_wad.c b/Source/w_wad.c index 4d485254..c40b009a 100644 --- a/Source/w_wad.c +++ b/Source/w_wad.c @@ -238,7 +238,7 @@ static void W_CoalesceMarkedResource(const char *start_marker, { // If this is the first start marker, add start marker to marked lumps if (!num_marked) { - strncpy(marked->name, start_marker, 8); + memcpy(marked->name, start_marker, 8); marked->size = 0; // killough 3/20/98: force size to be 0 marked->namespace = ns_global; // killough 4/17/98 num_marked = 1; @@ -271,7 +271,7 @@ static void W_CoalesceMarkedResource(const char *start_marker, { lumpinfo[numlumps].size = 0; // killough 3/20/98: force size to be 0 lumpinfo[numlumps].namespace = ns_global; // killough 4/17/98 - strncpy(lumpinfo[numlumps++].name, end_marker, 8); + memcpy(lumpinfo[numlumps++].name, end_marker, 8); } } @@ -535,7 +535,7 @@ void WritePredefinedLumpWad(const char *filename) fileinfo.filepos = LONG(filepos); fileinfo.size = LONG(predefined_lumps[i].size); - strncpy(fileinfo.name, predefined_lumps[i].name, 8); + memcpy(fileinfo.name, predefined_lumps[i].name, 8); fwrite(&fileinfo, 1, sizeof(fileinfo), file); diff --git a/Source/wi_stuff.c b/Source/wi_stuff.c index ad9fc2d2..4cc834dc 100644 --- a/Source/wi_stuff.c +++ b/Source/wi_stuff.c @@ -1159,10 +1159,6 @@ static void WI_drawDeathmatchStats(void) int x; int y; int w; - - int lh; // line height - - lh = WI_SPACINGY; WI_slamBackground(); @@ -1837,7 +1833,7 @@ static void WI_loadData(void) PU_STATIC, 0); for (i=0 ; iepsd != 1 || j != 8) { // animations - sprintf(name, "WIA%d%.2d%.2d", wbs->epsd, j, i); + snprintf(name, sizeof(name), "WIA%d%.2d%.2d", wbs->epsd, j, i); a->p[i] = W_CacheLumpName(name, PU_STATIC); } else