- got rid of all remaining rotatesprite calls in SW.

Also removed some dead code from player.cpp.
This commit is contained in:
Christoph Oelckers 2020-08-15 22:04:37 +02:00
parent 67b3a38fa3
commit deb9b74ce2
7 changed files with 34 additions and 248 deletions

View file

@ -1443,23 +1443,16 @@ void DrawCrosshair(PLAYERp pp)
{ {
extern SWBOOL DemoMode,CameraTestMode; extern SWBOOL DemoMode,CameraTestMode;
if (!cl_crosshair) if (cl_crosshair && !(DemoMode || CameraTestMode) && !TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE) && dimensionmode != 6)
return;
if (DemoMode || CameraTestMode)
return;
if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE))
return;
if (dimensionmode == 6)
return;
{ {
//NORMALXHAIR: int32_t a = 2326;
rotatesprite(160<<16, 100<<16, (1 << 16), 0,
2326, 10, 0, double crosshair_scale = cl_crosshairscale * .01;
0, windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y); if (isRR()) crosshair_scale *= .5;
DrawTexture(twod, tileGetTexture(a), 160, 100, DTA_Color, shadeToLight(10),
DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_ScaleX, crosshair_scale, DTA_ScaleY, crosshair_scale, DTA_CenterOffsetRel, true,
DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y, DTA_ViewportWidth, windowxy2.x - windowxy1.x + 1, DTA_ViewportHeight, windowxy2.y - windowxy1.y + 1, TAG_DONE);
} }
} }

View file

@ -108,7 +108,6 @@ extern int sw_snd_scratch;
#define BETA 0 #define BETA 0
#endif #endif
#define TITLE_ROT_FLAGS (RS_TOPLEFT|ROTATE_SPRITE_SCREEN_CLIP|ROTATE_SPRITE_NON_MASK)
#define PAL_SIZE (256*3) #define PAL_SIZE (256*3)
char DemoName[15][16]; char DemoName[15][16];
@ -937,7 +936,8 @@ void DrawMenuLevelScreen(void)
{ {
const int TITLE_PIC = 2324; const int TITLE_PIC = 2324;
twod->ClearScreen(); twod->ClearScreen();
rotatesprite(0, 0, RS_SCALE, 0, TITLE_PIC, 20, 0, TITLE_ROT_FLAGS, 0, 0, xdim - 1, ydim - 1); DrawTexture(twod, tileGetTexture(TITLE_PIC), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_LegacyRenderStyle, STYLE_Normal,
DTA_Color, shadeToLight(20), TAG_DONE);
} }
short PlayerQuitMenuLevel = -1; short PlayerQuitMenuLevel = -1;
@ -2392,13 +2392,23 @@ SHOWSPRITE:
// Special case tiles // Special case tiles
if (spr->picnum == 3123) break; if (spr->picnum == 3123) break;
int spnum = -1;
if (sprisplayer) if (sprisplayer)
{ {
if (gNet.MultiGameType != MULTI_GAME_COMMBAT || j == Player[screenpeek].PlayerSprite) if (gNet.MultiGameType != MULTI_GAME_COMMBAT || j == Player[screenpeek].PlayerSprite)
rotatesprite((x1 << 4) + (xdim << 15), (y1 << 4) + (ydim << 15), mulscale16(czoom * (spr->yrepeat), yxaspect), daang, 1196+pspr_ndx[myconnectindex], spr->shade, spr->pal, (spr->cstat & 2) >> 1, windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y); spnum = 1196 + pspr_ndx[myconnectindex];
}
else spnum = spr->picnum;
double xd = ((x1 << 4) + (xdim << 15)) / 65536.;
double yd = ((y1 << 4) + (ydim << 15)) / 65536.;
double sc = mulscale16(czoom * (spr->yrepeat), yxaspect) / 65536.;
if (spnum >= 0)
{
DrawTexture(twod, tileGetTexture(5407, true), xd, yd, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DTA_CenterOffsetRel, true, DTA_TranslationIndex, TRANSLATION(Translation_Remap, spr->pal), DTA_Color, shadeToLight(spr->shade),
DTA_Alpha, (spr->cstat & 2) ? 0.33 : 1., TAG_DONE);
} }
else
rotatesprite((x1 << 4) + (xdim << 15), (y1 << 4) + (ydim << 15), mulscale16(czoom * (spr->yrepeat), yxaspect), daang, spr->picnum, spr->shade, spr->pal, (spr->cstat & 2) >> 1, windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y);
} }
} }
} }

View file

@ -544,10 +544,6 @@ int StdRandomRange(int range);
#define NORM_WALL(val) ((val) & (MAXWALLS - 1)) #define NORM_WALL(val) ((val) & (MAXWALLS - 1))
#define NORM_SECTOR(val) ((val) & (MAXSECTORS - 1)) #define NORM_SECTOR(val) ((val) & (MAXSECTORS - 1))
EDUKE32_STATIC_ASSERT(isPow2(MAXSPRITES));
EDUKE32_STATIC_ASSERT(isPow2(MAXWALLS));
EDUKE32_STATIC_ASSERT(isPow2(MAXSECTORS));
// overwritesprite flags // overwritesprite flags
#define OVER_SPRITE_MIDDLE (BIT(0)) #define OVER_SPRITE_MIDDLE (BIT(0))
#define OVER_SPRITE_VIEW_CLIP (BIT(1)) #define OVER_SPRITE_VIEW_CLIP (BIT(1))
@ -555,12 +551,6 @@ EDUKE32_STATIC_ASSERT(isPow2(MAXSECTORS));
#define OVER_SPRITE_XFLIP (BIT(3)) #define OVER_SPRITE_XFLIP (BIT(3))
#define OVER_SPRITE_YFLIP (BIT(4)) #define OVER_SPRITE_YFLIP (BIT(4))
// rotatesprite flags
#define ROTATE_SPRITE_SCREEN_CLIP (BIT(1)|BIT(3)) // use window
#define ROTATE_SPRITE_NON_MASK (BIT(6)) // non masked sprites
#define RS_SCALE BIT(16)
// system defines for status bits // system defines for status bits
#define CEILING_STAT_PLAX BIT(0) #define CEILING_STAT_PLAX BIT(0)
#define CEILING_STAT_SLOPE BIT(1) #define CEILING_STAT_SLOPE BIT(1)

View file

@ -89,7 +89,6 @@ void MNU_DrawStringLarge(int x, int y, const char* string, int shade = 0, int al
#define pic_shadow_warrior 2366 #define pic_shadow_warrior 2366
#define m_defshade 2 #define m_defshade 2
#define MenuDrawFlags (ROTATE_SPRITE_SCREEN_CLIP)
extern SWBOOL LoadGameOutsideMoveLoop; extern SWBOOL LoadGameOutsideMoveLoop;

View file

@ -121,7 +121,6 @@ struct PANEL_SPRITEstruct
// list // list
short picndx; // for pip stuff in conpic.h short picndx; // for pip stuff in conpic.h
short picnum; // bypass pip stuff in conpic.h short picnum; // bypass pip stuff in conpic.h
short x1, y1, x2, y2; // for rotatesprites box cliping
short vel, vel_adj; short vel, vel_adj;
short numpages; short numpages;
int xorig, yorig, flags, priority; int xorig, yorig, flags, priority;

View file

@ -2425,46 +2425,12 @@ DoPlayerSlide(PLAYERp pp)
} }
} }
void PlayerMoveHitDebug(short ret)
{
SPRITEp sp;
switch (TEST(ret, HIT_MASK))
{
case HIT_SPRITE:
sp = &sprite[NORM_SPRITE(ret)];
//DSPRINTF(ds, "Hit a Sprite %d, stat %d ", sp-sprite, (short)sp->statnum);
if (sp->statnum == STAT_MISSILE)
{
//DSPRINTF(ds, "Monster hit bullet %d, stat %d ", sp-sprite, (short)sp->statnum);
}
else
{
//DSPRINTF(ds, "Hit a Sprite %d, stat %d ", sp-sprite, (short)sp->statnum);
}
break;
case HIT_WALL:
//DSPRINTF(ds, "Hit a Wall %d ", NORM_WALL(ret));
break;
case HIT_SECTOR:
//DSPRINTF(ds, "Hit a Sector %d ", NORM_SECTOR(ret));
break;
}
MONO_PRINT(ds);
}
void PlayerCheckValidMove(PLAYERp pp) void PlayerCheckValidMove(PLAYERp pp)
{ {
if (pp->cursectnum == -1) if (pp->cursectnum == -1)
{ {
static int count = 0; static int count = 0;
#if DEBUG
//DSPRINTF(ds,"PROBLEM!!!!! Player %d is not in a sector", pp - Player);
MONO_PRINT(ds);
#endif
pp->posx = pp->oldposx; pp->posx = pp->oldposx;
pp->posy = pp->oldposy; pp->posy = pp->oldposy;
pp->posz = pp->oldposz; pp->posz = pp->oldposz;
@ -2985,19 +2951,6 @@ DoPlayerMoveBoat(PLAYERp pp)
DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16aimvel); DoPlayerHorizon(pp, &pp->q16horiz, pp->input.q16aimvel);
} }
#if 0
STATE s_TankTreadMove[] =
{
{755, 6|SF_WALL_ANIM, NULL, s_TankTreadMove[1]},
{756, 6|SF_WALL_ANIM, NULL, s_TankTreadMove[0]},
};
STATE s_TankTreadStill[] =
{
{755, 6|SF_WALL_ANIM, NULL, s_TankTreadMove[0]},
};
#endif
void DoTankTreads(PLAYERp pp) void DoTankTreads(PLAYERp pp)
{ {
SPRITEp sp; SPRITEp sp;
@ -3026,25 +2979,6 @@ void DoTankTreads(PLAYERp pp)
if (!TEST_BOOL1(sp)) if (!TEST_BOOL1(sp))
continue; continue;
#if 0
if (sp->statnum == STAT_WALL_ANIM)
{
if (SP_TAG3(sp) == TANK_TREAD_WALL_ANIM)
{
if (vel)
{
if (u->StateStart != s_TankTreadMove)
ChangeState(i, s_TankTreadMove);
}
else
{
if (u->StateStart != s_TankTreadStill)
ChangeState(i, s_TankTreadStill);
}
}
}
else
#endif
if (sp->statnum == STAT_WALL_PAN) if (sp->statnum == STAT_WALL_PAN)
{ {
if (reverse) if (reverse)
@ -3761,9 +3695,6 @@ DoPlayerFall(PLAYERp pp)
// adjust player height by jump speed // adjust player height by jump speed
pp->posz += pp->jump_speed; pp->posz += pp->jump_speed;
////DSPRINTF(ds,"Fall velocity = %d",pp->jump_speed);
//MONO_PRINT(ds);
if (pp->jump_speed > 2000) if (pp->jump_speed > 2000)
{ {
PlayerSound(DIGI_FALLSCREAM, v3df_dontpan|v3df_doppler|v3df_follow,pp); PlayerSound(DIGI_FALLSCREAM, v3df_dontpan|v3df_doppler|v3df_follow,pp);
@ -4196,83 +4127,6 @@ SWBOOL PlayerFlyKey(void)
return key; return key;
} }
#if 0
void
DoPlayerBeginSwim(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
SPRITEp sp = &sprite[pp->PlayerSprite];
RESET(pp->Flags, PF_FALLING | PF_JUMPING);
SET(pp->Flags, PF_SWIMMING);
// reset because of bobbing when wading
pp->SpriteP->z = pp->posz + PLAYER_SWIM_HEIGHT;
pp->friction = PLAYER_SWIM_FRICTION;
pp->floor_dist = PLAYER_SWIM_FLOOR_DIST;
pp->ceiling_dist = PLAYER_SWIM_CEILING_DIST;
pp->DoPlayerAction = DoPlayerSwim;
//DamageData[u->WeaponNum].Init(pp);
NewStateGroup(pp->PlayerSprite, u->ActorActionSet->Swim);
SET(sp->cstat, CSTAT_SPRITE_YCENTER);
}
void
DoPlayerSwim(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
SPRITEp sp = &sprite[pp->PlayerSprite];
// Jump to get up
if (TEST_SYNC_KEY(pp, SK_JUMP))
{
if (FLAG_KEY_PRESSED(pp, SK_JUMP))
{
FLAG_KEY_RELEASE(pp, SK_JUMP);
RESET(sp->cstat, CSTAT_SPRITE_YCENTER);
RESET(pp->Flags, PF_SWIMMING);
DoPlayerBeginJump(pp);
// return;
}
}
else
{
FLAG_KEY_RESET(pp, SK_JUMP);
}
// If too shallow to swim or stopped the "RUN" key
if (pp->WadeDepth < MIN_SWIM_DEPTH || !(TEST_SYNC_KEY(pp, SK_RUN) || TEST(pp->Flags, PF_LOCK_RUN)))
{
RESET(sp->cstat, CSTAT_SPRITE_YCENTER);
RESET(pp->Flags, PF_SWIMMING);
DoPlayerBeginRun(pp);
// smooth the transition by updating the sprite now
//UpdatePlayerSprite(pp);
return;
}
// Move around
DoPlayerMove(pp);
if (PlayerCanDive(pp))
return;
if (!TEST(pp->Flags, PF_PLAYER_MOVED))
{
RESET(sp->cstat, CSTAT_SPRITE_YCENTER);
RESET(pp->Flags, PF_SWIMMING);
DoPlayerBeginWade(pp);
DoPlayerWade(pp);
return;
}
}
#endif
void void
DoPlayerBeginCrawl(PLAYERp pp) DoPlayerBeginCrawl(PLAYERp pp)
{ {
@ -5302,11 +5156,11 @@ DoPlayerDiveMeter(PLAYERp pp)
else else
color = 22; color = 22;
rotatesprite((200+8)<<16,y<<16,65536L,0,5408,1,1, DrawTexture(twod, tileGetTexture(5408, true), 208, y, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
(ROTATE_SPRITE_SCREEN_CLIP),0,0,xdim-1,ydim-1); DTA_CenterOffsetRel, true, DTA_TranslationIndex, TRANSLATION(Translation_Remap, 1), TAG_DONE);
rotatesprite((218+47)<<16,y<<16,65536L,0,5406-metertics,1,color, DrawTexture(twod, tileGetTexture(5406 - metertics, true), 265, y, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
(ROTATE_SPRITE_SCREEN_CLIP),0,0,xdim-1,ydim-1); DTA_CenterOffsetRel, true, DTA_TranslationIndex, TRANSLATION(Translation_Remap, color), TAG_DONE);
} }
void void
@ -5751,16 +5605,6 @@ DoPlayerWade(PLAYERp pp)
// Adjust height moving up and down sectors // Adjust height moving up and down sectors
DoPlayerHeight(pp); DoPlayerHeight(pp);
#if 0
if ((TEST_SYNC_KEY(pp, SK_RUN) || TEST(pp->Flags, PF_LOCK_RUN)) && PlayerInDiveArea(pp))
{
DoPlayerBeginSwim(pp);
pp->bob_amt = 0;
pp->bob_ndx = 0;
return;
}
#endif
if (!pp->WadeDepth) if (!pp->WadeDepth)
{ {
DoPlayerBeginRun(pp); DoPlayerBeginRun(pp);
@ -6332,21 +6176,12 @@ DoPlayerDeathFall(PLAYERp pp)
// adjust player height by jump speed // adjust player height by jump speed
pp->posz += pp->jump_speed; pp->posz += pp->jump_speed;
#if 0
if (pp->lo_sectp && TEST(pp->lo_sectp->extra, SECTFX_SINK))
{
loz = pp->lo_sectp->floorz - Z(SectUser[pp->lo_sectp - sector]->depth);
}
else
loz = pp->loz;
#else
if (pp->lo_sectp && TEST(pp->lo_sectp->extra, SECTFX_SINK)) if (pp->lo_sectp && TEST(pp->lo_sectp->extra, SECTFX_SINK))
{ {
loz = pp->lo_sectp->floorz; loz = pp->lo_sectp->floorz;
} }
else else
loz = pp->loz; loz = pp->loz;
#endif
if (PlayerFloorHit(pp, loz - PLAYER_DEATH_HEIGHT)) if (PlayerFloorHit(pp, loz - PLAYER_DEATH_HEIGHT))
//if (pp->posz > loz - PLAYER_DEATH_HEIGHT) //if (pp->posz > loz - PLAYER_DEATH_HEIGHT)
@ -6524,16 +6359,7 @@ DoPlayerBeginDie(PLAYERp pp)
PlayerSound(PlayerLowHealthPainVocs[choosesnd],v3df_dontpan|v3df_doppler|v3df_follow,pp); PlayerSound(PlayerLowHealthPainVocs[choosesnd],v3df_dontpan|v3df_doppler|v3df_follow,pp);
#if 0 PutStringInfo(pp, GStrings("TXTS_PRESSSPACE"));
if (!CommEnabled && numplayers <= 1 && QuickLoadNum >= 0)
{
ReloadPrompt = TRUE;
}
else
#endif
{
PutStringInfo(pp, GStrings("TXTS_PRESSSPACE"));
}
if (pp->sop_control) if (pp->sop_control)
DoPlayerStopOperate(pp); DoPlayerStopOperate(pp);
@ -6544,20 +6370,7 @@ DoPlayerBeginDie(PLAYERp pp)
RESET(pp->Flags, PF_JUMPING|PF_FALLING|PF_DIVING|PF_FLYING|PF_CLIMBING|PF_CRAWLING|PF_LOCK_CRAWL); RESET(pp->Flags, PF_JUMPING|PF_FALLING|PF_DIVING|PF_FLYING|PF_CLIMBING|PF_CRAWLING|PF_LOCK_CRAWL);
#if 0
short random;
// get tilt value
random = RANDOM_P2(1024);
if (random < 128)
pp->tilt_dest = 0;
else if (random < 512+64)
pp->tilt_dest = PLAYER_DEATH_TILT_VALUE;
else
pp->tilt_dest = -PLAYER_DEATH_TILT_VALUE;
#else
pp->tilt_dest = 0; pp->tilt_dest = 0;
#endif
ActorCoughItem(pp->PlayerSprite); ActorCoughItem(pp->PlayerSprite);
@ -7702,17 +7515,8 @@ void PlayerGlobal(PLAYERp pp)
{ {
int min_height; int min_height;
#if 0
if (TEST(pp->Flags, PF_JUMPING))
// this is a special case for jumping. Jumps have a very small
// z height for the box so players can jump into small areas.
min_height = PLAYER_MIN_HEIGHT_JUMP;
else
min_height = PLAYER_MIN_HEIGHT;
#else
// just adjusted min height to something small to take care of all cases // just adjusted min height to something small to take care of all cases
min_height = PLAYER_MIN_HEIGHT; min_height = PLAYER_MIN_HEIGHT;
#endif
if (labs(pp->loz - pp->hiz) < min_height) if (labs(pp->loz - pp->hiz) < min_height)
{ {
@ -7966,15 +7770,8 @@ domovethings(void)
if (!TEST(pp->Flags, PF_DEAD)) if (!TEST(pp->Flags, PF_DEAD))
{ {
#if DEBUG
if (!DebugPanel)
WeaponOperate(pp);
if (!DebugSector)
PlayerOperateEnv(pp);
#else
WeaponOperate(pp); WeaponOperate(pp);
PlayerOperateEnv(pp); PlayerOperateEnv(pp);
#endif
} }
// do for moving sectors // do for moving sectors
@ -8003,9 +7800,6 @@ domovethings(void)
} }
UpdatePlayerSprite(pp); UpdatePlayerSprite(pp);
#if DEBUG
if (!DebugPanel)
#endif
pSpriteControl(pp); pSpriteControl(pp);
PlayerStateControl(pp->PlayerSprite); PlayerStateControl(pp->PlayerSprite);

View file

@ -37,6 +37,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "sector.h" #include "sector.h"
#include "gamecontrol.h" #include "gamecontrol.h"
#include "mapinfo.h" #include "mapinfo.h"
#include "v_draw.h"
BEGIN_SW_NS BEGIN_SW_NS
@ -974,11 +975,11 @@ BossHealthMeter(void)
else else
color = 22; color = 22;
rotatesprite((73+12)<<16,y<<16,65536L,0,5407,1,1, DrawTexture(twod, tileGetTexture(5407, true), 85, y, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
(ROTATE_SPRITE_SCREEN_CLIP),0,0,xdim-1,ydim-1); DTA_CenterOffsetRel, true, DTA_TranslationIndex, TRANSLATION(Translation_Remap, 1), TAG_DONE);
rotatesprite((100+47)<<16,y<<16,65536L,0,5406-metertics,1,color, DrawTexture(twod, tileGetTexture(5406 - metertics, true), 147, y, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
(ROTATE_SPRITE_SCREEN_CLIP),0,0,xdim-1,ydim-1); DTA_CenterOffsetRel, true, DTA_TranslationIndex, TRANSLATION(Translation_Remap, color), TAG_DONE);
} }
} }