mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-16 01:11:28 +00:00
- ported the compass.
This commit is contained in:
parent
9ccf717311
commit
8c7b93ceef
2 changed files with 98 additions and 115 deletions
|
@ -70,12 +70,10 @@ extern SWBOOL HelpInputMode;
|
|||
extern short HelpPage;
|
||||
extern short HelpPagePic[];
|
||||
extern ParentalStruct aVoxelArray[MAXTILES];
|
||||
SWBOOL RedrawCompass=FALSE;
|
||||
extern int Follow_posx,Follow_posy;
|
||||
|
||||
int ConnectCopySprite(uspritetype const * tsp);
|
||||
void PreDrawStackedWater(void);
|
||||
void DrawCompass(PLAYERp pp);
|
||||
|
||||
#if 1
|
||||
void
|
||||
|
@ -1926,8 +1924,6 @@ drawscreen(PLAYERp pp)
|
|||
// part of new border refresh method
|
||||
if (!ScreenSavePic)
|
||||
{
|
||||
RedrawCompass = TRUE;
|
||||
// get rid of all PERM sprites!
|
||||
renderFlushPerms();
|
||||
// get rid of all PANF_KILL_AFTER_SHOW sprites!
|
||||
pFlushPerms(pp);
|
||||
|
@ -2218,7 +2214,6 @@ drawscreen(PLAYERp pp)
|
|||
|
||||
DrawMessageInput(); // This is only used for non-multiplayer input now
|
||||
|
||||
DrawCompass(pp);
|
||||
UpdateMiniBar(pp);
|
||||
|
||||
if (!M_Active())
|
||||
|
@ -2262,103 +2257,6 @@ drawscreen(PLAYERp pp)
|
|||
DrawScreen = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
DrawCompass(PLAYERp pp)
|
||||
{
|
||||
#define COMPASS_TIC 2380
|
||||
#define COMPASS_TIC2 2381
|
||||
|
||||
#define COMPASS_NORTH 2382
|
||||
#define COMPASS_NORTH2 2383
|
||||
|
||||
#define COMPASS_SOUTH 2384
|
||||
#define COMPASS_SOUTH2 2385
|
||||
|
||||
#define COMPASS_EAST 2386
|
||||
#define COMPASS_EAST2 2387
|
||||
|
||||
#define COMPASS_WEST 2388
|
||||
#define COMPASS_WEST2 2389
|
||||
|
||||
#define COMPASS_MID_TIC 2390
|
||||
#define COMPASS_MID_TIC2 2391
|
||||
|
||||
#define COMPASS_X 140
|
||||
#define COMPASS_Y (162-5)
|
||||
|
||||
#define NORM_CANG(ang) (((ang) + 32) & 31)
|
||||
|
||||
short start_ang,ang;
|
||||
short x_size = tilesiz[COMPASS_NORTH].x;
|
||||
short x;
|
||||
short i;
|
||||
int flags;
|
||||
|
||||
static short CompassPic[32] =
|
||||
{
|
||||
COMPASS_EAST, COMPASS_EAST2,
|
||||
COMPASS_TIC, COMPASS_TIC2,
|
||||
COMPASS_MID_TIC, COMPASS_MID_TIC2,
|
||||
COMPASS_TIC, COMPASS_TIC2,
|
||||
|
||||
COMPASS_SOUTH, COMPASS_SOUTH2,
|
||||
COMPASS_TIC, COMPASS_TIC2,
|
||||
COMPASS_MID_TIC, COMPASS_MID_TIC2,
|
||||
COMPASS_TIC, COMPASS_TIC2,
|
||||
|
||||
COMPASS_WEST, COMPASS_WEST2,
|
||||
COMPASS_TIC, COMPASS_TIC2,
|
||||
COMPASS_MID_TIC, COMPASS_MID_TIC2,
|
||||
COMPASS_TIC, COMPASS_TIC2,
|
||||
|
||||
COMPASS_NORTH, COMPASS_NORTH2,
|
||||
COMPASS_TIC, COMPASS_TIC2,
|
||||
COMPASS_MID_TIC, COMPASS_MID_TIC2,
|
||||
COMPASS_TIC, COMPASS_TIC2,
|
||||
};
|
||||
|
||||
static short CompassShade[10] =
|
||||
{
|
||||
//20, 16, 11, 6, 1, 1, 6, 11, 16, 20
|
||||
25, 19, 15, 9, 1, 1, 9, 15, 19, 25
|
||||
};
|
||||
|
||||
extern SWBOOL PanelUpdateMode;
|
||||
|
||||
if (!PanelUpdateMode)
|
||||
return;
|
||||
|
||||
if (gs.BorderNum < BORDER_BAR || pp - Player != screenpeek)
|
||||
return;
|
||||
|
||||
ang = fix16_to_int(pp->q16ang);
|
||||
|
||||
if (pp->sop_remote)
|
||||
ang = 0;
|
||||
|
||||
start_ang = (ang + 32) >> 6;
|
||||
|
||||
start_ang = NORM_CANG(start_ang - 4);
|
||||
|
||||
flags = ROTATE_SPRITE_SCREEN_CLIP | ROTATE_SPRITE_CORNER;
|
||||
if (RedrawCompass && !M_Active())
|
||||
{
|
||||
RedrawCompass = FALSE;
|
||||
SET(flags, ROTATE_SPRITE_ALL_PAGES);
|
||||
}
|
||||
|
||||
for (i = 0, x = COMPASS_X; i < 10; i++)
|
||||
{
|
||||
rotatesprite(x << 16, COMPASS_Y << 16, (1 << 16), 0,
|
||||
CompassPic[NORM_CANG(start_ang + i)], CompassShade[i], 0,
|
||||
flags, 0, 0, xdim - 1, ydim - 1);
|
||||
x += x_size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool GameInterface::GenerateSavePic()
|
||||
{
|
||||
ScreenSavePic = TRUE;
|
||||
|
|
|
@ -518,21 +518,81 @@ class DSWStatusBar : public DBaseStatusBar
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DisplayMinibarInventory(PLAYERp pp)
|
||||
void DrawCompass(PLAYERp pp)
|
||||
{
|
||||
int InventoryBoxX = MINI_BAR_INVENTORY_BOX_X;
|
||||
int InventoryBoxY = MINI_BAR_INVENTORY_BOX_Y;
|
||||
|
||||
int InventoryXoff = 1;
|
||||
int InventoryYoff = 1;
|
||||
|
||||
if (pp->InventoryAmount[pp->InventoryNum])
|
||||
enum
|
||||
{
|
||||
PlayerUpdateInventoryPic(pp, InventoryBoxX, InventoryBoxY, InventoryXoff, InventoryYoff);
|
||||
// Auto/On/Off
|
||||
PlayerUpdateInventoryState(pp, InventoryBoxX, InventoryBoxY, InventoryXoff, InventoryYoff);
|
||||
// Percent count/Item count
|
||||
PlayerUpdateInventoryPercent(pp, InventoryBoxX, InventoryBoxY, InventoryXoff, InventoryYoff);
|
||||
COMPASS_TIC = 2380,
|
||||
COMPASS_TIC2 = 2381,
|
||||
|
||||
COMPASS_NORTH = 2382,
|
||||
COMPASS_NORTH2 = 2383,
|
||||
|
||||
COMPASS_SOUTH = 2384,
|
||||
COMPASS_SOUTH2 = 2385,
|
||||
|
||||
COMPASS_EAST = 2386,
|
||||
COMPASS_EAST2 = 2387,
|
||||
|
||||
COMPASS_WEST = 2388,
|
||||
COMPASS_WEST2 = 2389,
|
||||
|
||||
COMPASS_MID_TIC = 2390,
|
||||
COMPASS_MID_TIC2 = 2391,
|
||||
|
||||
COMPASS_X = 140,
|
||||
COMPASS_Y = (162-5),
|
||||
};
|
||||
|
||||
auto NORM_CANG = [](int ang) { return (((ang)+32) & 31); };
|
||||
|
||||
int start_ang, ang;
|
||||
int x_size = tilesiz[COMPASS_NORTH].x;
|
||||
int x;
|
||||
int i;
|
||||
|
||||
static const short CompassPic[32] =
|
||||
{
|
||||
COMPASS_EAST, COMPASS_EAST2,
|
||||
COMPASS_TIC, COMPASS_TIC2,
|
||||
COMPASS_MID_TIC, COMPASS_MID_TIC2,
|
||||
COMPASS_TIC, COMPASS_TIC2,
|
||||
|
||||
COMPASS_SOUTH, COMPASS_SOUTH2,
|
||||
COMPASS_TIC, COMPASS_TIC2,
|
||||
COMPASS_MID_TIC, COMPASS_MID_TIC2,
|
||||
COMPASS_TIC, COMPASS_TIC2,
|
||||
|
||||
COMPASS_WEST, COMPASS_WEST2,
|
||||
COMPASS_TIC, COMPASS_TIC2,
|
||||
COMPASS_MID_TIC, COMPASS_MID_TIC2,
|
||||
COMPASS_TIC, COMPASS_TIC2,
|
||||
|
||||
COMPASS_NORTH, COMPASS_NORTH2,
|
||||
COMPASS_TIC, COMPASS_TIC2,
|
||||
COMPASS_MID_TIC, COMPASS_MID_TIC2,
|
||||
COMPASS_TIC, COMPASS_TIC2,
|
||||
};
|
||||
|
||||
static const short CompassShade[10] =
|
||||
{
|
||||
//20, 16, 11, 6, 1, 1, 6, 11, 16, 20
|
||||
25, 19, 15, 9, 1, 1, 9, 15, 19, 25
|
||||
};
|
||||
|
||||
ang = fix16_to_int(pp->q16ang);
|
||||
|
||||
if (pp->sop_remote)
|
||||
ang = 0;
|
||||
|
||||
start_ang = (ang + 32) >> 6;
|
||||
|
||||
start_ang = NORM_CANG(start_ang - 4);
|
||||
|
||||
for (i = 0, x = COMPASS_X; i < 10; i++)
|
||||
{
|
||||
DrawGraphic(tileGetTexture(CompassPic[NORM_CANG(start_ang + i)]), x, COMPASS_Y, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1, shadeToLight(CompassShade[i]));
|
||||
x += x_size;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -558,6 +618,31 @@ class DSWStatusBar : public DBaseStatusBar
|
|||
else if (gNet.TimeLimit)
|
||||
DisplayTimeLimit(pp);
|
||||
DisplayBarInventory(pp);
|
||||
DrawCompass(pp);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DisplayMinibarInventory(PLAYERp pp)
|
||||
{
|
||||
int InventoryBoxX = MINI_BAR_INVENTORY_BOX_X;
|
||||
int InventoryBoxY = MINI_BAR_INVENTORY_BOX_Y;
|
||||
|
||||
int InventoryXoff = 1;
|
||||
int InventoryYoff = 1;
|
||||
|
||||
if (pp->InventoryAmount[pp->InventoryNum])
|
||||
{
|
||||
PlayerUpdateInventoryPic(pp, InventoryBoxX, InventoryBoxY, InventoryXoff, InventoryYoff);
|
||||
// Auto/On/Off
|
||||
PlayerUpdateInventoryState(pp, InventoryBoxX, InventoryBoxY, InventoryXoff, InventoryYoff);
|
||||
// Percent count/Item count
|
||||
PlayerUpdateInventoryPercent(pp, InventoryBoxX, InventoryBoxY, InventoryXoff, InventoryYoff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue