- fix building on Linux

- fix bugged video playback
- remove bad file
This commit is contained in:
SoapyMan 2020-12-28 20:27:00 +06:00
parent 96ee21e921
commit db1f347b64
17 changed files with 53 additions and 702 deletions

6
.gitignore vendored
View File

@ -4,6 +4,10 @@
*.opendb
*.idb
*.obj
*.o
*.a
*.dep
*.d
*.log
*.vcxproj.user
*.pdb
@ -35,4 +39,4 @@ src_rebuild/.vs/*
src_rebuild/bin/*
src_rebuild/obj/*
src_rebuild/*.make
src_rebuild/Makefile
src_rebuild/Makefile

View File

@ -6,8 +6,8 @@
Not for commercial use
*/
#include "../DRIVER2.H"
#include "../C/SYSTEM.H"
#include "driver2.h"
#include "STRINGS.H"
struct RNCheader

View File

@ -1,6 +1,7 @@
#include "driver2.h"
#include "C/CAMERA.H"
#include "C/DRAW.H"
#include "C/camera.h"
#include "C/draw.h"
#include "INLINE_C.H"
extern MATRIX frustrum_matrix;

View File

@ -1,657 +0,0 @@
#include "driver2.h"
#include "E3stuff.h"
#include "pad.h"
#include "system.h"
#include "pres.h"
#include "pause.h"
#include "sound.h"
#include "LIBETC.H"
struct POLYCOORD
{
short x;
short y;
short u;
short v;
short w;
short h;
};
POLYCOORD polycoords[6] =
{
{ 0, 0, 640, 0, 256, 256 },
{ 256, 0, 768, 0, 256, 256 },
{ 512, 0, 896, 0, 128, 256 },
{ 0, 256, 640, 256, 256, 256 },
{ 256, 256, 768, 256, 256, 256 },
{ 512, 256, 896, 256, 128, 256 }
};
// [D] [T]
void ShowHiresScreens(char **names, int delay, int wait)
{
int timedelay;
char *filename;
filename = *names;
do {
if (!filename)
return;
FadeInHiresScreen(filename);
timedelay = delay-1;
do {
if (timedelay == 0)
break;
VSync(0);
ReadControllers();
timedelay--;
} while ((wait != 0) || (Pads[0].dirnew & 0x40) == 0);
FadeOutHiresScreen();
filename = *(++names);
} while (true);
}
// [D] [T]
void FadeInHiresScreen(char *filename)
{
int col;
DISPENV disp;
DRAWENV draw;
SPRT prims[6];
POLY_FT3 nulls[6];
RECT16 rect;
OTTYPE ot;
POLY_FT3 *poly;
SPRT *prim;
POLYCOORD *pc;
DrawSync(0);
VSync(0);
SetDispMask(0);
ResetGraph(3);
setRECT(&rect, 0, 0, 512, 512);
ClearImage2(&rect, 0, 0, 0);
DrawSync(0);
setRECT(&rect, 512, 0, 512, 512);
ClearImage2(&rect, 0, 0, 0);
DrawSync(0);
poly = nulls;
pc = polycoords;
prim = prims;
// prepare polygons
for(int i = 0; i < 6; i++)
{
// set primitive
setSprt(prim);
setUV0(prim, 0, 0);
setClut(prim, 640, 511);
setXY0(prim, pc->x, pc->y);
setWH(prim, pc->w, pc->h);
// set poly
setPolyFT3(poly);
setXY3(poly, -1,-1,-1,-1,-1,-1);
setTPage(poly, 1, 0, pc->u, pc->v);
prim++;
poly++;
pc++;
}
SetupDefDrawEnv(&draw, 0, 0, 640, 512);
SetupDefDispEnv(&disp, 0, 0, 640, 512);
draw.dfe = 1;
VSync(0);
PutDispEnv(&disp);
PutDrawEnv(&draw);
LoadfileSeg(filename, _overlay_buffer, 20, 0x4ff80);
LoadClut((u_long*)_overlay_buffer, 640, 511);
DrawSync(0);
setRECT(&rect, 640, 0, 320, 511);
LoadImage(&rect, (u_long*)&_overlay_buffer[524]);
DrawSync(0);
SetDispMask(1);
col = 0;
do {
DrawSync(0);
VSync(0);
PutDispEnv(&disp);
PutDrawEnv(&draw);
ClearOTagR((u_long*)&ot, 1);
poly = nulls;
prim = prims;
for (int i = 0; i < 6; i++)
{
if (col < 129)
{
setRGB0(prim, col, col, col);
}
else
{
setRGB0(prim, 128, 128, 128);
}
addPrim(&ot, prim);
addPrim(&ot, poly);
poly++; prim++;
}
DrawOTag((u_long*)&ot);
#ifndef PSX
PsyX_EndScene();
#endif
col += 4;
} while (col < 140);
DrawSync(0);
}
#define GALLERY_IMAGES 24
// [A] displays bonus gallery
void ShowBonusGallery()
{
char filename[64];
int currentImage;
DISPENV disp;
DRAWENV draw;
SPRT prims[6];
POLY_FT3 nulls[6];
RECT16 rect;
OTTYPE ot;
POLY_FT3 *poly;
SPRT *prim;
POLYCOORD *pc;
DrawSync(0);
VSync(0);
SetDispMask(0);
ResetGraph(3);
setRECT(&rect, 0, 0, 512, 512);
ClearImage2(&rect, 0, 0, 0);
DrawSync(0);
setRECT(&rect, 512, 0, 512, 512);
ClearImage2(&rect, 0, 0, 0);
DrawSync(0);
poly = nulls;
pc = polycoords;
prim = prims;
// prepare polygons
for(int i = 0; i < 6; i++)
{
// set primitive
setSprt(prim);
setUV0(prim, 0, 0);
setClut(prim, 640, 511);
setXY0(prim, pc->x, pc->y);
setWH(prim, pc->w, pc->h);
// set poly
setPolyFT3(poly);
setXY3(poly, -1,-1,-1,-1,-1,-1);
setTPage(poly, 1, 0, pc->u, pc->v);
prim++;
poly++;
pc++;
}
SetupDefDrawEnv(&draw, 0, 0, 640, 512);
SetupDefDispEnv(&disp, 0, 0, 640, 512);
draw.dfe = 1;
VSync(0);
PutDispEnv(&disp);
PutDrawEnv(&draw);
currentImage = 0;
// draw image cycle
while(currentImage <= GALLERY_IMAGES)
{
if(currentImage == 0)
sprintf(filename, "GFX\\GAL\\INTRO.TIM");
else
sprintf(filename, "GFX\\GAL\\IMG%d.TIM", currentImage-1);
LoadfileSeg(filename, _other_buffer, 20, 0x4ff80);
LoadClut((u_long*)_other_buffer, 640, 511);
DrawSync(0);
setRECT(&rect, 640, 0, 320, 511);
LoadImage(&rect, (u_long*)&_other_buffer[524]);
DrawSync(0);
SetDispMask(1);
// now draw image
DrawSync(0);
VSync(0);
PutDispEnv(&disp);
PutDrawEnv(&draw);
ClearOTagR((u_long*)&ot, 1);
poly = nulls;
prim = prims;
for (int i = 0; i < 6; i++)
{
setRGB0(prim, 128, 128, 128);
addPrim(&ot, prim);
addPrim(&ot, poly);
poly++; prim++;
}
DrawOTag((u_long*)&ot);
#ifndef PSX
PsyX_EndScene();
#endif
// wait for user input
do {
ReadControllers();
VSync(-1);
if(Pads[0].dirnew & 0x8000)
{
currentImage--;
if (currentImage < 0)
{
FESound(1);
currentImage = 0;
}
else
{
FESound(3);
break;
}
}
if(Pads[0].dirnew & 0x2000)
{
FESound(3);
currentImage++;
break;
}
if(Pads[0].dirnew & 0x10)
{
FESound(0);
currentImage = GALLERY_IMAGES+1; // quit
break;
}
} while (true);
}
DrawSync(0);
}
// [D] [T]
void FadeOutHiresScreen(void)
{
int col;
DISPENV disp;
DRAWENV draw;
SPRT prims[6];
POLY_FT3 nulls[6];
RECT16 rect;
OTTYPE ot;
POLY_FT3 *poly;
SPRT *prim;
POLYCOORD *pc;
poly = nulls;
pc = polycoords;
prim = prims;
// prepare polygons
for (int i = 0; i < 6; i++)
{
// set primitive
setSprt(prim);
setUV0(prim, 0, 0);
setClut(prim, 640, 511);
setXY0(prim, pc->x, pc->y);
setWH(prim, pc->w, pc->h);
// set poly
setPolyFT3(poly);
setXY3(poly, -1, -1, -1, -1, -1, -1);
setTPage(poly, 1, 0, pc->u, pc->v);
prim++;
poly++;
pc++;
}
SetupDefDrawEnv(&draw, 0, 0, 640, 512);
SetupDefDispEnv(&disp, 0, 0, 640, 512);
draw.dfe = 1;
VSync(0);
PutDispEnv(&disp);
PutDrawEnv(&draw);
//g_wireframeMode = 1;
DrawSync(0);
SetDispMask(1);
col = 128;
do {
DrawSync(0);
VSync(0);
PutDispEnv(&disp);
PutDrawEnv(&draw);
ClearOTagR((u_long*)&ot, 1);
poly = nulls;
prim = prims;
for (int i = 0; i < 6; i++)
{
setRGB0(prim, col, col, col);
// UNCERTAIN CODE
// LEARN TO DECOMPILE MIPS FIRST
addPrim(&ot, prim);
addPrim(&ot, poly);
poly++; prim++;
}
DrawOTag((u_long*)&ot);
#ifndef PSX
PsyX_EndScene();
#endif
col -= 4;
} while (col > -4);
DrawSync(0);
setRECT(&rect, 0, 0, 640, 512);
ClearImage2(&rect, 0, 0, 0);
DrawSync(0);
}
// [D] [T]
void SetupDefDrawEnv(DRAWENV *env, int x, int y, int w, int h)
{
if (h < 257)
SetDefDrawEnv(env, x, y, w, 256);
else
SetDefDrawEnv(env, x, y, w, 512);
}
// [D] [T]
void SetupDefDispEnv(DISPENV *env, int x, int y, int w, int h)
{
if (h < 257)
{
SetDefDispEnv(env, x, y, w, 256);
env->screen.x = draw_mode.framex;
env->screen.y = draw_mode.framey;
env->screen.h = 255;
env->isinter = 0;
}
else
{
SetDefDispEnv(env, x, y, w, 512);
env->screen.x = draw_mode.framex;
env->screen.y = draw_mode.framey;
env->screen.h = 255;
env->isinter = 1;
}
env->isrgb24 = 0;
}
int lastrequesteddisc = 0;
// [D] [T]
void SetPleaseWait(char *buffer)
{
char *filename;
DISPENV disp;
DRAWENV draw;
RECT16 rect;
DrawSync(0);
VSync(0);
SetDispMask(0);
SetupDefDrawEnv(&draw,0,0,320,256);
SetupDefDispEnv(&disp,0,0, 320, 256);
draw.dfe = 1;
PutDrawEnv(&draw);
PutDispEnv(&disp);
LoadFont(buffer);
if (buffer == NULL)
SetupDrawBuffers();
else
current->primptr = buffer;
rect.x = 0;
rect.y = 0;
rect.w = 320;
rect.h = 512;
ClearImage(&rect,0,0,0);
DrawSync(0);
#ifndef PSX
PsyX_BeginScene();
SetDispMask(1);
#endif
gShowMap = 1;
SetTextColour(128, 128, 128);
PrintStringCentred(G_LTXT(GTXT_PleaseWait),128);
gShowMap = 0;
VSync(0);
#ifdef PSX
if (lastrequesteddisc == 0)
filename = "\\SLES_029.96;1";
else
filename = "\\SLES_029.96;1";
if (DiscSwapped(filename) != 4)
ResetCityType();
#else
ResetCityType();
PsyX_EndScene();
#endif // PSX
}
// [D] [T]
void CheckForCorrectDisc(int disc)
{
CDTYPE ret;
char *mess2;
char *exe;
int discerror;
char *mess;
DISPENV disp;
DRAWENV draw;
RECT16 rect;
discerror = 0;
if (lastrequesteddisc != disc)
{
lastrequesteddisc = disc;
ResetCityType();
}
if (disc == 0)
{
mess = "Please insert DISC 1";
exe = ".\\SLES_029.96;1";
}
else
{
mess = "Please insert DISC 2";
exe = ".\\SLES_129.96;1";
}
if (DiscSwapped(exe) == CDTYPE_CORRECTDISC)
return;
LoadFont(NULL);
SetupDrawBuffers();
DrawSync(0);
VSync(0);
SetDispMask(0);
rect.x = 0;
rect.y = 0;
rect.w = 0x140;
rect.h = 0x200;
ClearImage(&rect, 0, 0, 0);
DrawSync(0);
SetupDefDrawEnv(&draw, 0, 0, 0x140, 0x100);
SetupDefDispEnv(&disp, 0, 0, 0x140, 0x100);
draw.dfe = 1;
PutDrawEnv(&draw);
PutDispEnv(&disp);
SetDispMask(1);
do {
VSync(10);
ret = DiscSwapped(exe);
switch (ret)
{
case CDTYPE_NODISC:
discerror = 0;
mess2 = "No DISC inserted";
break;
case CDTYPE_SHELLOPEN:
case CDTYPE_CORRECTDISC:
discerror = 0;
mess2 = "";
break;
case CDTYPE_DISCERROR:
discerror++;
if (discerror > 29)
mess2 = "No DISC inserted";
else
mess2 = "Checking...";
break;
case CDTYPE_WRONGDISC:
discerror = 0;
mess2 = "Incorrect DISC inserted";
break;
}
VSync(0);
rect.y = 0x6e;
rect.x = 0;
rect.w = 0x140;
rect.h = 0x3c;
ClearImage(&rect, 0, 0, 0);
DrawSync(0);
gShowMap = 1;
SetTextColour(128, 128, 128);
PrintStringCentred(mess, 0x6e);
SetTextColour(128, 16, 16);
PrintStringCentred(mess2, 0x8c);
#ifndef PSX
PsyX_EndScene();
#endif
gShowMap = 0;
} while (ret != CDTYPE_CORRECTDISC);
rect.x = 0;
rect.y = 0;
rect.w = 0x140;
rect.h = 0x200;
ClearImage(&rect, 0, 0, 0);
DrawSync(0);
}

View File

@ -59,13 +59,14 @@
#include "Frontend/FEmain.h"
#include "xaplay.h"
#include "shadow.h"
#include "pause.h"
#include "platform.h"
#include "RAND.H"
#include "STRINGS.H"
#include <PLATFORM.H>
#include "INLINE_C.H"

View File

@ -1,5 +1,5 @@
#include "driver2.h"
#include "MDRAW.H"
#include "mdraw.h"
#include "pres.h"
#include "mission.h"
#include "overmap.h"

View File

@ -4,7 +4,7 @@
#include "cars.h"
#include "system.h"
#include "mission.h"
#include "MDRAW.H"
#include "mdraw.h"
#include "players.h"
#include "overlay.h"
#include "debris.h"
@ -16,7 +16,7 @@
#include "camera.h"
#include "felony.h"
#include "pad.h"
#include "ASM/rnc_2.H"
#include "ASM/rnc_2.h"
#include "STRINGS.H"
#include "INLINE_C.H"

View File

@ -7,7 +7,7 @@
#include "system.h"
#include "PLATFORM.H"
#include "platform.h"
#include "xaplay.h"
#include "loadview.h"
#include "mission.h"

View File

@ -5,7 +5,7 @@
#include "camera.h"
#include "fmvplay.h"
#include "pause.h"
#include "PLATFORM.H"
#include "platform.h"
#include "sound.h"
#include "pres.h"
#include "system.h"

View File

@ -13,7 +13,7 @@ XMPLAY.C
#include "ABS.H"
#include "xmplay.h"
#include "xmcalls.H"
#include "xmcalls.h"
#include "LIBETC.H"
#include "LIBSPU.H"

View File

@ -21,7 +21,7 @@
#include "C/scores.h"
#include "C/loadsave.h"
#include "MEMCARD/MAIN.H"
#include "MemCard/main.h"
#include "STRINGS.H"

View File

@ -1,5 +1,5 @@
#include "driver2.h"
#include "DELETE.H"
#include "delete.h"
// decompiled code

View File

@ -3,7 +3,6 @@
project "Psy-X"
kind "StaticLib"
language "C++"
compileas "C++"
targetdir "bin/%{cfg.buildcfg}"
removeplatforms "psx"
@ -27,7 +26,7 @@ project "Psy-X"
}
filter "system:Windows"
defines { "_WINDOWS" }
defines { "_WINDOWS" }
links {
"opengl32",
"SDL2",
@ -59,3 +58,6 @@ project "Psy-X"
filter {"configurations:Release", "configurations:Release_dev"}
optimize "Speed"
filter { "files:**.c", "files:**.C" }
compileas "C++"

0
src_rebuild/gen_gmake2.sh Normal file → Executable file
View File

View File

@ -75,8 +75,7 @@ workspace "REDRIVER2"
-- game iteslf
project "REDRIVER2"
kind "ConsoleApp"
language "C++"
compileas "C++"
language "c++"
targetdir "bin/%{cfg.buildcfg}"
includedirs {
@ -87,7 +86,7 @@ project "REDRIVER2"
files {
"Game/**.h",
"Game/**.c",
"Game/**.c"
}
-- exclude sources which belong to overlays
@ -100,7 +99,7 @@ project "REDRIVER2"
"Game/C/leadai.c",
"Game/C/pathfind.c",
}
end
end
filter "system:Windows or linux"
defines { "SIMPLE_SPOOL" }
@ -184,3 +183,6 @@ project "REDRIVER2"
"CUTSCENE_RECORDER"
}
optimize "Speed"
filter { "files:**.c", "files:**.C" }
compileas "C++"

View File

@ -3,16 +3,21 @@
#include <SDL_keyboard.h>
#include "PLATFORM.H"
#include "platform.h"
#include "driver2.h"
#include "C/MAIN.H"
#include "C/SYSTEM.H"
#include "C/GAMESND.H"
#include "C/CAMERA.H"
#include "C/CARS.H"
#include "C/CIV_AI.H"
#include "C/MISSION.H"
#include "C/main.h"
#include "C/system.h"
#include "C/gamesnd.h"
#include "C/camera.h"
#include "C/cars.h"
#include "C/civ_ai.h"
#include "C/mission.h"
#include "C/cutscene.h"
#include "C/glaunch.h"
#include "C/loadview.h"
#include "C/overlay.h"
#include "C/players.h"
#include "utils/ini.h"
@ -21,13 +26,6 @@
#include "PSYX_GLOBALS.H"
#include "C/CUTSCENE.H"
#include "C/GLAUNCH.H"
#include "C/LOADVIEW.H"
#include "C/OVERLAY.H"
#include "C/PLAYERS.H"
// eq engine console output
typedef enum
{

View File

@ -5,7 +5,7 @@
#include "driver2.h"
#include "C/pad.H"
#include "C/pad.h"
#include "C/system.h"
#include "C/E3stuff.h"
#include "C/fmv_font.h"
@ -14,7 +14,7 @@
#include <AL/al.h>
#include <jpeglib.h>
#include "PLATFORM.H"
#include "platform.h"
#include <UTIL/TIMER.H>
@ -190,13 +190,13 @@ void SetupMovieRectangle(int image_w, int image_h)
GrVertex blit_vertices[] =
{
{ clipRectX+ clipRectW, clipRectY + clipRectH, 0, 0, r, t, 0, 0, 0, 0, 0, 0 },
{ clipRectX, clipRectY, 0, 0, l, b, 0, 0, 0, 0, 0, 0 },
{ clipRectX, clipRectY + clipRectH, 0, 0, l, t, 0, 0, 0, 0, 0, 0 },
{ clipRectX + clipRectW, clipRectY, 0, 0, r, b, 0, 0, 0, 0, 0, 0 },
{ clipRectX, clipRectY, 0, 0, l, b, 0, 0, 0, 0, 0, 0 },
{ clipRectX + clipRectW, clipRectY + clipRectH, 0, 0, r, t, 0, 0, 0, 0, 0, 0 },
{ clipRectX+ clipRectW, clipRectY + clipRectH, 0, 0, 0, 0, 0, 0, r, t, 0, 0, },
{ clipRectX, clipRectY, 0, 0, 0, 0, 0, 0, l, b, 0, 0, },
{ clipRectX, clipRectY + clipRectH, 0, 0, 0, 0, 0, 0, l, t, 0, 0, },
{ clipRectX + clipRectW, clipRectY, 0, 0, 0, 0, 0, 0, r, b, 0, 0, },
{ clipRectX, clipRectY, 0, 0, 0, 0, 0, 0, l, b, 0, 0, },
{ clipRectX + clipRectW, clipRectY + clipRectH, 0, 0, 0, 0, 0, 0, r, t, 0, 0, },
};
#else
GR_SetViewPort(0, 0, windowWidth, windowHeight);