diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/strife/p_inter.c | 97 | ||||
-rw-r--r-- | src/strife/p_local.h | 4 | ||||
-rw-r--r-- | src/strife/p_user.c | 1 | ||||
-rw-r--r-- | src/strife/r_things.c | 68 |
4 files changed, 105 insertions, 65 deletions
diff --git a/src/strife/p_inter.c b/src/strife/p_inter.c index 4eb4e391..c31b4333 100644 --- a/src/strife/p_inter.c +++ b/src/strife/p_inter.c @@ -71,48 +71,47 @@ int clipammo[NUMAMMO] = { 10, 4, 2, 20, 4, 6, 4 }; boolean P_GiveAmmo(player_t* player, ammotype_t ammo, int num) { int oldammo; - + if(ammo == am_noammo) - return false; - + return false; + if(ammo > NUMAMMO) - I_Error ("P_GiveAmmo: bad type %i", ammo); - + I_Error ("P_GiveAmmo: bad type %i", ammo); + if(player->ammo[ammo] == player->maxammo[ammo]) - return false; - + return false; + if(num) - num *= clipammo[ammo]; + num *= clipammo[ammo]; else - num = clipammo[ammo]/2; - + num = clipammo[ammo]/2; + if(gameskill == sk_baby - || gameskill == sk_nightmare) + || gameskill == sk_nightmare) { - // give double ammo in trainer mode, - // you'll need in nightmare - num <<= 1; + // give double ammo in trainer mode, + // you'll need in nightmare + num <<= 1; } - - + oldammo = player->ammo[ammo]; player->ammo[ammo] += num; if(player->ammo[ammo] > player->maxammo[ammo]) - player->ammo[ammo] = player->maxammo[ammo]; + player->ammo[ammo] = player->maxammo[ammo]; // If non zero ammo, // don't change up weapons, // player was lower on purpose. if(oldammo) - return true; + return true; // We were down to zero, // so select a new weapon. // Preferences are not user selectable. // villsa [STRIFE] ammo update - // [STRIFE] TODO - where's the check for grenades? + // where's the check for grenades? - haleyjd: verified no switch to grenades switch(ammo && !player->readyweapon) { case am_bullets: @@ -139,7 +138,7 @@ boolean P_GiveAmmo(player_t* player, ammotype_t ammo, int num) default: break; } - + return true; } @@ -253,7 +252,7 @@ boolean P_GiveBody(player_t* player, int num) player->health = health; } - + return true; } @@ -295,11 +294,11 @@ boolean P_GiveArmor(player_t* player, int armortype) boolean P_GiveCard(player_t* player, card_t card) { if (player->cards[card]) - return false; + return false; // villsa [STRIFE] multiply by 2 player->bonuscount = BONUSADD * 2; - player->cards[card] = 1; + player->cards[card] = true; return true; } @@ -309,26 +308,46 @@ boolean P_GiveCard(player_t* player, card_t card) // P_GivePower // boolean P_GivePower(player_t* player, powertype_t power) -{ +{ + + // haleyjd 09/14/10: [STRIFE] moved to top, exception for Shadow Armor + if(player->powers[power] && power != pw_invisibility) + return false; // already got it + + // if giving pw_invisibility and player already has MVIS, no can do. + if(power == pw_invisibility && (player->mo->flags & MF_MVIS)) + return false; + // villsa [STRIFE] if(power == pw_targeter) { player->powers[power] = TARGTICS; P_SetPsprite(player, ps_targcenter, S_TRGT_00); // 10 - P_SetPsprite(player, ps_targleft, S_TRGT_01); // 11 - P_SetPsprite(player, ps_targright, S_TRGT_02); // 12 + P_SetPsprite(player, ps_targleft, S_TRGT_01); // 11 + P_SetPsprite(player, ps_targright, S_TRGT_02); // 12 player->psprites[ps_targcenter].sx = (160*FRACUNIT); - player->psprites[ps_targleft].sy = (100*FRACUNIT); + player->psprites[ps_targleft ].sy = (100*FRACUNIT); player->psprites[ps_targcenter].sy = (100*FRACUNIT); - player->psprites[ps_targright].sy = (100*FRACUNIT); + player->psprites[ps_targright ].sy = (100*FRACUNIT); return true; } if(power == pw_invisibility) { + // if player already had this power... + if(player->powers[power]) + { + // remove SHADOW, give MVIS. + player->mo->flags &= ~MF_SHADOW; + player->mo->flags |= MF_MVIS; + } + else // give SHADOW + player->mo->flags |= MF_SHADOW; + + // set tics if giving shadow, or renew them if MVIS. player->powers[power] = INVISTICS; - player->mo->flags |= MF_SHADOW; + return true; } @@ -348,8 +367,9 @@ boolean P_GivePower(player_t* player, powertype_t power) // villsa [STRIFE] if(power == pw_allmap) { + // remember in mapstate if(gamemap < 40) - player->mapstate[gamemap] = 1; + player->mapstate[gamemap] = true; player->powers[power] = 1; return true; @@ -362,11 +382,7 @@ boolean P_GivePower(player_t* player, powertype_t power) return true; } - - if(player->powers[power]) - return false; // already got it - - + // default behavior: player->powers[power] = 1; return true; } @@ -512,7 +528,7 @@ void P_TouchSpecialThing(mobj_t* special, mobj_t* toucher) player->backpack = true; } for(i = 0; i < NUMAMMO; i++) - P_GiveAmmo(player, i, 1); + P_GiveAmmo(player, i, 1); break; case SPR_COIN: @@ -577,14 +593,17 @@ void P_TouchSpecialThing(mobj_t* special, mobj_t* toucher) if(!pickupmsg[0]) { if(special->info->name) - sprintf(pickupmsg, "You picked up the %s.", special->info->name); + { + DEH_snprintf(pickupmsg, sizeof(pickupmsg), + "You picked up the %s.", DEH_String(special->info->name)); + } else - sprintf(pickupmsg, "You picked up the item."); + DEH_snprintf(pickupmsg, sizeof(pickupmsg), "You picked up the item."); } // use the first character to indicate that the player is full on items else if(pickupmsg[0] == '!') { - sprintf(pickupmsg, "You cannot hold any more."); + DEH_snprintf(pickupmsg, sizeof(pickupmsg), "You cannot hold any more."); player->message = pickupmsg; return; } diff --git a/src/strife/p_local.h b/src/strife/p_local.h index bc8e6931..304f44c5 100644 --- a/src/strife/p_local.h +++ b/src/strife/p_local.h @@ -92,6 +92,10 @@ void P_DropWeapon (player_t* player); // // P_USER // + +// haleyjd 09/15/10: externalized +#define INVERSECOLORMAP 32 + void P_PlayerThink (player_t* player); // haleyjd 08/30/10: [STRIFE] Needed externally void P_Thrust (player_t* player, angle_t angle, fixed_t move); diff --git a/src/strife/p_user.c b/src/strife/p_user.c index ca82f7f0..c8c9b23e 100644 --- a/src/strife/p_user.c +++ b/src/strife/p_user.c @@ -39,7 +39,6 @@ // Index of the special effects (INVUL inverse) map. -#define INVERSECOLORMAP 32 #define LOOKPITCHAMOUNT 6 // villsa [STRIFE] #define CENTERVIEWAMOUNT (LOOKPITCHAMOUNT + 2) // villsa [STRIFE] #define LOOKUPMAX 90 // villsa [STRIFE] diff --git a/src/strife/r_things.c b/src/strife/r_things.c index 792c9f95..bda7a81c 100644 --- a/src/strife/r_things.c +++ b/src/strife/r_things.c @@ -43,6 +43,9 @@ #include "doomstat.h" +// haleyjd +#include "p_local.h" + #define MINZ (FRACUNIT*4) @@ -710,14 +713,14 @@ void R_DrawPSprite (pspdef_t* psp) // decide which patch to use #ifdef RANGECHECK if ( (unsigned)psp->state->sprite >= (unsigned int) numsprites) - I_Error ("R_ProjectSprite: invalid sprite number %i ", - psp->state->sprite); + I_Error ("R_ProjectSprite: invalid sprite number %i ", + psp->state->sprite); #endif sprdef = &sprites[psp->state->sprite]; #ifdef RANGECHECK if ( (psp->state->frame & FF_FRAMEMASK) >= sprdef->numframes) - I_Error ("R_ProjectSprite: invalid sprite frame %i : %i ", - psp->state->sprite, psp->state->frame); + I_Error ("R_ProjectSprite: invalid sprite frame %i : %i ", + psp->state->sprite, psp->state->frame); #endif sprframe = &sprdef->spriteframes[ psp->state->frame & FF_FRAMEMASK ]; @@ -726,20 +729,20 @@ void R_DrawPSprite (pspdef_t* psp) // calculate edges of the shape tx = psp->sx-160*FRACUNIT; - + tx -= spriteoffset[lump]; x1 = (centerxfrac + FixedMul (tx,pspritescale) ) >>FRACBITS; // off the right side if (x1 > viewwidth) - return; + return; tx += spritewidth[lump]; x2 = ((centerxfrac + FixedMul (tx, pspritescale) ) >>FRACBITS) - 1; // off the left side if (x2 < 0) - return; + return; // store information in a vissprite vis = &avis; @@ -750,46 +753,61 @@ void R_DrawPSprite (pspdef_t* psp) if (flip) { - vis->xiscale = -pspriteiscale; - vis->startfrac = spritewidth[lump]-1; + vis->xiscale = -pspriteiscale; + vis->startfrac = spritewidth[lump]-1; } else { - vis->xiscale = pspriteiscale; - vis->startfrac = 0; + 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); + vis->startfrac += vis->xiscale*(vis->x1-x1); vis->patch = lump; if (viewplayer->powers[pw_invisibility] > 4*32 - || viewplayer->powers[pw_invisibility] & 8) + || viewplayer->powers[pw_invisibility] & 8) { - // shadow draw - vis->colormap = NULL; + // shadow draw + vis->colormap = spritelights[MAXLIGHTSCALE-1]; + vis->mobjflags |= MF_SHADOW; } - else if (fixedcolormap) + else if(viewplayer->powers[pw_invisibility] & 4) { - // fixed color - vis->colormap = fixedcolormap; + vis->mobjflags |= (MF_SHADOW|MF_MVIS); } - else if (psp->state->frame & FF_FULLBRIGHT) + + // When not MVIS, or if SHADOW, behave normally: + if(!(viewplayer->mo->flags & MF_MVIS) || (viewplayer->mo->flags & MF_SHADOW)) { - // full bright - vis->colormap = colormaps; + if (fixedcolormap) + { + // fixed color + vis->colormap = fixedcolormap; + } + else if (psp->state->frame & FF_FULLBRIGHT) + { + // full bright + vis->colormap = colormaps; + } + else + { + // local light + vis->colormap = spritelights[MAXLIGHTSCALE-1]; + } } else { - // local light - vis->colormap = spritelights[MAXLIGHTSCALE-1]; + // When MVIS, use invulnerability colormap + vis->colormap = colormaps + INVERSECOLORMAP * 256 * sizeof(lighttable_t); } - + R_DrawVisSprite (vis, vis->x1, vis->x2); } |