From 17333436188f63319625b007489c7b70029bfaba Mon Sep 17 00:00:00 2001 From: James Haley Date: Sun, 6 Feb 2011 17:38:54 +0000 Subject: Numerous fixes/adjustments: removed bodyque, restored "is turbo" (found it in there after all), removed some dead code in p_dialog, added a 'default: break;' case in EV_VerticalDoor, initialize player_t::allegiance in P_SetupLevel, minor changes to EV_Teleport, 2nd-pass verification for p_tick, and big fixes in p_user.c including noclip cheat, viewz clipping against floor, air control thrust amount, and missing/incorrect else's. Subversion-branch: /branches/strife-branch Subversion-revision: 2250 --- src/strife/d_main.c | 88 ++++++++++++------------ src/strife/d_net.c | 4 +- src/strife/doomstat.h | 4 +- src/strife/g_game.c | 138 ++++++++++++++++++------------------- src/strife/p_dialog.c | 76 ++------------------- src/strife/p_doors.c | 19 +++--- src/strife/p_pspr.c | 27 ++++---- src/strife/p_setup.c | 60 ++++++++-------- src/strife/p_telept.c | 25 ++++--- src/strife/p_tick.c | 51 ++++++++------ src/strife/p_user.c | 186 +++++++++++++++++++++++++++++--------------------- src/strife/st_stuff.c | 8 ++- 12 files changed, 331 insertions(+), 355 deletions(-) diff --git a/src/strife/d_main.c b/src/strife/d_main.c index 07b3e505..429ec91b 100644 --- a/src/strife/d_main.c +++ b/src/strife/d_main.c @@ -471,14 +471,14 @@ extern boolean demorecording; void D_DoomLoop (void) { if (demorecording) - G_BeginRecording (); - + G_BeginRecording (); + if (M_CheckParm ("-debugfile")) { - char filename[20]; - sprintf (filename,"debug%i.txt",consoleplayer); - printf ("debug output to: %s\n",filename); - debugfile = fopen (filename,"w"); + char filename[20]; + sprintf (filename,"debug%i.txt",consoleplayer); + printf ("debug output to: %s\n",filename); + debugfile = fopen (filename,"w"); } TryRunTics(); @@ -500,30 +500,30 @@ void D_DoomLoop (void) while (1) { - // frame syncronous IO operations - I_StartFrame (); - - // process one or more tics - if (singletics) - { - I_StartTic (); - D_ProcessEvents (); - G_BuildTiccmd (&netcmds[consoleplayer][maketic%BACKUPTICS]); - if (advancedemo) - D_DoAdvanceDemo (); - M_Ticker (); - G_Ticker (); - gametic++; - maketic++; - } - else - { - TryRunTics (); // will run at least one tic - } + // frame syncronous IO operations + I_StartFrame (); - S_UpdateSounds (players[consoleplayer].mo);// move positional sounds + // process one or more tics + if (singletics) + { + I_StartTic (); + D_ProcessEvents (); + G_BuildTiccmd (&netcmds[consoleplayer][maketic%BACKUPTICS]); + if (advancedemo) + D_DoAdvanceDemo (); + M_Ticker (); + G_Ticker (); + gametic++; + maketic++; + } + else + { + TryRunTics (); // will run at least one tic + } + + S_UpdateSounds (players[consoleplayer].mo);// move positional sounds - // Update display, next frame, with current state. + // Update display, next frame, with current state. if (screenvisible) D_Display (); } @@ -548,7 +548,7 @@ char *pagename; void D_PageTicker (void) { if (--pagetic < 0) - D_AdvanceDemo (); + D_AdvanceDemo (); } @@ -580,6 +580,8 @@ void D_AdvanceDemo (void) // This cycles through the demo sequences. // FIXME - version dependend demo numbers? // +// [STRIFE] Modified for the opening slideshow and the exit screen +// void D_DoAdvanceDemo (void) { players[consoleplayer].playerstate = PST_LIVE; // not reborn @@ -596,7 +598,7 @@ void D_DoAdvanceDemo (void) return; case -4: // show exit screen menuactive = false; - pagetic = (3*TICRATE); + pagetic = 3*TICRATE; gamestate = GS_DEMOSCREEN; pagename = DEH_String("PANEL7"); S_StartMusic(mus_fast); @@ -606,13 +608,13 @@ void D_DoAdvanceDemo (void) demosequence = -5; // exit return; case -3: // show Velocity logo for demo version - pagetic = (6*TICRATE); + pagetic = 6*TICRATE; gamestate = GS_DEMOSCREEN; pagename = DEH_String("vellogo"); demosequence = -5; // exit return; case -2: // title screen - pagetic = (6*TICRATE); + pagetic = 6*TICRATE; gamestate = GS_DEMOSCREEN; pagename = DEH_String("TITLEPIC"); S_StartMusic(mus_logo); @@ -626,68 +628,68 @@ void D_DoAdvanceDemo (void) wipegamestate = -1; break; case 0: // Rogue logo - pagetic = (4*TICRATE); + pagetic = 4*TICRATE; gamestate = GS_DEMOSCREEN; pagename = DEH_String("RGELOGO"); wipegamestate = -1; break; case 1: - pagetic = (7*TICRATE); // The comet struck our planet without + pagetic = 7*TICRATE; // The comet struck our planet without gamestate = GS_DEMOSCREEN; // warning.We lost our paradise in a pagename = DEH_String("PANEL1"); // single, violent stroke. I_StartVoice(DEH_String("pro1")); S_StartMusic(mus_intro); break; case 2: - pagetic = (9*TICRATE); // The impact released a virus which + pagetic = 9*TICRATE; // The impact released a virus which gamestate = GS_DEMOSCREEN; // swept through the land and killed pagename = DEH_String("PANEL2"); // millions. They turned out to be I_StartVoice(DEH_String("pro2")); // the lucky ones... break; case 3: - pagetic = (12*TICRATE); // For those that did not die became + pagetic = 12*TICRATE; // For those that did not die became gamestate = GS_DEMOSCREEN; // mutations of humanity. Some became pagename = DEH_String("PANEL3"); // fanatics who heard the voice of a I_StartVoice(DEH_String("pro3")); // malignant God in their heads, and break; // called themselves the Order. case 4: - pagetic = (11*TICRATE); // Those of us who were deaf to this + pagetic = 11*TICRATE; // Those of us who were deaf to this pagename = DEH_String("PANEL4"); // voice suffer horribly and are gamestate = GS_DEMOSCREEN; // forced to serve these ruthless I_StartVoice(DEH_String("pro4")); // psychotics, who wield weapons more break; // powerful than anything we can muster. case 5: - pagetic = (10*TICRATE); // They destroy our women and children, + pagetic = 10*TICRATE; // They destroy our women and children, gamestate = GS_DEMOSCREEN; // so that we must hide them underground, pagename = DEH_String("PANEL5"); // and live like animals in constant I_StartVoice(DEH_String("pro5")); // fear for our lives. break; case 6: // But there are whispers of discontent. - pagetic = (16*TICRATE); // If we organize, can we defeat our + pagetic = 16*TICRATE; // If we organize, can we defeat our gamestate = GS_DEMOSCREEN; // masters? Weapons are being stolen, pagename = DEH_String("PANEL6"); // soldiers are being trained. A I_StartVoice(DEH_String("pro6")); // Movement is born! Born of lifelong break; // STRIFE! case 7: // titlepic again - unused... - pagetic = (9*TICRATE); + pagetic = 9*TICRATE; gamestate = GS_DEMOSCREEN; pagename = DEH_String("TITLEPIC"); wipegamestate = -1; break; case 8: // demo //ClearTmp(); STRIFE-TODO - pagetic = (9*TICRATE); + pagetic = 9*TICRATE; G_DeferedPlayDemo(DEH_String("demo1")); break; case 9: // velocity logo? - unused... - pagetic = (6*TICRATE); + pagetic = 6*TICRATE; gamestate = GS_DEMOSCREEN; pagename = DEH_String("vellogo"); wipegamestate = -1; break; case 10: // credits gamestate = GS_DEMOSCREEN; - pagetic = (12*TICRATE); + pagetic = 12*TICRATE; pagename = DEH_String("CREDIT"); wipegamestate = -1; break; diff --git a/src/strife/d_net.c b/src/strife/d_net.c index bacc4e23..3480b0ad 100644 --- a/src/strife/d_net.c +++ b/src/strife/d_net.c @@ -61,7 +61,7 @@ // ticcmd_t netcmds[MAXPLAYERS][BACKUPTICS]; -int nettics[MAXPLAYERS]; +int nettics[MAXPLAYERS]; int maketic; @@ -253,7 +253,7 @@ void D_CheckNetGame (void) for (i=0; itype == ev_keydown - && ev->data1 == key_spy && (singledemo || !deathmatch) ) + && ev->data1 == key_spy && (singledemo || !deathmatch) ) { - // spy mode - do - { - displayplayer++; - if (displayplayer == MAXPLAYERS) - displayplayer = 0; - } while (!playeringame[displayplayer] && displayplayer != consoleplayer); - return true; + // spy mode + do + { + displayplayer++; + if (displayplayer == MAXPLAYERS) + displayplayer = 0; + } while (!playeringame[displayplayer] && displayplayer != consoleplayer); + return true; } - + // any other key pops up menu if in demos if (gameaction == ga_nothing && !singledemo && - (demoplayback || gamestate == GS_DEMOSCREEN) - ) + (demoplayback || gamestate == GS_DEMOSCREEN) + ) { - if (ev->type == ev_keydown || - (ev->type == ev_mouse && ev->data1) || - (ev->type == ev_joystick && ev->data1) ) - { - M_StartControlPanel (); - return true; - } - return false; + if (ev->type == ev_keydown || + (ev->type == ev_mouse && ev->data1) || + (ev->type == ev_joystick && ev->data1) ) + { + M_StartControlPanel (); + return true; + } + return false; } if (gamestate == GS_LEVEL) { #if 0 - if (devparm && ev->type == ev_keydown && ev->data1 == ';') - { - G_DeathMatchSpawnPlayer (0); - return true; - } + if (devparm && ev->type == ev_keydown && ev->data1 == ';') + { + G_DeathMatchSpawnPlayer (0); + return true; + } #endif - if (HU_Responder (ev)) - return true; // chat ate the event - if (ST_Responder (ev)) - return true; // status window ate it - if (AM_Responder (ev)) - return true; // automap ate it + if (HU_Responder (ev)) + return true; // chat ate the event + if (ST_Responder (ev)) + return true; // status window ate it + if (AM_Responder (ev)) + return true; // automap ate it } - + if (gamestate == GS_FINALE) { - if (F_Responder (ev)) - return true; // finale ate the event + if (F_Responder (ev)) + return true; // finale ate the event } if (testcontrols && ev->type == ev_mouse) @@ -942,39 +941,39 @@ boolean G_Responder (event_t* ev) switch (ev->type) { - case ev_keydown: - if (ev->data1 == key_pause) - { - sendpause = true; - } + case ev_keydown: + if (ev->data1 == key_pause) + { + sendpause = true; + } else if (ev->data1 data1] = true; + gamekeydown[ev->data1] = true; } - return true; // eat key down events - - case ev_keyup: - if (ev->data1 data1] = false; - return false; // always let key up events filter down - - case ev_mouse: + return true; // eat key down events + + case ev_keyup: + if (ev->data1 data1] = false; + return false; // always let key up events filter down + + case ev_mouse: SetMouseButtons(ev->data1); - mousex = ev->data2*(mouseSensitivity+5)/10; - mousey = ev->data3*(mouseSensitivity+5)/10; - return true; // eat events - - case ev_joystick: + mousex = ev->data2*(mouseSensitivity+5)/10; + mousey = ev->data3*(mouseSensitivity+5)/10; + return true; // eat events + + case ev_joystick: SetJoyButtons(ev->data1); - joyxmove = ev->data2; - joyymove = ev->data3; - return true; // eat events - - default: - break; + joyxmove = ev->data2; + joyymove = ev->data3; + return true; // eat events + + default: + break; } - + return false; } @@ -1062,10 +1061,7 @@ void G_Ticker (void) // over the past 4 seconds. offset the checking period // for each player so messages are not displayed at the // same time. - // - // haleyjd 20110204 [STRIFE] unused - /* if (cmd->forwardmove > TURBOTHRESHOLD) { turbodetected[i] = true; @@ -1081,7 +1077,6 @@ void G_Ticker (void) players[consoleplayer].message = turbomessage; turbodetected[i] = false; } - */ if (netgame && !netdemo && !(gametic%ticdup) ) { @@ -1236,7 +1231,7 @@ void G_PlayerReborn (int player) int allegiance; killcount = players[player].killcount; - allegiance = players[player].allegiance; + allegiance = players[player].allegiance; // [STRIFE] memcpy(frags,players[player].frags,sizeof(frags)); @@ -1261,10 +1256,11 @@ void G_PlayerReborn (int player) for(i = 0; i < NUMAMMO; i++) p->maxammo[i] = maxammo[i]; + // [STRIFE] clear inventory for(i = 0; i < 32; i++) p->inventory[i].type = NUMMOBJTYPES; - // villsa [STRIFE] + // villsa [STRIFE]: Default objective strncpy(mission_objective, DEH_String("Find help"), OBJECTIVE_LEN); } diff --git a/src/strife/p_dialog.c b/src/strife/p_dialog.c index a3a3b6e3..77d48c0e 100644 --- a/src/strife/p_dialog.c +++ b/src/strife/p_dialog.c @@ -2,7 +2,6 @@ //----------------------------------------------------------------------------- // // Copyright(C) 1993-1996 Id Software, Inc. -// Copyright(C) 1996 Rogue Entertainment / Velocity, Inc. // Copyright(C) 2010 James Haley, Samuel Villareal // // This program is free software; you can redistribute it and/or @@ -138,7 +137,7 @@ typedef struct dialogstateset_s static dialogstateset_t dialogstatesets[] = { - { MT_PLAYER, S_NULL, S_NULL, S_NULL }, + { MT_PLAYER, S_NULL, S_NULL, S_NULL }, { MT_SHOPKEEPER_W, S_MRGT_00, S_MRYS_00, S_MRNO_00 }, { MT_SHOPKEEPER_B, S_MRGT_00, S_MRYS_00, S_MRNO_00 }, { MT_SHOPKEEPER_A, S_MRGT_00, S_MRYS_00, S_MRNO_00 }, @@ -558,7 +557,6 @@ mapdialog_t *P_DialogFind(mobjtype_t type, int jumptoconv) // [STRIFE] New function // haleyjd 09/03/10: Find the set of special dialog states (greetings, yes, no) // for a particular thing type. -// STRIFE-TODO: Or is it a conversation ID? // static dialogstateset_t *P_DialogGetStates(mobjtype_t type) { @@ -984,75 +982,6 @@ boolean P_GiveItemToPlayer(player_t *player, int sprnum, mobjtype_t type) S_StartSound(NULL, sound); return true; - - // check for other types - /* - switch(type) - { - // severed hand - - // 300 gold - - // ammo refill (at training) - - // health refill (at front HQ) - - // alarm - - // door special 1 - - // door special 2 - - // door special 3 - - // door special 4 - - // stamina upgrade - - // slideshow - - default: - // check for sprites if no specific type is found - switch(sprnum) - { - // bullets - - // box of bullets - - // missile - - // box of missiles - - // battery - - - - // backpack - - // communicator - - - // rifle - - // flame thrower - - // missile launcher - - // mauler - - - // misc item - default: - if(!P_GiveInventoryItem(player, sprnum, type)) - return false; - break; - } - break; - } - - S_StartSound(player->mo, sfx_itemup); - return true; - */ } // @@ -1479,3 +1408,6 @@ void P_DialogStart(player_t *player) "%d) %s", i + 1, byetext); } +// EOF + + diff --git a/src/strife/p_doors.c b/src/strife/p_doors.c index 71831c68..850baac6 100644 --- a/src/strife/p_doors.c +++ b/src/strife/p_doors.c @@ -554,7 +554,7 @@ void EV_VerticalDoor(line_t* line, mobj_t* thing) vldoor_t* door; int side; - side = 0; // only front sides can be used + side = 0; // only front sides can be used // Check for locks player = thing->player; @@ -732,11 +732,6 @@ void EV_VerticalDoor(line_t* line, mobj_t* thing) sec = sides[ line->sidenum[side^1]] .sector; secnum = sec-sectors; - - // STRIFE-TODO: retriggering logic was modified, and has a serious bug in that - // some linetypes are allowed to fall through and start multiple thinkers on a - // single sector - this must be carefully replicated - if (sec->specialdata) { door = sec->specialdata; @@ -764,7 +759,7 @@ void EV_VerticalDoor(line_t* line, mobj_t* thing) case 213: // villsa case 232: // villsa if(door->direction == -1) - door->direction = 1; // go back up + door->direction = 1; // go back up else { if (!thing->player) @@ -776,7 +771,7 @@ void EV_VerticalDoor(line_t* line, mobj_t* thing) if (door->thinker.function.acp1 == (actionf_p1) T_VerticalDoor) { - door->direction = -1; // start going down immediately + door->direction = -1; // start going down immediately } else if (door->thinker.function.acp1 == (actionf_p1) T_PlatRaise) { @@ -806,6 +801,8 @@ void EV_VerticalDoor(line_t* line, mobj_t* thing) } } return; + default: + break; } } @@ -830,7 +827,7 @@ void EV_VerticalDoor(line_t* line, mobj_t* thing) S_StartSound(&sec->soundorg, sfx_bdopn); break; - default: // NORMAL DOOR SOUND + default: // NORMAL DOOR SOUND S_StartSound(&sec->soundorg, door->opensound); break; } @@ -884,8 +881,8 @@ void EV_VerticalDoor(line_t* line, mobj_t* thing) // void P_SpawnDoorCloseIn30 (sector_t* sec) { - vldoor_t* door; - + vldoor_t* door; + door = Z_Malloc ( sizeof(*door), PU_LEVSPEC, 0); P_AddThinker (&door->thinker); diff --git a/src/strife/p_pspr.c b/src/strife/p_pspr.c index a41a372f..42a6bd7b 100644 --- a/src/strife/p_pspr.c +++ b/src/strife/p_pspr.c @@ -59,12 +59,12 @@ // void P_SetPsprite -( player_t* player, - int position, - statenum_t stnum ) +( player_t* player, + int position, + statenum_t stnum ) { - pspdef_t* psp; - state_t* state; + pspdef_t* psp; + state_t* state; psp = &player->psprites[position]; @@ -74,7 +74,7 @@ P_SetPsprite { // object removed itself psp->state = NULL; - break; + break; } state = &states[stnum]; @@ -116,7 +116,7 @@ P_SetPsprite // void P_BringUpWeapon (player_t* player) { - statenum_t newstate; + statenum_t newstate; if (player->pendingweapon == wp_nochange) player->pendingweapon = player->readyweapon; @@ -207,7 +207,7 @@ boolean P_CheckAmmo (player_t* player) // Now set appropriate weapon overlay. P_SetPsprite(player, ps_weapon, weaponinfo[player->readyweapon].downstate); - return false; + return false; } @@ -255,9 +255,9 @@ void P_DropWeapon (player_t* player) // or after previous attack/fire sequence. // void A_WeaponReady( player_t* player, pspdef_t* psp) -{ - statenum_t newstate; - int angle; +{ + statenum_t newstate; + int angle; // get out of attack state if (player->mo->state == &states[S_PLAY_05] || // 292 @@ -282,14 +282,13 @@ void A_WeaponReady( player_t* player, pspdef_t* psp) // (pending weapon should allready be validated) newstate = weaponinfo[player->readyweapon].downstate; P_SetPsprite (player, ps_weapon, newstate); - return; + return; } // check for fire // the missile launcher and torpedo do not auto fire if (player->cmd.buttons & BT_ATTACK) { - if ( !player->attackdown || (player->readyweapon != wp_missile && player->readyweapon != wp_torpedo)) // villsa [STRIFE] replace bfg with torpedo @@ -382,7 +381,7 @@ A_Lower { // Player is dead, so keep the weapon off screen. P_SetPsprite (player, ps_weapon, S_NULL); - return; + return; } player->readyweapon = player->pendingweapon; diff --git a/src/strife/p_setup.c b/src/strife/p_setup.c index b1a02b04..694d0185 100644 --- a/src/strife/p_setup.c +++ b/src/strife/p_setup.c @@ -751,20 +751,23 @@ static void P_LoadReject(int lumpnum) // void P_SetupLevel -( int map, - int playermask, - skill_t skill) +( int map, + int playermask, + skill_t skill) { - int i; - char lumpname[9]; - int lumpnum; - - totalkills = totalitems = totalsecret = wminfo.maxfrags = 0; - wminfo.partime = 180; + int i; + char lumpname[9]; + int lumpnum; + + // haleyjd 20110205 [STRIFE]: removed totalitems and wminfo + totalkills = totalsecret = 0; + for (i=0 ; iflags & MF_MISSILE) - return 0; + //if (thing->flags & MF_MISSILE) + // return 0; // Don't teleport if hit back of line, // so you can get out of teleporter. if (side == 1) return 0; - tag = line->tag; for (i = 0; i < numsectors; i++) { @@ -89,18 +90,18 @@ EV_Teleport { // not a mobj if (thinker->function.acp1 != (actionf_p1)P_MobjThinker) - continue; + continue; m = (mobj_t *)thinker; // not a teleportman if (m->type != MT_TELEPORTMAN ) - continue; + continue; sector = m->subsector->sector; // wrong sector if (sector-sectors != i ) - continue; + continue; oldx = thing->x; oldy = thing->y; @@ -114,9 +115,13 @@ EV_Teleport // // Note that although chex.exe is based on Final Doom, // it does not have this quirk. - + // + // haleyjd 20110205 [STRIFE] This code is *not* present, + // because of a z-set which Rogue added to P_TeleportMove. + /* if (gameversion < exe_final || gameversion == exe_chex) thing->z = thing->floorz; + */ if (thing->player) thing->player->viewz = thing->z+thing->player->viewheight; @@ -142,12 +147,12 @@ EV_Teleport // don't move for a bit if (thing->player) - thing->reactiontime = 18; + thing->reactiontime = 18; thing->angle = m->angle; thing->momx = thing->momy = thing->momz = 0; return 1; - } + } } } return 0; diff --git a/src/strife/p_tick.c b/src/strife/p_tick.c index cca2e2c4..4a7ead62 100644 --- a/src/strife/p_tick.c +++ b/src/strife/p_tick.c @@ -32,7 +32,7 @@ #include "doomstat.h" -int leveltime; +int leveltime; // // THINKERS @@ -45,12 +45,14 @@ int leveltime; // Both the head and tail of the thinker list. -thinker_t thinkercap; +thinker_t thinkercap; // // P_InitThinkers // +// [STRIFE] Verified unmodified +// void P_InitThinkers (void) { thinkercap.prev = thinkercap.next = &thinkercap; @@ -63,6 +65,8 @@ void P_InitThinkers (void) // P_AddThinker // Adds a new thinker at the end of the list. // +// [STRIFE] Verified unmodified +// void P_AddThinker (thinker_t* thinker) { thinkercap.prev->next = thinker; @@ -78,6 +82,8 @@ void P_AddThinker (thinker_t* thinker) // Deallocation is lazy -- it will not actually be freed // until its thinking turn comes up. // +// [STRIFE] Verified unmodified +// void P_RemoveThinker (thinker_t* thinker) { // FIXME: NOP. @@ -97,43 +103,46 @@ void P_AllocateThinker (thinker_t* thinker) // // P_RunThinkers // +// [STRIFE] Verified unmodified +// void P_RunThinkers (void) { - thinker_t* currentthinker; + thinker_t* currentthinker; currentthinker = thinkercap.next; while (currentthinker != &thinkercap) { - if ( currentthinker->function.acv == (actionf_v)(-1) ) - { - // time to remove it - currentthinker->next->prev = currentthinker->prev; - currentthinker->prev->next = currentthinker->next; - Z_Free (currentthinker); - } - else - { - if (currentthinker->function.acp1) - currentthinker->function.acp1 (currentthinker); - } - currentthinker = currentthinker->next; + if ( currentthinker->function.acv == (actionf_v)(-1) ) + { + // time to remove it + currentthinker->next->prev = currentthinker->prev; + currentthinker->prev->next = currentthinker->next; + Z_Free (currentthinker); + } + else + { + if (currentthinker->function.acp1) + currentthinker->function.acp1 (currentthinker); + } + currentthinker = currentthinker->next; } } // // P_Ticker // - +// [STRIFE] Menu pause behavior modified +// void P_Ticker (void) { - int i; + int i; // run the tic if (paused) return; - + // pause if in menu and at least one tic has been run - // haleyjd 09/08/10: menuactive -> menupause + // haleyjd 09/08/10 [STRIFE]: menuactive -> menupause if (!netgame && menupause && !demoplayback @@ -152,5 +161,5 @@ void P_Ticker (void) P_RespawnSpecials (); // for par times - leveltime++; + leveltime++; } diff --git a/src/strife/p_user.c b/src/strife/p_user.c index f3580b0c..fa521ace 100644 --- a/src/strife/p_user.c +++ b/src/strife/p_user.c @@ -71,6 +71,8 @@ boolean onground; // P_Thrust // Moves the given origin along a given angle. // +// [STRIFE] Verified unmodified +// void P_Thrust ( player_t* player, @@ -90,10 +92,12 @@ P_Thrust // P_CalcHeight // Calculate the walking / running height adjustment // +// [STRIFE] Some odd adjustments, and terrain view height adjustment +// void P_CalcHeight (player_t* player) { - int angle; - fixed_t bob; + int angle; + fixed_t bob; // Regular movement bobbing // (needs to be calculated for gun swing @@ -102,62 +106,69 @@ void P_CalcHeight (player_t* player) // Note: a LUT allows for effects // like a ramp with low health. player->bob = - FixedMul (player->mo->momx, player->mo->momx) - + FixedMul (player->mo->momy,player->mo->momy); - + FixedMul (player->mo->momx, player->mo->momx) + + FixedMul (player->mo->momy,player->mo->momy); + player->bob >>= 2; if (player->bob>MAXBOB) - player->bob = MAXBOB; + player->bob = MAXBOB; - if ((player->cheats & CF_NOMOMENTUM) || !onground) + // haleyjd 20110205 [STRIFE]: No CF_NOMOMENTUM check, and Rogue also removed + // the dead code inside. + if (!onground) { - player->viewz = player->mo->z + VIEWHEIGHT; + /* + player->viewz = player->mo->z + VIEWHEIGHT; - if (player->viewz > player->mo->ceilingz-4*FRACUNIT) - player->viewz = player->mo->ceilingz-4*FRACUNIT; + if (player->viewz > player->mo->ceilingz-4*FRACUNIT) + player->viewz = player->mo->ceilingz-4*FRACUNIT; + */ - player->viewz = player->mo->z + player->viewheight; - return; + player->viewz = player->mo->z + player->viewheight; + return; } - + angle = (FINEANGLES/20*leveltime)&FINEMASK; bob = FixedMul ( player->bob/2, finesine[angle]); - // move viewheight if (player->playerstate == PST_LIVE) { - player->viewheight += player->deltaviewheight; - - if (player->viewheight > VIEWHEIGHT) - { - player->viewheight = VIEWHEIGHT; - player->deltaviewheight = 0; - } - - if (player->viewheight < VIEWHEIGHT/2) - { - player->viewheight = VIEWHEIGHT/2; - if (player->deltaviewheight <= 0) - player->deltaviewheight = 1; - } - - if (player->deltaviewheight) - { - player->deltaviewheight += FRACUNIT/4; - if (!player->deltaviewheight) - player->deltaviewheight = 1; - } + player->viewheight += player->deltaviewheight; + + if (player->viewheight > VIEWHEIGHT) + { + player->viewheight = VIEWHEIGHT; + player->deltaviewheight = 0; + } + + if (player->viewheight < VIEWHEIGHT/2) + { + player->viewheight = VIEWHEIGHT/2; + if (player->deltaviewheight <= 0) + player->deltaviewheight = 1; + } + + if (player->deltaviewheight) + { + player->deltaviewheight += FRACUNIT/4; + if (!player->deltaviewheight) + player->deltaviewheight = 1; + } } player->viewz = player->mo->z + player->viewheight + bob; - // villsa [STRIFE] TODO - verify + // villsa [STRIFE] account for terrain lowering the view if(player->mo->flags & MF_FEETCLIPPED) - player->viewz -= (13*FRACUNIT); + player->viewz -= 13*FRACUNIT; if (player->viewz > player->mo->ceilingz-4*FRACUNIT) - player->viewz = player->mo->ceilingz-4*FRACUNIT; + player->viewz = player->mo->ceilingz-4*FRACUNIT; + + // haleyjd [STRIFE]: added a floorz clip here + if (player->viewz < player->mo->floorz) + player->viewz = player->mo->floorz; } @@ -165,12 +176,14 @@ void P_CalcHeight (player_t* player) // // P_MovePlayer // +// [STRIFE] Adjustments to allow air control, jumping, and up/down look. +// void P_MovePlayer (player_t* player) { - ticcmd_t* cmd; - + ticcmd_t* cmd; + cmd = &player->cmd; - + player->mo->angle += (cmd->angleturn<<16); // Do not let the player control movement @@ -178,10 +191,11 @@ void P_MovePlayer (player_t* player) onground = (player->mo->z <= player->mo->floorz); // villsa [STRIFE] allows player to climb over things by jumping + // haleyjd 20110205: air control thrust should be 256, not cmd->forwardmove if(!onground) { if(cmd->forwardmove) - P_Thrust (player, player->mo->angle, cmd->forwardmove); + P_Thrust (player, player->mo->angle, 256); } else { @@ -189,21 +203,23 @@ void P_MovePlayer (player_t* player) if (cmd->buttons2 & BT2_JUMP) { if(!player->deltaviewheight) - player->mo->momz += (8*FRACUNIT); + player->mo->momz += 8*FRACUNIT; } - - if (cmd->forwardmove && onground) - P_Thrust (player, player->mo->angle, cmd->forwardmove*2048); - - if (cmd->sidemove && onground) - P_Thrust (player, player->mo->angle-ANG90, cmd->sidemove*2048); + + // haleyjd 20110205 [STRIFE] Either Rogue or Watcom removed the + // redundant "onground" checks from these if's. + if (cmd->forwardmove) + P_Thrust (player, player->mo->angle, cmd->forwardmove*2048); + + if (cmd->sidemove) + P_Thrust (player, player->mo->angle-ANG90, cmd->sidemove*2048); } - // villsa [STRIFE] TODO - verify + // villsa [STRIFE] player walking state set if ( (cmd->forwardmove || cmd->sidemove) - && player->mo->state == &states[S_PLAY_00] ) + && player->mo->state == &states[S_PLAY_00] ) { - P_SetMobjState (player->mo, S_PLAY_01); + P_SetMobjState (player->mo, S_PLAY_01); } // villsa [STRIFE] centerview button @@ -249,7 +265,7 @@ void P_MovePlayer (player_t* player) } } -} +} @@ -258,7 +274,9 @@ void P_MovePlayer (player_t* player) // Fall on your face when dying. // Decrease POV height to floor height. // -#define ANG5 (ANG90/18) +// [STRIFE] Modifications for up/down look. +// +#define ANG5 (ANG90/18) void P_DeathThink(player_t* player) { @@ -281,9 +299,9 @@ void P_DeathThink(player_t* player) if(player->attacker && player->attacker != player->mo) { angle = R_PointToAngle2 (player->mo->x, - player->mo->y, - player->attacker->x, - player->attacker->y); + player->mo->y, + player->attacker->x, + player->attacker->y); delta = angle - player->mo->angle; @@ -317,17 +335,35 @@ void P_DeathThink(player_t* player) // // P_PlayerThink // +// [STRIFE] Massive changes/additions: +// * NOCLIP hack removed +// * P_DeathThink moved up +// * Inventory use/dropping +// * Strife weapons logic +// * Dialog +// * Strife powerups and nukage behavior +// * Fire Death/Sigil Shock +// void P_PlayerThink (player_t* player) { - ticcmd_t* cmd; - weapontype_t newweapon; + ticcmd_t* cmd; + weapontype_t newweapon; + // villsa [STRIFE] unused code (see ST_Responder) + /* // fixme: do this in the cheat code - // villsa [STRIFE] TODO - verify if unused if (player->cheats & CF_NOCLIP) player->mo->flags |= MF_NOCLIP; else player->mo->flags &= ~MF_NOCLIP; + */ + + // haleyjd 20110205 [STRIFE]: P_DeathThink moved up + if (player->playerstate == PST_DEAD) + { + P_DeathThink (player); + return; + } // chain saw run forward cmd = &player->cmd; @@ -339,13 +375,6 @@ void P_PlayerThink (player_t* player) player->mo->flags &= ~MF_JUSTATTACKED; } - - if (player->playerstate == PST_DEAD) - { - P_DeathThink (player); - return; - } - // Move around. // Reactiontime is used to prevent movement // for a bit after a teleport. @@ -369,9 +398,10 @@ void P_PlayerThink (player_t* player) else if(cmd->buttons2 & BT2_INVUSE) P_UseInventoryItem(player, cmd->inventory); else if(cmd->buttons2 & BT2_INVDROP) - P_DropInventoryItem(player, cmd->inventory); - else { + P_DropInventoryItem(player, cmd->inventory); + + // haleyjd 20110205: removed incorrect "else" here // villsa [STRIFE] if(workparm) { @@ -390,7 +420,6 @@ void P_PlayerThink (player_t* player) } } } - } player->inventorydown = true; @@ -402,7 +431,7 @@ void P_PlayerThink (player_t* player) // A special event has no other buttons. if(cmd->buttons & BT_SPECIAL) - cmd->buttons = 0; + cmd->buttons = 0; if(cmd->buttons & BT_CHANGE) { @@ -491,7 +520,7 @@ void P_PlayerThink (player_t* player) // Strength counts up to diminish fade. if (player->powers[pw_strength]) - player->powers[pw_strength]++; + player->powers[pw_strength]++; // villsa [STRIFE] targeter powerup if(player->powers[pw_targeter]) @@ -500,21 +529,20 @@ void P_PlayerThink (player_t* player) if(player->powers[pw_targeter] == 1) { P_SetPsprite(player, ps_targcenter, S_NULL); - P_SetPsprite(player, ps_targleft, S_NULL); - P_SetPsprite(player, ps_targright, S_NULL); + P_SetPsprite(player, ps_targleft, S_NULL); + P_SetPsprite(player, ps_targright, S_NULL); } - else if(player->powers[pw_targeter] - 1 < 175) + else if(player->powers[pw_targeter] - 1 < 5*TICRATE) { if(player->powers[pw_targeter] & 32) { P_SetPsprite(player, ps_targright, S_NULL); - P_SetPsprite(player, ps_targleft, S_TRGT_01); // 11 + P_SetPsprite(player, ps_targleft, S_TRGT_01); // 11 } - - if(player->powers[pw_targeter] & 16) + else if(player->powers[pw_targeter] & 16) // haleyjd 20110205: missing else { P_SetPsprite(player, ps_targright, S_TRGT_02); // 12 - P_SetPsprite(player, ps_targleft, S_NULL); + P_SetPsprite(player, ps_targleft, S_NULL); } } } diff --git a/src/strife/st_stuff.c b/src/strife/st_stuff.c index cebc5bfc..1811ddfa 100644 --- a/src/strife/st_stuff.c +++ b/src/strife/st_stuff.c @@ -651,15 +651,21 @@ boolean ST_Responder(event_t* ev) } else if (cht_CheckCheat(&cheat_noclip, ev->data2)) { - // [STRIFE] Verified unmodified, except no idspispopd shit: + // [STRIFE] Removed idspispopd, added NOCLIP flag setting/removal // Noclip cheat - "ELVIS" (hah-hah :P ) plyr->cheats ^= CF_NOCLIP; if (plyr->cheats & CF_NOCLIP) + { plyr->message = DEH_String(STSTR_NCON); + plyr->mo->flags |= MF_NOCLIP; + } else + { plyr->message = DEH_String(STSTR_NCOFF); + plyr->mo->flags &= ~MF_NOCLIP; + } } // villsa [STRIFE] -- cgit v1.2.3