- implement ShowLoadingScreen

- implement ShowLoading
This commit is contained in:
Ilya Shurumov 2020-03-29 04:26:18 +06:00
parent 223da63fe2
commit 54128aebc6
6 changed files with 138 additions and 150 deletions

View File

@ -1,6 +1,16 @@
#include "THISDUST.H" #include "THISDUST.H"
#include "LOADVIEW.H" #include "LOADVIEW.H"
#include "E3STUFF.H"
#include "SYSTEM.H"
#include "LIBETC.H"
#include "../FRONTEND/FEMAIN.H"
DRAWENV load_draw = { 0 };
DISPENV load_disp = { 0 };
int load_steps = 0;
int loading_bar_pos = 0;
// decompiled code // decompiled code
// original method signature: // original method signature:
@ -33,72 +43,50 @@
/* WARNING: Unknown calling convention yet parameter storage is locked */ /* WARNING: Unknown calling convention yet parameter storage is locked */
// [D]
void ShowLoading(void) void ShowLoading(void)
{ {
UNIMPLEMENTED(); POLY_G4 poly;
/*
undefined auStack56[4];
undefined local_34;
undefined local_33;
undefined local_32;
undefined2 local_30;
undefined2 local_2e;
undefined local_2c;
undefined local_2b;
undefined local_2a;
short local_28;
undefined2 local_26;
undefined local_24;
undefined local_23;
undefined local_22;
undefined2 local_20;
undefined2 local_1e;
undefined local_1c;
undefined local_1b;
undefined local_1a;
short local_18;
undefined2 local_16;
if ((NewLevel != 0) || (gInFrontend != 0)) { if ((NewLevel != 0) || (gInFrontend != 0)) {
loading_bar_pos = loading_bar_pos + 1; loading_bar_pos = loading_bar_pos + 1;
local_28 = (short)(loading_bar_pos * load_steps); poly.x1 = (short)(loading_bar_pos * load_steps);
if (0x78 < loading_bar_pos * load_steps) { if (120 < loading_bar_pos * load_steps) {
local_28 = 0x78; poly.x1 = 120;
} }
SetPolyG4(auStack56);
local_34 = 0x1e; SetPolyG4(&poly);
local_24 = 0x1e; poly.r0 = 30;
local_33 = 0xb; poly.r2 = 30;
local_32 = 0xb; poly.g0 = 11;
local_23 = 0xb; poly.b0 = 11;
local_22 = 0xb; poly.g2 = 11;
local_2b = 0xb; poly.b2 = 11;
local_2a = 0xb; poly.g1 = 11;
local_1b = 0xb; poly.b1 = 11;
local_1a = 0xb; poly.g3 = 11;
local_2c = 0x86; poly.b3 = 11;
local_1c = 0x86; poly.r1 = 122;
local_28 = local_28 + 0xb0; poly.r3 = 122;
local_2e = 0x1b3; poly.x1 = poly.x1 + 0xb0;
local_26 = 0x1b3; poly.y0 = 435;
local_30 = 0xb0; poly.y1 = 435;
local_20 = 0xb0; poly.x0 = 176;
local_1e = 0x1cc; poly.x2 = 176;
local_16 = 0x1cc; poly.y2 = 460;
local_18 = local_28; poly.y3 = 460;
DrawPrim(auStack56); poly.x3 = poly.x1;
DrawPrim(&poly);
VSync(0); VSync(0);
DrawSync(0); DrawSync(0);
PutDrawEnv(&load_draw); PutDrawEnv(&load_draw);
PutDispEnv(&load_disp); PutDispEnv(&load_disp);
DrawPrim(auStack56); DrawPrim(&poly);
VSync(0); VSync(0);
DrawSync(0); DrawSync(0);
PutDrawEnv(&load_draw); PutDrawEnv(&load_draw);
PutDispEnv(&load_disp); PutDispEnv(&load_disp);
} }
return;
*/
} }
@ -267,124 +255,118 @@ void FadeGameScreen(int flag, int speed)
/* end block 4 */ /* end block 4 */
// End Line: 704 // End Line: 704
// [D]
void ShowLoadingScreen(char *screen_name, int effect, int loading_steps) void ShowLoadingScreen(char *screen_name, int effect, int loading_steps)
{ {
UNIMPLEMENTED();
/*
bool bVar1; bool bVar1;
char local_a0_424;
uint uVar2; uint uVar2;
undefined *puVar3; SPRT *pSVar3;
undefined *puVar4; SPRT *pSVar4;
undefined *puVar5; POLY_FT3 *pPVar5;
undefined *puVar6; POLY_FT3 *pPVar6;
uint uVar7; uint uVar7;
int iVar8; int iVar8;
int iVar9; int iVar9;
int iVar10; int iVar10;
undefined uVar11; unsigned char uVar11;
int iVar12; int iVar12;
undefined2 local_108; RECT16 dest;
undefined2 local_106; SPRT prims[4];
undefined2 local_104; POLY_FT3 nulls[4];
undefined2 local_102; int fade_step;
undefined auStack256[40];
undefined auStack216[40];
undefined auStack176[3];
undefined local_ad[4];
undefined local_a9;
ushort local_a8[28];
undefined auStack112[3];
undefined local_6d[4];
undefined local_69;
ushort local_68[28];
int local_30;
iVar12 = 0xff; iVar12 = 0xff;
local_30 = -4; fade_step = -4;
if (effect == 1) { if (effect == 1) {
SetDispMask(0); SetDispMask(0);
} }
SetupDefDrawEnv(&load_draw, 0, 0, 0x140, 0x200); SetupDefDrawEnv(&load_draw, 0, 0, 320, 512);
SetupDefDispEnv(&load_disp, 0, 0, 0x140, 0x200); SetupDefDispEnv(&load_disp, 0, 0, 320, 512);
load_draw.dfe = '\x01'; load_draw.dfe = '\x01';
PutDispEnv(&load_disp); PutDispEnv(&load_disp);
PutDrawEnv(&load_draw); PutDrawEnv(&load_draw);
Loadfile(screen_name, &DAT_000f3000);
LoadClut(&DAT_000f3014, 0x140, 0x1ff); Loadfile(screen_name, _frontend_buffer);
LoadClut((u_long*)&_frontend_buffer[20], 320, 511);
DrawSync(0); DrawSync(0);
local_108 = 0x140; dest.x = 320;
local_106 = 0; dest.y = 0;
local_104 = 0xa0; dest.w = 160;
local_102 = 0x1ff; dest.h = 511;
LoadImage(&local_108, &DAT_000f3220); LoadImage(&dest, (u_long *)&_frontend_buffer[544]);
DrawSync(0); DrawSync(0);
bVar1 = false; bVar1 = false;
iVar8 = 0; iVar8 = 0;
puVar4 = auStack216; pSVar4 = prims + 2;
puVar6 = auStack112; pPVar6 = nulls + 2;
uVar7 = 0x140; uVar7 = 320;
puVar5 = auStack176; pPVar5 = nulls;
puVar3 = auStack256; pSVar3 = prims;
do { do {
uVar2 = uVar7 & 0x3ff; uVar2 = uVar7 & 0x3ff;
uVar7 = uVar7 + 0x80; uVar7 = uVar7 + 0x80;
puVar3[3] = 4; setSprt(pSVar3);
puVar3[7] = 100; pSVar3->x0 = (short)(iVar8 << 8);
*(short *)(puVar3 + 8) = (short)(iVar8 << 8); pSVar3->y0 = 0;
*(undefined2 *)(puVar3 + 10) = 0; pSVar3->u0 = '\0';
puVar3[0xc] = 0; pSVar3->v0 = '\0';
puVar3[0xd] = 0; pSVar3->w = 0x100;
*(undefined2 *)(puVar3 + 0x10) = 0x100; pSVar3->h = 0x100;
*(undefined2 *)(puVar3 + 0x12) = 0x100; pSVar3->clut = 0x7fd4;
*(undefined2 *)(puVar3 + 0xe) = 0x7fd4;
puVar5[3] = 7; setPolyFT3(pPVar5);
*(undefined2 *)(puVar5 + 8) = 0xffff; pPVar5->x0 = -1;
*(undefined2 *)(puVar5 + 10) = 0xffff; pPVar5->y0 = -1;
*(undefined2 *)(puVar5 + 0x10) = 0xffff; pPVar5->x1 = -1;
*(undefined2 *)(puVar5 + 0x12) = 0xffff; pPVar5->y1 = -1;
*(undefined2 *)(puVar5 + 0x18) = 0xffff; pPVar5->x2 = -1;
*(undefined2 *)(puVar5 + 0x1a) = 0xffff; pPVar5->y2 = -1;
puVar5[7] = 0x24; pPVar5->tpage = (ushort)((int)uVar2 >> 6) | 0x80;
*(ushort *)(puVar5 + 0x16) = (ushort)((int)uVar2 >> 6) | 0x80; pPVar5 = pPVar5 + 1;
puVar5 = puVar5 + 0x20;
iVar8 = iVar8 + 1; iVar8 = iVar8 + 1;
puVar3 = puVar3 + 0x14; pSVar3 = pSVar3 + 1;
} while (iVar8 < 2); } while (iVar8 < 2);
iVar8 = 0; iVar8 = 0;
uVar7 = 0x140; uVar7 = 0x140;
do { do {
uVar2 = uVar7 & 0x3ff; uVar2 = uVar7 & 0x3ff;
uVar7 = uVar7 + 0x80; uVar7 = uVar7 + 0x80;
puVar4[3] = 4; setSprt(pSVar4);
puVar4[7] = 100; pSVar4->x0 = (short)(iVar8 << 8);
*(short *)(puVar4 + 8) = (short)(iVar8 << 8); pSVar4->y0 = 0x100;
*(undefined2 *)(puVar4 + 10) = 0x100; pSVar4->u0 = '\0';
puVar4[0xc] = 0; pSVar4->v0 = '\0';
puVar4[0xd] = 0; pSVar4->w = 0x100;
*(undefined2 *)(puVar4 + 0x10) = 0x100; pSVar4->h = 0x100;
*(undefined2 *)(puVar4 + 0x12) = 0x100; pSVar4->clut = 0x7fd4;
*(undefined2 *)(puVar4 + 0xe) = 0x7fd4;
puVar6[3] = 7; setPolyFT3(pPVar6);
*(undefined2 *)(puVar6 + 8) = 0xffff; pPVar6->x0 = -1;
*(undefined2 *)(puVar6 + 10) = 0xffff; pPVar6->y0 = -1;
*(undefined2 *)(puVar6 + 0x10) = 0xffff; pPVar6->x1 = -1;
*(undefined2 *)(puVar6 + 0x12) = 0xffff; pPVar6->y1 = -1;
*(undefined2 *)(puVar6 + 0x18) = 0xffff; pPVar6->x2 = -1;
*(undefined2 *)(puVar6 + 0x1a) = 0xffff; pPVar6->y2 = -1;
puVar6[7] = 0x24; pPVar6->tpage = (ushort)((int)uVar2 >> 6) | 0x90;
*(ushort *)(puVar6 + 0x16) = (ushort)((int)uVar2 >> 6) | 0x90; pPVar6 = pPVar6 + 1;
puVar6 = puVar6 + 0x20;
iVar8 = iVar8 + 1; iVar8 = iVar8 + 1;
puVar4 = puVar4 + 0x14; pSVar4 = pSVar4 + 1;
} while (iVar8 < 2); } while (iVar8 < 2);
if (effect == 1) { if (effect == 1) {
iVar12 = 8; iVar12 = 8;
local_30 = 2; fade_step = 2;
} }
else { else {
if (effect == 2) { if (effect == 2) {
iVar12 = 0x80; iVar12 = 128;
local_30 = -2; fade_step = -2;
} }
} }
iVar8 = 0; iVar8 = 0;
@ -392,30 +374,31 @@ void ShowLoadingScreen(char *screen_name, int effect, int loading_steps)
if (iVar8 == 2) { if (iVar8 == 2) {
SetDispMask(1); SetDispMask(1);
} }
puVar4 = auStack176; pPVar5 = nulls;
puVar5 = auStack256; pSVar4 = prims;
iVar8 = iVar8 + 1; iVar8 = iVar8 + 1;
iVar9 = 3; iVar9 = 3;
iVar10 = iVar12 + local_30; iVar10 = iVar12 + fade_step;
puVar3 = puVar5; pSVar3 = pSVar4;
do { do {
uVar11 = (undefined)iVar12; uVar11 = (unsigned char)iVar12;
puVar3[4] = uVar11; pSVar3->r0 = uVar11;
puVar3[5] = uVar11; pSVar3->g0 = uVar11;
puVar3[6] = uVar11; pSVar3->b0 = uVar11;
iVar9 = iVar9 + -1; iVar9 = iVar9 + -1;
puVar3 = puVar3 + 0x14; pSVar3 = pSVar3 + 1;
} while (-1 < iVar9); } while (-1 < iVar9);
iVar12 = 3; iVar12 = 3;
do { do {
DrawPrim(puVar4); DrawPrim(pPVar5);
DrawPrim(puVar5); DrawPrim(pSVar4);
puVar5 = puVar5 + 0x14; pSVar4 = pSVar4 + 1;
iVar12 = iVar12 + -1; iVar12 = iVar12 + -1;
puVar4 = puVar4 + 0x20; pPVar5 = pPVar5 + 1;
} while (-1 < iVar12); } while (-1 < iVar12);
DrawSync(0); DrawSync(0);
VSync(0); VSync(0);
PutDispEnv(&load_disp); PutDispEnv(&load_disp);
PutDrawEnv(&load_draw); PutDrawEnv(&load_draw);
if (effect == 1) { if (effect == 1) {
@ -432,11 +415,10 @@ void ShowLoadingScreen(char *screen_name, int effect, int loading_steps)
} while (!bVar1); } while (!bVar1);
load_steps = 0x18; load_steps = 0x18;
if (gInFrontend == 0) { if (gInFrontend == 0) {
load_steps = 0x14; load_steps = 20;
} }
loading_bar_pos = 0; loading_bar_pos = 0;
return; return;
*/
} }

View File

@ -2081,8 +2081,8 @@ int redriver2_main(void)
}; };
char *NTSCScreenNames[4] = { char *NTSCScreenNames[4] = {
//"GFX\\SPLASH2.TIM", "GFX\\SPLASH2.TIM",
//"GFX\\SPLASH3.TIM", "GFX\\SPLASH3.TIM",
"GFX\\SPLASH1N.TIM", "GFX\\SPLASH1N.TIM",
NULL NULL
}; };

View File

@ -9,7 +9,7 @@
#include <string.h> #include <string.h>
char _overlay_buffer[0x50000]; // 0x1C0000 char _overlay_buffer[0x50000]; // 0x1C0000
char _frontend_buffer[0x8000]; // 0xFB400 char _frontend_buffer[0x50000]; // 0xFB400
char* LevelFiles[] = { char* LevelFiles[] = {
"LEVELS\\CHICAGO.LEV", "LEVELS\\CHICAGO.LEV",
@ -46,6 +46,7 @@ char _tempPrimTab2[0x8000]; // 0x119400
// TODO: to game vars // TODO: to game vars
unsigned char NumPlayers = 1; unsigned char NumPlayers = 1;
int NewLevel = 1;
// decompiled code // decompiled code
// original method signature: // original method signature:

View File

@ -2,7 +2,7 @@
#define SYSTEM_H #define SYSTEM_H
extern char _overlay_buffer[0x50000]; // 0x1C0000 extern char _overlay_buffer[0x50000]; // 0x1C0000
extern char _frontend_buffer[0x8000]; // 0xFB400 extern char _frontend_buffer[0x50000]; // 0xFB400
extern DRAW_MODE draw_mode_pal; extern DRAW_MODE draw_mode_pal;
extern DRAW_MODE draw_mode_ntsc; extern DRAW_MODE draw_mode_ntsc;
@ -18,6 +18,7 @@ extern char _tempPrimTab1[0x8000]; // 0xFB400
extern char _tempPrimTab2[0x8000]; // 0x119400 extern char _tempPrimTab2[0x8000]; // 0x119400
extern unsigned char NumPlayers; extern unsigned char NumPlayers;
extern int NewLevel;
#ifdef PAL #ifdef PAL
#define draw_mode draw_mode_pal #define draw_mode draw_mode_pal

View File

@ -1,6 +1,7 @@
#ifndef FEMAIN_H #ifndef FEMAIN_H
#define FEMAIN_H #define FEMAIN_H
extern int gInFrontend;
extern void SetVariable(int var); // 0x001C0974 extern void SetVariable(int var); // 0x001C0974

View File

@ -9,6 +9,9 @@ int(*GPU_printf)(const char *fmt, ...);
int main() int main()
{ {
//g_texturelessMode = 1;
//g_wireframeMode = 1;
GPU_printf = printf; GPU_printf = printf;
Emulator_Initialise("DRIVER 2", 800, 600); Emulator_Initialise("DRIVER 2", 800, 600);