diff options
author | Samuel Villareal | 2010-09-03 04:11:39 +0000 |
---|---|---|
committer | Samuel Villareal | 2010-09-03 04:11:39 +0000 |
commit | d1c8cb2cfed18f5c5c32347011f33a210c96ff38 (patch) | |
tree | 2d0e2e886d0dae84347e8d9a390ea77652bab403 | |
parent | 1c756bd681af926fabdb99c57248e68b776e66fd (diff) | |
download | chocolate-doom-d1c8cb2cfed18f5c5c32347011f33a210c96ff38.tar.gz chocolate-doom-d1c8cb2cfed18f5c5c32347011f33a210c96ff38.tar.bz2 chocolate-doom-d1c8cb2cfed18f5c5c32347011f33a210c96ff38.zip |
+ More button flags added to buttoncode_e
+ Looking/jumping implemented
+ Jump/look/center keys supported
+ Strife mouse firing bug implemented
Subversion-branch: /branches/strife-branch
Subversion-revision: 2003
-rw-r--r-- | src/d_event.h | 14 | ||||
-rw-r--r-- | src/m_controls.h | 11 | ||||
-rw-r--r-- | src/strife/doomstat.h | 1 | ||||
-rw-r--r-- | src/strife/g_game.c | 39 | ||||
-rw-r--r-- | src/strife/m_menu.c | 1 | ||||
-rw-r--r-- | src/strife/p_user.c | 8 | ||||
-rw-r--r-- | src/strife/r_main.c | 38 | ||||
-rw-r--r-- | src/strife/r_things.c | 5 |
8 files changed, 105 insertions, 12 deletions
diff --git a/src/d_event.h b/src/d_event.h index eb9211bb..25334a96 100644 --- a/src/d_event.h +++ b/src/d_event.h @@ -94,13 +94,19 @@ typedef enum typedef enum { // Player view look up - BT_LOOKUP = 1, + BT2_LOOKUP = 1, // Player view look down - BT_LOOKDOWN = 2, + BT2_LOOKDOWN = 2, // Center player's view - BT_CENTERVIEW = 4, + BT2_CENTERVIEW = 4, + // Use inventory item + BT2_INVUSE = 8, + // Drop inventory item + BT2_INVDROP = 16, // Jump up and down - BT_JUMP = 32, + BT2_JUMP = 32, + // Use medkit + BT2_HEALTH = 128, } buttoncode2_t; diff --git a/src/m_controls.h b/src/m_controls.h index c284fa84..10ca7a0c 100644 --- a/src/m_controls.h +++ b/src/m_controls.h @@ -49,6 +49,17 @@ extern int key_invleft; extern int key_invright; extern int key_useartifact; +// villsa [STRIFE] strife keys +extern int key_usehealth; +extern int key_invquery; +extern int key_mission; +extern int key_invpop; +extern int key_invkey; +extern int key_invhome; +extern int key_invend; +extern int key_invuse; +extern int key_invdrop; + extern int key_message_refresh; extern int key_pause; diff --git a/src/strife/doomstat.h b/src/strife/doomstat.h index 779987d0..6aaaf976 100644 --- a/src/strife/doomstat.h +++ b/src/strife/doomstat.h @@ -191,6 +191,7 @@ extern boolean usergame; //? extern boolean demoplayback; extern boolean demorecording; +extern int mouse_fire_countdown; // villsa [STRIFE] // Round angleturn in ticcmds to the nearest 256. This is used when // recording Vanilla demos in netgames. diff --git a/src/strife/g_game.c b/src/strife/g_game.c index 7d8b08db..352e65de 100644 --- a/src/strife/g_game.c +++ b/src/strife/g_game.c @@ -170,6 +170,8 @@ fixed_t forwardmove[2] = {0x19, 0x32}; fixed_t sidemove[2] = {0x18, 0x28}; fixed_t angleturn[3] = {640, 1280, 320}; // + slow turn +int mouse_fire_countdown = 0; // villsa [STRIFE] + static int *weapon_keys[] = { &key_weapon1, &key_weapon2, @@ -364,6 +366,16 @@ void G_BuildTiccmd (ticcmd_t* cmd) cmd->consistancy = consistancy[consoleplayer][maketic%BACKUPTICS]; + + // villsa [STRIFE] + if(gamekeydown[key_lookup]) + cmd->buttons2 |= BT2_LOOKUP; + if (gamekeydown[key_lookdown]) + cmd->buttons2 |= BT2_LOOKDOWN; + if (gamekeydown[key_usehealth]) + cmd->buttons2 |= BT2_HEALTH; + + strafe = gamekeydown[key_strafe] || mousebuttons[mousebstrafe] || joybuttons[joybstrafe]; @@ -377,6 +389,14 @@ void G_BuildTiccmd (ticcmd_t* cmd) || joybuttons[joybspeed]; forward = side = 0; + + // villsa [STRIFE] running causes centerview to occur + if(speed) + cmd->buttons2 |= BT2_CENTERVIEW; + + // villsa [STRIFE] disable running if low on health + if (players[consoleplayer].health <= 15) + speed = 0; // use two stage accelerative turning // on the keyboard and joystick @@ -456,10 +476,25 @@ void G_BuildTiccmd (ticcmd_t* cmd) // buttons cmd->chatchar = HU_dequeueChatChar(); + + // villsa [STRIFE] TODO - add mouse button support for jump + if(gamekeydown[key_jump] /*|| mousebuttons[mousebjump]*/) + cmd->buttons2 |= BT2_JUMP; - if (gamekeydown[key_fire] || mousebuttons[mousebfire] + // villsa [STRIFE] + if (gamekeydown[key_fire] /*|| mousebuttons[mousebfire]*/ || joybuttons[joybfire]) - cmd->buttons |= BT_ATTACK; + cmd->buttons |= BT_ATTACK; + + // villsa [STRIFE] + if(mousebuttons[mousebfire]) + { + if(mouse_fire_countdown <= 0) + cmd->buttons |= BT_ATTACK; + else + --mouse_fire_countdown; + + } if (gamekeydown[key_use] || joybuttons[joybuse] diff --git a/src/strife/m_menu.c b/src/strife/m_menu.c index 78ef8dfe..5800aefc 100644 --- a/src/strife/m_menu.c +++ b/src/strife/m_menu.c @@ -1542,6 +1542,7 @@ boolean M_Responder (event_t* ev) { key = key_menu_forward; mousewait = I_GetTime() + 15; + mouse_fire_countdown = 5; // villsa [STRIFE] } if (ev->data1&2) diff --git a/src/strife/p_user.c b/src/strife/p_user.c index 3c0cdb5e..9e038a06 100644 --- a/src/strife/p_user.c +++ b/src/strife/p_user.c @@ -167,7 +167,7 @@ void P_MovePlayer (player_t* player) onground = (player->mo->z <= player->mo->floorz); // villsa [STRIFE] jump button - if (onground && cmd->buttons2 & BT_JUMP) + if (onground && cmd->buttons2 & BT2_JUMP) { if(!player->deltaviewheight) player->mo->momz += (8*FRACUNIT); @@ -187,7 +187,7 @@ void P_MovePlayer (player_t* player) } // villsa [STRIFE] centerview button - if (cmd->buttons2 & BT_CENTERVIEW) + if (cmd->buttons2 & BT2_CENTERVIEW) player->centerview = 1; // villsa [STRIFE] adjust player's pitch when centerviewing @@ -210,7 +210,7 @@ void P_MovePlayer (player_t* player) } // villsa [STRIFE] look up action - if (cmd->buttons2 & BT_LOOKUP) + if (cmd->buttons2 & BT2_LOOKUP) { player->pitch += LOOKPITCHAMOUNT; if ((player->pitch + LOOKPITCHAMOUNT) > LOOKUPMAX || @@ -220,7 +220,7 @@ void P_MovePlayer (player_t* player) else { // villsa [STRIFE] look down action - if (cmd->buttons2 & BT_LOOKDOWN) + if (cmd->buttons2 & BT2_LOOKDOWN) { player->pitch -= LOOKPITCHAMOUNT; if ((player->pitch - LOOKPITCHAMOUNT) > LOOKUPMAX || diff --git a/src/strife/r_main.c b/src/strife/r_main.c index 7ea2a329..dea4603b 100644 --- a/src/strife/r_main.c +++ b/src/strife/r_main.c @@ -35,6 +35,7 @@ #include "doomdef.h" +#include "doomstat.h" // villsa [STRIFE] #include "d_net.h" #include "m_bbox.h" @@ -79,6 +80,8 @@ fixed_t viewx; fixed_t viewy; fixed_t viewz; +int viewpitch; // villsa [STRIFE] + angle_t viewangle; fixed_t viewcos; @@ -697,7 +700,10 @@ void R_ExecuteSetViewSize (void) detailshift = setdetail; viewwidth = scaledviewwidth>>detailshift; - centery = viewheight/2; + // villsa [STRIFE] calculate centery from player's pitch + centery = (setblocks*players[consoleplayer].pitch); + centery = (unsigned int)(centery/10)+viewheight/2; + centerx = viewwidth/2; centerxfrac = centerx<<FRACBITS; centeryfrac = centery<<FRACBITS; @@ -823,6 +829,34 @@ R_PointInSubsector return &subsectors[nodenum & ~NF_SUBSECTOR]; } +// +// R_SetupPitch +// villsa [STRIFE] new function +// Calculate centery/centeryfrac for player viewpitch +// + +void R_SetupPitch(player_t* player) +{ + fixed_t pitchfrac; + int i = 0; + + if(viewpitch != player->pitch) + { + viewpitch = player->pitch; + pitchfrac = ((setblocks*player->pitch)/10); + centery = (pitchfrac+viewheight)/2; + centeryfrac = centery<<FRACBITS; + + if(viewheight > 0) + { + for(i = 0; i < viewheight; i++) + { + yslope[i] = FixedDiv(viewwidth/2*FRACUNIT, + abs(((i-centery)<<FRACBITS)+(FRACUNIT/2))); + } + } + } +} // @@ -832,6 +866,8 @@ void R_SetupFrame (player_t* player) { int i; + R_SetupPitch(player); // villsa [STRIFE] + viewplayer = player; viewx = player->mo->x; viewy = player->mo->y; diff --git a/src/strife/r_things.c b/src/strife/r_things.c index 82039dd8..90267052 100644 --- a/src/strife/r_things.c +++ b/src/strife/r_things.c @@ -699,7 +699,6 @@ void R_DrawPSprite (pspdef_t* psp) // store information in a vissprite vis = &avis; vis->mobjflags = 0; - vis->texturemid = (BASEYCENTER<<FRACBITS)+FRACUNIT/2-(psp->sy-spritetopoffset[lump]); vis->x1 = x1 < 0 ? 0 : x1; vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2; vis->scale = pspritescale<<detailshift; @@ -714,6 +713,10 @@ void R_DrawPSprite (pspdef_t* psp) vis->xiscale = pspriteiscale; vis->startfrac = 0; } + + // villsa [STRIFE] calculate y offset with view pitch + vis->texturemid = ((BASEYCENTER<<FRACBITS)+FRACUNIT/2)-(psp->sy-spritetopoffset[lump]) + + FixedMul(vis->xiscale, (centery-viewheight/2)<<FRACBITS); if (vis->x1 > x1) vis->startfrac += vis->xiscale*(vis->x1-x1); |