- fix CD icon

- misc changes
This commit is contained in:
Ilya Shurumov 2021-05-04 20:50:19 +06:00
parent ad645c694d
commit 5073ee382c
6 changed files with 82 additions and 87 deletions

View File

@ -16,6 +16,7 @@
#include "RAND.H"
#include "STRINGS.H"
#include "LIMITS.H"
#include "INLINE_C.H"
#include "LIBETC.H"

View File

@ -2,8 +2,6 @@
#include "cell.h"
#include "system.h"
#include "map.h"
#include "event.h"
#include "mission.h"
#include "spool.h"
int cell_object_index = 0;
@ -11,6 +9,8 @@ CELL_OBJECT cell_object_buffer[1024];
unsigned char cell_object_computed_values[2048];
extern u_char NumPlayers;
// [D] [T]
void ClearCopUsage(void)
{
@ -23,8 +23,8 @@ PACKED_CELL_OBJECT * GetFirstPackedCop(int cellx, int cellz, CELL_ITERATOR *pci,
PACKED_CELL_OBJECT *ppco;
u_int value;
unsigned short index;
unsigned short num;
u_short index;
u_short num;
int cbr;
CELL_DATA* cell;
ushort ptr;
@ -166,7 +166,7 @@ CELL_OBJECT* UnpackCellObject(PACKED_CELL_OBJECT* ppco, XZPAIR* near)
return NULL;
pco = &cell_object_buffer[cell_object_index];
cell_object_index = cell_object_index + 1U & 0x3ff;
cell_object_index = cell_object_index + 1 & 0x3ff;
pco->pos.vx = near->x + (((ppco->pos.vx - near->x) << 0x10) >> 0x10);
pco->pos.vz = near->z + (((ppco->pos.vz - near->z) << 0x10) >> 0x10);
@ -181,7 +181,7 @@ CELL_OBJECT* UnpackCellObject(PACKED_CELL_OBJECT* ppco, XZPAIR* near)
// [D] [T]
void QuickUnpackCellObject(PACKED_CELL_OBJECT* ppco, XZPAIR* near, CELL_OBJECT* pco)
{
cell_object_index = cell_object_index + 1U & 0x3ff;
cell_object_index = cell_object_index + 1 & 0x3ff;
pco->pos.vx = near->x + (((ppco->pos.vx - near->x) << 0x10) >> 0x10);
pco->pos.vz = near->z + (((ppco->pos.vz - near->z) << 0x10) >> 0x10);

View File

@ -26,6 +26,7 @@
#include "INLINE_C.H"
#include "STRINGS.H"
#include "RAND.H"
#include "LIMITS.H"
inline void UpdateCarDrawMatrix(CAR_DATA* cp)
{

View File

@ -142,7 +142,6 @@ extern char g_CurrentLevelFileName[64];
// [D] [T]
int check_regions_present(void)
{
int barrel_region;
int x, z;
int region_to_unpack;
int num_regions_to_unpack;
@ -150,7 +149,6 @@ int check_regions_present(void)
int topbottom_unpack;
int retval;
AREA_LOAD_INFO regions_to_unpack[3];
char textbuf[128];
leftright_unpack = 0;
topbottom_unpack = 0;
@ -242,32 +240,25 @@ int check_regions_present(void)
if (LoadingArea != 0)
{
if (new_area_location == 1)
if (new_area_location == 0)
{
if (current_barrel_region_zcell > 26)
retval++;
}
else if (new_area_location == 1)
{
if (current_barrel_region_xcell > 26)
{
retval++;
}
}
else
else if (new_area_location == 2)
{
if (new_area_location < 2)
{
if (new_area_location == 0 && current_barrel_region_zcell > 26)
{
retval++;
}
}
else
{
barrel_region = current_barrel_region_zcell;
if ((new_area_location == 2 ||
(barrel_region = current_barrel_region_xcell, new_area_location == 3)) &&
barrel_region < 6)
{
retval++;
}
}
if (current_barrel_region_xcell < 6)
retval++;
}
else if(new_area_location == 3)
{
if(current_barrel_region_zcell < 6)
retval++;
}
}
@ -291,8 +282,45 @@ void startgame(void)
UnPauseSFX();
}
extern POLY_FT4 cd_sprite;
extern unsigned short cd_icon[288];
int bCdIconSetup = 0;
POLY_FT4 cd_sprite;
extern u_short cd_icon[288];
// [D] [T]
void InitCdIcon(void)
{
ushort* palette;
RECT16 rect;
palette = cd_icon + 10;
for (int i = 0; i < 14; i++)
{
*palette &= 0x7fff;
palette++;
}
cd_icon[10] = 0;
rect.x = 960;
rect.y = 434;
rect.w = 8;
rect.h = 32;
cd_icon[24] |= 0x8000;
cd_icon[25] |= 0x8000;
LoadImage(&rect, (u_long*)(cd_icon + 24));
setPolyFT4(&cd_sprite);
setRGB0(&cd_sprite, 128, 128, 128);
setUVWH(&cd_sprite, 0, 179, 32, 31);
setXYWH(&cd_sprite, 80, 38, 38, 21);
setClut(&cd_sprite, 960, 433);
setTPage(&cd_sprite, 0, 0, 960, 256);
bCdIconSetup = 1;
}
// [D] [T]
void DrawCDicon(void)
@ -311,7 +339,7 @@ void DrawCDicon(void)
}
setRECT(&dest, 960, 433, 16, 1);
LoadImage(&dest, (u_long *)palette);
LoadImage(&dest, (u_long*)(cd_icon + 10));
DrawPrim(&cd_sprite);
DrawSync(0);
@ -378,6 +406,7 @@ void InitSpooling(void)
}
CleanSpooledModelSlots();
InitCdIcon();
newmodels = NULL;
spool_regioncounter = 0;
@ -650,21 +679,18 @@ void CheckValidSpoolData(void)
{
if (models_ready)
init_spooled_models();
if (spoolactive)
if (spoolactive && check_regions_present())
{
if (check_regions_present())
stopgame();
while (spoolactive)
{
stopgame();
while (spoolactive)
{
DrawCDicon();
VSync(0);
}
startgame();
DrawCDicon();
VSync(0);
}
startgame();
}
}

View File

@ -31,6 +31,8 @@ extern volatile int spoolactive;
extern int SpoolLumpOffset;
extern int bCdIconSetup;
extern void ProcessSpoolInfoLump(char *lump_ptr, int lump_size); // 0x0007C464
extern void InitSpooling(); // 0x0007E494
@ -50,6 +52,8 @@ extern void SpoolSYNC(void);
extern void InitSpecSpool(); // 0x0007D6D8
extern void InitCdIcon();
extern void CheckSpecialSpool(); // 0x0007D4E0
extern void QuickSpoolSpecial(); // 0x0007E84C

View File

@ -23,6 +23,7 @@
#include "C/gamesnd.h"
#include "C/scores.h"
#include "C/loadsave.h"
#include "C/spool.h"
#include "C/state.h"
@ -410,7 +411,6 @@ int gIdleReplay = 0;
int padsConnected[2] = { 1, 0 };
int feVariableSave[4] = { -1 };
int bCdIconSetup = 0;
int bDrawExtra = 0;
int mainScreenLoaded = 1;
@ -448,8 +448,6 @@ FE_FONT feFont;
RECT16 extraRect = { 896, 256, 64, 219 };
POLY_FT4 cd_sprite;
SPRT extraSprt;
POLY_FT3 extraDummy;
@ -929,42 +927,7 @@ void DrawScreen(PSXSCREEN *pScr)
#endif
}
// [D] [T]
void FEInitCdIcon(void)
{
ushort* palette;
RECT16 rect;
palette = cd_icon + 10;
for (int i = 0; i < 14; i++)
{
*palette &= 0x7fff;
palette++;
}
cd_icon[10] = 0;
rect.x = 960;
rect.y = 434;
rect.w = 8;
rect.h = 32;
cd_icon[24] |= 0x8000;
cd_icon[25] |= 0x8000;
LoadImage(&rect, (u_long*)(cd_icon + 24));
setPolyFT4(&cd_sprite);
setRGB0(&cd_sprite, 128, 128, 128);
setUVWH(&cd_sprite, 0, 178, 32, 32);
setXYWH(&cd_sprite, 80, 38, 38, 21);
setClut(&cd_sprite, 960, 433);
setTPage(&cd_sprite, 0, 0, 960, 256);
bCdIconSetup = 1;
}
extern POLY_FT4 cd_sprite;
// [D] [T]
void FEDrawCDicon(void)
@ -978,7 +941,7 @@ void FEDrawCDicon(void)
cd_icon[23] = cd_icon[11];
palette = cd_icon + 10;
palette = &cd_icon[10];
for (i = 0; i < 12; i++)
{
@ -992,6 +955,7 @@ void FEDrawCDicon(void)
dest.h = 1;
LoadImage(&dest, (u_long*)(cd_icon + 10));
DrawPrim(&cd_sprite);
DrawSync(0);
#ifndef PSX
@ -1233,8 +1197,7 @@ void ReInitScreens(int returnToMain)
SwitchMappings(1);
#endif // !PSX
if (!bCdIconSetup)
FEInitCdIcon();
InitCdIcon();
if (bReturnToMain)
{
@ -1629,7 +1592,7 @@ void SetFEDrawMode(void)
// [A] - was inlined in State_FrontEnd
void InitFrontend(void)
{
FEInitCdIcon();
InitCdIcon();
ResetGraph(1);
SetDispMask(0);