Showing preview only (1,876K chars total). Download the full file or copy to clipboard to get everything.
Repository: Arsunt/TR2Main
Branch: master
Commit: f38bc90438e2
Files: 212
Total size: 1.8 MB
Directory structure:
gitextract_vwbsridj/
├── .gitignore
├── 3dsystem/
│ ├── 3d_gen.cpp
│ ├── 3d_gen.h
│ ├── 3d_out.cpp
│ ├── 3d_out.h
│ ├── 3dinsert.cpp
│ ├── 3dinsert.h
│ ├── phd_math.cpp
│ ├── phd_math.h
│ ├── scalespr.cpp
│ └── scalespr.h
├── CHANGELOG.md
├── COPYING.md
├── Doxyfile
├── README.md
├── TR2Main.cbp
├── TR2Main.cpp
├── TR2Main.rc
├── TR2_progress.txt
├── binaries/
│ ├── BAREFOOT.SFX
│ └── README.md
├── configs/
│ ├── TR2Main.json
│ └── textures/
│ └── texpages/
│ ├── README.md
│ └── config.json
├── embedded/
│ ├── BUTTONS.JSON
│ └── BUTTONS.PCX
├── game/
│ ├── bear.cpp
│ ├── bear.h
│ ├── bird.cpp
│ ├── bird.h
│ ├── boat.cpp
│ ├── boat.h
│ ├── box.cpp
│ ├── box.h
│ ├── camera.cpp
│ ├── camera.h
│ ├── cinema.cpp
│ ├── cinema.h
│ ├── collide.cpp
│ ├── collide.h
│ ├── control.cpp
│ ├── control.h
│ ├── demo.cpp
│ ├── demo.h
│ ├── diver.cpp
│ ├── diver.h
│ ├── dog.cpp
│ ├── dog.h
│ ├── dragon.cpp
│ ├── dragon.h
│ ├── draw.cpp
│ ├── draw.h
│ ├── eel.cpp
│ ├── eel.h
│ ├── effects.cpp
│ ├── effects.h
│ ├── enemies.cpp
│ ├── enemies.h
│ ├── gameflow.cpp
│ ├── gameflow.h
│ ├── hair.cpp
│ ├── hair.h
│ ├── health.cpp
│ ├── health.h
│ ├── inventory.cpp
│ ├── inventory.h
│ ├── invfunc.cpp
│ ├── invfunc.h
│ ├── invtext.cpp
│ ├── invtext.h
│ ├── items.cpp
│ ├── items.h
│ ├── lara.cpp
│ ├── lara.h
│ ├── lara1gun.cpp
│ ├── lara1gun.h
│ ├── lara2gun.cpp
│ ├── lara2gun.h
│ ├── laraclimb.cpp
│ ├── laraclimb.h
│ ├── larafire.cpp
│ ├── larafire.h
│ ├── laraflare.cpp
│ ├── laraflare.h
│ ├── laramisc.cpp
│ ├── laramisc.h
│ ├── larasurf.cpp
│ ├── larasurf.h
│ ├── laraswim.cpp
│ ├── laraswim.h
│ ├── lot.cpp
│ ├── lot.h
│ ├── missile.cpp
│ ├── missile.h
│ ├── moveblock.cpp
│ ├── moveblock.h
│ ├── objects.cpp
│ ├── objects.h
│ ├── people.cpp
│ ├── people.h
│ ├── pickup.cpp
│ ├── pickup.h
│ ├── rat.cpp
│ ├── rat.h
│ ├── savegame.cpp
│ ├── savegame.h
│ ├── setup.cpp
│ ├── setup.h
│ ├── shark.cpp
│ ├── shark.h
│ ├── skidoo.cpp
│ ├── skidoo.h
│ ├── sound.cpp
│ ├── sound.h
│ ├── sphere.cpp
│ ├── sphere.h
│ ├── spider.cpp
│ ├── spider.h
│ ├── text.cpp
│ ├── text.h
│ ├── traps.cpp
│ ├── traps.h
│ ├── wolf.cpp
│ ├── wolf.h
│ ├── yeti.cpp
│ └── yeti.h
├── global/
│ ├── md5.c
│ ├── md5.h
│ ├── memmem.c
│ ├── memmem.h
│ ├── precompiled.h
│ ├── resource.h
│ ├── types.h
│ └── vars.h
├── json-parser/
│ ├── LICENSE
│ ├── README.md
│ ├── json.c
│ └── json.h
├── modding/
│ ├── background_new.cpp
│ ├── background_new.h
│ ├── cd_pauld.cpp
│ ├── cd_pauld.h
│ ├── file_utils.cpp
│ ├── file_utils.h
│ ├── gdi_utils.cpp
│ ├── gdi_utils.h
│ ├── joy_output.cpp
│ ├── joy_output.h
│ ├── json_utils.cpp
│ ├── json_utils.h
│ ├── mod_utils.cpp
│ ├── mod_utils.h
│ ├── pause.cpp
│ ├── pause.h
│ ├── psx_bar.cpp
│ ├── psx_bar.h
│ ├── raw_input.cpp
│ ├── raw_input.h
│ ├── texture_utils.cpp
│ ├── texture_utils.h
│ ├── xinput_ex.cpp
│ └── xinput_ex.h
└── specific/
├── background.cpp
├── background.h
├── display.cpp
├── display.h
├── file.cpp
├── file.h
├── fmv.cpp
├── fmv.h
├── frontend.cpp
├── frontend.h
├── game.cpp
├── game.h
├── hwr.cpp
├── hwr.h
├── init.cpp
├── init.h
├── init_3d.cpp
├── init_3d.h
├── init_display.cpp
├── init_display.h
├── init_input.cpp
├── init_input.h
├── init_sound.cpp
├── init_sound.h
├── input.cpp
├── input.h
├── option.cpp
├── option.h
├── output.cpp
├── output.h
├── registry.cpp
├── registry.h
├── screenshot.cpp
├── screenshot.h
├── setupdlg.cpp
├── setupdlg.h
├── setupwnd.cpp
├── setupwnd.h
├── smain.cpp
├── smain.h
├── sndpc.cpp
├── sndpc.h
├── texture.cpp
├── texture.h
├── utils.cpp
├── utils.h
├── winmain.cpp
├── winmain.h
├── winvid.cpp
└── winvid.h
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
*.exe
*.dll
*.lib
*.exp
*.gch
*.layout
*.depend
*.cscope_file_list
cscope.out
obj/
bin/
doc/
================================================
FILE: 3dsystem/3d_gen.cpp
================================================
/*
* Copyright (c) 2017-2021 Michael Chaban. All rights reserved.
* Original game is created by Core Design Ltd. in 1997.
* Lara Croft and Tomb Raider are trademarks of Embracer Group AB.
*
* This file is part of TR2Main.
*
* TR2Main is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TR2Main is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TR2Main. If not, see <http://www.gnu.org/licenses/>.
*/
#include "global/precompiled.h"
#include "3dsystem/3d_gen.h"
#include "3dsystem/3d_out.h"
#include "3dsystem/3dinsert.h"
#include "3dsystem/phd_math.h"
#include "3dsystem/scalespr.h"
#include "specific/hwr.h"
#include "global/vars.h"
// related to POLYTYPE enum
static void (__cdecl *PolyDrawRoutines[])(__int16 *) = {
draw_poly_gtmap, // gouraud shaded poly (texture)
draw_poly_wgtmap, // gouraud shaded poly (texture + colorkey)
draw_poly_gtmap_persp, // gouraud shaded poly (texture + perspective)
draw_poly_wgtmap_persp, // gouraud shaded poly (texture + colorkey + perspective)
draw_poly_line, // line (color)
draw_poly_flat, // flat shaded poly (color)
draw_poly_gouraud, // gouraud shaded poly (color)
draw_poly_trans, // shadow poly (color + semitransparent)
draw_scaled_spriteC // scaled sprite (texture + colorkey)
};
#if defined(FEATURE_EXTENDED_LIMITS) || defined(FEATURE_VIEW_IMPROVED)
SORT_ITEM SortBuffer[16000];
__int16 Info3dBuffer[480000];
#endif // defined(FEATURE_EXTENDED_LIMITS) || defined(FEATURE_VIEW_IMPROVED)
#ifdef FEATURE_EXTENDED_LIMITS
PHD_SPRITE PhdSpriteInfo[2048];
D3DTLVERTEX HWR_VertexBuffer[0x8000];
#endif // FEATURE_EXTENDED_LIMITS
#ifdef FEATURE_VIEW_IMPROVED
bool PsxFovEnabled;
// view distance
double ViewDistanceFactor = 6.0;
// regular fog
double FogBeginFactor = 1.0;
double FogEndFactor = 6.0;
int FogBeginDepth = DEPTHQ_START;
int FogEndDepth = DEPTHQ_END;
// underwater fog
double WaterFogBeginFactor = 0.6;
double WaterFogEndFactor = 1.0;
int WaterFogBeginDepth = DEPTHQ_START;
int WaterFogEndDepth = DEPTHQ_END;
// fog formula
int CalculateFogShade(int depth) {
int fogBegin, fogEnd;
if( IsWaterEffect ) {
fogBegin = WaterFogBeginDepth;
fogEnd = WaterFogEndDepth;
} else {
fogBegin = FogBeginDepth;
fogEnd = FogEndDepth;
}
if( depth < fogBegin )
return 0;
if( depth >= fogEnd )
return 0x1FFF;
return (depth - fogBegin) * 0x1FFF / (fogEnd - fogBegin);
}
#endif // FEATURE_VIEW_IMPROVED
#ifdef FEATURE_VIDEOFX_IMPROVED
#include "modding/mod_utils.h"
extern DWORD ReflectionMode;
static POLYFILTER ReflectFilter;
static D3DCOLOR ReflectTint = 0;
static bool IsReflect = false;
void ClearMeshReflectState() {
memset(&ReflectFilter, 0 , sizeof(ReflectFilter));
ReflectTint = RGBA_MAKE(0xFF,0xFF,0xFF,0x80);
IsReflect = false;
}
void SetMeshReflectState(int objID, int meshIdx) {
// Clear poly filters and disable reflection by default
ClearMeshReflectState();
if( TextureFormat.bpp < 16 || !ReflectionMode ) return;
if( objID == ID_NONE ) {
// Reflect all meshes with custom tint instead of mesh index
ReflectTint = meshIdx;
IsReflect = true;
return;
}
#ifdef FEATURE_MOD_CONFIG
// Check if config is presented
if( IsModReflectConfigLoaded() ) {
POLYFILTER_NODE *node = NULL;
if( meshIdx < 0 ) {
for( node = GetModReflectStaticsFilter(); node != NULL; node = node->next ) {
if( node->id == objID ) {
ReflectFilter = node->filter;
IsReflect = true;
break;
}
}
} else if( objID >= 0 && objID < ID_NUMBER_OBJECTS ) {
POLYFILTER_NODE **obj = GetModReflectObjectsFilter();
for( node = obj[objID]; node != NULL; node = node->next ) {
if( node->id == meshIdx ) {
ReflectFilter = node->filter;
IsReflect = true;
break;
}
}
}
return;
}
#endif // FEATURE_MOD_CONFIG
// If config is absent or disabled, use hardcoded params
if( objID >= 0 && meshIdx < 0 ) {
// This is static object mesh
return;
}
// This is animated object mesh
switch( objID ) {
case ID_SKIDOO_FAST :
// This one is a fast showmobile from the Golden Mask
// Reflect the windshield only (skidoo body is mesh #0)
if( meshIdx == 0 ) {
// Set filter conditions
ReflectFilter.n_vtx = 59;
ReflectFilter.n_gt4 = 14;
ReflectFilter.n_gt3 = 73;
ReflectFilter.n_g4 = 0;
ReflectFilter.n_g3 = 17;
// All colored triangles are reflective
// The only reflective textured triangle is 48
ReflectFilter.gt3[0].idx = 48;
ReflectFilter.gt3[0].num = 1;
// Quads are not reflective
ReflectFilter.gt4[0].idx = ~0;
ReflectFilter.g4[0].idx = ~0;
IsReflect = true;
}
break;
case ID_SKIDOO_ARMED :
// This one is an armed showmobile
// Reflect the windshield only (skidoo body is mesh #0)
if( meshIdx == 0 ) {
// Set filter conditions
ReflectFilter.n_vtx = 88;
ReflectFilter.n_gt4 = 45;
ReflectFilter.n_gt3 = 60;
ReflectFilter.n_g4 = 0;
ReflectFilter.n_g3 = 0;
// The reflective textured quads are 21..22, 34..47
ReflectFilter.gt4[0].idx = 21;
ReflectFilter.gt4[0].num = 2;
ReflectFilter.gt3[0].idx = 34;
ReflectFilter.gt3[0].num = 14;
// Other polys are not reflective
ReflectFilter.g4[0].idx = ~0;
ReflectFilter.g3[0].idx = ~0;
IsReflect = true;
}
break;
case ID_WORKER5 :
// Reflect the black glass mask of flamethrower buddy (his head is mesh #15)
if( meshIdx == 15 ) {
// Set filter conditions
ReflectFilter.n_vtx = 38;
ReflectFilter.n_gt4 = 30;
ReflectFilter.n_gt3 = 12;
ReflectFilter.n_g4 = 0;
ReflectFilter.n_g3 = 0;
// The reflective textured quads are 22..26
ReflectFilter.gt4[0].idx = 22;
ReflectFilter.gt4[0].num = 5;
// Other polys are not reflective
ReflectFilter.gt3[0].idx = ~0;
ReflectFilter.g4[0].idx = ~0;
ReflectFilter.g3[0].idx = ~0;
IsReflect = true;
}
break;
case ID_SPINNING_BLADE :
if( meshIdx == 0 ) {
// Reflect only quads, not triangles
ReflectFilter.gt3[0].idx = ~0;
ReflectFilter.g3[0].idx = ~0;
IsReflect = true;
}
break;
case ID_BLADE :
// Reflect the blade only (mesh #1)
if( meshIdx == 1 ) {
IsReflect = true;
}
break;
case ID_KILLER_STATUE :
// Reflect the sword only (mesh #7)
if( meshIdx == 7 ) {
IsReflect = true;
}
break;
}
}
static bool InsertEnvmap(__int16 *ptrObj, int vtxCount, bool colored, LPVOID param) {
InsertObjectEM(ptrObj, vtxCount, ReflectTint, (PHD_UV *)param);
return true;
}
static void phd_PutEnvmapPolygons(__int16 *ptrEnv) {
if( ptrEnv == NULL || !IsReflect
|| SavedAppSettings.RenderMode != RM_Hardware ) return;
__int16 *ptrObj = ptrEnv;
ptrObj += 5; // skip x, y, z, radius, flags
__int16 num = *(ptrObj++); // get vertex counter
ptrObj += num * 3; // skip vertices
int vtxCount = *ptrObj++;
if( vtxCount <= 0 ) return;
PHD_UV *uv = new PHD_UV[vtxCount];
for( int i = 0; i < vtxCount; ++i ) {
// make sure that reflection will be drawn after normal poly
PhdVBuf[i].zv -= (double)(W2V_SCALE/2);
// set lighting that depends only from fog distance
PhdVBuf[i].g = 0x1000;
int depth = PhdMatrixPtr->_23 >> W2V_SHIFT;
#ifdef FEATURE_VIEW_IMPROVED
PhdVBuf[i].g += CalculateFogShade(depth);
#else // !FEATURE_VIEW_IMPROVED
if( depth > DEPTHQ_START ) // fog begin
PhdVBuf[i].g += depth - DEPTHQ_START;
#endif // FEATURE_VIEW_IMPROVED
CLAMP(PhdVBuf[i].g, 0x1000, 0x1FFF); // reflection can be darker but not brighter
// rotate normal vectors for X/Y, no translation
int x = (PhdMatrixPtr->_00 * ptrObj[0] +
PhdMatrixPtr->_01 * ptrObj[1] +
PhdMatrixPtr->_02 * ptrObj[2]) >> W2V_SHIFT;
int y = (PhdMatrixPtr->_10 * ptrObj[0] +
PhdMatrixPtr->_11 * ptrObj[1] +
PhdMatrixPtr->_12 * ptrObj[2]) >> W2V_SHIFT;
CLAMP(x, -PHD_IONE, PHD_IONE);
CLAMP(y, -PHD_IONE, PHD_IONE);
uv[i].u = PHD_ONE/PHD_IONE * (x + PHD_IONE)/2;
uv[i].v = PHD_ONE/PHD_IONE * (y + PHD_IONE)/2;
ptrObj += 3;
}
EnumeratePolys(ptrEnv, false, InsertEnvmap, &ReflectFilter, (LPVOID)uv);
delete[] uv;
}
#endif // FEATURE_VIDEOFX_IMPROVED
void phd_GenerateW2V(PHD_3DPOS *viewPos) {
int sx = phd_sin(viewPos->rotX);
int cx = phd_cos(viewPos->rotX);
int sy = phd_sin(viewPos->rotY);
int cy = phd_cos(viewPos->rotY);
int sz = phd_sin(viewPos->rotZ);
int cz = phd_cos(viewPos->rotZ);
PhdMatrixPtr = &MatrixStack[0]; // set matrix stack pointer to W2V
MatrixW2V._00 = PhdMatrixPtr->_00 = TRIGMULT3(sx, sy, sz) + TRIGMULT2(cy, cz);
MatrixW2V._01 = PhdMatrixPtr->_01 = TRIGMULT2(cx, sz);
MatrixW2V._02 = PhdMatrixPtr->_02 = TRIGMULT3(sx, cy, sz) - TRIGMULT2(sy, cz);
MatrixW2V._10 = PhdMatrixPtr->_10 = (int)(FltViewAspect * (double)(TRIGMULT3(sx, sy, cz) - TRIGMULT2(cy, sz)));
MatrixW2V._11 = PhdMatrixPtr->_11 = (int)(FltViewAspect * (double)(TRIGMULT2(cx, cz)));
MatrixW2V._12 = PhdMatrixPtr->_12 = (int)(FltViewAspect * (double)(TRIGMULT3(sx, cy, cz) + TRIGMULT2(sy, sz)));
MatrixW2V._20 = PhdMatrixPtr->_20 = TRIGMULT2(cx, sy);
MatrixW2V._21 = PhdMatrixPtr->_21 = -(sx);
MatrixW2V._22 = PhdMatrixPtr->_22 = TRIGMULT2(cx, cy);
MatrixW2V._03 = PhdMatrixPtr->_03 = viewPos->x;;
MatrixW2V._13 = PhdMatrixPtr->_13 = viewPos->y;
MatrixW2V._23 = PhdMatrixPtr->_23 = viewPos->z;
}
void __cdecl phd_LookAt(int xsrc, int ysrc, int zsrc, int xtar, int ytar, int ztar, __int16 roll) {
PHD_3DPOS viewPos;
VECTOR_ANGLES angles;
phd_GetVectorAngles(xtar - xsrc, ytar - ysrc, ztar - zsrc, &angles);
viewPos.x = xsrc;
viewPos.y = ysrc;
viewPos.z = zsrc;
viewPos.rotX = angles.pitch;
viewPos.rotY = angles.yaw;
viewPos.rotZ = roll;
phd_GenerateW2V(&viewPos);
}
void __cdecl phd_GetVectorAngles(int x, int y, int z, VECTOR_ANGLES *angles) {
__int16 pitch;
angles->yaw = phd_atan(z, x);
while( (__int16)x != x || (__int16)y != y || (__int16)z != z ) {
x >>= 2;
y >>= 2;
z >>= 2;
}
pitch = phd_atan(phd_sqrt(SQR(x) + SQR(z)), y);
if( (y > 0 && pitch > 0) || (y < 0 && pitch < 0) )
pitch = -pitch;
angles->pitch = pitch;
}
void __cdecl phd_RotX(__int16 angle) {
if( angle != 0 ) {
int m0, m1;
int sx = phd_sin(angle);
int cx = phd_cos(angle);
m0 = PhdMatrixPtr->_01 * cx + PhdMatrixPtr->_02 * sx;
m1 = PhdMatrixPtr->_02 * cx - PhdMatrixPtr->_01 * sx;
PhdMatrixPtr->_01 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_02 = m1 >> W2V_SHIFT;
m0 = PhdMatrixPtr->_11 * cx + PhdMatrixPtr->_12 * sx;
m1 = PhdMatrixPtr->_12 * cx - PhdMatrixPtr->_11 * sx;
PhdMatrixPtr->_11 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_12 = m1 >> W2V_SHIFT;
m0 = PhdMatrixPtr->_21 * cx + PhdMatrixPtr->_22 * sx;
m1 = PhdMatrixPtr->_22 * cx - PhdMatrixPtr->_21 * sx;
PhdMatrixPtr->_21 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_22 = m1 >> W2V_SHIFT;
}
}
void __cdecl phd_RotY(__int16 angle) {
if( angle != 0 ) {
int m0, m1;
int sy = phd_sin(angle);
int cy = phd_cos(angle);
m0 = PhdMatrixPtr->_00 * cy - PhdMatrixPtr->_02 * sy;
m1 = PhdMatrixPtr->_02 * cy + PhdMatrixPtr->_00 * sy;
PhdMatrixPtr->_00 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_02 = m1 >> W2V_SHIFT;
m0 = PhdMatrixPtr->_10 * cy - PhdMatrixPtr->_12 * sy;
m1 = PhdMatrixPtr->_12 * cy + PhdMatrixPtr->_10 * sy;
PhdMatrixPtr->_10 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_12 = m1 >> W2V_SHIFT;
m0 = PhdMatrixPtr->_20 * cy - PhdMatrixPtr->_22 * sy;
m1 = PhdMatrixPtr->_22 * cy + PhdMatrixPtr->_20 * sy;
PhdMatrixPtr->_20 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_22 = m1 >> W2V_SHIFT;
}
}
void __cdecl phd_RotZ(__int16 angle) {
if( angle != 0 ) {
int m0, m1;
int sz = phd_sin(angle);
int cz = phd_cos(angle);
m0 = PhdMatrixPtr->_00 * cz + PhdMatrixPtr->_01 * sz;
m1 = PhdMatrixPtr->_01 * cz - PhdMatrixPtr->_00 * sz;
PhdMatrixPtr->_00 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_01 = m1 >> W2V_SHIFT;
m0 = PhdMatrixPtr->_10 * cz + PhdMatrixPtr->_11 * sz;
m1 = PhdMatrixPtr->_11 * cz - PhdMatrixPtr->_10 * sz;
PhdMatrixPtr->_10 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_11 = m1 >> W2V_SHIFT;
m0 = PhdMatrixPtr->_20 * cz + PhdMatrixPtr->_21 * sz;
m1 = PhdMatrixPtr->_21 * cz - PhdMatrixPtr->_20 * sz;
PhdMatrixPtr->_20 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_21 = m1 >> W2V_SHIFT;
}
}
void __cdecl phd_RotYXZ(__int16 ry, __int16 rx, __int16 rz) {
int sx, cx;
int sy, cy;
int sz, cz;
int m0, m1;
if( ry != 0 ) {
sy = phd_sin(ry);
cy = phd_cos(ry);
m0 = PhdMatrixPtr->_00 * cy - PhdMatrixPtr->_02 * sy;
m1 = PhdMatrixPtr->_02 * cy + PhdMatrixPtr->_00 * sy;
PhdMatrixPtr->_00 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_02 = m1 >> W2V_SHIFT;
m0 = PhdMatrixPtr->_10 * cy - PhdMatrixPtr->_12 * sy;
m1 = PhdMatrixPtr->_12 * cy + PhdMatrixPtr->_10 * sy;
PhdMatrixPtr->_10 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_12 = m1 >> W2V_SHIFT;
m0 = PhdMatrixPtr->_20 * cy - PhdMatrixPtr->_22 * sy;
m1 = PhdMatrixPtr->_22 * cy + PhdMatrixPtr->_20 * sy;
PhdMatrixPtr->_20 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_22 = m1 >> W2V_SHIFT;
}
if( rx != 0 ) {
sx = phd_sin(rx);
cx = phd_cos(rx);
m0 = PhdMatrixPtr->_01 * cx + PhdMatrixPtr->_02 * sx;
m1 = PhdMatrixPtr->_02 * cx - PhdMatrixPtr->_01 * sx;
PhdMatrixPtr->_01 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_02 = m1 >> W2V_SHIFT;
m0 = PhdMatrixPtr->_11 * cx + PhdMatrixPtr->_12 * sx;
m1 = PhdMatrixPtr->_12 * cx - PhdMatrixPtr->_11 * sx;
PhdMatrixPtr->_11 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_12 = m1 >> W2V_SHIFT;
m0 = PhdMatrixPtr->_21 * cx + PhdMatrixPtr->_22 * sx;
m1 = PhdMatrixPtr->_22 * cx - PhdMatrixPtr->_21 * sx;
PhdMatrixPtr->_21 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_22 = m1 >> W2V_SHIFT;
}
if( rz != 0 ) {
sz = phd_sin(rz);
cz = phd_cos(rz);
m0 = PhdMatrixPtr->_00 * cz + PhdMatrixPtr->_01 * sz;
m1 = PhdMatrixPtr->_01 * cz - PhdMatrixPtr->_00 * sz;
PhdMatrixPtr->_00 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_01 = m1 >> W2V_SHIFT;
m0 = PhdMatrixPtr->_10 * cz + PhdMatrixPtr->_11 * sz;
m1 = PhdMatrixPtr->_11 * cz - PhdMatrixPtr->_10 * sz;
PhdMatrixPtr->_10 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_11 = m1 >> W2V_SHIFT;
m0 = PhdMatrixPtr->_20 * cz + PhdMatrixPtr->_21 * sz;
m1 = PhdMatrixPtr->_21 * cz - PhdMatrixPtr->_20 * sz;
PhdMatrixPtr->_20 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_21 = m1 >> W2V_SHIFT;
}
}
void __cdecl phd_RotYXZpack(DWORD rpack) {
int sx, cx;
int sy, cy;
int sz, cz;
int m0, m1;
__int16 rx = ((rpack >> 20) & 0x3FF) << 6;
__int16 ry = ((rpack >> 10) & 0x3FF) << 6;
__int16 rz = ((rpack >> 00) & 0x3FF) << 6;
if( ry != 0 ) {
sy = phd_sin(ry);
cy = phd_cos(ry);
m0 = PhdMatrixPtr->_00 * cy - PhdMatrixPtr->_02 * sy;
m1 = PhdMatrixPtr->_02 * cy + PhdMatrixPtr->_00 * sy;
PhdMatrixPtr->_00 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_02 = m1 >> W2V_SHIFT;
m0 = PhdMatrixPtr->_10 * cy - PhdMatrixPtr->_12 * sy;
m1 = PhdMatrixPtr->_12 * cy + PhdMatrixPtr->_10 * sy;
PhdMatrixPtr->_10 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_12 = m1 >> W2V_SHIFT;
m0 = PhdMatrixPtr->_20 * cy - PhdMatrixPtr->_22 * sy;
m1 = PhdMatrixPtr->_22 * cy + PhdMatrixPtr->_20 * sy;
PhdMatrixPtr->_20 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_22 = m1 >> W2V_SHIFT;
}
if( rx != 0 ) {
sx = phd_sin(rx);
cx = phd_cos(rx);
m0 = PhdMatrixPtr->_01 * cx + PhdMatrixPtr->_02 * sx;
m1 = PhdMatrixPtr->_02 * cx - PhdMatrixPtr->_01 * sx;
PhdMatrixPtr->_01 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_02 = m1 >> W2V_SHIFT;
m0 = PhdMatrixPtr->_11 * cx + PhdMatrixPtr->_12 * sx;
m1 = PhdMatrixPtr->_12 * cx - PhdMatrixPtr->_11 * sx;
PhdMatrixPtr->_11 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_12 = m1 >> W2V_SHIFT;
m0 = PhdMatrixPtr->_21 * cx + PhdMatrixPtr->_22 * sx;
m1 = PhdMatrixPtr->_22 * cx - PhdMatrixPtr->_21 * sx;
PhdMatrixPtr->_21 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_22 = m1 >> W2V_SHIFT;
}
if( rz != 0 ) {
sz = phd_sin(rz);
cz = phd_cos(rz);
m0 = PhdMatrixPtr->_00 * cz + PhdMatrixPtr->_01 * sz;
m1 = PhdMatrixPtr->_01 * cz - PhdMatrixPtr->_00 * sz;
PhdMatrixPtr->_00 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_01 = m1 >> W2V_SHIFT;
m0 = PhdMatrixPtr->_10 * cz + PhdMatrixPtr->_11 * sz;
m1 = PhdMatrixPtr->_11 * cz - PhdMatrixPtr->_10 * sz;
PhdMatrixPtr->_10 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_11 = m1 >> W2V_SHIFT;
m0 = PhdMatrixPtr->_20 * cz + PhdMatrixPtr->_21 * sz;
m1 = PhdMatrixPtr->_21 * cz - PhdMatrixPtr->_20 * sz;
PhdMatrixPtr->_20 = m0 >> W2V_SHIFT;
PhdMatrixPtr->_21 = m1 >> W2V_SHIFT;
}
}
BOOL __cdecl phd_TranslateRel(int x, int y, int z) {
PhdMatrixPtr->_03 += PhdMatrixPtr->_00 * x + PhdMatrixPtr->_01 * y + PhdMatrixPtr->_02 * z;
PhdMatrixPtr->_13 += PhdMatrixPtr->_10 * x + PhdMatrixPtr->_11 * y + PhdMatrixPtr->_12 * z;
PhdMatrixPtr->_23 += PhdMatrixPtr->_20 * x + PhdMatrixPtr->_21 * y + PhdMatrixPtr->_22 * z;
if( ABS(PhdMatrixPtr->_03) > PhdFarZ ||
ABS(PhdMatrixPtr->_13) > PhdFarZ ||
ABS(PhdMatrixPtr->_23) > PhdFarZ )
{
return FALSE;
}
return TRUE;
}
void __cdecl phd_TranslateAbs(int x, int y, int z) {
x -= MatrixW2V._03;
y -= MatrixW2V._13;
z -= MatrixW2V._23;
PhdMatrixPtr->_03 = x * PhdMatrixPtr->_00 + y * PhdMatrixPtr->_01 + z * PhdMatrixPtr->_02;
PhdMatrixPtr->_13 = x * PhdMatrixPtr->_10 + y * PhdMatrixPtr->_11 + z * PhdMatrixPtr->_12;
PhdMatrixPtr->_23 = x * PhdMatrixPtr->_20 + y * PhdMatrixPtr->_21 + z * PhdMatrixPtr->_22;
}
void __cdecl phd_PutPolygons(__int16 *ptrObj, int clip) {
FltWinLeft = (float)PhdWinMinX;
FltWinTop = (float)PhdWinMinY;
FltWinRight = (float)(PhdWinMinX + PhdWinMaxX + 1);
FltWinBottom = (float)(PhdWinMinY + PhdWinMaxY + 1);
FltWinCenterX = (float)(PhdWinMinX + PhdWinCenterX);
FltWinCenterY = (float)(PhdWinMinY + PhdWinCenterY);
#ifdef FEATURE_VIDEOFX_IMPROVED
__int16 *ptrEnv = ptrObj;
#endif // FEATURE_VIDEOFX_IMPROVED
ptrObj += 4; // skip x, y, z, radius
ptrObj = calc_object_vertices(ptrObj);
if( ptrObj != NULL ) {
ptrObj = calc_vertice_light(ptrObj);
ptrObj = ins_objectGT4(ptrObj+1, *ptrObj, ST_AvgZ);
ptrObj = ins_objectGT3(ptrObj+1, *ptrObj, ST_AvgZ);
ptrObj = ins_objectG4(ptrObj+1, *ptrObj, ST_AvgZ);
ptrObj = ins_objectG3(ptrObj+1, *ptrObj, ST_AvgZ);
#ifdef FEATURE_VIDEOFX_IMPROVED
phd_PutEnvmapPolygons(ptrEnv);
#endif // FEATURE_VIDEOFX_IMPROVED
}
}
void __cdecl S_InsertRoom(__int16 *ptrObj, BOOL isOutside) {
FltWinLeft = (float)(PhdWinMinX + PhdWinLeft);
FltWinTop = (float)(PhdWinMinY + PhdWinTop);
FltWinRight = (float)(PhdWinMinX + PhdWinRight + 1);
FltWinBottom = (float)(PhdWinMinY + PhdWinBottom + 1);
FltWinCenterX = (float)(PhdWinMinX + PhdWinCenterX);
FltWinCenterY = (float)(PhdWinMinY + PhdWinCenterY);
ptrObj = calc_roomvert(ptrObj, isOutside?0x00:0x10);
ptrObj = ins_objectGT4(ptrObj+1, *ptrObj, ST_MaxZ);
ptrObj = ins_objectGT3(ptrObj+1, *ptrObj, ST_MaxZ);
ptrObj = ins_room_sprite(ptrObj+1, *ptrObj);
}
__int16 *__cdecl calc_background_light(__int16 *ptrObj) {
int vtxCount = *ptrObj++;
if( vtxCount > 0 ) {
ptrObj += 3 * vtxCount;
}
else if( vtxCount < 0 ) {
vtxCount = -vtxCount;
ptrObj += vtxCount;
}
// Skybox has normal brightness
int shade = 0x0FFF;
// NOTE: Sunset did not change the skybox brightness in the original game
if( GF_SunsetEnabled )
shade += 0x400 * SunsetTimer / SUNSET_TIMEOUT;
for( int i = 0; i < vtxCount; ++i )
PhdVBuf[i].g = shade;
return ptrObj;
}
void __cdecl S_InsertBackground(__int16 *ptrObj) {
FltWinLeft = (float)(PhdWinMinX + PhdWinLeft);
FltWinTop = (float)(PhdWinMinY + PhdWinTop);
FltWinRight = (float)(PhdWinMinX + PhdWinRight + 1);
FltWinBottom = (float)(PhdWinMinY + PhdWinBottom + 1);
FltWinCenterX = (float)(PhdWinMinX + PhdWinCenterX);
FltWinCenterY = (float)(PhdWinMinY + PhdWinCenterY);
ptrObj += 4; // skip x, y, z, radius
ptrObj = calc_object_vertices(ptrObj);
if( ptrObj == NULL ) {
return;
}
ptrObj = calc_background_light(ptrObj);
#ifdef FEATURE_VIEW_IMPROVED
MidSort = 0xFFFF;
#endif // FEATURE_VIEW_IMPROVED
if( SavedAppSettings.RenderMode == RM_Hardware ) {
HWR_EnableZBuffer(false, false);
}
ptrObj = ins_objectGT4(ptrObj+1, *ptrObj, ST_FarZ);
ptrObj = ins_objectGT3(ptrObj+1, *ptrObj, ST_FarZ);
ptrObj = ins_objectG4(ptrObj+1, *ptrObj, ST_FarZ);
ptrObj = ins_objectG3(ptrObj+1, *ptrObj, ST_FarZ);
if( SavedAppSettings.RenderMode == RM_Hardware ) {
HWR_EnableZBuffer(true, true);
}
#ifdef FEATURE_VIEW_IMPROVED
MidSort = 0;
#endif // FEATURE_VIEW_IMPROVED
}
void __cdecl S_InsertInvBgnd(__int16 *ptrObj) {
// NOTE: Null function in the PC version.
// But there is waving inventory function in the PlayStation version.
// Main S_InsertInvBgnd() logic is similar to S_InsertBackground();
}
__int16 *__cdecl calc_object_vertices(__int16 *ptrObj) {
double xv, yv, zv, persp, baseZ;
int vtxCount;
BYTE totalClip, clipFlags;
baseZ = 0.0;
#ifndef FEATURE_VIEW_IMPROVED
if( SavedAppSettings.RenderMode == RM_Software || !SavedAppSettings.ZBuffer ) {
baseZ = (double)(MidSort << (W2V_SHIFT + 8));
}
#endif // !FEATURE_VIEW_IMPROVED
totalClip = 0xFF;
ptrObj++; // skip poly counter
vtxCount = *(ptrObj++); // get vertex counter
if( vtxCount < 0 ) {
printf("vtxCount=%d", vtxCount);
}
for( int i = 0; i < vtxCount; ++i ) {
xv = (double)(PhdMatrixPtr->_00 * ptrObj[0] +
PhdMatrixPtr->_01 * ptrObj[1] +
PhdMatrixPtr->_02 * ptrObj[2] +
PhdMatrixPtr->_03);
yv = (double)(PhdMatrixPtr->_10 * ptrObj[0] +
PhdMatrixPtr->_11 * ptrObj[1] +
PhdMatrixPtr->_12 * ptrObj[2] +
PhdMatrixPtr->_13);
zv = (double)(PhdMatrixPtr->_20 * ptrObj[0] +
PhdMatrixPtr->_21 * ptrObj[1] +
PhdMatrixPtr->_22 * ptrObj[2] +
PhdMatrixPtr->_23);
PhdVBuf[i].xv = xv;
PhdVBuf[i].yv = yv;
if( zv < FltNearZ ) {
clipFlags = 0x80;
PhdVBuf[i].zv = zv;
} else {
clipFlags = 0;
if( zv >= FltFarZ ) {
zv = FltFarZ;
PhdVBuf[i].zv = zv;
} else {
PhdVBuf[i].zv = zv + baseZ;
}
persp = FltPersp / zv;
PhdVBuf[i].xs = persp * xv + FltWinCenterX;
PhdVBuf[i].ys = persp * yv + FltWinCenterY;
PhdVBuf[i].rhw = persp * FltRhwOPersp;
if( PhdVBuf[i].xs < FltWinLeft )
clipFlags |= 0x01;
else if( PhdVBuf[i].xs > FltWinRight )
clipFlags |= 0x02;
if( PhdVBuf[i].ys < FltWinTop )
clipFlags |= 0x04;
else if( PhdVBuf[i].ys > FltWinBottom )
clipFlags |= 0x08;
}
PhdVBuf[i].clip = clipFlags;
totalClip &= clipFlags;
ptrObj += 3;
}
return ( totalClip == 0 ) ? ptrObj : NULL;
}
__int16 *__cdecl calc_vertice_light(__int16 *ptrObj) {
int i, xv, yv, zv;
__int16 shade;
int vtxCount = *ptrObj++;
if( vtxCount > 0 ) {
if( LsDivider != 0 ) {
xv = (PhdMatrixPtr->_00 * LsVectorView.x +
PhdMatrixPtr->_10 * LsVectorView.y +
PhdMatrixPtr->_20 * LsVectorView.z) / LsDivider;
yv = (PhdMatrixPtr->_01 * LsVectorView.x +
PhdMatrixPtr->_11 * LsVectorView.y +
PhdMatrixPtr->_21 * LsVectorView.z) / LsDivider;
zv = (PhdMatrixPtr->_02 * LsVectorView.x +
PhdMatrixPtr->_12 * LsVectorView.y +
PhdMatrixPtr->_22 * LsVectorView.z) / LsDivider;
for( i = 0; i < vtxCount; ++i ) {
shade = LsAdder + ((ptrObj[0]*xv + ptrObj[1]*yv + ptrObj[2]*zv) >> 16);
CLAMP(shade, 0, 0x1FFF);
PhdVBuf[i].g = shade;
ptrObj += 3;
}
} else {
shade = LsAdder;
CLAMP(shade, 0, 0x1FFF);
for( i = 0; i < vtxCount; ++i ) {
PhdVBuf[i].g = shade;
}
ptrObj += 3*vtxCount;
}
} else {
for( i = 0; i < -vtxCount; ++i ) {
shade = LsAdder + *ptrObj;
CLAMP(shade, 0, 0x1FFF);
PhdVBuf[i].g = shade;
++ptrObj;
}
}
return ptrObj;
}
__int16 *__cdecl calc_roomvert(__int16 *ptrObj, BYTE farClip) {
double xv, yv, zv, persp, baseZ, depth;
int vtxCount, zv_int;
baseZ = 0.0;
#ifndef FEATURE_VIEW_IMPROVED
if( SavedAppSettings.RenderMode == RM_Software || !SavedAppSettings.ZBuffer ) {
baseZ = (double)(MidSort << (W2V_SHIFT + 8));
}
#endif // !FEATURE_VIEW_IMPROVED
vtxCount = *(ptrObj++);
for( int i = 0; i < vtxCount; ++i ) {
xv = (double)(PhdMatrixPtr->_00 * ptrObj[0] +
PhdMatrixPtr->_01 * ptrObj[1] +
PhdMatrixPtr->_02 * ptrObj[2] +
PhdMatrixPtr->_03);
yv = (double)(PhdMatrixPtr->_10 * ptrObj[0] +
PhdMatrixPtr->_11 * ptrObj[1] +
PhdMatrixPtr->_12 * ptrObj[2] +
PhdMatrixPtr->_13);
zv_int = (PhdMatrixPtr->_20 * ptrObj[0] +
PhdMatrixPtr->_21 * ptrObj[1] +
PhdMatrixPtr->_22 * ptrObj[2] +
PhdMatrixPtr->_23);
zv = (double)zv_int;
PhdVBuf[i].xv = xv;
PhdVBuf[i].yv = yv;
PhdVBuf[i].g = ptrObj[5];
if( IsWaterEffect != 0 )
PhdVBuf[i].g += ShadesTable[(WibbleOffset + (BYTE)RandomTable[(vtxCount - i) % WIBBLE_SIZE]) % WIBBLE_SIZE];
if( zv < FltNearZ ) {
PhdVBuf[i].clip = 0xFF80;
PhdVBuf[i].zv = zv;
} else {
persp = FltPersp / zv;
depth = zv_int >> W2V_SHIFT;
#ifdef FEATURE_VIEW_IMPROVED
if( depth >= PhdViewDistance ) {
PhdVBuf[i].rhw = persp * FltRhwOPersp;
PhdVBuf[i].zv = zv + baseZ;
#else // !FEATURE_VIEW_IMPROVED
if( depth >= DEPTHQ_END ) { // fog end
PhdVBuf[i].rhw = 0.0; // NOTE: zero RHW is an invalid value, but the original game sets it.
PhdVBuf[i].zv = FltFarZ;
#endif // FEATURE_VIEW_IMPROVED
PhdVBuf[i].g = 0x1FFF;
PhdVBuf[i].clip = farClip;
} else {
#ifdef FEATURE_VIEW_IMPROVED
PhdVBuf[i].g += CalculateFogShade(depth);
#else // !FEATURE_VIEW_IMPROVED
if( depth > DEPTHQ_START ) { // fog begin
PhdVBuf[i].g += depth - DEPTHQ_START;
}
#endif // FEATURE_VIEW_IMPROVED
PhdVBuf[i].rhw = persp * FltRhwOPersp;
PhdVBuf[i].clip = 0;
PhdVBuf[i].zv = zv + baseZ;
}
PhdVBuf[i].xs = persp * xv + FltWinCenterX;
PhdVBuf[i].ys = persp * yv + FltWinCenterY;
if( IsWibbleEffect && ptrObj[4] >= 0 ) {
PhdVBuf[i].xs += WibbleTable[(WibbleOffset + (BYTE)PhdVBuf[i].ys) % WIBBLE_SIZE];
PhdVBuf[i].ys += WibbleTable[(WibbleOffset + (BYTE)PhdVBuf[i].xs) % WIBBLE_SIZE];
}
if( PhdVBuf[i].xs < FltWinLeft )
PhdVBuf[i].clip |= 0x01;
else if( PhdVBuf[i].xs > FltWinRight )
PhdVBuf[i].clip |= 0x02;
if( PhdVBuf[i].ys < FltWinTop )
PhdVBuf[i].clip |= 0x04;
else if( PhdVBuf[i].ys > FltWinBottom )
PhdVBuf[i].clip |= 0x08;
PhdVBuf[i].clip |= ~(BYTE)(PhdVBuf[i].zv / 0x155555.p0) << 8;
}
CLAMP(PhdVBuf[i].g, 0, 0x1FFF);
ptrObj += 6;
}
return ptrObj;
}
void __cdecl phd_RotateLight(__int16 pitch, __int16 yaw) {
int xcos, ysin, wcos, wsin;
int ls_x, ls_y, ls_z;
PhdLsYaw = yaw;
PhdLsPitch = pitch;
xcos = phd_cos(pitch);
ysin = phd_sin(pitch);
wcos = phd_cos(yaw);
wsin = phd_sin(yaw);
ls_x = TRIGMULT2(xcos, wsin);
ls_y = -ysin;
ls_z = TRIGMULT2(xcos, wcos);
LsVectorView.x = (MatrixW2V._00 * ls_x + MatrixW2V._01 * ls_y + MatrixW2V._02 * ls_z) >> W2V_SHIFT;
LsVectorView.y = (MatrixW2V._10 * ls_x + MatrixW2V._11 * ls_y + MatrixW2V._12 * ls_z) >> W2V_SHIFT;
LsVectorView.z = (MatrixW2V._20 * ls_x + MatrixW2V._21 * ls_y + MatrixW2V._22 * ls_z) >> W2V_SHIFT;
}
void __cdecl phd_InitPolyList() {
SurfaceCount = 0;
Sort3dPtr = SortBuffer;
Info3dPtr = Info3dBuffer;
if( SavedAppSettings.RenderMode == RM_Hardware )
HWR_VertexPtr = HWR_VertexBuffer;
}
void __cdecl phd_SortPolyList() {
if( SurfaceCount ) {
for( DWORD i=0; i<SurfaceCount; ++i ) {
#ifdef FEATURE_VIEW_IMPROVED
SortBuffer[i]._1 <<= 16;
#endif // FEATURE_VIEW_IMPROVED
SortBuffer[i]._1 += i;
}
do_quickysorty(0, SurfaceCount-1);
}
}
void __cdecl do_quickysorty(int left, int right) {
#ifdef FEATURE_VIEW_IMPROVED
UINT64 swapBuf;
UINT64 compare = SortBuffer[(left + right) / 2]._1;
#else // FEATURE_VIEW_IMPROVED
DWORD swapBuf;
DWORD compare = SortBuffer[(left + right) / 2]._1;
#endif // FEATURE_VIEW_IMPROVED
int i = left;
int j = right;
do {
while( (i < right) && (SortBuffer[i]._1 > compare) ) ++i;
while( (left < j) && (compare > SortBuffer[j]._1) ) --j;
if( i > j ) break;
SWAP(SortBuffer[i]._0, SortBuffer[j]._0, swapBuf);
SWAP(SortBuffer[i]._1, SortBuffer[j]._1, swapBuf);
} while( ++i <= --j );
if( left < j )
do_quickysorty(left, j);
if( i < right )
do_quickysorty(i, right);
}
void __cdecl phd_PrintPolyList(BYTE *surfacePtr) {
__int16 polyType, *bufPtr;
PrintSurfacePtr = surfacePtr;
for( DWORD i=0; i<SurfaceCount; ++i ) {
bufPtr = (__int16 *)SortBuffer[i]._0;
polyType = *(bufPtr++); // poly has type as routine index in first word
PolyDrawRoutines[polyType](bufPtr); // send poly data as parameter to routine
}
}
void __cdecl AlterFOV(__int16 fov) {
fov /= 2; // half fov angle
#ifdef FEATURE_VIEW_IMPROVED
int fovWidth = PhdWinHeight*320/(PsxFovEnabled ? 200 : 240);
FltViewAspect = 1.0; // must always be 1.0 for unstretched view
PhdPersp = (fovWidth / 2) * phd_cos(fov) / phd_sin(fov);
#else // !FEATURE_VIEW_IMPROVED
PhdPersp = (PhdWinWidth / 2) * phd_cos(fov) / phd_sin(fov);
#endif // FEATURE_VIEW_IMPROVED
FltPersp = (float)PhdPersp;
FltRhwOPersp = RhwFactor / FltPersp;
FltPerspONearZ = FltPersp / FltNearZ;
#ifndef FEATURE_VIEW_IMPROVED // if feature is not defined!!!
double windowAspect = 4.0 / 3.0;
if( !SavedAppSettings.FullScreen && SavedAppSettings.AspectMode == AM_16_9 ) {
windowAspect = 16.0 / 9.0;
}
FltViewAspect = windowAspect / ((double)PhdWinWidth / (double)PhdWinHeight);
#endif // !FEATURE_VIEW_IMPROVED
}
void __cdecl phd_SetNearZ(int nearZ) {
PhdNearZ = nearZ;
FltNearZ = (float)nearZ;
FltRhwONearZ = RhwFactor / FltNearZ;
FltPerspONearZ = FltPersp / FltNearZ;
double resZ = 0.99 * FltFarZ * FltNearZ / (FltFarZ - FltNearZ);
FltResZ = resZ;
FltResZORhw = resZ / RhwFactor;
FltResZBuf = 0.005 + resZ / FltNearZ;
}
void __cdecl phd_SetFarZ(int farZ) {
PhdFarZ = farZ;
FltFarZ = (float)farZ;
double resZ = 0.99 * FltFarZ * FltNearZ / (FltFarZ - FltNearZ);
FltResZ = resZ;
FltResZORhw = resZ / RhwFactor;
FltResZBuf = 0.005 + resZ / FltNearZ;
}
void __cdecl phd_InitWindow(__int16 x, __int16 y, int width, int height, int nearZ, int farZ, __int16 viewAngle, int screenWidth, int screenHeight) {
PhdWinMinX = x;
PhdWinMinY = y;
PhdWinMaxX = width - 1;
PhdWinMaxY = height - 1;
PhdWinWidth = width;
PhdWinHeight = height;
PhdWinCenterX = width / 2;
PhdWinCenterY = height / 2;
FltWinCenterX = (float)PhdWinCenterX;
FltWinCenterY = (float)PhdWinCenterY;
PhdWinLeft = 0;
PhdWinTop = 0;
PhdWinRight = PhdWinMaxX;
PhdWinBottom = PhdWinMaxY;
PhdWinRect.left = PhdWinMinX;
PhdWinRect.bottom = PhdWinMinY + PhdWinHeight;
PhdWinRect.top = PhdWinMinY;
PhdWinRect.right = PhdWinMinX + PhdWinWidth;
PhdScreenWidth = screenWidth;
PhdScreenHeight = screenHeight;
#ifdef FEATURE_VIEW_IMPROVED
double baseDistance = (double)farZ;
farZ = (int)(baseDistance * ViewDistanceFactor);
FogBeginDepth = (int)(baseDistance * FogBeginFactor);
FogEndDepth = (int)(baseDistance * FogEndFactor);
WaterFogBeginDepth = (int)(baseDistance * WaterFogBeginFactor);
WaterFogEndDepth = (int)(baseDistance * WaterFogEndFactor);
#endif // FEATURE_VIEW_IMPROVED
PhdNearZ = nearZ << W2V_SHIFT;
PhdFarZ = farZ << W2V_SHIFT;
PhdViewDistance = farZ;
AlterFOV(PHD_DEGREE * viewAngle); // convert degrees to PHD angle
phd_SetNearZ(PhdNearZ);
phd_SetFarZ(PhdFarZ);
PhdMatrixPtr = MatrixStack; // reset matrix stack pointer
if( SavedAppSettings.RenderMode == RM_Software ) {
PerspectiveDistance = SavedAppSettings.PerspectiveCorrect ? SW_DETAIL_HIGH : SW_DETAIL_MEDIUM;
ins_objectGT3 = InsertObjectGT3;
ins_objectGT4 = InsertObjectGT4;
ins_objectG3 = InsertObjectG3;
ins_objectG4 = InsertObjectG4;
ins_flat_rect = InsertFlatRect;
ins_line = InsertLine;
ins_sprite = InsertSprite;
ins_poly_trans8 = InsertTrans8;
ins_trans_quad = InsertTransQuad;
}
else if( SavedAppSettings.RenderMode == RM_Hardware ) {
if( SavedAppSettings.ZBuffer ) {
ins_objectGT3 = InsertObjectGT3_ZBuffered;
ins_objectGT4 = InsertObjectGT4_ZBuffered;
ins_objectG3 = InsertObjectG3_ZBuffered;
ins_objectG4 = InsertObjectG4_ZBuffered;
ins_flat_rect = InsertFlatRect_ZBuffered;
ins_line = InsertLine_ZBuffered;
} else {
ins_objectGT3 = InsertObjectGT3_Sorted;
ins_objectGT4 = InsertObjectGT4_Sorted;
ins_objectG3 = InsertObjectG3_Sorted;
ins_objectG4 = InsertObjectG4_Sorted;
ins_flat_rect = InsertFlatRect_Sorted;
ins_line = InsertLine_Sorted;
}
ins_sprite = InsertSprite_Sorted;
ins_poly_trans8 = InsertTrans8_Sorted;
ins_trans_quad = InsertTransQuad_Sorted;
}
}
void __cdecl phd_PopMatrix() {
--PhdMatrixPtr;
}
void __cdecl phd_PushMatrix() {
PhdMatrixPtr[1] = PhdMatrixPtr[0]; // copy the last matrix
++PhdMatrixPtr;
}
void __cdecl phd_PushUnitMatrix() {
++PhdMatrixPtr;
memset(PhdMatrixPtr, 0, sizeof(PHD_MATRIX));
PhdMatrixPtr->_00 = W2V_SCALE;
PhdMatrixPtr->_11 = W2V_SCALE;
PhdMatrixPtr->_22 = W2V_SCALE;
}
/*
* Inject function
*/
void Inject_3Dgen() {
INJECT(0x00401000, phd_GenerateW2V);
INJECT(0x004011D0, phd_LookAt);
INJECT(0x00401250, phd_GetVectorAngles);
INJECT(0x004012D0, phd_RotX);
INJECT(0x00401380, phd_RotY);
INJECT(0x00401430, phd_RotZ);
INJECT(0x004014E0, phd_RotYXZ);
INJECT(0x004016C0, phd_RotYXZpack);
INJECT(0x004018B0, phd_TranslateRel);
INJECT(0x00401960, phd_TranslateAbs);
INJECT(0x004019E0, phd_PutPolygons);
INJECT(0x00401AE0, S_InsertRoom);
INJECT(0x00401BD0, calc_background_light);
INJECT(0x00401C10, S_InsertBackground);
// INJECT(----------, S_InsertInvBgnd); // NOTE: this is null in the original code
INJECT(0x00401D50, calc_object_vertices);
INJECT(0x00401F30, calc_vertice_light);
INJECT(0x004020A0, calc_roomvert);
INJECT(0x00402320, phd_RotateLight);
INJECT(0x004023F0, phd_InitPolyList);
INJECT(0x00402420, phd_SortPolyList);
INJECT(0x00402460, do_quickysorty);
INJECT(0x00402530, phd_PrintPolyList);
INJECT(0x00402570, AlterFOV);
INJECT(0x00402680, phd_SetNearZ);
INJECT(0x004026D0, phd_SetFarZ);
INJECT(0x004026F0, phd_InitWindow);
// INJECT(----------, phd_PopMatrix); // NOTE: this is inline or macro in the original code
INJECT(0x00457510, phd_PushMatrix);
INJECT(0x0045752E, phd_PushUnitMatrix);
}
================================================
FILE: 3dsystem/3d_gen.h
================================================
/*
* Copyright (c) 2017-2020 Michael Chaban. All rights reserved.
* Original game is created by Core Design Ltd. in 1997.
* Lara Croft and Tomb Raider are trademarks of Embracer Group AB.
*
* This file is part of TR2Main.
*
* TR2Main is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TR2Main is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TR2Main. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _3DGEN_H_INCLUDED
#define _3DGEN_H_INCLUDED
#include "global/types.h"
/*
* Function list
*/
#ifdef FEATURE_VIDEOFX_IMPROVED
void ClearMeshReflectState();
void SetMeshReflectState(int objID, int meshIdx);
#endif // FEATURE_VIDEOFX_IMPROVED
void phd_GenerateW2V(PHD_3DPOS *viewPos); // 0x00401000
void __cdecl phd_LookAt(int xsrc, int ysrc, int zsrc, int xtar, int ytar, int ztar, __int16 roll); // 0x004011D0
void __cdecl phd_GetVectorAngles(int x, int y, int z, VECTOR_ANGLES *angles); // 0x00401250
void __cdecl phd_RotX(__int16 angle); // 0x004012D0
void __cdecl phd_RotY(__int16 angle); // 0x00401380
void __cdecl phd_RotZ(__int16 angle); // 0x00401430
void __cdecl phd_RotYXZ(__int16 ry, __int16 rx, __int16 rz); // 0x004014E0
void __cdecl phd_RotYXZpack(DWORD rpack); // 0x004016C0
BOOL __cdecl phd_TranslateRel(int x, int y, int z); // 0x004018B0
void __cdecl phd_TranslateAbs(int x, int y, int z); // 0x00401960
void __cdecl phd_PutPolygons(__int16 *ptrObj, int clip); // 0x004019E0
void __cdecl S_InsertRoom(__int16 *ptrObj, BOOL isOutside); // 0x00401AE0
__int16 *__cdecl calc_background_light(__int16 *ptrObj); // 0x00401BD0
void __cdecl S_InsertBackground(__int16 *ptrObj); // 0x00401C10
void __cdecl S_InsertInvBgnd(__int16 *ptrObj); // ----------
__int16 *__cdecl calc_object_vertices(__int16 *ptrObj); // 0x00401D50
__int16 *__cdecl calc_vertice_light(__int16 *ptrObj); // 0x00401F30
__int16 *__cdecl calc_roomvert(__int16 *ptrObj, BYTE farClip); // 0x004020A0
void __cdecl phd_RotateLight(__int16 pitch, __int16 yaw); // 0x00402320
void __cdecl phd_InitPolyList(); // 0x004023F0
void __cdecl phd_SortPolyList(); // 0x00402420
void __cdecl do_quickysorty(int left, int right); // 0x00402460
void __cdecl phd_PrintPolyList(BYTE *surfacePtr); // 0x00402530
void __cdecl AlterFOV(__int16 fov); // 0x00402570
void __cdecl phd_SetNearZ(int nearZ); // 0x00402680
void __cdecl phd_SetFarZ(int farZ); // 0x004026D0
void __cdecl phd_InitWindow(__int16 x, __int16 y, int width, int height, int nearZ, int farZ, __int16 viewAngle, int screenWidth, int screenHeight); // 0x004026F0
void __cdecl phd_PopMatrix(); // ----------
void __cdecl phd_PushMatrix(); // 0x00457510
void __cdecl phd_PushUnitMatrix(); // 0x0045752E
#endif // _3DGEN_H_INCLUDED
================================================
FILE: 3dsystem/3d_out.cpp
================================================
/*
* Copyright (c) 2017-2020 Michael Chaban. All rights reserved.
* Original game is created by Core Design Ltd. in 1997.
* Lara Croft and Tomb Raider are trademarks of Embracer Group AB.
*
* This file is part of TR2Main.
*
* TR2Main is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TR2Main is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TR2Main. If not, see <http://www.gnu.org/licenses/>.
*/
#include "global/precompiled.h"
#include "3dsystem/3d_out.h"
#include "global/vars.h"
#pragma pack(push, 1)
typedef struct {
UINT16 x;
UINT16 y;
} XGEN_X;
typedef struct {
UINT16 x;
UINT16 y;
UINT16 g;
} XGEN_XG;
typedef struct {
UINT16 x;
UINT16 y;
UINT16 g;
UINT16 u;
UINT16 v;
} XGEN_XGUV;
typedef struct {
UINT16 x;
UINT16 y;
UINT16 g;
float rhw;
float u;
float v;
} XGEN_XGUVP;
typedef struct {
int x0;
int x1;
} XBUF_X;
typedef struct {
int x0;
int g0;
int x1;
int g1;
} XBUF_XG;
typedef struct {
int x0;
int g0;
int u0;
int v0;
int x1;
int g1;
int u1;
int v1;
} XBUF_XGUV;
typedef struct {
int x0;
int g0;
float u0;
float v0;
float rhw0;
int x1;
int g1;
float u1;
float v1;
float rhw1;
} XBUF_XGUVP;
#pragma pack(pop)
#ifdef FEATURE_NOLEGACY_OPTIONS
static int SwrPitch = 0;
static int SwrHeight = 0;
static void *XBuffer = NULL;
int GetPitchSWR() {
return SwrPitch;
}
void PrepareSWR(int pitch, int height) {
if( pitch != 0 ) {
SwrPitch = pitch;
}
if( height != 0 && (XBuffer == NULL || SwrHeight != height) ) {
SwrHeight = height;
if( XBuffer != NULL ) free(XBuffer);
XBuffer = malloc(sizeof(XBUF_XGUVP) * height);
}
}
#else // FEATURE_NOLEGACY_OPTIONS
#define SwrPitch PhdScreenWidth // NOTE: this is the original game bug!
static int XBuffer[1200 * sizeof(XBUF_XGUVP) / sizeof(int)]; // maximum safe resolution is 1200 pixels
#endif // FEATURE_NOLEGACY_OPTIONS
void __cdecl draw_poly_line(__int16 *bufPtr) {
int i, j;
int x0, y0, x1, y1;
int xSize, ySize, xAdd, yAdd, colAdd, rowAdd;
int swapBuf, part, partTotal;
BYTE colorIdx;
BYTE *drawPtr;
x0 = *(bufPtr++);
y0 = *(bufPtr++);
x1 = *(bufPtr++);
y1 = *(bufPtr++);
colorIdx = (BYTE)*bufPtr;
if( x1 < x0 ) {
SWAP(x0, x1, swapBuf);
SWAP(y0, y1, swapBuf);
}
if( x1 < 0 || x0 > PhdWinMaxX )
return;
if( x0 < 0 ) {
y0 -= x0 * (y1 - y0) / (x1 - x0);
x0 = 0;
}
if( x1 > PhdWinMaxX ) {
y1 = y0 + (y1 - y0) * (PhdWinMaxX - x0) / (x1 - x0);
x1 = PhdWinMaxX;
}
if( y1 < y0 ) {
SWAP(x0, x1, swapBuf);
SWAP(y0, y1, swapBuf);
}
if( y1 < 0 || y0 > PhdWinMaxY )
return;
if( y0 < 0 ) {
x0 -= y0 * (x1 - x0) / (y1 - y0);
y0 = 0;
}
if( y1 > PhdWinMaxY ) {
x1 = x0 + (x1 - x0) * (PhdWinMaxY - y0) / (y1 - y0);
y1 = PhdWinMaxY;
}
drawPtr = PrintSurfacePtr + (SwrPitch * y0 + x0);
xSize = x1 - x0;
ySize = y1 - y0;
if( (xSize|ySize) == 0 ) {
*drawPtr = colorIdx;
return;
}
if( xSize < 0 ) {
xSize = -xSize;
xAdd = -1;
} else {
xAdd = 1;
}
if( ySize < 0 ) {
ySize = -ySize;
yAdd = -SwrPitch;
} else {
yAdd = SwrPitch;
}
if( xSize >= ySize ) {
i = xSize + 1;
j = ySize + 1;
colAdd = xAdd;
rowAdd = yAdd;
} else {
i = ySize + 1;
j = xSize + 1;
colAdd = yAdd;
rowAdd = xAdd;
}
partTotal = 0;
part = PHD_ONE * j / i;
while( i-- ) {
partTotal += part;
*drawPtr = colorIdx;
drawPtr += colAdd;
if( partTotal >= PHD_ONE ) {
drawPtr += rowAdd;
partTotal -= PHD_ONE;
}
}
}
void __cdecl draw_poly_flat(__int16 *bufPtr) {
if( xgen_x(bufPtr + 1) )
flatA(XGen_y0, XGen_y1, *bufPtr);
}
void __cdecl draw_poly_trans(__int16 *bufPtr) {
if( xgen_x(bufPtr + 1) )
transA(XGen_y0, XGen_y1, *bufPtr);
}
void __cdecl draw_poly_gouraud(__int16 *bufPtr) {
if( xgen_xg(bufPtr + 1) )
gourA(XGen_y0, XGen_y1, *bufPtr);
}
void __cdecl draw_poly_gtmap(__int16 *bufPtr) {
if( xgen_xguv(bufPtr + 1) )
gtmapA(XGen_y0, XGen_y1, TexturePageBuffer8[*bufPtr]);
}
void __cdecl draw_poly_wgtmap(__int16 *bufPtr) {
if( xgen_xguv(bufPtr + 1) )
wgtmapA(XGen_y0, XGen_y1, TexturePageBuffer8[*bufPtr]);
}
BOOL __cdecl xgen_x(__int16 *bufPtr) {
int ptCount;
XGEN_X *pt1, *pt2;
int yMin, yMax;
int x1, y1, x2, y2;
int xSize, ySize;
int x, xAdd;
XBUF_X *xPtr;
ptCount = *bufPtr++;
pt2 = (XGEN_X *)bufPtr;
pt1 = pt2 + (ptCount - 1);
yMin = yMax = pt1->y;
while( ptCount-- ) {
x1 = pt1->x;
y1 = pt1->y;
x2 = pt2->x;
y2 = pt2->y;
pt1 = pt2++;
if( y1 < y2 ) {
CLAMPG(yMin, y1);
xSize = x2 - x1;
ySize = y2 - y1;
xPtr = (XBUF_X *)XBuffer + y1;
xAdd = PHD_ONE * xSize / ySize;
x = x1 * PHD_ONE + (PHD_ONE - 1);
do {
(xPtr++)->x1 = (x += xAdd);
} while( --ySize );
}
else if( y2 < y1 ) {
CLAMPL(yMax, y1);
xSize = x1 - x2;
ySize = y1 - y2;
xPtr = (XBUF_X *)XBuffer + y2;
xAdd = PHD_ONE * xSize / ySize;
x = x2 * PHD_ONE + 1;
do {
(xPtr++)->x0 = (x += xAdd);
} while( --ySize );
}
}
if( yMin == yMax )
return FALSE;
XGen_y0 = yMin;
XGen_y1 = yMax;
return TRUE;
}
BOOL __cdecl xgen_xg(__int16 *bufPtr) {
int ptCount;
XGEN_XG *pt1, *pt2;
int yMin, yMax;
int x1, y1, g1, x2, y2, g2;
int xSize, ySize, gSize;
int x, g, xAdd, gAdd;
XBUF_XG *xgPtr;
ptCount = *bufPtr++;
pt2 = (XGEN_XG *)bufPtr;
pt1 = pt2 + (ptCount - 1);
yMin = yMax = pt1->y;
while( ptCount-- ) {
x1 = pt1->x;
y1 = pt1->y;
g1 = pt1->g;
x2 = pt2->x;
y2 = pt2->y;
g2 = pt2->g;
pt1 = pt2++;
if( y1 < y2 ) {
CLAMPG(yMin, y1);
xSize = x2 - x1;
ySize = y2 - y1;
gSize = g2 - g1;
xgPtr = (XBUF_XG *)XBuffer + y1;
xAdd = PHD_ONE * xSize / ySize;
gAdd = PHD_HALF * gSize / ySize;
x = x1 * PHD_ONE + (PHD_ONE - 1);
g = g1 * PHD_HALF;
do {
xgPtr->x1 = (x += xAdd);
xgPtr->g1 = (g += gAdd);
xgPtr++;
} while( --ySize );
}
else if( y2 < y1 ) {
CLAMPL(yMax, y1);
xSize = x1 - x2;
ySize = y1 - y2;
gSize = g1 - g2;
xgPtr = (XBUF_XG *)XBuffer + y2;
xAdd = PHD_ONE * xSize / ySize;
gAdd = PHD_HALF * gSize / ySize;
x = x2 * PHD_ONE + 1;
g = g2 * PHD_HALF;
do {
xgPtr->x0 = (x += xAdd);
xgPtr->g0 = (g += gAdd);
xgPtr++;
} while( --ySize );
}
}
if( yMin == yMax )
return FALSE;
XGen_y0 = yMin;
XGen_y1 = yMax;
return TRUE;
}
BOOL __cdecl xgen_xguv(__int16 *bufPtr) {
int ptCount;
XGEN_XGUV *pt1, *pt2;
int yMin, yMax;
int x1, y1, g1, u1, v1, x2, y2, g2, u2, v2;
int xSize, ySize, gSize, uSize, vSize;
int x, g, u, v, xAdd, gAdd, uAdd, vAdd;
XBUF_XGUV *xguvPtr;
ptCount = *bufPtr++;
pt2 = (XGEN_XGUV *)bufPtr;
pt1 = pt2 + (ptCount - 1);
yMin = yMax = pt1->y;
while( ptCount-- ) {
x1 = pt1->x;
y1 = pt1->y;
g1 = pt1->g;
u1 = pt1->u;
v1 = pt1->v;
x2 = pt2->x;
y2 = pt2->y;
g2 = pt2->g;
u2 = pt2->u;
v2 = pt2->v;
pt1 = pt2++;
if( y1 < y2 ) {
CLAMPG(yMin, y1);
xSize = x2 - x1;
ySize = y2 - y1;
gSize = g2 - g1;
uSize = u2 - u1;
vSize = v2 - v1;
xguvPtr = (XBUF_XGUV *)XBuffer + y1;
xAdd = PHD_ONE * xSize / ySize;
gAdd = PHD_HALF * gSize / ySize;
uAdd = PHD_HALF * uSize / ySize;
vAdd = PHD_HALF * vSize / ySize;
x = x1 * PHD_ONE + (PHD_ONE - 1);
g = g1 * PHD_HALF;
u = u1 * PHD_HALF;
v = v1 * PHD_HALF;
do {
xguvPtr->x1 = (x += xAdd);
xguvPtr->g1 = (g += gAdd);
xguvPtr->u1 = (u += uAdd);
xguvPtr->v1 = (v += vAdd);
xguvPtr++;
} while( --ySize );
}
else if( y2 < y1 ) {
CLAMPL(yMax, y1);
xSize = x1 - x2;
ySize = y1 - y2;
gSize = g1 - g2;
uSize = u1 - u2;
vSize = v1 - v2;
xguvPtr = (XBUF_XGUV *)XBuffer + y2;
xAdd = PHD_ONE * xSize / ySize;
gAdd = PHD_HALF * gSize / ySize;
uAdd = PHD_HALF * uSize / ySize;
vAdd = PHD_HALF * vSize / ySize;
x = x2 * PHD_ONE + 1;
g = g2 * PHD_HALF;
u = u2 * PHD_HALF;
v = v2 * PHD_HALF;
do {
xguvPtr->x0 = (x += xAdd);
xguvPtr->g0 = (g += gAdd);
xguvPtr->u0 = (u += uAdd);
xguvPtr->v0 = (v += vAdd);
xguvPtr++;
} while( --ySize );
}
}
if( yMin == yMax )
return FALSE;
XGen_y0 = yMin;
XGen_y1 = yMax;
return TRUE;
}
BOOL __cdecl xgen_xguvpersp_fp(__int16 *bufPtr) {
int ptCount;
XGEN_XGUVP *pt1, *pt2;
int yMin, yMax;
int x1, y1, g1, x2, y2, g2;
float u1, v1, rhw1, u2, v2, rhw2;
int xSize, ySize, gSize;
float uSize, vSize, rhwSize;
int x, g, xAdd, gAdd;
float u, v, rhw, uAdd, vAdd, rhwAdd;
XBUF_XGUVP *xguvPtr;
ptCount = *bufPtr++;
pt2 = (XGEN_XGUVP *)bufPtr;
pt1 = pt2 + (ptCount - 1);
yMin = yMax = pt1->y;
while( ptCount-- ) {
x1 = pt1->x;
y1 = pt1->y;
g1 = pt1->g;
u1 = pt1->u;
v1 = pt1->v;
rhw1 = pt1->rhw;
x2 = pt2->x;
y2 = pt2->y;
g2 = pt2->g;
u2 = pt2->u;
v2 = pt2->v;
rhw2 = pt2->rhw;
pt1 = pt2++;
if( y1 < y2 ) {
CLAMPG(yMin, y1);
xSize = x2 - x1;
ySize = y2 - y1;
gSize = g2 - g1;
uSize = u2 - u1;
vSize = v2 - v1;
rhwSize = rhw2 - rhw1;
xguvPtr = (XBUF_XGUVP *)XBuffer + y1;
xAdd = PHD_ONE * xSize / ySize;
gAdd = PHD_HALF * gSize / ySize;
uAdd = uSize / (float)ySize;
vAdd = vSize / (float)ySize;
rhwAdd = rhwSize / (float)ySize;
x = x1 * PHD_ONE + (PHD_ONE - 1);
g = g1 * PHD_HALF;
u = u1;
v = v1;
rhw = rhw1;
do {
xguvPtr->x1 = (x += xAdd);
xguvPtr->g1 = (g += gAdd);
xguvPtr->u1 = (u += uAdd);
xguvPtr->v1 = (v += vAdd);
xguvPtr->rhw1 = (rhw += rhwAdd);
xguvPtr++;
} while( --ySize );
}
else if( y2 < y1 ) {
CLAMPL(yMax, y1);
xSize = x1 - x2;
ySize = y1 - y2;
gSize = g1 - g2;
uSize = u1 - u2;
vSize = v1 - v2;
rhwSize = rhw1 - rhw2;
xguvPtr = (XBUF_XGUVP *)XBuffer + y2;
xAdd = PHD_ONE * xSize / ySize;
gAdd = PHD_HALF * gSize / ySize;
uAdd = (float)uSize / (float)ySize;
vAdd = (float)vSize / (float)ySize;
rhwAdd = (float)rhwSize / (float)ySize;
x = x2 * PHD_ONE + 1;
g = g2 * PHD_HALF;
u = (float)u2;
v = (float)v2;
rhw = (float)rhw2;
do {
xguvPtr->x0 = (x += xAdd);
xguvPtr->g0 = (g += gAdd);
xguvPtr->u0 = (u += uAdd);
xguvPtr->v0 = (v += vAdd);
xguvPtr->rhw0 = (rhw += rhwAdd);
xguvPtr++;
} while( --ySize );
}
}
if( yMin == yMax )
return FALSE;
XGen_y0 = yMin;
XGen_y1 = yMax;
return TRUE;
}
void __cdecl gtmap_persp32_fp(int y0, int y1, BYTE *texPage) {
int batchSize, batchCounter;
int x, xSize, ySize;
int g, u0, u1, v0, v1, gAdd, u0Add, v0Add;
double u, v, rhw, uAdd, vAdd, rhwAdd;
BYTE *drawPtr, *linePtr;
XBUF_XGUVP *xbuf;
BYTE colorIdx;
ySize = y1 - y0;
if( ySize <= 0 )
return;
xbuf = (XBUF_XGUVP *)XBuffer + y0;
drawPtr = PrintSurfacePtr + y0 * SwrPitch;
for( ; ySize > 0; --ySize, ++xbuf, drawPtr += SwrPitch ) {
x = xbuf->x0 / PHD_ONE;
xSize = (xbuf->x1 / PHD_ONE) - x;
if( xSize <= 0 )
continue;
g = xbuf->g0;
u = xbuf->u0;
v = xbuf->v0;
rhw = xbuf->rhw0;
gAdd = (xbuf->g1 - g) / xSize;
u0 = (int)(PHD_HALF * u / rhw);
v0 = (int)(PHD_HALF * v / rhw);
linePtr = drawPtr + x;
batchSize = 32;
if( xSize >= batchSize ) {
uAdd = (xbuf->u1 - u) / (double)xSize * double(batchSize);
vAdd = (xbuf->v1 - v) / (double)xSize * double(batchSize);
rhwAdd = (xbuf->rhw1 - rhw) / (double)xSize * double(batchSize);
do {
u += uAdd;
v += vAdd;
rhw += rhwAdd;
u1 = (int)(PHD_HALF * u / rhw);
v1 = (int)(PHD_HALF * v / rhw);
u0Add = (u1 - u0) / batchSize;
v0Add = (v1 - v0) / batchSize;
if( (ABS(u0Add) + ABS(v0Add)) < (PHD_ONE / 2) ) {
batchCounter = batchSize / 2;
do {
colorIdx = texPage[BYTE2(v0)*256 + BYTE2(u0)];
colorIdx = DepthQTable[BYTE2(g)].index[colorIdx];
*(linePtr++) = colorIdx;
*(linePtr++) = colorIdx;
g += gAdd * 2;
u0 += u0Add * 2;
v0 += v0Add * 2;
} while( --batchCounter );
} else {
batchCounter = batchSize;
do {
colorIdx = texPage[BYTE2(v0)*256 + BYTE2(u0)];
*(linePtr++) = DepthQTable[BYTE2(g)].index[colorIdx];
g += gAdd;
u0 += u0Add;
v0 += v0Add;
} while( --batchCounter );
}
u0 = u1;
v0 = v1;
xSize -= batchSize;
} while( xSize >= batchSize );
}
if( xSize > 1 ) {
u1 = (int)(PHD_HALF * xbuf->u1 / xbuf->rhw1);
v1 = (int)(PHD_HALF * xbuf->v1 / xbuf->rhw1);
u0Add = (u1 - u0) / xSize;
v0Add = (v1 - v0) / xSize;
batchSize = xSize & ~1;
xSize -= batchSize;
if( (ABS(u0Add) + ABS(v0Add)) < (PHD_ONE / 2) ) {
batchCounter = batchSize / 2;
do {
colorIdx = texPage[BYTE2(v0)*256 + BYTE2(u0)];
colorIdx = DepthQTable[BYTE2(g)].index[colorIdx];
*(linePtr++) = colorIdx;
*(linePtr++) = colorIdx;
g += gAdd * 2;
u0 += u0Add * 2;
v0 += v0Add * 2;
} while( --batchCounter );
} else {
batchCounter = batchSize;
do {
colorIdx = texPage[BYTE2(v0)*256 + BYTE2(u0)];
*(linePtr++) = DepthQTable[BYTE2(g)].index[colorIdx];
g += gAdd;
u0 += u0Add;
v0 += v0Add;
} while( --batchCounter );
}
}
if( xSize != 0 ) { // xSize == 1
colorIdx = texPage[BYTE2(v0)*256 + BYTE2(u0)];
*linePtr = DepthQTable[BYTE2(g)].index[colorIdx];
}
}
}
void __cdecl wgtmap_persp32_fp(int y0, int y1, BYTE *texPage) {
int batchSize, batchCounter;
int x, xSize, ySize;
int g, u0, u1, v0, v1, gAdd, u0Add, v0Add;
double u, v, rhw, uAdd, vAdd, rhwAdd;
BYTE *drawPtr, *linePtr;
XBUF_XGUVP *xbuf;
BYTE colorIdx;
ySize = y1 - y0;
if( ySize <= 0 )
return;
xbuf = (XBUF_XGUVP *)XBuffer + y0;
drawPtr = PrintSurfacePtr + y0 * SwrPitch;
for( ; ySize > 0; --ySize, ++xbuf, drawPtr += SwrPitch ) {
x = xbuf->x0 / PHD_ONE;
xSize = (xbuf->x1 / PHD_ONE) - x;
if( xSize <= 0 )
continue;
g = xbuf->g0;
u = xbuf->u0;
v = xbuf->v0;
rhw = xbuf->rhw0;
gAdd = (xbuf->g1 - g) / xSize;
u0 = (int)(PHD_HALF * u / rhw);
v0 = (int)(PHD_HALF * v / rhw);
linePtr = drawPtr + x;
batchSize = 32;
if( xSize >= batchSize ) {
uAdd = (xbuf->u1 - u) / (double)xSize * double(batchSize);
vAdd = (xbuf->v1 - v) / (double)xSize * double(batchSize);
rhwAdd = (xbuf->rhw1 - rhw) / (double)xSize * double(batchSize);
do {
u += uAdd;
v += vAdd;
rhw += rhwAdd;
u1 = (int)(PHD_HALF * u / rhw);
v1 = (int)(PHD_HALF * v / rhw);
u0Add = (u1 - u0) / batchSize;
v0Add = (v1 - v0) / batchSize;
if( (ABS(u0Add) + ABS(v0Add)) < (PHD_ONE / 2) ) {
batchCounter = batchSize / 2;
do {
colorIdx = texPage[BYTE2(v0)*256 + BYTE2(u0)];
if( colorIdx != 0 ) {
colorIdx = DepthQTable[BYTE2(g)].index[colorIdx];
linePtr[0] = colorIdx;
linePtr[1] = colorIdx;
}
linePtr += 2;
g += gAdd * 2;
u0 += u0Add * 2;
v0 += v0Add * 2;
} while( --batchCounter );
} else {
batchCounter = batchSize;
do {
colorIdx = texPage[BYTE2(v0)*256 + BYTE2(u0)];
if( colorIdx != 0 ) {
*linePtr = DepthQTable[BYTE2(g)].index[colorIdx];
}
linePtr++;
g += gAdd;
u0 += u0Add;
v0 += v0Add;
} while( --batchCounter );
}
u0 = u1;
v0 = v1;
xSize -= batchSize;
} while( xSize >= batchSize );
}
if( xSize > 1 ) {
u1 = (int)(PHD_HALF * xbuf->u1 / xbuf->rhw1);
v1 = (int)(PHD_HALF * xbuf->v1 / xbuf->rhw1);
u0Add = (u1 - u0) / xSize;
v0Add = (v1 - v0) / xSize;
batchSize = xSize & ~1;
xSize -= batchSize;
if( (ABS(u0Add) + ABS(v0Add)) < (PHD_ONE / 2) ) {
batchCounter = batchSize / 2;
do {
colorIdx = texPage[BYTE2(v0)*256 + BYTE2(u0)];
if( colorIdx != 0 ) {
colorIdx = DepthQTable[BYTE2(g)].index[colorIdx];
linePtr[0] = colorIdx;
linePtr[1] = colorIdx;
}
linePtr += 2;
g += gAdd * 2;
u0 += u0Add * 2;
v0 += v0Add * 2;
} while( --batchCounter );
} else {
batchCounter = batchSize;
do {
colorIdx = texPage[BYTE2(v0)*256 + BYTE2(u0)];
if( colorIdx != 0 ) {
*linePtr = DepthQTable[BYTE2(g)].index[colorIdx];
}
linePtr++;
g += gAdd;
u0 += u0Add;
v0 += v0Add;
} while( --batchCounter );
}
}
if( xSize != 0 ) { // xSize == 1
colorIdx = texPage[BYTE2(v0)*256 + BYTE2(u0)];
if( colorIdx != 0 ) {
*linePtr = DepthQTable[BYTE2(g)].index[colorIdx];
}
}
}
}
void __cdecl draw_poly_gtmap_persp(__int16 *bufPtr) {
if( xgen_xguvpersp_fp(bufPtr + 1) )
gtmap_persp32_fp(XGen_y0, XGen_y1, TexturePageBuffer8[*bufPtr]);
}
void __cdecl draw_poly_wgtmap_persp(__int16 *bufPtr) {
if( xgen_xguvpersp_fp(bufPtr + 1) )
wgtmap_persp32_fp(XGen_y0, XGen_y1, TexturePageBuffer8[*bufPtr]);
}
void __fastcall flatA(int y0, int y1, BYTE colorIdx) {
int x, xSize, ySize;
BYTE *drawPtr;
XBUF_X *xbuf;
ySize = y1 - y0;
if( ySize <= 0 )
return;
xbuf = (XBUF_X *)XBuffer + y0;
drawPtr = PrintSurfacePtr + y0 * SwrPitch;
for( ; ySize > 0; --ySize, ++xbuf, drawPtr += SwrPitch ) {
x = xbuf->x0 / PHD_ONE;
xSize = (xbuf->x1 / PHD_ONE) - x;
if( xSize > 0 ) {
memset(drawPtr + x, colorIdx, xSize);
}
}
}
void __fastcall transA(int y0, int y1, BYTE depthQ) {
int x, xSize, ySize;
BYTE *drawPtr, *linePtr;
XBUF_X *xbuf;
DEPTHQ_ENTRY *qt;
ySize = y1 - y0;
if( ySize <= 0 || depthQ >= 32 ) // NOTE: depthQ check was ( > 32) in the original code
return;
xbuf = (XBUF_X *)XBuffer + y0;
drawPtr = PrintSurfacePtr + y0 * SwrPitch;
qt = DepthQTable + depthQ;
for( ; ySize > 0; --ySize, ++xbuf, drawPtr += SwrPitch ) {
x = xbuf->x0 / PHD_ONE;
xSize = (xbuf->x1 / PHD_ONE) - x;
if( xSize <= 0 )
continue;
linePtr = drawPtr + x;
do {
*linePtr = qt->index[*linePtr];
++linePtr;
} while( --xSize );
}
}
void __fastcall gourA(int y0, int y1, BYTE colorIdx) {
int x, xSize, ySize;
int g, gAdd;
BYTE *drawPtr, *linePtr;
XBUF_XG *xbuf;
GOURAUD_ENTRY *gt;
ySize = y1 - y0;
if( ySize <= 0 )
return;
xbuf = (XBUF_XG *)XBuffer + y0;
drawPtr = PrintSurfacePtr + y0 * SwrPitch;
gt = GouraudTable + colorIdx;
for( ; ySize > 0; --ySize, ++xbuf, drawPtr += SwrPitch ) {
x = xbuf->x0 / PHD_ONE;
xSize = (xbuf->x1 / PHD_ONE) - x;
if( xSize <= 0 )
continue;
g = xbuf->g0;
gAdd = (xbuf->g1 - g) / xSize;
linePtr = drawPtr + x;
do {
*(linePtr++) = gt->index[BYTE2(g)];
g += gAdd;
} while( --xSize );
}
}
void __fastcall gtmapA(int y0, int y1, BYTE *texPage) {
int x, xSize, ySize;
int g, u, v, gAdd, uAdd, vAdd;
BYTE *drawPtr, *linePtr;
XBUF_XGUV *xbuf;
BYTE colorIdx;
ySize = y1 - y0;
if( ySize <= 0 )
return;
xbuf = (XBUF_XGUV *)XBuffer + y0;
drawPtr = PrintSurfacePtr + y0 * SwrPitch;
for( ; ySize > 0; --ySize, ++xbuf, drawPtr += SwrPitch ) {
x = xbuf->x0 / PHD_ONE;
xSize = (xbuf->x1 / PHD_ONE) - x;
if( xSize <= 0 )
continue;
g = xbuf->g0;
u = xbuf->u0;
v = xbuf->v0;
gAdd = (xbuf->g1 - g) / xSize;
uAdd = (xbuf->u1 - u) / xSize;
vAdd = (xbuf->v1 - v) / xSize;
linePtr = drawPtr + x;
do {
colorIdx = texPage[BYTE2(v)*256 + BYTE2(u)];
*(linePtr++) = DepthQTable[BYTE2(g)].index[colorIdx];
g += gAdd;
u += uAdd;
v += vAdd;
} while( --xSize );
}
}
void __fastcall wgtmapA(int y0, int y1, BYTE *texPage) {
int x, xSize, ySize;
int g, u, v, gAdd, uAdd, vAdd;
BYTE *drawPtr, *linePtr;
XBUF_XGUV *xbuf;
BYTE colorIdx;
ySize = y1 - y0;
if( ySize <= 0 )
return;
xbuf = (XBUF_XGUV *)XBuffer + y0;
drawPtr = PrintSurfacePtr + y0 * SwrPitch;
for( ; ySize > 0; --ySize, ++xbuf, drawPtr += SwrPitch ) {
x = xbuf->x0 / PHD_ONE;
xSize = (xbuf->x1 / PHD_ONE) - x;
if( xSize <= 0 )
continue;
g = xbuf->g0;
u = xbuf->u0;
v = xbuf->v0;
gAdd = (xbuf->g1 - g) / xSize;
uAdd = (xbuf->u1 - u) / xSize;
vAdd = (xbuf->v1 - v) / xSize;
linePtr = drawPtr + x;
do {
colorIdx = texPage[BYTE2(v)*256 + BYTE2(u)];
if( colorIdx != 0 ) {
*linePtr = DepthQTable[BYTE2(g)].index[colorIdx];
}
++linePtr;
g += gAdd;
u += uAdd;
v += vAdd;
} while( --xSize );
}
}
/*
* Inject function
*/
void Inject_3Dout() {
INJECT(0x00402960, draw_poly_line);
INJECT(0x00402B00, draw_poly_flat);
INJECT(0x00402B40, draw_poly_trans);
INJECT(0x00402B80, draw_poly_gouraud);
INJECT(0x00402BC0, draw_poly_gtmap);
INJECT(0x00402C00, draw_poly_wgtmap);
INJECT(0x00402C40, xgen_x);
INJECT(0x00402D20, xgen_xg);
INJECT(0x00402E70, xgen_xguv);
INJECT(0x00403090, xgen_xguvpersp_fp);
INJECT(0x00403320, gtmap_persp32_fp);
INJECT(0x004042F0, wgtmap_persp32_fp);
INJECT(0x004057C0, draw_poly_gtmap_persp);
INJECT(0x00405800, draw_poly_wgtmap_persp);
// NOTE: asm functions below use Watcom register calling convention so they incompatible
// INJECT(0x00457564, flatA);
// INJECT(0x004575C5, transA);
// INJECT(0x004576FF, gourA);
// INJECT(0x0045785F, gtmapA);
// INJECT(0x00457B5C, wgtmapA);
}
================================================
FILE: 3dsystem/3d_out.h
================================================
/*
* Copyright (c) 2017-2018 Michael Chaban. All rights reserved.
* Original game is created by Core Design Ltd. in 1997.
* Lara Croft and Tomb Raider are trademarks of Embracer Group AB.
*
* This file is part of TR2Main.
*
* TR2Main is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TR2Main is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TR2Main. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _3DOUT_H_INCLUDED
#define _3DOUT_H_INCLUDED
#include "global/types.h"
/*
* Function list
*/
void __cdecl draw_poly_line(__int16 *bufPtr); // 0x00402960
void __cdecl draw_poly_flat(__int16 *bufPtr); // 0x00402B00
void __cdecl draw_poly_trans(__int16 *bufPtr); // 0x00402B40
void __cdecl draw_poly_gouraud(__int16 *bufPtr); // 0x00402B80
void __cdecl draw_poly_gtmap(__int16 *bufPtr); // 0x00402BC0
void __cdecl draw_poly_wgtmap(__int16 *bufPtr); // 0x00402C00
BOOL __cdecl xgen_x(__int16 *bufPtr); // 0x00402C40
BOOL __cdecl xgen_xg(__int16 *bufPtr); // 0x00402D20
BOOL __cdecl xgen_xguv(__int16 *bufPtr); // 0x00402E70
BOOL __cdecl xgen_xguvpersp_fp(__int16 *bufPtr); // 0x00403090
void __cdecl gtmap_persp32_fp(int y0, int y1, BYTE *texPage); // 0x00403320
void __cdecl wgtmap_persp32_fp(int y0, int y1, BYTE *texPage); // 0x004042F0
void __cdecl draw_poly_gtmap_persp(__int16 *bufPtr); // 0x004057C0
void __cdecl draw_poly_wgtmap_persp(__int16 *bufPtr); // 0x00405800
void __fastcall flatA(int y0, int y1, BYTE colorIdx); // 0x00457564
void __fastcall transA(int y0, int y1, BYTE depthQ); // 0x004575C5
void __fastcall gourA(int y0, int y1, BYTE colorIdx); // 0x004576FF
void __fastcall gtmapA(int y0, int y1, BYTE *texPage); // 0x0045785F
void __fastcall wgtmapA(int y0, int y1, BYTE *texPage); // 0x00457B5C
#endif // _3DOUT_H_INCLUDED
================================================
FILE: 3dsystem/3dinsert.cpp
================================================
/*
* Copyright (c) 2017-2021 Michael Chaban. All rights reserved.
* Original game is created by Core Design Ltd. in 1997.
* Lara Croft and Tomb Raider are trademarks of Embracer Group AB.
*
* This file is part of TR2Main.
*
* TR2Main is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TR2Main is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TR2Main. If not, see <http://www.gnu.org/licenses/>.
*/
#include "global/precompiled.h"
#include "3dsystem/3dinsert.h"
#include "specific/hwr.h"
#include "global/vars.h"
#if defined(FEATURE_HUD_IMPROVED) || (DIRECT3D_VERSION >= 0x900)
#include "modding/texture_utils.h"
#endif // defined(FEATURE_HUD_IMPROVED) || (DIRECT3D_VERSION >= 0x900)
#ifdef FEATURE_VIDEOFX_IMPROVED
#include "specific/texture.h"
#include "modding/mod_utils.h"
extern DWORD ShadowMode;
extern DWORD AlphaBlendMode;
bool CustomWaterColorEnabled = true;
#endif // FEATURE_VIDEOFX_IMPROVED
static VERTEX_INFO VBuffer[40]; // NOTE: original size was 20
static D3DTLVERTEX VBufferD3D[32];
static D3DCOLOR GlobalTint = 0; // NOTE: not presented in the original code
#ifdef FEATURE_VIEW_IMPROVED
bool RoomSortEnabled = false;
#define MAKE_ZSORT(z) (RoomSortEnabled && (SavedAppSettings.RenderMode == RM_Software || !SavedAppSettings.ZBuffer) ? (((UINT64)MidSort)<<32)+(DWORD)(z) : (DWORD)(z))
#else // FEATURE_VIEW_IMPROVED
#define MAKE_ZSORT(z) ((DWORD)(z))
#endif // FEATURE_VIEW_IMPROVED
static D3DCOLOR shadeColor(DWORD red, DWORD green, DWORD blue, DWORD alpha, DWORD shade, bool isTextured) {
CLAMPG(shade, 0x1FFF);
if( GlobalTint ) {
red = RGBA_GETRED(GlobalTint);
green = RGBA_GETGREEN(GlobalTint);
blue = RGBA_GETBLUE(GlobalTint);
alpha = RGBA_GETALPHA(GlobalTint);
}
#if defined(FEATURE_VIDEOFX_IMPROVED) && (DIRECT3D_VERSION >= 0x900)
if( SavedAppSettings.LightingMode == 1 ) CLAMPL(shade, 0x800);
if( SavedAppSettings.LightingMode && isTextured ) shade = 0x1000 + shade/2;
if( !SavedAppSettings.LightingMode && !isTextured ) CLAMPL(shade, 0x1000);
#else // defined(FEATURE_VIDEOFX_IMPROVED) && (DIRECT3D_VERSION >= 0x900)
// NOTE: The original game bugfix. We need to limit brightness of untextured faces for DirectX 5
// because brightness of textured faces is limited by D3DTBLEND_MODULATEALPHA or D3DTBLEND_MODULATE
if( !isTextured ) CLAMPL(shade, 0x1000);
#endif // defined(FEATURE_VIDEOFX_IMPROVED) && (DIRECT3D_VERSION >= 0x900)
if( shade != 0x1000 ) {
DWORD brightness = 0x2000 - shade;
red = red * brightness >> 12;
green = green * brightness >> 12;
blue = blue * brightness >> 12;
}
CLAMPG(red, 0xFF);
CLAMPG(green, 0xFF);
CLAMPG(blue, 0xFF);
CLAMPG(alpha, 0xFF);
if( IsShadeEffect ) {
#if defined(FEATURE_VIDEOFX_IMPROVED) && defined(FEATURE_MOD_CONFIG)
D3DCOLOR water = GetModWaterColor();
if( CustomWaterColorEnabled && water ) {
red = red * RGB_GETRED(water) / 256;
green = green * RGB_GETGREEN(water) / 256;
blue = blue * RGB_GETBLUE(water) / 256;
} else {
red = red * 128 / 256;
green = green * 224 / 256;
}
#else // defined(FEATURE_VIDEOFX_IMPROVED) && defined(FEATURE_MOD_CONFIG)
red = red * 128 / 256;
green = green * 224 / 256;
#endif // defined(FEATURE_VIDEOFX_IMPROVED) && defined(FEATURE_MOD_CONFIG)
}
return RGBA_MAKE(red, green, blue, alpha);
}
static double CalculatePolyZ(SORTTYPE sortType, double z0, double z1, double z2, double z3 = -1.0) {
double zv = 0.0;
switch( sortType ) {
case ST_AvgZ :
zv = ( z3 > 0.0 ) ? (z0+z1+z2+z3)/4.0 : (z0+z1+z2)/3.0;
break;
case ST_MaxZ :
zv = z0;
CLAMPL(zv, z1);
CLAMPL(zv, z2);
if( z3 > 0.0 ) CLAMPL(zv, z3);
break;
case ST_FarZ :
default :
zv = 4000000000.0; // the original game value was 1000000000.0
break;
}
return zv;
}
#ifdef FEATURE_VIDEOFX_IMPROVED
static POLYTYPE GetPolyType(UINT16 drawtype) {
switch( drawtype ) {
case DRAW_Opaque:
return POLY_HWR_GTmap;
case DRAW_Semitrans:
return AlphaBlendMode ? POLY_HWR_WGTmapHalf : POLY_HWR_WGTmap;
case DRAW_ColorKey:
return POLY_HWR_WGTmap;
}
return POLY_HWR_WGTmap;
}
bool InsertObjectEM(__int16 *ptrObj, int vtxCount, D3DCOLOR tint, PHD_UV *em_uv) {
PHD_VBUF *vtx[4];
PHD_TEXTURE texture;
PHD_UV *uv = texture.uv;
if( ptrObj == NULL || em_uv == NULL || vtxCount < 3 || vtxCount > 4 ) {
return false;
}
texture.drawtype = DRAW_ColorKey;
texture.tpage = (UINT16)~0;
for( int i = 0; i < vtxCount; ++ i ) {
vtx[i] = &PhdVBuf[ptrObj[i]];
texture.uv[i] = em_uv[ptrObj[i]];
}
GlobalTint = tint;
if( vtxCount == 4 ) {
InsertGT4_Sorted(vtx[0], vtx[1], vtx[2], vtx[3], &texture, ST_AvgZ);
} else {
InsertGT3_Sorted(vtx[0], vtx[1], vtx[2], &texture, &uv[0], &uv[1], &uv[2], ST_AvgZ);
}
GlobalTint = 0;
return true;
}
#endif // FEATURE_VIDEOFX_IMPROVED
// NOTE: this function is not presented in the original game
void __cdecl InsertGourQuad(int x0, int y0, int x1, int y1, int z, D3DCOLOR color0, D3DCOLOR color1, D3DCOLOR color2, D3DCOLOR color3) {
double rhw, sz;
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(z);
++Sort3dPtr;
*(Info3dPtr++) = POLY_HWR_trans;
*(Info3dPtr++) = 4; // vertex count
*(D3DTLVERTEX **)Info3dPtr = HWR_VertexPtr;
Info3dPtr += sizeof(D3DTLVERTEX *)/sizeof(__int16);
rhw = RhwFactor / (double)z;
sz = FltResZBuf - rhw * FltResZORhw;
HWR_VertexPtr[0].sx = (float)x1;
HWR_VertexPtr[0].sy = (float)y0;
HWR_VertexPtr[0].color = color1;
HWR_VertexPtr[1].sx = (float)x1;
HWR_VertexPtr[1].sy = (float)y1;
HWR_VertexPtr[1].color = color2;
HWR_VertexPtr[2].sx = (float)x0;
HWR_VertexPtr[2].sy = (float)y1;
HWR_VertexPtr[2].color = color3;
HWR_VertexPtr[3].sx = (float)x0;
HWR_VertexPtr[3].sy = (float)y0;
HWR_VertexPtr[3].color = color0;
for( int i=0; i<4; ++i ) {
HWR_VertexPtr[i].sz = sz;
HWR_VertexPtr[i].rhw = rhw;
}
HWR_VertexPtr += 4;
++SurfaceCount;
}
BOOL __cdecl visible_zclip(PHD_VBUF *vtx0, PHD_VBUF *vtx1, PHD_VBUF *vtx2) {
return ( (vtx0->yv * vtx2->zv - vtx0->zv * vtx2->yv) * vtx1->xv +
(vtx0->zv * vtx2->xv - vtx0->xv * vtx2->zv) * vtx1->yv +
(vtx0->xv * vtx2->yv - vtx0->yv * vtx2->xv) * vtx1->zv < 0.0 );
}
int __cdecl ZedClipper(int vtxCount, POINT_INFO *pts, VERTEX_INFO *vtx) {
int i, j, diff0, diff1;
double clip;
POINT_INFO *pts0, *pts1;
if( vtxCount == 0 )
return 0;
j = 0;
pts0 = pts;
pts1 = &pts[vtxCount-1];
for( i = 0; i < vtxCount; ++i ) {
diff0 = (int)(FltNearZ - pts0->zv);
diff1 = (int)(FltNearZ - pts1->zv);
if( (diff0|diff1) < 0 ) {
if( (diff0^diff1) < 0 ) {
clip = (FltNearZ - pts0->zv) / (pts1->zv - pts0->zv);
vtx[j].x = ((pts1->xv - pts0->xv) * clip + pts0->xv) * FltPerspONearZ + FltWinCenterX;
vtx[j].y = ((pts1->yv - pts0->yv) * clip + pts0->yv) * FltPerspONearZ + FltWinCenterY;
vtx[j].rhw = FltRhwONearZ;
vtx[j].u = ((pts1->u - pts0->u) * clip + pts0->u) * FltRhwONearZ;
vtx[j].v = ((pts1->v - pts0->v) * clip + pts0->v) * FltRhwONearZ;
vtx[j].g = ((pts1->g - pts0->g) * clip + pts0->g);
++j;
}
if( diff0 < 0 ) {
vtx[j].x = pts0->xs;
vtx[j].y = pts0->ys;
vtx[j].rhw = pts0->rhw;
vtx[j].u = pts0->u * pts0->rhw;
vtx[j].v = pts0->v * pts0->rhw;
vtx[j].g = pts0->g;
++j;
}
}
pts1 = pts0++;
}
return ( j < 3 ) ? 0 : j;
}
static inline void clipGUV(VERTEX_INFO *buf, VERTEX_INFO *vtx1, VERTEX_INFO *vtx2, float clip) {
buf->rhw = vtx2->rhw + (vtx1->rhw - vtx2->rhw) * clip;
buf->u = vtx2->u + (vtx1->u - vtx2->u) * clip;
buf->v = vtx2->v + (vtx1->v - vtx2->v) * clip;
buf->g = vtx2->g + (vtx1->g - vtx2->g) * clip;
}
int __cdecl XYGUVClipper(int vtxCount, VERTEX_INFO *vtx) {
VERTEX_INFO vtx_buf[8];
VERTEX_INFO *vtx1, *vtx2;
float clip;
int i, j;
if( vtxCount < 3 )
return 0;
// horizontal clip
vtx2 = &vtx[vtxCount - 1];
j = 0;
for( i = 0; i < vtxCount; ++i ) {
vtx1 = vtx2;
vtx2 = &vtx[i];
if( vtx1->x < FltWinLeft ) {
if( vtx2->x < FltWinLeft ) {
continue;
}
clip = (FltWinLeft - vtx2->x) / (vtx1->x - vtx2->x);
vtx_buf[j].x = FltWinLeft;
vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip;
clipGUV(&vtx_buf[j++], vtx1, vtx2, clip);
}
else if( vtx1->x > FltWinRight) {
if( vtx2->x > FltWinRight ) {
continue;
}
clip = (FltWinRight - vtx2->x) / (vtx1->x - vtx2->x);
vtx_buf[j].x = FltWinRight;
vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip;
clipGUV(&vtx_buf[j++], vtx1, vtx2, clip);
}
if( vtx2->x < FltWinLeft ) {
clip = (FltWinLeft - vtx2->x) / (vtx1->x - vtx2->x);
vtx_buf[j].x = FltWinLeft;
vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip;
clipGUV(&vtx_buf[j++], vtx1, vtx2, clip);
}
else if( vtx2->x > FltWinRight ) {
clip = (FltWinRight - vtx2->x) / (vtx1->x - vtx2->x);
vtx_buf[j].x = FltWinRight;
vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip;
clipGUV(&vtx_buf[j++], vtx1, vtx2, clip);
} else {
vtx_buf[j++] = *vtx2;
}
}
vtxCount = j;
if( vtxCount < 3 )
return 0;
// vertical clip
vtx2 = &vtx_buf[vtxCount-1];
j = 0;
for( i = 0; i < vtxCount; ++i ) {
vtx1 = vtx2;
vtx2 = &vtx_buf[i];
if( vtx1->y < FltWinTop ) {
if( vtx2->y < FltWinTop ) {
continue;
}
clip = (FltWinTop - vtx2->y) / (vtx1->y - vtx2->y);
vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip;
vtx[j].y = FltWinTop;
clipGUV(&vtx[j++], vtx1, vtx2, clip);
}
else if( vtx1->y > FltWinBottom ) {
if( vtx2->y > FltWinBottom ) {
continue;
}
clip = (FltWinBottom - vtx2->y) / (vtx1->y - vtx2->y);
vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip;
vtx[j].y = FltWinBottom;
clipGUV(&vtx[j++], vtx1, vtx2, clip);
}
if( vtx2->y < FltWinTop ) {
clip = (FltWinTop - vtx2->y) / (vtx1->y - vtx2->y);
vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip;
vtx[j].y = FltWinTop;
clipGUV(&vtx[j++], vtx1, vtx2, clip);
}
else if( vtx2->y > FltWinBottom ) {
clip = (FltWinBottom - vtx2->y) / (vtx1->y - vtx2->y);
vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip;
vtx[j].y = FltWinBottom;
clipGUV(&vtx[j++], vtx1, vtx2, clip);
} else {
vtx[j++] = *vtx2;
}
}
return ( j < 3 ) ? 0 : j;
}
__int16 *__cdecl InsertObjectGT4(__int16 *ptrObj, int number, SORTTYPE sortType) {
char clipOR, clipAND;
PHD_VBUF *vtx0, *vtx1, *vtx2, *vtx3;
int i, j, nPoints;
float zv;
__int16 textureIdx;
PHD_TEXTURE *texture;
PHD_UV *uv;
POINT_INFO points[4];
for( i = 0; i < number; ++i ) {
vtx0 = &PhdVBuf[*ptrObj++];
vtx1 = &PhdVBuf[*ptrObj++];
vtx2 = &PhdVBuf[*ptrObj++];
vtx3 = &PhdVBuf[*ptrObj++];
textureIdx = *ptrObj++;
texture = &PhdTextureInfo[textureIdx];
uv = texture->uv;
nPoints = 4;
clipOR = LOBYTE(vtx0->clip | vtx1->clip | vtx2->clip | vtx3->clip);
clipAND = LOBYTE(vtx0->clip & vtx1->clip & vtx2->clip & vtx3->clip);
if( clipAND != 0 )
continue;
if( clipOR >= 0 ) {
if( !VBUF_VISIBLE(*vtx0, *vtx1, *vtx2) )
continue;
if( clipOR == 0 ) {
zv = CalculatePolyZ(sortType, vtx0->zv, vtx1->zv, vtx2->zv, vtx3->zv);
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(zv);
++Sort3dPtr;
if( zv >= (double)PerspectiveDistance ) {
*Info3dPtr++ = ( texture->drawtype == DRAW_Opaque ) ? POLY_GTmap : POLY_WGTmap;
*Info3dPtr++ = texture->tpage;
*Info3dPtr++ = 4;
*Info3dPtr++ = (int)vtx0->xs;
*Info3dPtr++ = (int)vtx0->ys;
*Info3dPtr++ = (int)vtx0->g;
*Info3dPtr++ = uv[0].u;
*Info3dPtr++ = uv[0].v;
*Info3dPtr++ = (int)vtx1->xs;
*Info3dPtr++ = (int)vtx1->ys;
*Info3dPtr++ = (int)vtx1->g;
*Info3dPtr++ = uv[1].u;
*Info3dPtr++ = uv[1].v;
*Info3dPtr++ = (int)vtx2->xs;
*Info3dPtr++ = (int)vtx2->ys;
*Info3dPtr++ = (int)vtx2->g;
*Info3dPtr++ = uv[2].u;
*Info3dPtr++ = uv[2].v;
*Info3dPtr++ = (int)vtx3->xs;
*Info3dPtr++ = (int)vtx3->ys;
*Info3dPtr++ = (int)vtx3->g;
*Info3dPtr++ = uv[3].u;
*Info3dPtr++ = uv[3].v;
} else {
*Info3dPtr++ = ( texture->drawtype == DRAW_Opaque ) ? POLY_GTmap_persp : POLY_WGTmap_persp;
*Info3dPtr++ = texture->tpage;
*Info3dPtr++ = 4;
*Info3dPtr++ = (int)vtx0->xs;
*Info3dPtr++ = (int)vtx0->ys;
*Info3dPtr++ = (int)vtx0->g;
*(float *)Info3dPtr = vtx0->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*(float *)Info3dPtr = (double)uv[0].u * vtx0->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*(float *)Info3dPtr = (double)uv[0].v * vtx0->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*Info3dPtr++ = (int)vtx1->xs;
*Info3dPtr++ = (int)vtx1->ys;
*Info3dPtr++ = (int)vtx1->g;
*(float *)Info3dPtr = vtx1->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*(float *)Info3dPtr = (double)uv[1].u * vtx1->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*(float *)Info3dPtr = (double)uv[1].v * vtx1->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*Info3dPtr++ = (int)vtx2->xs;
*Info3dPtr++ = (int)vtx2->ys;
*Info3dPtr++ = (int)vtx2->g;
*(float *)Info3dPtr = vtx2->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*(float *)Info3dPtr = (double)uv[2].u * vtx2->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*(float *)Info3dPtr = (double)uv[2].v * vtx2->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*Info3dPtr++ = (int)vtx3->xs;
*Info3dPtr++ = (int)vtx3->ys;
*Info3dPtr++ = (int)vtx3->g;
*(float *)Info3dPtr = vtx3->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*(float *)Info3dPtr = (double)uv[3].u * vtx3->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*(float *)Info3dPtr = (double)uv[3].v * vtx3->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
}
++SurfaceCount;
continue;
}
VBuffer[0].x = vtx0->xs;
VBuffer[0].y = vtx0->ys;
VBuffer[0].rhw = vtx0->rhw;
VBuffer[0].g = (float)vtx0->g;
VBuffer[0].u = (double)uv[0].u * vtx0->rhw;
VBuffer[0].v = (double)uv[0].v * vtx0->rhw;
VBuffer[1].x = vtx1->xs;
VBuffer[1].y = vtx1->ys;
VBuffer[1].rhw = vtx1->rhw;
VBuffer[1].g = (float)vtx1->g;
VBuffer[1].u = (double)uv[1].u * vtx1->rhw;
VBuffer[1].v = (double)uv[1].v * vtx1->rhw;
VBuffer[2].x = vtx2->xs;
VBuffer[2].y = vtx2->ys;
VBuffer[2].rhw = vtx2->rhw;
VBuffer[2].g = (float)vtx2->g;
VBuffer[2].u = (double)uv[2].u * vtx2->rhw;
VBuffer[2].v = (double)uv[2].v * vtx2->rhw;
VBuffer[3].x = vtx3->xs;
VBuffer[3].y = vtx3->ys;
VBuffer[3].rhw = vtx3->rhw;
VBuffer[3].g = (float)vtx3->g;
VBuffer[3].u = (double)uv[3].u * vtx3->rhw;
VBuffer[3].v = (double)uv[3].v * vtx3->rhw;
} else {
if( !visible_zclip(vtx0, vtx1, vtx2) )
continue;
points[0].xv = vtx0->xv;
points[0].yv = vtx0->yv;
points[0].zv = vtx0->zv;
points[0].rhw = vtx0->rhw;
points[0].xs = vtx0->xs;
points[0].ys = vtx0->ys;
points[0].u = (float)uv[0].u;
points[0].v = (float)uv[0].v;
points[0].g = (float)vtx0->g;
points[1].yv = vtx1->yv;
points[1].xv = vtx1->xv;
points[1].zv = vtx1->zv;
points[1].rhw = vtx1->rhw;
points[1].xs = vtx1->xs;
points[1].ys = vtx1->ys;
points[1].u = (float)uv[1].u;
points[1].v = (float)uv[1].v;
points[1].g = (float)vtx1->g;
points[2].xv = vtx2->xv;
points[2].yv = vtx2->yv;
points[2].zv = vtx2->zv;
points[2].rhw = vtx2->rhw;
points[2].xs = vtx2->xs;
points[2].ys = vtx2->ys;
points[2].u = (float)uv[2].u;
points[2].v = (float)uv[2].v;
points[2].g = (float)vtx2->g;
points[3].xv = vtx3->xv;
points[3].yv = vtx3->yv;
points[3].zv = vtx3->zv;
points[3].rhw = vtx3->rhw;
points[3].xs = vtx3->xs;
points[3].ys = vtx3->ys;
points[3].u = (float)uv[3].u;
points[3].v = (float)uv[3].v;
points[3].g = (float)vtx3->g;
nPoints = ZedClipper(nPoints, points, VBuffer);
if( nPoints == 0 ) continue;
}
nPoints = XYGUVClipper(nPoints, VBuffer);
if( nPoints == 0 ) continue;
zv = CalculatePolyZ(sortType, vtx0->zv, vtx1->zv, vtx2->zv, vtx3->zv);
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(zv);
++Sort3dPtr;
if( zv >= (double)PerspectiveDistance ) {
*Info3dPtr++ = ( texture->drawtype == DRAW_Opaque ) ? POLY_GTmap : POLY_WGTmap;
*Info3dPtr++ = texture->tpage;
*Info3dPtr++ = nPoints;
for( j = 0; j < nPoints; ++j ) {
*Info3dPtr++ = (int)VBuffer[j].x;
*Info3dPtr++ = (int)VBuffer[j].y;
*Info3dPtr++ = (int)VBuffer[j].g;
*Info3dPtr++ = (int)(VBuffer[j].u / VBuffer[j].rhw);
*Info3dPtr++ = (int)(VBuffer[j].v / VBuffer[j].rhw);
}
} else {
*Info3dPtr++ = ( texture->drawtype == DRAW_Opaque ) ? POLY_GTmap_persp : POLY_WGTmap_persp;
*Info3dPtr++ = texture->tpage;
*Info3dPtr++ = nPoints;
for( j = 0; j < nPoints; ++j ) {
*Info3dPtr++ = (int)VBuffer[j].x;
*Info3dPtr++ = (int)VBuffer[j].y;
*Info3dPtr++ = (int)VBuffer[j].g;
*(float *)Info3dPtr = VBuffer[j].rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*(float *)Info3dPtr = VBuffer[j].u;
Info3dPtr += sizeof(float)/sizeof(__int16);
*(float *)Info3dPtr = VBuffer[j].v;
Info3dPtr += sizeof(float)/sizeof(__int16);
}
}
++SurfaceCount;
}
return ptrObj;
}
__int16 *__cdecl InsertObjectGT3(__int16 *ptrObj, int number, SORTTYPE sortType) {
char clipOR, clipAND;
PHD_VBUF *vtx0, *vtx1, *vtx2;
int i, j, nPoints;
float zv;
__int16 textureIdx;
PHD_TEXTURE *texture;
PHD_UV *uv;
POINT_INFO points[3];
for( i = 0; i < number; ++i ) {
vtx0 = &PhdVBuf[*ptrObj++];
vtx1 = &PhdVBuf[*ptrObj++];
vtx2 = &PhdVBuf[*ptrObj++];
textureIdx = *ptrObj++;
texture = &PhdTextureInfo[textureIdx];
uv = texture->uv;
nPoints = 3;
clipOR = LOBYTE(vtx0->clip | vtx1->clip | vtx2->clip);
clipAND = LOBYTE(vtx0->clip & vtx1->clip & vtx2->clip);
if( clipAND != 0 )
continue;
if( clipOR >= 0 ) {
if( !VBUF_VISIBLE(*vtx0, *vtx1, *vtx2) )
continue;
if( clipOR == 0 ) {
zv = CalculatePolyZ(sortType, vtx0->zv, vtx1->zv, vtx2->zv);
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(zv);
++Sort3dPtr;
if( zv >= (double)PerspectiveDistance ) {
*Info3dPtr++ = ( texture->drawtype == DRAW_Opaque ) ? POLY_GTmap : POLY_WGTmap;
*Info3dPtr++ = texture->tpage;
*Info3dPtr++ = 3;
*Info3dPtr++ = (int)vtx0->xs;
*Info3dPtr++ = (int)vtx0->ys;
*Info3dPtr++ = (int)vtx0->g;
*Info3dPtr++ = uv[0].u;
*Info3dPtr++ = uv[0].v;
*Info3dPtr++ = (int)vtx1->xs;
*Info3dPtr++ = (int)vtx1->ys;
*Info3dPtr++ = (int)vtx1->g;
*Info3dPtr++ = uv[1].u;
*Info3dPtr++ = uv[1].v;
*Info3dPtr++ = (int)vtx2->xs;
*Info3dPtr++ = (int)vtx2->ys;
*Info3dPtr++ = (int)vtx2->g;
*Info3dPtr++ = uv[2].u;
*Info3dPtr++ = uv[2].v;
} else {
*Info3dPtr++ = ( texture->drawtype == DRAW_Opaque ) ? POLY_GTmap_persp : POLY_WGTmap_persp;
*Info3dPtr++ = texture->tpage;
*Info3dPtr++ = 3;
*Info3dPtr++ = (int)vtx0->xs;
*Info3dPtr++ = (int)vtx0->ys;
*Info3dPtr++ = (int)vtx0->g;
*(float *)Info3dPtr = vtx0->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*(float *)Info3dPtr = (double)uv[0].u * vtx0->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*(float *)Info3dPtr = (double)uv[0].v * vtx0->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*Info3dPtr++ = (int)vtx1->xs;
*Info3dPtr++ = (int)vtx1->ys;
*Info3dPtr++ = (int)vtx1->g;
*(float *)Info3dPtr = vtx1->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*(float *)Info3dPtr = (double)uv[1].u * vtx1->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*(float *)Info3dPtr = (double)uv[1].v * vtx1->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*Info3dPtr++ = (int)vtx2->xs;
*Info3dPtr++ = (int)vtx2->ys;
*Info3dPtr++ = (int)vtx2->g;
*(float *)Info3dPtr = vtx2->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*(float *)Info3dPtr = (double)uv[2].u * vtx2->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*(float *)Info3dPtr = (double)uv[2].v * vtx2->rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
}
++SurfaceCount;
continue;
}
VBuffer[0].x = vtx0->xs;
VBuffer[0].y = vtx0->ys;
VBuffer[0].rhw = vtx0->rhw;
VBuffer[0].g = (float)vtx0->g;
VBuffer[0].u = (double)uv[0].u * vtx0->rhw;
VBuffer[0].v = (double)uv[0].v * vtx0->rhw;
VBuffer[1].x = vtx1->xs;
VBuffer[1].y = vtx1->ys;
VBuffer[1].rhw = vtx1->rhw;
VBuffer[1].g = (float)vtx1->g;
VBuffer[1].u = (double)uv[1].u * vtx1->rhw;
VBuffer[1].v = (double)uv[1].v * vtx1->rhw;
VBuffer[2].x = vtx2->xs;
VBuffer[2].y = vtx2->ys;
VBuffer[2].rhw = vtx2->rhw;
VBuffer[2].g = (float)vtx2->g;
VBuffer[2].u = (double)uv[2].u * vtx2->rhw;
VBuffer[2].v = (double)uv[2].v * vtx2->rhw;
} else {
if( !visible_zclip(vtx0, vtx1, vtx2) )
continue;
points[0].xv = vtx0->xv;
points[0].yv = vtx0->yv;
points[0].zv = vtx0->zv;
points[0].rhw = vtx0->rhw;
points[0].xs = vtx0->xs;
points[0].ys = vtx0->ys;
points[0].u = (float)uv[0].u;
points[0].v = (float)uv[0].v;
points[0].g = (float)vtx0->g;
points[1].yv = vtx1->yv;
points[1].xv = vtx1->xv;
points[1].zv = vtx1->zv;
points[1].rhw = vtx1->rhw;
points[1].xs = vtx1->xs;
points[1].ys = vtx1->ys;
points[1].u = (float)uv[1].u;
points[1].v = (float)uv[1].v;
points[1].g = (float)vtx1->g;
points[2].xv = vtx2->xv;
points[2].yv = vtx2->yv;
points[2].zv = vtx2->zv;
points[2].rhw = vtx2->rhw;
points[2].xs = vtx2->xs;
points[2].ys = vtx2->ys;
points[2].u = (float)uv[2].u;
points[2].v = (float)uv[2].v;
points[2].g = (float)vtx2->g;
nPoints = ZedClipper(nPoints, points, VBuffer);
if( nPoints == 0 ) continue;
}
nPoints = XYGUVClipper(nPoints, VBuffer);
if( nPoints == 0 ) continue;
zv = CalculatePolyZ(sortType, vtx0->zv, vtx1->zv, vtx2->zv);
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(zv);
++Sort3dPtr;
if( zv >= (double)PerspectiveDistance ) {
*Info3dPtr++ = ( texture->drawtype == DRAW_Opaque ) ? POLY_GTmap : POLY_WGTmap;
*Info3dPtr++ = texture->tpage;
*Info3dPtr++ = nPoints;
for( j = 0; j < nPoints; ++j ) {
*Info3dPtr++ = (int)VBuffer[j].x;
*Info3dPtr++ = (int)VBuffer[j].y;
*Info3dPtr++ = (int)VBuffer[j].g;
*Info3dPtr++ = (int)(VBuffer[j].u / VBuffer[j].rhw);
*Info3dPtr++ = (int)(VBuffer[j].v / VBuffer[j].rhw);
}
} else {
*Info3dPtr++ = ( texture->drawtype == DRAW_Opaque ) ? POLY_GTmap_persp : POLY_WGTmap_persp;
*Info3dPtr++ = texture->tpage;
*Info3dPtr++ = nPoints;
for( j = 0; j < nPoints; ++j ) {
*Info3dPtr++ = (int)VBuffer[j].x;
*Info3dPtr++ = (int)VBuffer[j].y;
*Info3dPtr++ = (int)VBuffer[j].g;
*(float *)Info3dPtr = VBuffer[j].rhw;
Info3dPtr += sizeof(float)/sizeof(__int16);
*(float *)Info3dPtr = VBuffer[j].u;
Info3dPtr += sizeof(float)/sizeof(__int16);
*(float *)Info3dPtr = VBuffer[j].v;
Info3dPtr += sizeof(float)/sizeof(__int16);
}
}
++SurfaceCount;
}
return ptrObj;
}
static inline void clipG(VERTEX_INFO *buf, VERTEX_INFO *vtx1, VERTEX_INFO *vtx2, float clip) {
buf->rhw = vtx2->rhw + (vtx1->rhw - vtx2->rhw) * clip;
buf->g = vtx2->g + (vtx1->g - vtx2->g) * clip;
}
int __cdecl XYGClipper(int vtxCount, VERTEX_INFO *vtx) {
VERTEX_INFO vtx_buf[8];
VERTEX_INFO *vtx1, *vtx2;
float clip;
int i, j;
if( vtxCount < 3 )
return 0;
// horizontal clip
vtx2 = &vtx[vtxCount - 1];
j = 0;
for( i = 0; i < vtxCount; ++i ) {
vtx1 = vtx2;
vtx2 = &vtx[i];
if( vtx1->x < FltWinLeft ) {
if( vtx2->x < FltWinLeft ) {
continue;
}
clip = (FltWinLeft - vtx2->x) / (vtx1->x - vtx2->x);
vtx_buf[j].x = FltWinLeft;
vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip;
clipG(&vtx_buf[j++], vtx1, vtx2, clip);
}
else if( vtx1->x > FltWinRight) {
if( vtx2->x > FltWinRight ) {
continue;
}
clip = (FltWinRight - vtx2->x) / (vtx1->x - vtx2->x);
vtx_buf[j].x = FltWinRight;
vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip;
clipG(&vtx_buf[j++], vtx1, vtx2, clip);
}
if( vtx2->x < FltWinLeft ) {
clip = (FltWinLeft - vtx2->x) / (vtx1->x - vtx2->x);
vtx_buf[j].x = FltWinLeft;
vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip;
clipG(&vtx_buf[j++], vtx1, vtx2, clip);
}
else if( vtx2->x > FltWinRight ) {
clip = (FltWinRight - vtx2->x) / (vtx1->x - vtx2->x);
vtx_buf[j].x = FltWinRight;
vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip;
clipG(&vtx_buf[j++], vtx1, vtx2, clip);
} else {
vtx_buf[j++] = *vtx2;
}
}
vtxCount = j;
if( vtxCount < 3 )
return 0;
// vertical clip
vtx2 = &vtx_buf[vtxCount-1];
j = 0;
for( i = 0; i < vtxCount; ++i ) {
vtx1 = vtx2;
vtx2 = &vtx_buf[i];
if( vtx1->y < FltWinTop ) {
if( vtx2->y < FltWinTop ) {
continue;
}
clip = (FltWinTop - vtx2->y) / (vtx1->y - vtx2->y);
vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip;
vtx[j].y = FltWinTop;
clipG(&vtx[j++], vtx1, vtx2, clip);
}
else if( vtx1->y > FltWinBottom ) {
if( vtx2->y > FltWinBottom ) {
continue;
}
clip = (FltWinBottom - vtx2->y) / (vtx1->y - vtx2->y);
vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip;
vtx[j].y = FltWinBottom;
clipG(&vtx[j++], vtx1, vtx2, clip);
}
if( vtx2->y < FltWinTop ) {
clip = (FltWinTop - vtx2->y) / (vtx1->y - vtx2->y);
vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip;
vtx[j].y = FltWinTop;
clipG(&vtx[j++], vtx1, vtx2, clip);
}
else if( vtx2->y > FltWinBottom ) {
clip = (FltWinBottom - vtx2->y) / (vtx1->y - vtx2->y);
vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip;
vtx[j].y = FltWinBottom;
clipG(&vtx[j++], vtx1, vtx2, clip);
} else {
vtx[j++] = *vtx2;
}
}
return ( j < 3 ) ? 0 : j;
}
__int16 *__cdecl InsertObjectG4(__int16 *ptrObj, int number, SORTTYPE sortType) {
char clipOR, clipAND;
PHD_VBUF *vtx0, *vtx1, *vtx2, *vtx3;
int i, j, nPoints;
float zv;
BYTE colorIdx;
POINT_INFO pts[4];
for( i = 0; i < number; ++i ) {
vtx0 = &PhdVBuf[*ptrObj++];
vtx1 = &PhdVBuf[*ptrObj++];
vtx2 = &PhdVBuf[*ptrObj++];
vtx3 = &PhdVBuf[*ptrObj++];
colorIdx = *ptrObj++;
nPoints = 4;
clipOR = LOBYTE(vtx0->clip | vtx1->clip | vtx2->clip | vtx3->clip);
clipAND = LOBYTE(vtx0->clip & vtx1->clip & vtx2->clip & vtx3->clip);
if( clipAND != 0 )
continue;
if( clipOR >= 0 ) {
if( !VBUF_VISIBLE(*vtx0, *vtx1, *vtx2) )
continue;
VBuffer[0].x = vtx0->xs;
VBuffer[0].y = vtx0->ys;
VBuffer[0].rhw = vtx0->rhw;
VBuffer[0].g = (float)vtx0->g;
VBuffer[1].x = vtx1->xs;
VBuffer[1].y = vtx1->ys;
VBuffer[1].rhw = vtx1->rhw;
VBuffer[1].g = (float)vtx1->g;
VBuffer[2].x = vtx2->xs;
VBuffer[2].y = vtx2->ys;
VBuffer[2].rhw = vtx2->rhw;
VBuffer[2].g = (float)vtx2->g;
VBuffer[3].x = vtx3->xs;
VBuffer[3].y = vtx3->ys;
VBuffer[3].rhw = vtx3->rhw;
VBuffer[3].g = (float)vtx3->g;
if( clipOR > 0 ) {
nPoints = XYGClipper(nPoints, VBuffer);
}
} else {
if( !visible_zclip(vtx0, vtx1, vtx2) )
continue;
pts[0].xv = vtx0->xv;
pts[0].yv = vtx0->yv;
pts[0].zv = vtx0->zv;
pts[0].rhw = vtx0->rhw;
pts[0].xs = vtx0->xs;
pts[0].ys = vtx0->ys;
pts[0].g = (float)vtx0->g;
pts[1].xv = vtx1->xv;
pts[1].yv = vtx1->yv;
pts[1].zv = vtx1->zv;
pts[1].rhw = vtx1->rhw;
pts[1].xs = vtx1->xs;
pts[1].ys = vtx1->ys;
pts[1].g = (float)vtx1->g;
pts[2].xv = vtx2->xv;
pts[2].yv = vtx2->yv;
pts[2].zv = vtx2->zv;
pts[2].rhw = vtx2->rhw;
pts[2].xs = vtx2->xs;
pts[2].ys = vtx2->ys;
pts[2].g = (float)vtx2->g;
pts[3].xv = vtx3->xv;
pts[3].yv = vtx3->yv;
pts[3].zv = vtx3->zv;
pts[3].rhw = vtx3->rhw;
pts[3].xs = vtx3->xs;
pts[3].ys = vtx3->ys;
pts[3].g = (float)vtx3->g;
nPoints = ZedClipper(nPoints, pts, VBuffer);
if( nPoints == 0 ) continue;
nPoints = XYGClipper(nPoints, VBuffer);
}
if( nPoints == 0 )
continue;
zv = CalculatePolyZ(sortType, vtx0->zv, vtx1->zv, vtx2->zv, vtx3->zv);
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(zv);
++Sort3dPtr;
*Info3dPtr++ = POLY_gouraud;
*Info3dPtr++ = colorIdx;
*Info3dPtr++ = nPoints;
for( j = 0; j < nPoints; ++j ) {
*Info3dPtr++ = VBuffer[j].x;
*Info3dPtr++ = VBuffer[j].y;
*Info3dPtr++ = VBuffer[j].g;
}
++SurfaceCount;
}
return ptrObj;
}
__int16 *__cdecl InsertObjectG3(__int16 *ptrObj, int number, SORTTYPE sortType) {
char clipOR, clipAND;
PHD_VBUF *vtx0, *vtx1, *vtx2;
int i, j, nPoints;
float zv;
BYTE colorIdx;
POINT_INFO pts[3];
for( i = 0; i < number; ++i ) {
vtx0 = &PhdVBuf[*ptrObj++];
vtx1 = &PhdVBuf[*ptrObj++];
vtx2 = &PhdVBuf[*ptrObj++];
colorIdx = *ptrObj++;
nPoints = 3;
clipOR = LOBYTE(vtx0->clip | vtx1->clip | vtx2->clip);
clipAND = LOBYTE(vtx0->clip & vtx1->clip & vtx2->clip);
if( clipAND != 0 )
continue;
if( clipOR >= 0 ) {
if( !VBUF_VISIBLE(*vtx0, *vtx1, *vtx2) )
continue;
VBuffer[0].x = vtx0->xs;
VBuffer[0].y = vtx0->ys;
VBuffer[0].rhw = vtx0->rhw;
VBuffer[0].g = (float)vtx0->g;
VBuffer[1].x = vtx1->xs;
VBuffer[1].y = vtx1->ys;
VBuffer[1].rhw = vtx1->rhw;
VBuffer[1].g = (float)vtx1->g;
VBuffer[2].x = vtx2->xs;
VBuffer[2].y = vtx2->ys;
VBuffer[2].rhw = vtx2->rhw;
VBuffer[2].g = (float)vtx2->g;
if( clipOR > 0 ) {
nPoints = XYGClipper(nPoints, VBuffer);
}
} else {
if( !visible_zclip(vtx0, vtx1, vtx2) )
continue;
pts[0].xv = vtx0->xv;
pts[0].yv = vtx0->yv;
pts[0].zv = vtx0->zv;
pts[0].rhw = vtx0->rhw;
pts[0].xs = vtx0->xs;
pts[0].ys = vtx0->ys;
pts[0].g = (float)vtx0->g;
pts[1].xv = vtx1->xv;
pts[1].yv = vtx1->yv;
pts[1].zv = vtx1->zv;
pts[1].rhw = vtx1->rhw;
pts[1].xs = vtx1->xs;
pts[1].ys = vtx1->ys;
pts[1].g = (float)vtx1->g;
pts[2].xv = vtx2->xv;
pts[2].yv = vtx2->yv;
pts[2].zv = vtx2->zv;
pts[2].rhw = vtx2->rhw;
pts[2].xs = vtx2->xs;
pts[2].ys = vtx2->ys;
pts[2].g = (float)vtx2->g;
nPoints = ZedClipper(nPoints, pts, VBuffer);
if( nPoints == 0 ) continue;
nPoints = XYGClipper(nPoints, VBuffer);
}
if( nPoints == 0 )
continue;
zv = CalculatePolyZ(sortType, vtx0->zv, vtx1->zv, vtx2->zv);
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(zv);
++Sort3dPtr;
*Info3dPtr++ = POLY_gouraud;
*Info3dPtr++ = colorIdx;
*Info3dPtr++ = nPoints;
for( j = 0; j < nPoints; ++j ) {
*Info3dPtr++ = (int)VBuffer[j].x;
*Info3dPtr++ = (int)VBuffer[j].y;
*Info3dPtr++ = (int)VBuffer[j].g;
}
++SurfaceCount;
}
return ptrObj;
}
int __cdecl XYClipper(int vtxCount, VERTEX_INFO *vtx) {
// NOTE: the original function ignores rhw clipping that produces bugs for Z Buffer
static VERTEX_INFO vtx_buf[40]; // NOTE: original size was 20
VERTEX_INFO *vtx1, *vtx2;
float clip;
int i, j;
if( vtxCount < 3 )
return 0;
// horizontal clip
vtx2 = &vtx[vtxCount - 1];
j = 0;
for( i = 0; i < vtxCount; ++i ) {
vtx1 = vtx2;
vtx2 = &vtx[i];
if( vtx1->x < FltWinLeft ) {
if( vtx2->x < FltWinLeft ) {
continue;
}
clip = (FltWinLeft - vtx2->x) / (vtx1->x - vtx2->x);
vtx_buf[j].x = FltWinLeft;
vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip;
vtx_buf[j++].rhw = vtx2->rhw + (vtx1->rhw - vtx2->rhw) * clip;
}
else if( vtx1->x > FltWinRight) {
if( vtx2->x > FltWinRight ) {
continue;
}
clip = (FltWinRight - vtx2->x) / (vtx1->x - vtx2->x);
vtx_buf[j].x = FltWinRight;
vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip;
vtx_buf[j++].rhw = vtx2->rhw + (vtx1->rhw - vtx2->rhw) * clip;
}
if( vtx2->x < FltWinLeft ) {
clip = (FltWinLeft - vtx2->x) / (vtx1->x - vtx2->x);
vtx_buf[j].x = FltWinLeft;
vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip;
vtx_buf[j++].rhw = vtx2->rhw + (vtx1->rhw - vtx2->rhw) * clip;
}
else if( vtx2->x > FltWinRight ) {
clip = (FltWinRight - vtx2->x) / (vtx1->x - vtx2->x);
vtx_buf[j].x = FltWinRight;
vtx_buf[j].y = vtx2->y + (vtx1->y - vtx2->y) * clip;
vtx_buf[j++].rhw = vtx2->rhw + (vtx1->rhw - vtx2->rhw) * clip;
} else {
vtx_buf[j].x = vtx2->x;
vtx_buf[j].y = vtx2->y;
vtx_buf[j++].rhw = vtx2->rhw;
}
}
vtxCount = j;
if( vtxCount < 3 )
return 0;
// vertical clip
vtx2 = &vtx_buf[vtxCount-1];
j = 0;
for( i = 0; i < vtxCount; ++i ) {
vtx1 = vtx2;
vtx2 = &vtx_buf[i];
if( vtx1->y < FltWinTop ) {
if( vtx2->y < FltWinTop ) {
continue;
}
clip = (FltWinTop - vtx2->y) / (vtx1->y - vtx2->y);
vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip;
vtx[j].y = FltWinTop;
vtx[j++].rhw = vtx2->rhw + (vtx1->rhw - vtx2->rhw) * clip;
}
else if( vtx1->y > FltWinBottom ) {
if( vtx2->y > FltWinBottom ) {
continue;
}
clip = (FltWinBottom - vtx2->y) / (vtx1->y - vtx2->y);
vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip;
vtx[j].y = FltWinBottom;
vtx[j++].rhw = vtx2->rhw + (vtx1->rhw - vtx2->rhw) * clip;
}
if( vtx2->y < FltWinTop ) {
clip = (FltWinTop - vtx2->y) / (vtx1->y - vtx2->y);
vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip;
vtx[j].y = FltWinTop;
vtx[j++].rhw = vtx2->rhw + (vtx1->rhw - vtx2->rhw) * clip;
}
else if( vtx2->y > FltWinBottom ) {
clip = (FltWinBottom - vtx2->y) / (vtx1->y - vtx2->y);
vtx[j].x = vtx2->x + (vtx1->x - vtx2->x) * clip;
vtx[j].y = FltWinBottom;
vtx[j++].rhw = vtx2->rhw + (vtx1->rhw - vtx2->rhw) * clip;
} else {
vtx[j].x = vtx2->x;
vtx[j].y = vtx2->y;
vtx[j++].rhw = vtx2->rhw;
}
}
return ( j < 3 ) ? 0 : j;
}
void __cdecl InsertTrans8(PHD_VBUF *vbuf, __int16 shade) {
int i, nPoints, polyZ;
char clipOR = 0x00;
char clipAND = 0xFF;
#ifdef FEATURE_VIDEOFX_IMPROVED
int nVtx = ( ShadowMode == 1 ) ? 32 : 8;
#else // FEATURE_VIDEOFX_IMPROVED
int nVtx = 8;
#endif // FEATURE_VIDEOFX_IMPROVED
for( i = 0; i < nVtx; ++i ) {
clipOR |= LOBYTE(vbuf[i].clip);
clipAND &= LOBYTE(vbuf[i].clip);
}
if( (clipOR < 0) || (clipAND != 0) || !VBUF_VISIBLE(vbuf[0], vbuf[1], vbuf[2]) )
return;
for( i = 0; i < nVtx; ++i ) {
VBuffer[i].x = vbuf[i].xs;
VBuffer[i].y = vbuf[i].ys;
}
nPoints = nVtx;
if( clipOR != 0 ) {
FltWinLeft = 0.0;
FltWinTop = 0.0;
FltWinRight = (float)PhdWinMaxX;
FltWinBottom = (float)PhdWinMaxY;
nPoints = XYClipper(nPoints, VBuffer);
if( nPoints == 0) return;
}
#ifdef FEATURE_VIDEOFX_IMPROVED
double polyZflt = 0.0;
for( i = 0; i < nVtx; ++i ) {
polyZflt += (double)vbuf[i].zv / (double)nVtx;
}
polyZ = polyZflt;
#else // FEATURE_VIDEOFX_IMPROVED
polyZ = 0;
for( i = 0; i < nVtx; ++i ) {
polyZ += vbuf[i].zv;
}
polyZ /= nVtx;
#endif // FEATURE_VIDEOFX_IMPROVED
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(polyZ);
++Sort3dPtr;
*(Info3dPtr++) = POLY_trans;
*(Info3dPtr++) = shade;
*(Info3dPtr++) = nPoints; // number of vertices
for( i = 0; i < nPoints; ++i ) {
*(Info3dPtr++) = (int)VBuffer[i].x;
*(Info3dPtr++) = (int)VBuffer[i].y;
}
++SurfaceCount;
}
void __cdecl InsertTransQuad(int x, int y, int width, int height, int z) {
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(PhdNearZ + 8*z);
++Sort3dPtr;
*(Info3dPtr++) = POLY_trans;
// NOTE: Here 24 is DepthQ index (shade factor).
// 0 lightest, 15 no shade, 31 darkest (pitch black).
// But original code has value 32 supposed to be interpreted as 24 (which means 50% darker)
// Also 32 is maximum valid value in the original code, though it is DepthQTable range violation.
// This trick worked because DepthQIndex array was right after DepthQ array in the memory
// (DepthQIndex is equal to &DepthQ[24].index).This allocation is not guaranteed on some systems, so it was fixed
*(Info3dPtr++) = 24;
*(Info3dPtr++) = 4; // number of vertices
*(Info3dPtr++) = x;
*(Info3dPtr++) = y;
*(Info3dPtr++) = x + width;
*(Info3dPtr++) = y;
*(Info3dPtr++) = x + width;
*(Info3dPtr++) = y + height;
*(Info3dPtr++) = x;
*(Info3dPtr++) = y + height;
++SurfaceCount;
}
void __cdecl InsertFlatRect(int x0, int y0, int x1, int y1, int z, BYTE colorIdx) {
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(z);
++Sort3dPtr;
*(Info3dPtr++) = POLY_flat;
*(Info3dPtr++) = colorIdx;
*(Info3dPtr++) = 4; // number of vertices
*(Info3dPtr++) = x0;
*(Info3dPtr++) = y0;
*(Info3dPtr++) = x1;
*(Info3dPtr++) = y0;
*(Info3dPtr++) = x1;
*(Info3dPtr++) = y1;
*(Info3dPtr++) = x0;
*(Info3dPtr++) = y1;
++SurfaceCount;
}
void __cdecl InsertLine(int x0, int y0, int x1, int y1, int z, BYTE colorIdx) {
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(z);
++Sort3dPtr;
*(Info3dPtr++) = POLY_line;
*(Info3dPtr++) = PhdWinMinX + x0;
*(Info3dPtr++) = PhdWinMinY + y0;
*(Info3dPtr++) = PhdWinMinX + x1;
*(Info3dPtr++) = PhdWinMinY + y1;
*(Info3dPtr++) = colorIdx;
++SurfaceCount;
}
void __cdecl InsertGT3_ZBuffered(PHD_VBUF *vtx0, PHD_VBUF *vtx1, PHD_VBUF *vtx2, PHD_TEXTURE *texture, PHD_UV *uv0, PHD_UV *uv1, PHD_UV *uv2) {
char clipOR, clipAND;
POINT_INFO points[3];
int nPoints = 3;
clipOR = LOBYTE(vtx0->clip | vtx1->clip | vtx2->clip);
clipAND = LOBYTE(vtx0->clip & vtx1->clip & vtx2->clip);
if( clipAND != 0 )
return;
if( clipOR >= 0 ) {
if( !VBUF_VISIBLE(*vtx0, *vtx1, *vtx2) )
return;
if( clipOR == 0 ) {
VBufferD3D[0].sx = vtx0->xs;
VBufferD3D[0].sy = vtx0->ys;
VBufferD3D[0].sz = FltResZBuf - FltResZORhw * vtx0->rhw;
VBufferD3D[0].rhw = vtx0->rhw;
VBufferD3D[0].color = shadeColor(0xFF, 0xFF, 0xFF, 0xFF, vtx0->g, true);
VBufferD3D[0].tu = (double)uv0->u / (double)PHD_ONE;
VBufferD3D[0].tv = (double)uv0->v / (double)PHD_ONE;
VBufferD3D[1].sx = vtx1->xs;
VBufferD3D[1].sy = vtx1->ys;
VBufferD3D[1].sz = FltResZBuf - FltResZORhw * vtx1->rhw;
VBufferD3D[1].rhw = vtx1->rhw;
VBufferD3D[1].color = shadeColor(0xFF, 0xFF, 0xFF, 0xFF, vtx1->g, true);
VBufferD3D[1].tu = (double)uv1->u / (double)PHD_ONE;
VBufferD3D[1].tv = (double)uv1->v / (double)PHD_ONE;
VBufferD3D[2].sx = vtx2->xs;
VBufferD3D[2].sy = vtx2->ys;
VBufferD3D[2].sz = FltResZBuf - FltResZORhw * vtx2->rhw;
VBufferD3D[2].rhw = vtx2->rhw;
VBufferD3D[2].color = shadeColor(0xFF, 0xFF, 0xFF, 0xFF, vtx2->g, true);
VBufferD3D[2].tu = (double)uv2->u / (double)PHD_ONE;
VBufferD3D[2].tv = (double)uv2->v / (double)PHD_ONE;
#ifdef FEATURE_VIDEOFX_IMPROVED
HWR_TexSource(texture->tpage == (UINT16)~0 ? GetEnvmapTextureHandle() : HWR_PageHandles[texture->tpage]);
#else // !FEATURE_VIDEOFX_IMPROVED
HWR_TexSource(HWR_PageHandles[texture->tpage]);
#endif // !FEATURE_VIDEOFX_IMPROVED
HWR_EnableColorKey(texture->drawtype != DRAW_Opaque);
HWR_DrawPrimitive(D3DPT_TRIANGLELIST, VBufferD3D, 3, true);
return;
}
VBuffer[0].x = vtx0->xs;
VBuffer[0].y = vtx0->ys;
VBuffer[0].rhw = vtx0->rhw;
VBuffer[0].g = (double)vtx0->g;
VBuffer[0].u = (double)uv0->u * vtx0->rhw;
VBuffer[0].v = (double)uv0->v * vtx0->rhw;
VBuffer[1].x = vtx1->xs;
VBuffer[1].y = vtx1->ys;
VBuffer[1].rhw = vtx1->rhw;
VBuffer[1].g = (double)vtx1->g;
VBuffer[1].u = (double)uv1->u * vtx1->rhw;
VBuffer[1].v = (double)uv1->v * vtx1->rhw;
VBuffer[2].x = vtx2->xs;
VBuffer[2].y = vtx2->ys;
VBuffer[2].rhw = vtx2->rhw;
VBuffer[2].g = (double)vtx2->g;
VBuffer[2].u = (double)uv2->u * vtx2->rhw;
VBuffer[2].v = (double)uv2->v * vtx2->rhw;
} else {
if( !visible_zclip(vtx0, vtx1, vtx2) )
return;
points[0].xv = vtx0->xv;
points[0].yv = vtx0->yv;
points[0].zv = vtx0->zv;
points[0].rhw = vtx0->rhw;
points[0].xs = vtx0->xs;
points[0].ys = vtx0->ys;
points[0].u = (float)uv0->u;
points[0].v = (float)uv0->v;
points[0].g = (float)vtx0->g;
points[1].yv = vtx1->yv;
points[1].xv = vtx1->xv;
points[1].zv = vtx1->zv;
points[1].rhw = vtx1->rhw;
points[1].xs = vtx1->xs;
points[1].ys = vtx1->ys;
points[1].u = (float)uv1->u;
points[1].v = (float)uv1->v;
points[1].g = (float)vtx1->g;
points[2].xv = vtx2->xv;
points[2].yv = vtx2->yv;
points[2].zv = vtx2->zv;
points[2].rhw = vtx2->rhw;
points[2].xs = vtx2->xs;
points[2].ys = vtx2->ys;
points[2].u = (float)uv2->u;
points[2].v = (float)uv2->v;
points[2].g = (float)vtx2->g;
nPoints = ZedClipper(nPoints, points, VBuffer);
if( nPoints == 0 ) return;
}
nPoints = XYGUVClipper(nPoints, VBuffer);
if( nPoints == 0 ) return;
#ifdef FEATURE_VIDEOFX_IMPROVED
HWR_TexSource(texture->tpage == (UINT16)~0 ? GetEnvmapTextureHandle() : HWR_PageHandles[texture->tpage]);
#else // !FEATURE_VIDEOFX_IMPROVED
HWR_TexSource(HWR_PageHandles[texture->tpage]);
#endif // !FEATURE_VIDEOFX_IMPROVED
HWR_EnableColorKey(texture->drawtype != DRAW_Opaque);
DrawClippedPoly_Textured(nPoints);
}
void __cdecl DrawClippedPoly_Textured(int vtxCount) {
D3DCOLOR color;
double tu, tv;
if( vtxCount == 0 )
return;
for( int i = 0; i < vtxCount; ++i ) {
color = shadeColor(0xFF, 0xFF, 0xFF, 0xFF, (DWORD)VBuffer[i].g, true);
tu = VBuffer[i].u / VBuffer[i].rhw / (double)PHD_ONE;
tv = VBuffer[i].v / VBuffer[i].rhw / (double)PHD_ONE;
CLAMP(tu, 0.0, 1.0);
CLAMP(tv, 0.0, 1.0);
VBufferD3D[i].sx = VBuffer[i].x;
VBufferD3D[i].sy = VBuffer[i].y;
VBufferD3D[i].sz = FltResZBuf - FltResZORhw * VBuffer[i].rhw;
VBufferD3D[i].rhw = VBuffer[i].rhw;
VBufferD3D[i].color = color;
VBufferD3D[i].tu = tu;
VBufferD3D[i].tv = tv;
}
HWR_DrawPrimitive(D3DPT_TRIANGLEFAN, VBufferD3D, vtxCount, true);
}
void __cdecl InsertGT4_ZBuffered(PHD_VBUF *vtx0, PHD_VBUF *vtx1, PHD_VBUF *vtx2, PHD_VBUF *vtx3, PHD_TEXTURE *texture) {
char clipOR, clipAND;
clipOR = LOBYTE(vtx0->clip | vtx1->clip | vtx2->clip | vtx3->clip);
clipAND = LOBYTE(vtx0->clip & vtx1->clip & vtx2->clip & vtx3->clip);
if( clipAND != 0 )
return;
if( clipOR == 0 && VBUF_VISIBLE(*vtx0, *vtx1, *vtx2) ) {
VBufferD3D[0].sx = vtx0->xs;
VBufferD3D[0].sy = vtx0->ys;
VBufferD3D[0].sz = FltResZBuf - FltResZORhw * vtx0->rhw;
VBufferD3D[0].rhw = vtx0->rhw;
VBufferD3D[0].color = shadeColor(0xFF, 0xFF, 0xFF, 0xFF, vtx0->g, true);
VBufferD3D[0].tu = (double)texture->uv[0].u / (double)PHD_ONE;
VBufferD3D[0].tv = (double)texture->uv[0].v / (double)PHD_ONE;
VBufferD3D[1].sx = vtx1->xs;
VBufferD3D[1].sy = vtx1->ys;
VBufferD3D[1].sz = FltResZBuf - FltResZORhw * vtx1->rhw;
VBufferD3D[1].rhw = vtx1->rhw;
VBufferD3D[1].color = shadeColor(0xFF, 0xFF, 0xFF, 0xFF, vtx1->g, true);
VBufferD3D[1].tu = (double)texture->uv[1].u / (double)PHD_ONE;
VBufferD3D[1].tv = (double)texture->uv[1].v / (double)PHD_ONE;
VBufferD3D[2].sx = vtx2->xs;
VBufferD3D[2].sy = vtx2->ys;
VBufferD3D[2].sz = FltResZBuf - FltResZORhw * vtx2->rhw;
VBufferD3D[2].rhw = vtx2->rhw;
VBufferD3D[2].color = shadeColor(0xFF, 0xFF, 0xFF, 0xFF, vtx2->g, true);
VBufferD3D[2].tu = (double)texture->uv[2].u / (double)PHD_ONE;
VBufferD3D[2].tv = (double)texture->uv[2].v / (double)PHD_ONE;
VBufferD3D[3].sx = vtx3->xs;
VBufferD3D[3].sy = vtx3->ys;
VBufferD3D[3].sz = FltResZBuf - FltResZORhw * vtx3->rhw;
VBufferD3D[3].rhw = vtx3->rhw;
VBufferD3D[3].color = shadeColor(0xFF, 0xFF, 0xFF, 0xFF, vtx3->g, true);
VBufferD3D[3].tu = (double)texture->uv[3].u / (double)PHD_ONE;
VBufferD3D[3].tv = (double)texture->uv[3].v / (double)PHD_ONE;
#ifdef FEATURE_VIDEOFX_IMPROVED
HWR_TexSource(texture->tpage == (UINT16)~0 ? GetEnvmapTextureHandle() : HWR_PageHandles[texture->tpage]);
#else // !FEATURE_VIDEOFX_IMPROVED
HWR_TexSource(HWR_PageHandles[texture->tpage]);
#endif // !FEATURE_VIDEOFX_IMPROVED
HWR_EnableColorKey(texture->drawtype != DRAW_Opaque);
HWR_DrawPrimitive(D3DPT_TRIANGLEFAN, VBufferD3D, 4, true);
}
else if( (clipOR < 0 && visible_zclip(vtx0, vtx1, vtx2)) ||
(clipOR > 0 && VBUF_VISIBLE(*vtx0, *vtx1, *vtx2)) )
{
InsertGT3_ZBuffered(vtx0, vtx1, vtx2, texture, texture->uv, &texture->uv[1], &texture->uv[2]);
InsertGT3_ZBuffered(vtx0, vtx2, vtx3, texture, texture->uv, &texture->uv[2], &texture->uv[3]);
}
}
__int16 *__cdecl InsertObjectGT4_ZBuffered(__int16 *ptrObj, int number, SORTTYPE sortType) {
PHD_VBUF *vtx0, *vtx1, *vtx2, *vtx3;
PHD_TEXTURE *texture;
for( int i = 0; i < number; ++i ) {
vtx0 = &PhdVBuf[ptrObj[0]];
vtx1 = &PhdVBuf[ptrObj[1]];
vtx2 = &PhdVBuf[ptrObj[2]];
vtx3 = &PhdVBuf[ptrObj[3]];
texture = &PhdTextureInfo[ptrObj[4]];
if( texture->drawtype != DRAW_Opaque )
InsertGT4_Sorted(vtx0, vtx1, vtx2, vtx3, texture, sortType);
else
InsertGT4_ZBuffered(vtx0, vtx1, vtx2, vtx3, texture);
ptrObj += 5;
}
return ptrObj;
}
__int16 *__cdecl InsertObjectGT3_ZBuffered(__int16 *ptrObj, int number, SORTTYPE sortType) {
PHD_VBUF *vtx0, *vtx1, *vtx2;
PHD_TEXTURE *texture;
PHD_UV *uv;
for( int i = 0; i < number; ++i ) {
vtx0 = &PhdVBuf[ptrObj[0]];
vtx1 = &PhdVBuf[ptrObj[1]];
vtx2 = &PhdVBuf[ptrObj[2]];
texture = &PhdTextureInfo[ptrObj[3]];
uv = texture->uv;
if( texture->drawtype != DRAW_Opaque )
InsertGT3_Sorted(vtx0, vtx1, vtx2, texture, &uv[0], &uv[1], &uv[2], sortType);
else
InsertGT3_ZBuffered(vtx0, vtx1, vtx2, texture, &uv[0], &uv[1], &uv[2]);
ptrObj += 4;
}
return ptrObj;
}
__int16 *__cdecl InsertObjectG4_ZBuffered(__int16 *ptrObj, int number, SORTTYPE sortType) {
char clipOR, clipAND;
PHD_VBUF *vtx0, *vtx1, *vtx2, *vtx3;
int i, nPoints;
__int16 colorIdx;
POINT_INFO pts[4];
HWR_TexSource(0);
HWR_EnableColorKey(false);
for( i = 0; i < number; ++i ) {
vtx0 = &PhdVBuf[*ptrObj++];
vtx1 = &PhdVBuf[*ptrObj++];
vtx2 = &PhdVBuf[*ptrObj++];
vtx3 = &PhdVBuf[*ptrObj++];
colorIdx = *ptrObj++;
nPoints = 4;
clipOR = LOBYTE(vtx0->clip | vtx1->clip | vtx2->clip | vtx3->clip);
clipAND = LOBYTE(vtx0->clip & vtx1->clip & vtx2->clip & vtx3->clip);
if( clipAND != 0 )
continue;
if( clipOR >= 0 ) {
if( !VBUF_VISIBLE(*vtx0, *vtx1, *vtx2) )
continue;
VBuffer[0].x = vtx0->xs;
VBuffer[0].y = vtx0->ys;
VBuffer[0].rhw = vtx0->rhw;
VBuffer[0].g = (float)vtx0->g;
VBuffer[1].x = vtx1->xs;
VBuffer[1].y = vtx1->ys;
VBuffer[1].rhw = vtx1->rhw;
VBuffer[1].g = (float)vtx1->g;
VBuffer[2].x = vtx2->xs;
VBuffer[2].y = vtx2->ys;
VBuffer[2].rhw = vtx2->rhw;
VBuffer[2].g = (float)vtx2->g;
VBuffer[3].x = vtx3->xs;
VBuffer[3].y = vtx3->ys;
VBuffer[3].rhw = vtx3->rhw;
VBuffer[3].g = (float)vtx3->g;
if( clipOR > 0 ) {
nPoints = XYGClipper(nPoints, VBuffer);
}
} else {
if( !visible_zclip(vtx0, vtx1, vtx2) )
continue;
pts[0].xv = vtx0->xv;
pts[0].yv = vtx0->yv;
pts[0].zv = vtx0->zv;
pts[0].rhw = vtx0->rhw;
pts[0].xs = vtx0->xs;
pts[0].ys = vtx0->ys;
pts[0].g = (float)vtx0->g;
pts[1].xv = vtx1->xv;
pts[1].yv = vtx1->yv;
pts[1].zv = vtx1->zv;
pts[1].rhw = vtx1->rhw;
pts[1].xs = vtx1->xs;
pts[1].ys = vtx1->ys;
pts[1].g = (float)vtx1->g;
pts[2].xv = vtx2->xv;
pts[2].yv = vtx2->yv;
pts[2].zv = vtx2->zv;
pts[2].rhw = vtx2->rhw;
pts[2].xs = vtx2->xs;
pts[2].ys = vtx2->ys;
pts[2].g = (float)vtx2->g;
pts[3].xv = vtx3->xv;
pts[3].yv = vtx3->yv;
pts[3].zv = vtx3->zv;
pts[3].rhw = vtx3->rhw;
pts[3].xs = vtx3->xs;
pts[3].ys = vtx3->ys;
pts[3].g = (float)vtx3->g;
nPoints = ZedClipper(nPoints, pts, VBuffer);
if( nPoints == 0 ) continue;
nPoints = XYGClipper(nPoints, VBuffer);
}
if( nPoints != 0 ) {
PALETTEENTRY *color = &GamePalette16[colorIdx >> 8];
#ifdef FEATURE_VIDEOFX_IMPROVED
if( AlphaBlendMode && color->peFlags > 0 && color->peFlags <= 4 ) {
float zv = CalculatePolyZ(sortType, vtx0->zv, vtx1->zv, vtx2->zv, vtx3->zv);
short blend[4] = {POLY_HWR_half, POLY_HWR_add, POLY_HWR_sub, POLY_HWR_qrt};
InsertPoly_Gouraud(nPoints, zv, color->peRed, color->peGreen, color->peBlue, blend[color->peFlags - 1]);
} else {
DrawPoly_Gouraud(nPoints, color->peRed, color->peGreen, color->peBlue);
}
#else // FEATURE_VIDEOFX_IMPROVED
DrawPoly_Gouraud(nPoints, color->peRed, color->peGreen, color->peBlue);
#endif // FEATURE_VIDEOFX_IMPROVED
}
}
return ptrObj;
}
void __cdecl DrawPoly_Gouraud(int vtxCount, int red, int green, int blue) {
D3DCOLOR color;
if( vtxCount == 0 )
return;
for( int i = 0; i < vtxCount; ++i ) {
color = shadeColor(red, green, blue, 0xFF, (DWORD)VBuffer[i].g, false);
VBufferD3D[i].sx = VBuffer[i].x;
VBufferD3D[i].sy = VBuffer[i].y;
VBufferD3D[i].sz = FltResZBuf - FltResZORhw * VBuffer[i].rhw;
VBufferD3D[i].rhw = VBuffer[i].rhw;
VBufferD3D[i].color = color;
}
HWR_DrawPrimitive(D3DPT_TRIANGLEFAN, VBufferD3D, vtxCount, true);
}
__int16 *__cdecl InsertObjectG3_ZBuffered(__int16 *ptrObj, int number, SORTTYPE sortType) {
char clipOR, clipAND;
PHD_VBUF *vtx0, *vtx1, *vtx2;
int i, nPoints;
__int16 colorIdx;
POINT_INFO pts[3];
HWR_TexSource(0);
HWR_EnableColorKey(false);
for( i = 0; i < number; ++i ) {
vtx0 = &PhdVBuf[*ptrObj++];
vtx1 = &PhdVBuf[*ptrObj++];
vtx2 = &PhdVBuf[*ptrObj++];
colorIdx = *ptrObj++;
nPoints = 3;
clipOR = LOBYTE(vtx0->clip | vtx1->clip | vtx2->clip);
clipAND = LOBYTE(vtx0->clip & vtx1->clip & vtx2->clip);
if( clipAND != 0 )
continue;
if( clipOR >= 0 ) {
if( !VBUF_VISIBLE(*vtx0, *vtx1, *vtx2) )
continue;
VBuffer[0].x = vtx0->xs;
VBuffer[0].y = vtx0->ys;
VBuffer[0].rhw = vtx0->rhw;
VBuffer[0].g = (float)vtx0->g;
VBuffer[1].x = vtx1->xs;
VBuffer[1].y = vtx1->ys;
VBuffer[1].rhw = vtx1->rhw;
VBuffer[1].g = (float)vtx1->g;
VBuffer[2].x = vtx2->xs;
VBuffer[2].y = vtx2->ys;
VBuffer[2].rhw = vtx2->rhw;
VBuffer[2].g = (float)vtx2->g;
if( clipOR > 0 ) {
nPoints = XYGClipper(nPoints, VBuffer);
}
} else {
if( !visible_zclip(vtx0, vtx1, vtx2) )
continue;
pts[0].xv = vtx0->xv;
pts[0].yv = vtx0->yv;
pts[0].zv = vtx0->zv;
pts[0].rhw = vtx0->rhw;
pts[0].xs = vtx0->xs;
pts[0].ys = vtx0->ys;
pts[0].g = (float)vtx0->g;
pts[1].xv = vtx1->xv;
pts[1].yv = vtx1->yv;
pts[1].zv = vtx1->zv;
pts[1].rhw = vtx1->rhw;
pts[1].xs = vtx1->xs;
pts[1].ys = vtx1->ys;
pts[1].g = (float)vtx1->g;
pts[2].xv = vtx2->xv;
pts[2].yv = vtx2->yv;
pts[2].zv = vtx2->zv;
pts[2].rhw = vtx2->rhw;
pts[2].xs = vtx2->xs;
pts[2].ys = vtx2->ys;
pts[2].g = (float)vtx2->g;
nPoints = ZedClipper(nPoints, pts, VBuffer);
if( nPoints == 0 ) continue;
nPoints = XYGClipper(nPoints, VBuffer);
}
if( nPoints != 0 ) {
PALETTEENTRY *color = &GamePalette16[colorIdx >> 8];
#ifdef FEATURE_VIDEOFX_IMPROVED
if( AlphaBlendMode && color->peFlags > 0 && color->peFlags <= 4 ) {
float zv = CalculatePolyZ(sortType, vtx0->zv, vtx1->zv, vtx2->zv);
short blend[4] = {POLY_HWR_half, POLY_HWR_add, POLY_HWR_sub, POLY_HWR_qrt};
InsertPoly_Gouraud(nPoints, zv, color->peRed, color->peGreen, color->peBlue, blend[color->peFlags - 1]);
} else {
DrawPoly_Gouraud(nPoints, color->peRed, color->peGreen, color->peBlue);
}
#else // FEATURE_VIDEOFX_IMPROVED
DrawPoly_Gouraud(nPoints, color->peRed, color->peGreen, color->peBlue);
#endif // FEATURE_VIDEOFX_IMPROVED
}
}
return ptrObj;
}
void __cdecl InsertFlatRect_ZBuffered(int x0, int y0, int x1, int y1, int z, BYTE colorIdx) {
double sz, rhw;
D3DCOLOR color;
if( x0 >= x1 || y0 >= y1 )
return;
if( x0 < PhdWinMinX )
x0 = PhdWinMinX;
if( y0 < PhdWinMinY )
y0 = PhdWinMinY;
if( x1 > PhdWinMinX + PhdWinWidth )
x1 = PhdWinMinX + PhdWinWidth;
if( y1 > PhdWinMinY + PhdWinHeight )
x1 = PhdWinMinY + PhdWinHeight;
CLAMP(z, PhdNearZ, PhdFarZ);
color = shadeColor(GamePalette8[colorIdx].red, GamePalette8[colorIdx].green, GamePalette8[colorIdx].blue, 0xFF, 0, false);
rhw = RhwFactor / (double)z;
sz = FltResZBuf - rhw * FltResZORhw;
VBufferD3D[0].sx = (float)x0;
VBufferD3D[0].sy = (float)y0;
VBufferD3D[1].sx = (float)x1;
VBufferD3D[1].sy = (float)y0;
VBufferD3D[2].sx = (float)x0;
VBufferD3D[2].sy = (float)y1;
VBufferD3D[3].sx = (float)x1;
VBufferD3D[3].sy = (float)y1;
for( int i=0; i<4; ++i ) {
VBufferD3D[i].sz = sz;
VBufferD3D[i].rhw = rhw;
VBufferD3D[i].color = color;
}
HWR_TexSource(0);
HWR_EnableColorKey(false);
HWR_DrawPrimitive(D3DPT_TRIANGLESTRIP, VBufferD3D, 4, true);
}
void __cdecl InsertLine_ZBuffered(int x0, int y0, int x1, int y1, int z, BYTE colorIdx) {
double sz, rhw;
D3DCOLOR color;
if( z > PhdFarZ ) {
return;
}
if( z < PhdNearZ ) {
z = PhdNearZ;
}
color = shadeColor(GamePalette8[colorIdx].red, GamePalette8[colorIdx].green, GamePalette8[colorIdx].blue, 0xFF, 0, false);
rhw = RhwFactor / (double)z;
sz = FltResZBuf - rhw * FltResZORhw;
VBufferD3D[0].sx = (float)(PhdWinMinX + x0);
VBufferD3D[0].sy = (float)(PhdWinMinY + y0);
VBufferD3D[1].sx = (float)(PhdWinMinX + x1);
VBufferD3D[1].sy = (float)(PhdWinMinY + y1);
for( int i=0; i<2; ++i ) {
VBufferD3D[i].sz = sz;
VBufferD3D[i].rhw = rhw;
VBufferD3D[i].color = color;
}
HWR_TexSource(0);
HWR_EnableColorKey(false);
HWR_DrawPrimitive(D3DPT_LINESTRIP, VBufferD3D, 2, true);
}
void __cdecl InsertGT3_Sorted(PHD_VBUF *vtx0, PHD_VBUF *vtx1, PHD_VBUF *vtx2, PHD_TEXTURE *texture, PHD_UV *uv0, PHD_UV *uv1, PHD_UV *uv2, SORTTYPE sortType) {
char clipOR, clipAND;
float zv;
POINT_INFO points[3];
int nPoints = 3;
clipOR = LOBYTE(vtx0->clip | vtx1->clip | vtx2->clip);
clipAND = LOBYTE(vtx0->clip & vtx1->clip & vtx2->clip);
if( clipAND != 0 )
return;
if( clipOR >= 0 ) {
if( !VBUF_VISIBLE(*vtx0, *vtx1, *vtx2) )
return;
if( clipOR == 0 ) {
zv = CalculatePolyZ(sortType, vtx0->zv, vtx1->zv, vtx2->zv);
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(zv);
++Sort3dPtr;
#ifdef FEATURE_VIDEOFX_IMPROVED
*Info3dPtr++ = GetPolyType(texture->drawtype);
#else // FEATURE_VIDEOFX_IMPROVED
*Info3dPtr++ = ( texture->drawtype == DRAW_Opaque ) ? POLY_HWR_GTmap : POLY_HWR_WGTmap;
#endif // FEATURE_VIDEOFX_IMPROVED
*Info3dPtr++ = texture->tpage;
*Info3dPtr++ = 3;
*(D3DTLVERTEX **)Info3dPtr = HWR_VertexPtr;
Info3dPtr += sizeof(D3DTLVERTEX *)/sizeof(__int16);
HWR_VertexPtr[0].sx = vtx0->xs;
HWR_VertexPtr[0].sy = vtx0->ys;
HWR_VertexPtr[0].sz = FltResZBuf - FltResZORhw * vtx0->rhw; // NOTE: there was bug because of uninitialized sz and rhw
HWR_VertexPtr[0].rhw = vtx0->rhw;
HWR_VertexPtr[0].color = shadeColor(0xFF, 0xFF, 0xFF, 0xFF, vtx0->g, true);
HWR_VertexPtr[0].tu = (double)uv0->u / (double)PHD_ONE;
HWR_VertexPtr[0].tv = (double)uv0->v / (double)PHD_ONE;
HWR_VertexPtr[1].sx = vtx1->xs;
HWR_VertexPtr[1].sy = vtx1->ys;
HWR_VertexPtr[1].sz = FltResZBuf - FltResZORhw * vtx1->rhw; // NOTE: there was bug because of uninitialized sz and rhw
HWR_VertexPtr[1].rhw = vtx1->rhw;
HWR_VertexPtr[1].color = shadeColor(0xFF, 0xFF, 0xFF, 0xFF, vtx1->g, true);
HWR_VertexPtr[1].tu = (double)uv1->u / (double)PHD_ONE;
HWR_VertexPtr[1].tv = (double)uv1->v / (double)PHD_ONE;
HWR_VertexPtr[2].sx = vtx2->xs;
HWR_VertexPtr[2].sy = vtx2->ys;
HWR_VertexPtr[2].sz = FltResZBuf - FltResZORhw * vtx2->rhw; // NOTE: there was bug because of uninitialized sz and rhw
HWR_VertexPtr[2].rhw = vtx2->rhw;
HWR_VertexPtr[2].color = shadeColor(0xFF, 0xFF, 0xFF, 0xFF, vtx2->g, true);
HWR_VertexPtr[2].tu = (double)uv2->u / (double)PHD_ONE;
HWR_VertexPtr[2].tv = (double)uv2->v / (double)PHD_ONE;
HWR_VertexPtr += 3;
++SurfaceCount;
return;
}
VBuffer[0].x = vtx0->xs;
VBuffer[0].y = vtx0->ys;
VBuffer[0].rhw = vtx0->rhw;
VBuffer[0].g = (double)vtx0->g;
VBuffer[0].u = (double)uv0->u * vtx0->rhw;
VBuffer[0].v = (double)uv0->v * vtx0->rhw;
VBuffer[1].x = vtx1->xs;
VBuffer[1].y = vtx1->ys;
VBuffer[1].rhw = vtx1->rhw;
VBuffer[1].g = (double)vtx1->g;
VBuffer[1].u = (double)uv1->u * vtx1->rhw;
VBuffer[1].v = (double)uv1->v * vtx1->rhw;
VBuffer[2].x = vtx2->xs;
VBuffer[2].y = vtx2->ys;
VBuffer[2].rhw = vtx2->rhw;
VBuffer[2].g = (double)vtx2->g;
VBuffer[2].u = (double)uv2->u * vtx2->rhw;
VBuffer[2].v = (double)uv2->v * vtx2->rhw;
} else {
if( !visible_zclip(vtx0, vtx1, vtx2) )
return;
points[0].xv = vtx0->xv;
points[0].yv = vtx0->yv;
points[0].zv = vtx0->zv;
points[0].rhw = vtx0->rhw;
points[0].xs = vtx0->xs;
points[0].ys = vtx0->ys;
points[0].u = (float)uv0->u;
points[0].v = (float)uv0->v;
points[0].g = (float)vtx0->g;
points[1].yv = vtx1->yv;
points[1].xv = vtx1->xv;
points[1].zv = vtx1->zv;
points[1].rhw = vtx1->rhw;
points[1].xs = vtx1->xs;
points[1].ys = vtx1->ys;
points[1].u = (float)uv1->u;
points[1].v = (float)uv1->v;
points[1].g = (float)vtx1->g;
points[2].xv = vtx2->xv;
points[2].yv = vtx2->yv;
points[2].zv = vtx2->zv;
points[2].rhw = vtx2->rhw;
points[2].xs = vtx2->xs;
points[2].ys = vtx2->ys;
points[2].u = (float)uv2->u;
points[2].v = (float)uv2->v;
points[2].g = (float)vtx2->g;
nPoints = ZedClipper(nPoints, points, VBuffer);
if( nPoints == 0 ) return;
}
nPoints = XYGUVClipper(nPoints, VBuffer);
if( nPoints == 0 ) return;
zv = CalculatePolyZ(sortType, vtx0->zv, vtx1->zv, vtx2->zv);
#ifdef FEATURE_VIDEOFX_IMPROVED
InsertClippedPoly_Textured(nPoints, zv, GetPolyType(texture->drawtype), texture->tpage);
#else // FEATURE_VIDEOFX_IMPROVED
InsertClippedPoly_Textured(nPoints, zv, ( texture->drawtype == DRAW_Opaque ) ? POLY_HWR_GTmap : POLY_HWR_WGTmap, texture->tpage);
#endif // FEATURE_VIDEOFX_IMPROVED
}
void __cdecl InsertClippedPoly_Textured(int vtxCount, float z, __int16 polyType, __int16 texPage) {
double tu, tv;
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(z);
++Sort3dPtr;
*(Info3dPtr++) = polyType;
*(Info3dPtr++) = texPage;
*(Info3dPtr++) = vtxCount;
*(D3DTLVERTEX **)Info3dPtr = HWR_VertexPtr;
Info3dPtr += sizeof(D3DTLVERTEX *)/sizeof(__int16);
for( int i = 0; i < vtxCount; ++i ) {
tu = VBuffer[i].u / double(PHD_ONE) / VBuffer[i].rhw;
tv = VBuffer[i].v / double(PHD_ONE) / VBuffer[i].rhw;
CLAMP(tu, 0.0, 1.0);
CLAMP(tv, 0.0, 1.0);
HWR_VertexPtr[i].sx = VBuffer[i].x;
HWR_VertexPtr[i].sy = VBuffer[i].y;
HWR_VertexPtr[i].sz = FltResZBuf - FltResZORhw * VBuffer[i].rhw; // NOTE: there was bug because of uninitialized sz and rhw
HWR_VertexPtr[i].rhw = VBuffer[i].rhw;
HWR_VertexPtr[i].color = shadeColor(0xFF, 0xFF, 0xFF, 0xFF, VBuffer[i].g, true);
HWR_VertexPtr[i].tu = tu;
HWR_VertexPtr[i].tv = tv;
}
HWR_VertexPtr += vtxCount;
++SurfaceCount;
}
void __cdecl InsertGT4_Sorted(PHD_VBUF *vtx0, PHD_VBUF *vtx1, PHD_VBUF *vtx2, PHD_VBUF *vtx3, PHD_TEXTURE *texture, SORTTYPE sortType) {
char clipOR, clipAND;
float zv;
clipOR = LOBYTE(vtx0->clip | vtx1->clip | vtx2->clip | vtx3->clip);
clipAND = LOBYTE(vtx0->clip & vtx1->clip & vtx2->clip & vtx3->clip);
if( clipAND != 0 )
return;
if( clipOR == 0 && VBUF_VISIBLE(*vtx0, *vtx1, *vtx2) ) {
zv = CalculatePolyZ(sortType, vtx0->zv, vtx1->zv, vtx2->zv, vtx3->zv);
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(zv);
++Sort3dPtr;
#ifdef FEATURE_VIDEOFX_IMPROVED
*Info3dPtr++ = GetPolyType(texture->drawtype);
#else // FEATURE_VIDEOFX_IMPROVED
*Info3dPtr++ = ( texture->drawtype == DRAW_Opaque ) ? POLY_HWR_GTmap : POLY_HWR_WGTmap;
#endif // FEATURE_VIDEOFX_IMPROVED
*Info3dPtr++ = texture->tpage;
*Info3dPtr++ = 4;
*(D3DTLVERTEX **)Info3dPtr = HWR_VertexPtr;
Info3dPtr += sizeof(D3DTLVERTEX *)/sizeof(__int16);
HWR_VertexPtr[0].sx = vtx0->xs;
HWR_VertexPtr[0].sy = vtx0->ys;
HWR_VertexPtr[0].sz = FltResZBuf - FltResZORhw * vtx0->rhw; // NOTE: there was bug because of uninitialized sz and rhw
HWR_VertexPtr[0].rhw = vtx0->rhw;
HWR_VertexPtr[0].color = shadeColor(0xFF, 0xFF, 0xFF, 0xFF, vtx0->g, true);
HWR_VertexPtr[0].tu = (double)texture->uv[0].u / (double)PHD_ONE;
HWR_VertexPtr[0].tv = (double)texture->uv[0].v / (double)PHD_ONE;
HWR_VertexPtr[1].sx = vtx1->xs;
HWR_VertexPtr[1].sy = vtx1->ys;
HWR_VertexPtr[1].sz = FltResZBuf - FltResZORhw * vtx1->rhw; // NOTE: there was bug because of uninitialized sz and rhw
HWR_VertexPtr[1].rhw = vtx1->rhw;
HWR_VertexPtr[1].color = shadeColor(0xFF, 0xFF, 0xFF, 0xFF, vtx1->g, true);
HWR_VertexPtr[1].tu = (double)texture->uv[1].u / (double)PHD_ONE;
HWR_VertexPtr[1].tv = (double)texture->uv[1].v / (double)PHD_ONE;
HWR_VertexPtr[2].sx = vtx2->xs;
HWR_VertexPtr[2].sy = vtx2->ys;
HWR_VertexPtr[2].sz = FltResZBuf - FltResZORhw * vtx2->rhw; // NOTE: there was bug because of uninitialized sz and rhw
HWR_VertexPtr[2].rhw = vtx2->rhw;
HWR_VertexPtr[2].color = shadeColor(0xFF, 0xFF, 0xFF, 0xFF, vtx2->g, true);
HWR_VertexPtr[2].tu = (double)texture->uv[2].u / (double)PHD_ONE;
HWR_VertexPtr[2].tv = (double)texture->uv[2].v / (double)PHD_ONE;
HWR_VertexPtr[3].sx = vtx3->xs;
HWR_VertexPtr[3].sy = vtx3->ys;
HWR_VertexPtr[3].sz = FltResZBuf - FltResZORhw * vtx3->rhw; // NOTE: there was bug because of uninitialized sz and rhw
HWR_VertexPtr[3].rhw = vtx3->rhw;
HWR_VertexPtr[3].color = shadeColor(0xFF, 0xFF, 0xFF, 0xFF, vtx3->g, true);
HWR_VertexPtr[3].tu = (double)texture->uv[3].u / (double)PHD_ONE;
HWR_VertexPtr[3].tv = (double)texture->uv[3].v / (double)PHD_ONE;
HWR_VertexPtr += 4;
++SurfaceCount;
}
else if( (clipOR < 0 && visible_zclip(vtx0, vtx1, vtx2)) ||
(clipOR > 0 && VBUF_VISIBLE(*vtx0, *vtx1, *vtx2)) )
{
InsertGT3_Sorted(vtx0, vtx1, vtx2, texture, texture->uv, &texture->uv[1], &texture->uv[2], sortType);
InsertGT3_Sorted(vtx0, vtx2, vtx3, texture, texture->uv, &texture->uv[2], &texture->uv[3], sortType);
}
}
__int16 *__cdecl InsertObjectGT4_Sorted(__int16 *ptrObj, int number, SORTTYPE sortType) {
PHD_VBUF *vtx0, *vtx1, *vtx2, *vtx3;
PHD_TEXTURE *texture;
for( int i = 0; i < number; ++i ) {
if( HWR_VertexBufferFull() ) {
ptrObj += (number - i) * 5;
break;
}
vtx0 = &PhdVBuf[ptrObj[0]];
vtx1 = &PhdVBuf[ptrObj[1]];
vtx2 = &PhdVBuf[ptrObj[2]];
vtx3 = &PhdVBuf[ptrObj[3]];
texture = &PhdTextureInfo[ptrObj[4]];
ptrObj += 5;
InsertGT4_Sorted(vtx0, vtx1, vtx2, vtx3, texture, sortType);
}
return ptrObj;
}
__int16 *__cdecl InsertObjectGT3_Sorted(__int16 *ptrObj, int number, SORTTYPE sortType) {
PHD_VBUF *vtx0, *vtx1, *vtx2;
PHD_TEXTURE *texture;
PHD_UV *uv;
for( int i = 0; i < number; ++i ) {
if( HWR_VertexBufferFull() ) {
ptrObj += (number - i) * 4;
break;
}
vtx0 = &PhdVBuf[ptrObj[0]];
vtx1 = &PhdVBuf[ptrObj[1]];
vtx2 = &PhdVBuf[ptrObj[2]];
texture = &PhdTextureInfo[ptrObj[3]];
uv = texture->uv;
ptrObj += 4;
InsertGT3_Sorted(vtx0, vtx1, vtx2, texture, &uv[0], &uv[1], &uv[2], sortType);
}
return ptrObj;
}
__int16 *__cdecl InsertObjectG4_Sorted(__int16 *ptrObj, int number, SORTTYPE sortType) {
char clipOR, clipAND;
PHD_VBUF *vtx0, *vtx1, *vtx2, *vtx3;
int i, nPoints;
float zv;
__int16 colorIdx;
PALETTEENTRY *color;
POINT_INFO pts[4];
for( i = 0; i < number; ++i ) {
if( HWR_VertexBufferFull() ) {
ptrObj += number - i;
break;
}
vtx0 = &PhdVBuf[*ptrObj++];
vtx1 = &PhdVBuf[*ptrObj++];
vtx2 = &PhdVBuf[*ptrObj++];
vtx3 = &PhdVBuf[*ptrObj++];
colorIdx = *ptrObj++;
nPoints = 4;
clipOR = LOBYTE(vtx0->clip | vtx1->clip | vtx2->clip | vtx3->clip);
clipAND = LOBYTE(vtx0->clip & vtx1->clip & vtx2->clip & vtx3->clip);
if( clipAND != 0 )
continue;
if( clipOR >= 0 ) {
if( !VBUF_VISIBLE(*vtx0, *vtx1, *vtx2) )
continue;
VBuffer[0].x = vtx0->xs;
VBuffer[0].y = vtx0->ys;
VBuffer[0].rhw = vtx0->rhw;
VBuffer[0].g = (float)vtx0->g;
VBuffer[1].x = vtx1->xs;
VBuffer[1].y = vtx1->ys;
VBuffer[1].rhw = vtx1->rhw;
VBuffer[1].g = (float)vtx1->g;
VBuffer[2].x = vtx2->xs;
VBuffer[2].y = vtx2->ys;
VBuffer[2].rhw = vtx2->rhw;
VBuffer[2].g = (float)vtx2->g;
VBuffer[3].x = vtx3->xs;
VBuffer[3].y = vtx3->ys;
VBuffer[3].rhw = vtx3->rhw;
VBuffer[3].g = (float)vtx3->g;
if( clipOR > 0 ) {
nPoints = XYGClipper(nPoints, VBuffer);
}
} else {
if( !visible_zclip(vtx0, vtx1, vtx2) )
continue;
pts[0].xv = vtx0->xv;
pts[0].yv = vtx0->yv;
pts[0].zv = vtx0->zv;
pts[0].rhw = vtx0->rhw;
pts[0].xs = vtx0->xs;
pts[0].ys = vtx0->ys;
pts[0].g = (float)vtx0->g;
pts[1].xv = vtx1->xv;
pts[1].yv = vtx1->yv;
pts[1].zv = vtx1->zv;
pts[1].rhw = vtx1->rhw;
pts[1].xs = vtx1->xs;
pts[1].ys = vtx1->ys;
pts[1].g = (float)vtx1->g;
pts[2].xv = vtx2->xv;
pts[2].yv = vtx2->yv;
pts[2].zv = vtx2->zv;
pts[2].rhw = vtx2->rhw;
pts[2].xs = vtx2->xs;
pts[2].ys = vtx2->ys;
pts[2].g = (float)vtx2->g;
pts[3].xv = vtx3->xv;
pts[3].yv = vtx3->yv;
pts[3].zv = vtx3->zv;
pts[3].rhw = vtx3->rhw;
pts[3].xs = vtx3->xs;
pts[3].ys = vtx3->ys;
pts[3].g = (float)vtx3->g;
nPoints = ZedClipper(nPoints, pts, VBuffer);
if( nPoints == 0 ) continue;
nPoints = XYGClipper(nPoints, VBuffer);
}
if( nPoints == 0 )
continue;
color = &GamePalette16[colorIdx >> 8];
zv = CalculatePolyZ(sortType, vtx0->zv, vtx1->zv, vtx2->zv, vtx3->zv);
#ifdef FEATURE_VIDEOFX_IMPROVED
if( AlphaBlendMode && color->peFlags > 0 && color->peFlags <= 4 ) {
short blend[4] = {POLY_HWR_half, POLY_HWR_add, POLY_HWR_sub, POLY_HWR_qrt};
InsertPoly_Gouraud(nPoints, zv, color->peRed, color->peGreen, color->peBlue, blend[color->peFlags - 1]);
} else {
InsertPoly_Gouraud(nPoints, zv, color->peRed, color->peGreen, color->peBlue, POLY_HWR_gouraud);
}
#else // FEATURE_VIDEOFX_IMPROVED
InsertPoly_Gouraud(nPoints, zv, color->peRed, color->peGreen, color->peBlue, POLY_HWR_gouraud);
#endif // FEATURE_VIDEOFX_IMPROVED
}
return ptrObj;
}
void __cdecl InsertPoly_Gouraud(int vtxCount, float z, int red, int green, int blue, __int16 polyType) {
BYTE alpha = ( polyType == POLY_HWR_trans ) ? 0x80 : 0xFF;
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(z);
++Sort3dPtr;
*(Info3dPtr++) = polyType;
*(Info3dPtr++) = vtxCount;
*(D3DTLVERTEX **)Info3dPtr = HWR_VertexPtr;
Info3dPtr += sizeof(D3DTLVERTEX *)/sizeof(__int16);
for( int i = 0; i < vtxCount; ++i ) {
HWR_VertexPtr[i].sx = VBuffer[i].x;
HWR_VertexPtr[i].sy = VBuffer[i].y;
HWR_VertexPtr[i].sz = FltResZBuf - FltResZORhw * VBuffer[i].rhw; // NOTE: there was bug because of uninitialized sz and rhw
HWR_VertexPtr[i].rhw = VBuffer[i].rhw;
HWR_VertexPtr[i].color = shadeColor(red, green, blue, alpha, VBuffer[i].g, false);
}
HWR_VertexPtr += vtxCount;
++SurfaceCount;
}
__int16 *__cdecl InsertObjectG3_Sorted(__int16 *ptrObj, int number, SORTTYPE sortType) {
char clipOR, clipAND;
PHD_VBUF *vtx0, *vtx1, *vtx2;
int i, nPoints;
float zv;
__int16 colorIdx;
PALETTEENTRY *color;
POINT_INFO pts[3];
for( i = 0; i < number; ++i ) {
if( HWR_VertexBufferFull() ) {
ptrObj += number - i;
break;
}
vtx0 = &PhdVBuf[*ptrObj++];
vtx1 = &PhdVBuf[*ptrObj++];
vtx2 = &PhdVBuf[*ptrObj++];
colorIdx = *ptrObj++;
nPoints = 3;
clipOR = LOBYTE(vtx0->clip | vtx1->clip | vtx2->clip);
clipAND = LOBYTE(vtx0->clip & vtx1->clip & vtx2->clip);
if( clipAND != 0 )
continue;
if( clipOR >= 0 ) {
if( !VBUF_VISIBLE(*vtx0, *vtx1, *vtx2) )
continue;
VBuffer[0].x = vtx0->xs;
VBuffer[0].y = vtx0->ys;
VBuffer[0].rhw = vtx0->rhw;
VBuffer[0].g = (float)vtx0->g;
VBuffer[1].x = vtx1->xs;
VBuffer[1].y = vtx1->ys;
VBuffer[1].rhw = vtx1->rhw;
VBuffer[1].g = (float)vtx1->g;
VBuffer[2].x = vtx2->xs;
VBuffer[2].y = vtx2->ys;
VBuffer[2].rhw = vtx2->rhw;
VBuffer[2].g = (float)vtx2->g;
if( clipOR > 0 ) {
nPoints = XYGClipper(nPoints, VBuffer);
}
} else {
if( !visible_zclip(vtx0, vtx1, vtx2) )
continue;
pts[0].xv = vtx0->xv;
pts[0].yv = vtx0->yv;
pts[0].zv = vtx0->zv;
pts[0].rhw = vtx0->rhw;
pts[0].xs = vtx0->xs;
pts[0].ys = vtx0->ys;
pts[0].g = (float)vtx0->g;
pts[1].xv = vtx1->xv;
pts[1].yv = vtx1->yv;
pts[1].zv = vtx1->zv;
pts[1].rhw = vtx1->rhw;
pts[1].xs = vtx1->xs;
pts[1].ys = vtx1->ys;
pts[1].g = (float)vtx1->g;
pts[2].xv = vtx2->xv;
pts[2].yv = vtx2->yv;
pts[2].zv = vtx2->zv;
pts[2].rhw = vtx2->rhw;
pts[2].xs = vtx2->xs;
pts[2].ys = vtx2->ys;
pts[2].g = (float)vtx2->g;
nPoints = ZedClipper(nPoints, pts, VBuffer);
if( nPoints == 0 ) continue;
nPoints = XYGClipper(nPoints, VBuffer);
}
if( nPoints == 0 )
continue;
color = &GamePalette16[colorIdx >> 8];
zv = CalculatePolyZ(sortType, vtx0->zv, vtx1->zv, vtx2->zv);
#ifdef FEATURE_VIDEOFX_IMPROVED
if( AlphaBlendMode && color->peFlags > 0 && color->peFlags <= 4 ) {
short blend[4] = {POLY_HWR_half, POLY_HWR_add, POLY_HWR_sub, POLY_HWR_qrt};
InsertPoly_Gouraud(nPoints, zv, color->peRed, color->peGreen, color->peBlue, blend[color->peFlags - 1]);
} else {
InsertPoly_Gouraud(nPoints, zv, color->peRed, color->peGreen, color->peBlue, POLY_HWR_gouraud);
}
#else // FEATURE_VIDEOFX_IMPROVED
InsertPoly_Gouraud(nPoints, zv, color->peRed, color->peGreen, color->peBlue, POLY_HWR_gouraud);
#endif // FEATURE_VIDEOFX_IMPROVED
}
return ptrObj;
}
#ifdef FEATURE_VIDEOFX_IMPROVED
void __cdecl InsertSprite_Sorted(int z, int x0, int y0, int x1, int y1, int spriteIdx, __int16 shade, DWORD flags) {
if( TextureFormat.bpp < 16 && CHK_ANY(flags, SPR_TINT) ) return; // tinted sprites are not supported for 8 bit textured mode
#else // FEATURE_VIDEOFX_IMPROVED
void __cdecl InsertSprite_Sorted(int z, int x0, int y0, int x1, int y1, int spriteIdx, __int16 shade) {
#endif // FEATURE_VIDEOFX_IMPROVED
double rhw, u0, v0, u1, v1;
int uOffset, vOffset, nPoints;
if( HWR_VertexBufferFull() || x0 >= x1 || y0 >= y1 || x1 <= 0 || y1 <= 0 || x0 >= PhdWinMaxX || y0 >= PhdWinMaxY || z >= PhdFarZ )
return;
x0 += PhdWinMinX;
y0 += PhdWinMinY;
x1 += PhdWinMinX;
y1 += PhdWinMinY;
if( z < PhdNearZ )
z = PhdNearZ;
rhw = RhwFactor / (double)z;
uOffset = LOBYTE(PhdSpriteInfo[spriteIdx].offset) * 256;
vOffset = HIBYTE(PhdSpriteInfo[spriteIdx].offset) * 256;
// NOTE: page side is not counted in the original game, but we need it for HD textures
int adjustment = UvAdd * 256 / GetTextureSideByPage(PhdSpriteInfo[spriteIdx].texPage);
#if (DIRECT3D_VERSION >= 0x900)
double forcedAdjust = GetTexPagesAdjustment();
if( forcedAdjust > 0.0) {
adjustment = (int)(forcedAdjust * 256.0);
}
#endif // (DIRECT3D_VERSION >= 0x900)
#ifdef FEATURE_HUD_IMPROVED
if( spriteIdx >= (int)ARRAY_SIZE(PhdSpriteInfo) - HUD_SPRITE_RESERVED ) {
adjustment = 0;
}
#endif // FEATURE_HUD_IMPROVED
CLAMPL(adjustment, 1);
u0 = rhw * (double)(uOffset - adjustment + PhdSpriteInfo[spriteIdx].width);
v0 = rhw * (double)(vOffset + adjustment);
u1 = rhw * (double)(uOffset + adjustment);
v1 = rhw * (double)(vOffset - adjustment + PhdSpriteInfo[spriteIdx].height);
VBuffer[0].x = (float)x0;
VBuffer[0].y = (float)y0;
VBuffer[0].u = u1;
VBuffer[0].v = v0;
VBuffer[1].x = (float)x1;
VBuffer[1].y = (float)y0;
VBuffer[1].u = u0;
VBuffer[1].v = v0;
VBuffer[2].x = (float)x1;
VBuffer[2].y = (float)y1;
VBuffer[2].u = u0;
VBuffer[2].v = v1;
VBuffer[3].x = (float)x0;
VBuffer[3].y = (float)y1;
VBuffer[3].u = u1;
VBuffer[3].v = v1;
for( int i=0; i<4; ++i ) {
VBuffer[i].rhw = rhw;
VBuffer[i].g = (float)shade;
}
nPoints = 4;
if( x0 < PhdWinMinX || y0 < PhdWinMinY || x1 > PhdWinWidth + PhdWinMinX || y1 > PhdWinHeight + PhdWinMinY ) {
FltWinLeft = (float)PhdWinMinX;
FltWinTop = (float)PhdWinMinY;
FltWinRight = (float)(PhdWinMinX + PhdWinWidth);
FltWinBottom = (float)(PhdWinMinY + PhdWinHeight);
nPoints = XYGUVClipper(nPoints, VBuffer);
if( nPoints == 0 ) return;
}
bool isShadeEffectBackup = IsShadeEffect;
IsShadeEffect = false;
#ifdef FEATURE_VIDEOFX_IMPROVED
short polyType = POLY_HWR_WGTmap;
if( CHK_ANY(flags, SPR_TINT) ) {
GlobalTint = RGBA_SETALPHA(flags, 0xFF);
}
if( AlphaBlendMode && CHK_ANY(flags, SPR_SEMITRANS) ) {
short blend[4] = {
POLY_HWR_WGTmapHalf,
POLY_HWR_WGTmapAdd,
POLY_HWR_WGTmapSub,
POLY_HWR_WGTmapQrt,
};
polyType = blend[(flags & SPR_BLEND) >> 29];
}
InsertClippedPoly_Textured(nPoints, (float)z, polyType, PhdSpriteInfo[spriteIdx].texPage);
GlobalTint = 0;
#else // FEATURE_VIDEOFX_IMPROVED
InsertClippedPoly_Textured(nPoints, (float)z, POLY_HWR_WGTmap, PhdSpriteInfo[spriteIdx].texPage);
#endif // FEATURE_VIDEOFX_IMPROVED
IsShadeEffect = isShadeEffectBackup;
}
void __cdecl InsertFlatRect_Sorted(int x0, int y0, int x1, int y1, int z, BYTE colorIdx) {
double rhw, sz;
D3DCOLOR color;
if( x0 >= x1 || y0 >= y1 )
return;
if( x0 < PhdWinMinX )
x0 = PhdWinMinX;
if( y0 < PhdWinMinY )
y0 = PhdWinMinY;
if( x1 > PhdWinMinX + PhdWinWidth )
x1 = PhdWinMinX + PhdWinWidth;
if( y1 > PhdWinMinY + PhdWinHeight )
x1 = PhdWinMinY + PhdWinHeight;
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(z);
++Sort3dPtr;
*(Info3dPtr++) = POLY_HWR_gouraud;
*(Info3dPtr++) = 4; // vertex count
*(D3DTLVERTEX **)Info3dPtr = HWR_VertexPtr;
Info3dPtr += sizeof(D3DTLVERTEX *)/sizeof(__int16);
color = shadeColor(GamePalette8[colorIdx].red, GamePalette8[colorIdx].green, GamePalette8[colorIdx].blue, 0xFF, 0, false);
rhw = RhwFactor / (double)z;
sz = FltResZBuf - rhw * FltResZORhw;
HWR_VertexPtr[0].sx = (float)x0;
HWR_VertexPtr[0].sy = (float)y0;
HWR_VertexPtr[1].sx = (float)x1;
HWR_VertexPtr[1].sy = (float)y0;
HWR_VertexPtr[2].sx = (float)x1;
HWR_VertexPtr[2].sy = (float)y1;
HWR_VertexPtr[3].sx = (float)x0;
HWR_VertexPtr[3].sy = (float)y1;
for( int i=0; i<4; ++i ) {
HWR_VertexPtr[i].color = color;
HWR_VertexPtr[i].sz = sz; // NOTE: there was bug because of uninitialized sz and rhw
HWR_VertexPtr[i].rhw = rhw;
}
HWR_VertexPtr += 4;
++SurfaceCount;
}
void __cdecl InsertLine_Sorted(int x0, int y0, int x1, int y1, int z, BYTE colorIdx) {
double rhw, sz;
D3DCOLOR color;
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(z);
++Sort3dPtr;
*(Info3dPtr++) = POLY_HWR_line;
*(Info3dPtr++) = 2; // vertex count
*(D3DTLVERTEX **)Info3dPtr = HWR_VertexPtr;
Info3dPtr += sizeof(D3DTLVERTEX *)/sizeof(__int16);
color = shadeColor(GamePalette8[colorIdx].red, GamePalette8[colorIdx].green, GamePalette8[colorIdx].blue, 0xFF, 0, false);
rhw = RhwFactor / (double)z;
sz = FltResZBuf - rhw * FltResZORhw;
HWR_VertexPtr[0].sx = (float)(PhdWinMinX + x0);
HWR_VertexPtr[0].sy = (float)(PhdWinMinY + y0);
HWR_VertexPtr[1].sx = (float)(PhdWinMinX + x1);
HWR_VertexPtr[1].sy = (float)(PhdWinMinY + y1);
for( int i=0; i<2; ++i ) {
HWR_VertexPtr[i].color = color;
HWR_VertexPtr[i].sz = sz; // NOTE: there was bug because of uninitialized sz and rhw
HWR_VertexPtr[i].rhw = rhw;
}
HWR_VertexPtr += 2;
++SurfaceCount;
}
void __cdecl InsertTrans8_Sorted(PHD_VBUF *vbuf, __int16 shade) {
int i, nPoints, polyZ;
char clipOR = 0x00;
char clipAND = 0xFF;
#ifdef FEATURE_VIDEOFX_IMPROVED
int nVtx = ( ShadowMode == 1 ) ? 32 : 8;
#else // FEATURE_VIDEOFX_IMPROVED
int nVtx = 8;
#endif // FEATURE_VIDEOFX_IMPROVED
for( i = 0; i < nVtx; ++i ) {
clipOR |= LOBYTE(vbuf[i].clip);
clipAND &= LOBYTE(vbuf[i].clip);
}
if( (clipOR < 0) || (clipAND != 0) || !VBUF_VISIBLE(vbuf[0], vbuf[1], vbuf[2]) )
return;
for( i = 0; i < nVtx; ++i ) {
VBuffer[i].x = vbuf[i].xs;
VBuffer[i].y = vbuf[i].ys;
VBuffer[i].rhw = RhwFactor / (double)(vbuf[i].zv - 0x20000);
}
nPoints = nVtx;
if( clipOR != 0 ) {
FltWinLeft = 0.0;
FltWinTop = 0.0;
FltWinRight = (float)PhdWinMaxX;
FltWinBottom = (float)PhdWinMaxY;
nPoints = XYClipper(nPoints, VBuffer);
if( nPoints == 0) return;
}
#ifdef FEATURE_VIDEOFX_IMPROVED
double polyZflt = 0.0;
for( i = 0; i < nVtx; ++i ) {
polyZflt += (double)vbuf[i].zv / (double)nVtx;
}
polyZ = polyZflt;
#else // FEATURE_VIDEOFX_IMPROVED
polyZ = 0;
for( i = 0; i < nVtx; ++i ) {
polyZ += vbuf[i].zv;
}
polyZ /= nVtx;
#endif // FEATURE_VIDEOFX_IMPROVED
InsertPoly_Gouraud(nPoints, (float)(polyZ - 0x20000), 0, 0, 0, POLY_HWR_trans);
}
void __cdecl InsertTransQuad_Sorted(int x, int y, int width, int height, int z) {
float x0, y0, x1, y1;
double rhw, sz;
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(z);
++Sort3dPtr;
*(Info3dPtr++) = POLY_HWR_trans;
*(Info3dPtr++) = 4; // vertex count
*(D3DTLVERTEX **)Info3dPtr = HWR_VertexPtr;
Info3dPtr += sizeof(D3DTLVERTEX *)/sizeof(__int16);
x0 = (float)x;
y0 = (float)y;
x1 = (float)(x + width);
y1 = (float)(y + height);
rhw = RhwFactor / (double)z;
sz = FltResZBuf - rhw * FltResZORhw;
HWR_VertexPtr[0].sx = x0;
HWR_VertexPtr[0].sy = y0;
HWR_VertexPtr[1].sx = x1;
HWR_VertexPtr[1].sy = y0;
HWR_VertexPtr[2].sx = x1;
HWR_VertexPtr[2].sy = y1;
HWR_VertexPtr[3].sx = x0;
HWR_VertexPtr[3].sy = y1;
for( int i=0; i<4; ++i ) {
HWR_VertexPtr[i].color = 0x80000000; // half transparent black
HWR_VertexPtr[i].sz = sz; // NOTE: there was bug because of uninitialized sz and rhw
HWR_VertexPtr[i].rhw = rhw;
}
HWR_VertexPtr += 4;
++SurfaceCount;
}
#ifdef FEATURE_VIDEOFX_IMPROVED
void __cdecl InsertSprite(int z, int x0, int y0, int x1, int y1, int spriteIdx, __int16 shade, DWORD flags) {
if( CHK_ANY(flags, SPR_TINT) ) return; // tinted sprites are not supported by software renderer yet
#else // FEATURE_VIDEOFX_IMPROVED
void __cdecl InsertSprite(int z, int x0, int y0, int x1, int y1, int spriteIdx, __int16 shade) {
#endif // FEATURE_VIDEOFX_IMPROVED
Sort3dPtr->_0 = (DWORD)Info3dPtr;
Sort3dPtr->_1 = MAKE_ZSORT(z);
++Sort3dPtr;
*(Info3dPtr++) = POLY_sprite;
*(Info3dPtr++) = x0;
*(Info3dPtr++) = y0;
*(Info3dPtr++) = x1;
*(Info3dPtr++) = y1;
*(Info3dPtr++) = spriteIdx;
*(Info3dPtr++) = shade;
++SurfaceCount;
}
/*
* Inject function
*/
void Inject_3Dinsert() {
INJECT(0x00405840, visible_zclip);
INJECT(0x004058B0, ZedClipper);
INJECT(0x004059F0, XYGUVClipper);
INJECT(0x00405F10, InsertObjectGT4);
INJECT(0x00406970, InsertObjectGT3);
INJECT(0x004071F0, XYGClipper);
INJECT(0x00407620, InsertObjectG4);
INJECT(0x00407A00, InsertObjectG3);
INJECT(0x00407D20, XYClipper);
INJECT(0x00407FF0, InsertTrans8);
INJECT(0x004084A0, InsertTransQuad);
INJECT(0x00408580, InsertFlatRect);
INJECT(0x00408650, InsertLine);
INJECT(0x00408710, InsertGT3_ZBuffered);
INJECT(0x00408D60, DrawClippedPoly_Textured);
INJECT(0x00408EA0, InsertGT4_ZBuffered);
INJECT(0x004092E0, InsertObjectGT4_ZBuffered);
INJECT(0x00409380, InsertObjectGT3_ZBuffered);
INJECT(0x00409430, InsertObjectG4_ZBuffered);
INJECT(0x004097D0, DrawPoly_Gouraud);
INJECT(0x004098D0, InsertObjectG3_ZBuffered);
INJECT(0x00409BB0, InsertFlatRect_ZBuffered);
INJECT(0x00409D80, InsertLine_ZBuffered);
INJECT(0x00409EC0, InsertGT3_Sorted);
INJECT(0x0040A5D0, InsertClippedPoly_Textured);
INJECT(0x0040A780, InsertGT4_Sorted);
INJECT(0x0040AC60, InsertObjectGT4_Sorted);
INJECT(0x0040ACF0, InsertObjectGT3_Sorted);
INJECT(0x0040AD90, InsertObjectG4_Sorted);
INJECT(0x0040B1D0, InsertPoly_Gouraud);
INJECT(0x0040B350, InsertObjectG3_Sorted);
INJECT(0x0040B6A0, InsertSprite_Sorted);
INJECT(0x0040B9F0, InsertFlatRect_Sorted);
INJECT(0x0040BB70, InsertLine_Sorted);
INJECT(0x0040BCA0, InsertTrans8_Sorted);
INJECT(0x0040BE40, InsertTransQuad_Sorted);
INJECT(0x0040BF80, InsertSprite);
}
================================================
FILE: 3dsystem/3dinsert.h
================================================
/*
* Copyright (c) 2017-2020 Michael Chaban. All rights reserved.
* Original game is created by Core Design Ltd. in 1997.
* Lara Croft and Tomb Raider are trademarks of Embracer Group AB.
*
* This file is part of TR2Main.
*
* TR2Main is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TR2Main is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TR2Main. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _3DINSERT_H_INCLUDED
#define _3DINSERT_H_INCLUDED
#include "global/types.h"
/*
* Function list
*/
#ifdef FEATURE_VIDEOFX_IMPROVED
bool InsertObjectEM(__int16 *ptrObj, int vtxCount, D3DCOLOR tint, PHD_UV *em_uv);
#endif // FEATURE_VIDEOFX_IMPROVED
// NOTE: this function is not presented in the original game
void InsertGourQuad(int x0, int y0, int x1, int y1, int z, D3DCOLOR color0, D3DCOLOR color1, D3DCOLOR color2, D3DCOLOR color3);
BOOL __cdecl visible_zclip(PHD_VBUF *vtx0, PHD_VBUF *vtx1, PHD_VBUF *vtx2); // 0x00405840
int __cdecl ZedClipper(int vtxCount, POINT_INFO *pts, VERTEX_INFO *vtx); // 0x004058B0
int __cdecl XYGUVClipper(int vtxCount, VERTEX_INFO *vtx); // 0x004059F0
__int16 *__cdecl InsertObjectGT4(__int16 *ptrObj, int number, SORTTYPE sortType); // 0x00405F10
__int16 *__cdecl InsertObjectGT3(__int16 *ptrObj, int number, SORTTYPE sortType); // 0x00406970
int __cdecl XYGClipper(int vtxCount, VERTEX_INFO *vtx); // 0x004071F0
__int16 *__cdecl InsertObjectG4(__int16 *ptrObj, int number, SORTTYPE sortType); // 0x00407620
__int16 *__cdecl InsertObjectG3(__int16 *ptrObj, int number, SORTTYPE sortType); // 0x00407A00
int __cdecl XYClipper(int vtxCount, VERTEX_INFO *vtx); // 0x00407D20
void __cdecl InsertTrans8(PHD_VBUF *vbuf, __int16 shade); // 0x00407FF0
void __cdecl InsertTransQuad(int x, int y, int width, int height, int z); // 0x004084A0
void __cdecl InsertFlatRect(int x0, int y0, int x1, int y1, int z, BYTE colorIdx); // 0x00408580
void __cdecl InsertLine(int x0, int y0, int x1, int y1, int z, BYTE colorIdx); // 0x00408650
void __cdecl InsertGT3_ZBuffered(PHD_VBUF *vtx0, PHD_VBUF *vtx1, PHD_VBUF *vtx2, PHD_TEXTURE *texture, PHD_UV *uv0, PHD_UV *uv1, PHD_UV *uv2); // 0x00408710
void __cdecl DrawClippedPoly_Textured(int vtxCount); // 0x00408D60
void __cdecl InsertGT4_ZBuffered(PHD_VBUF *vtx0, PHD_VBUF *vtx1, PHD_VBUF *vtx2, PHD_VBUF *vtx3, PHD_TEXTURE *texture); // 0x00408EA0
__int16 *__cdecl InsertObjectGT4_ZBuffered(__int16 *ptrObj, int number, SORTTYPE sortType); // 0x004092E0
__int16 *__cdecl InsertObjectGT3_ZBuffered(__int16 *ptrObj, int number, SORTTYPE sortType); // 0x00409380
__int16 *__cdecl InsertObjectG4_ZBuffered(__int16 *ptrObj, int number, SORTTYPE sortType); // 0x00409430
void __cdecl DrawPoly_Gouraud(int vtxCount, int red, int green, int blue); // 0x004097D0
__int16 *__cdecl InsertObjectG3_ZBuffered(__int16 *ptrObj, int number, SORTTYPE sortType); // 0x004098D0
void __cdecl InsertFlatRect_ZBuffered(int x0, int y0, int x1, int y1, int z, BYTE colorIdx); // 0x00409BB0
void __cdecl InsertLine_ZBuffered(int x0, int y0, int x1, int y1, int z, BYTE colorIdx); // 0x00409D80
void __cdecl InsertGT3_Sorted(PHD_VBUF *vtx0, PHD_VBUF *vtx1, PHD_VBUF *vtx2, PHD_TEXTURE *texture, PHD_UV *uv0, PHD_UV *uv1, PHD_UV *uv2, SORTTYPE sortType); // 0x00409EC0
void __cdecl InsertClippedPoly_Textured(int vtxCount, float z, __int16 polyType, __int16 texPage); // 0x0040A5D0
void __cdecl InsertGT4_Sorted(PHD_VBUF *vtx0, PHD_VBUF *vtx1, PHD_VBUF *vtx2, PHD_VBUF *vtx3, PHD_TEXTURE *texture, SORTTYPE sortType); // 0x0040A780
__int16 *__cdecl InsertObjectGT4_Sorted(__int16 *ptrObj, int number, SORTTYPE sortType); // 0x0040AC60
__int16 *__cdecl InsertObjectGT3_Sorted(__int16 *ptrObj, int number, SORTTYPE sortType); // 0x0040ACF0
__int16 *__cdecl InsertObjectG4_Sorted(__int16 *ptrObj, int number, SORTTYPE sortType); // 0x0040AD90
void __cdecl InsertPoly_Gouraud(int vtxCount, float z, int red, int green, int blue, __int16 polyType); // 0x0040B1D0
__int16 *__cdecl InsertObjectG3_Sorted(__int16 *ptrObj, int number, SORTTYPE sortType); // 0x0040B350
#ifdef FEATURE_VIDEOFX_IMPROVED
void __cdecl InsertSprite_Sorted(int z, int x0, int y0, int x1, int y1, int spriteIdx, __int16 shade, DWORD flags); // 0x0040B6A0
#else // FEATURE_VIDEOFX_IMPROVED
void __cdecl InsertSprite_Sorted(int z, int x0, int y0, int x1, int y1, int spriteIdx, __int16 shade); // 0x0040B6A0
#endif // FEATURE_VIDEOFX_IMPROVED
void __cdecl InsertFlatRect_Sorted(int x0, int y0, int x1, int y1, int z, BYTE colorIdx); // 0x0040B9F0
void __cdecl InsertLine_Sorted(int x0, int y0, int x1, int y1, int z, BYTE colorIdx); // 0x0040BB70
void __cdecl InsertTrans8_Sorted(PHD_VBUF *vbuf, __int16 shade); // 0x0040BCA0
void __cdecl InsertTransQuad_Sorted(int x, int y, int width, int height, int z); // 0x0040BE40
#ifdef FEATURE_VIDEOFX_IMPROVED
void __cdecl InsertSprite(int z, int x0, int y0, int x1, int y1, int spriteIdx, __int16 shade, DWORD flags); // 0x0040BF80
#else // FEATURE_VIDEOFX_IMPROVED
void __cdecl InsertSprite(int z, int x0, int y0, int x1, int y1, int spriteIdx, __int16 shade); // 0x0040BF80
#endif // FEATURE_VIDEOFX_IMPROVED
#endif // _3DINSERT_H_INCLUDED
================================================
FILE: 3dsystem/phd_math.cpp
================================================
/*
* Copyright (c) 2017-2018 Michael Chaban. All rights reserved.
* Original game is created by Core Design Ltd. in 1997.
* Lara Croft and Tomb Raider are trademarks of Embracer Group AB.
*
* This file is part of TR2Main.
*
* TR2Main is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TR2Main is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TR2Main. If not, see <http://www.gnu.org/licenses/>.
*/
#include "global/precompiled.h"
#include "3dsystem/phd_math.h"
#include "global/vars.h"
// Arctan base table
static int AtanBaseTable[8] = {
0x0000,
-0x4000,
-0xFFFF,
0xC000,
-0x8000,
0x4000,
0x8000,
-0xC000,
};
// Arctan angle table
static __int16 AtanAngleTable[0x802] = {
0x0000, 0x0005, 0x000A, 0x000F, 0x0014, 0x0019, 0x001F, 0x0024,
0x0029, 0x002E, 0x0033, 0x0038, 0x003D, 0x0042, 0x0047, 0x004C,
0x0051, 0x0057, 0x005C, 0x0061, 0x0066, 0x006B, 0x0070, 0x0075,
0x007A, 0x007F, 0x0084, 0x008A, 0x008F, 0x0094, 0x0099, 0x009E,
0x00A3, 0x00A8, 0x00AD, 0x00B2, 0x00B7, 0x00BC, 0x00C2, 0x00C7,
0x00CC, 0x00D1, 0x00D6, 0x00DB, 0x00E0, 0x00E5, 0x00EA, 0x00EF,
0x00F4, 0x00FA, 0x00FF, 0x0104, 0x0109, 0x010E, 0x0113, 0x0118,
0x011D, 0x0122, 0x0127, 0x012C, 0x0131, 0x0137, 0x013C, 0x0141,
0x0146, 0x014B, 0x0150, 0x0155, 0x015A, 0x015F, 0x0164, 0x0169,
0x016F, 0x0174, 0x0179, 0x017E, 0x0183, 0x0188, 0x018D, 0x0192,
0x0197, 0x019C, 0x01A1, 0x01A6, 0x01AC, 0x01B1, 0x01B6, 0x01BB,
0x01C0, 0x01C5, 0x01CA, 0x01CF, 0x01D4, 0x01D9, 0x01DE, 0x01E3,
0x01E9, 0x01EE, 0x01F3, 0x01F8, 0x01FD, 0x0202, 0x0207, 0x020C,
0x0211, 0x0216, 0x021B, 0x0220, 0x0226, 0x022B, 0x0230, 0x0235,
0x023A, 0x023F, 0x0244, 0x0249, 0x024E, 0x0253, 0x0258, 0x025D,
0x0262, 0x0268, 0x026D, 0x0272, 0x0277, 0x027C, 0x0281, 0x0286,
0x028B, 0x0290, 0x0295, 0x029A, 0x029F, 0x02A4, 0x02A9, 0x02AF,
0x02B4, 0x02B9, 0x02BE, 0x02C3, 0x02C8, 0x02CD, 0x02D2, 0x02D7,
0x02DC, 0x02E1, 0x02E6, 0x02EB, 0x02F0, 0x02F6, 0x02FB, 0x0300,
0x0305, 0x030A, 0x030F, 0x0314, 0x0319, 0x031E, 0x0323, 0x0328,
0x032D, 0x0332, 0x0337, 0x033C, 0x0341, 0x0347, 0x034C, 0x0351,
0x0356, 0x035B, 0x0360, 0x0365, 0x036A, 0x036F, 0x0374, 0x0379,
0x037E, 0x0383, 0x0388, 0x038D, 0x0392, 0x0397, 0x039C, 0x03A2,
0x03A7, 0x03AC, 0x03B1, 0x03B6, 0x03BB, 0x03C0, 0x03C5, 0x03CA,
0x03CF, 0x03D4, 0x03D9, 0x03DE, 0x03E3, 0x03E8, 0x03ED, 0x03F2,
0x03F7, 0x03FC, 0x0401, 0x0407, 0x040C, 0x0411, 0x0416, 0x041B,
0x0420, 0x0425, 0x042A, 0x042F, 0x0434, 0x0439, 0x043E, 0x0443,
0x0448, 0x044D, 0x0452, 0x0457, 0x045C, 0x0461, 0x0466, 0x046B,
0x0470, 0x0475, 0x047A, 0x047F, 0x0484, 0x0489, 0x048E, 0x0494,
0x0499, 0x049E, 0x04A3, 0x04A8, 0x04AD, 0x04B2, 0x04B7, 0x04BC,
0x04C1, 0x04C6, 0x04CB, 0x04D0, 0x04D5, 0x04DA, 0x04DF, 0x04E4,
0x04E9, 0x04EE, 0x04F3, 0x04F8, 0x04FD, 0x0502, 0x0507, 0x050C,
0x0511, 0x0516, 0x051B, 0x0520, 0x0525, 0x052A, 0x052F, 0x0534,
0x0539, 0x053E, 0x0543, 0x0548, 0x054D, 0x0552, 0x0557, 0x055C,
0x0561, 0x0566, 0x056B, 0x0570, 0x0575, 0x057A, 0x057F, 0x0584,
0x0589, 0x058E, 0x0593, 0x0598, 0x059D, 0x05A2, 0x05A7, 0x05AC,
0x05B1, 0x05B6, 0x05BB, 0x05C0, 0x05C5, 0x05CA, 0x05CF, 0x05D4,
0x05D9, 0x05DE, 0x05E3, 0x05E8, 0x05ED, 0x05F2, 0x05F7, 0x05FC,
0x0601, 0x0606, 0x060B, 0x0610, 0x0615, 0x061A, 0x061F, 0x0624,
0x0629, 0x062E, 0x0633, 0x0638, 0x063D, 0x0642, 0x0647, 0x064C,
0x0651, 0x0656, 0x065B, 0x0660, 0x0665, 0x066A, 0x066E, 0x0673,
0x0678, 0x067D, 0x0682, 0x0687, 0x068C, 0x0691, 0x0696, 0x069B,
0x06A0, 0x06A5, 0x06AA, 0x06AF, 0x06B4, 0x06B9, 0x06BE, 0x06C3,
0x06C8, 0x06CD, 0x06D2, 0x06D7, 0x06DC, 0x06E1, 0x06E5, 0x06EA,
0x06EF, 0x06F4, 0x06F9, 0x06FE, 0x0703, 0x0708, 0x070D, 0x0712,
0x0717, 0x071C, 0x0721, 0x0726, 0x072B, 0x0730, 0x0735, 0x0739,
0x073E, 0x0743, 0x0748, 0x074D, 0x0752, 0x0757, 0x075C, 0x0761,
0x0766, 0x076B, 0x0770, 0x0775, 0x077A, 0x077E, 0x0783, 0x0788,
0x078D, 0x0792, 0x0797, 0x079C, 0x07A1, 0x07A6, 0x07AB, 0x07B0,
0x07B5, 0x07B9, 0x07BE, 0x07C3, 0x07C8, 0x07CD, 0x07D2, 0x07D7,
0x07DC, 0x07E1, 0x07E6, 0x07EB, 0x07EF, 0x07F4, 0x07F9, 0x07FE,
0x0803, 0x0808, 0x080D, 0x0812, 0x0817, 0x081C, 0x0820, 0x0825,
0x082A, 0x082F, 0x0834, 0x0839, 0x083E, 0x0843, 0x0848, 0x084C,
0x0851, 0x0856, 0x085B, 0x0860, 0x0865, 0x086A, 0x086F, 0x0873,
0x0878, 0x087D, 0x0882, 0x0887, 0x088C, 0x0891, 0x0896, 0x089A,
0x089F, 0x08A4, 0x08A9, 0x08AE, 0x08B3, 0x08B8, 0x08BD, 0x08C1,
0x08C6, 0x08CB, 0x08D0, 0x08D5, 0x08DA, 0x08DF, 0x08E3, 0x08E8,
0x08ED, 0x08F2, 0x08F7, 0x08FC, 0x0901, 0x0905, 0x090A, 0x090F,
0x0914, 0x0919, 0x091E, 0x0922, 0x0927, 0x092C, 0x0931, 0x0936,
0x093B, 0x093F, 0x0944, 0x0949, 0x094E, 0x0953, 0x0958, 0x095C,
0x0961, 0x0966, 0x096B, 0x0970, 0x0975, 0x0979, 0x097E, 0x0983,
0x0988, 0x098D, 0x0992, 0x0996, 0x099B, 0x09A0, 0x09A5, 0x09AA,
0x09AE, 0x09B3, 0x09B8, 0x09BD, 0x09C2, 0x09C6, 0x09CB, 0x09D0,
0x09D5, 0x09DA, 0x09DE, 0x09E3, 0x09E8, 0x09ED, 0x09F2, 0x09F6,
0x09FB, 0x0A00, 0x0A05, 0x0A0A, 0x0A0E, 0x0A13, 0x0A18, 0x0A1D,
0x0A22, 0x0A26, 0x0A2B, 0x0A30, 0x0A35, 0x0A39, 0x0A3E, 0x0A43,
0x0A48, 0x0A4D, 0x0A51, 0x0A56, 0x0A5B, 0x0A60, 0x0A64, 0x0A69,
0x0A6E, 0x0A73, 0x0A77, 0x0A7C, 0x0A81, 0x0A86, 0x0A8B, 0x0A8F,
0x0A94, 0x0A99, 0x0A9E, 0x0AA2, 0x0AA7, 0x0AAC, 0x0AB1, 0x0AB5,
0x0ABA, 0x0ABF, 0x0AC4, 0x0AC8, 0x0ACD, 0x0AD2, 0x0AD7, 0x0ADB,
0x0AE0, 0x0AE5, 0x0AE9, 0x0AEE, 0x0AF3, 0x0AF8, 0x0AFC, 0x0B01,
0x0B06, 0x0B0B, 0x0B0F, 0x0B14, 0x0B19, 0x0B1E, 0x0B22, 0x0B27,
0x0B2C, 0x0B30, 0x0B35, 0x0B3A, 0x0B3F, 0x0B43, 0x0B48, 0x0B4D,
0x0B51, 0x0B56, 0x0B5B, 0x0B60, 0x0B64, 0x0B69, 0x0B6E, 0x0B72,
0x0B77, 0x0B7C, 0x0B80, 0x0B85, 0x0B8A, 0x0B8F, 0x0B93, 0x0B98,
0x0B9D, 0x0BA1, 0x0BA6, 0x0BAB, 0x0BAF, 0x0BB4, 0x0BB9, 0x0BBD,
0x0BC2, 0x0BC7, 0x0BCB, 0x0BD0, 0x0BD5, 0x0BD9, 0x0BDE, 0x0BE3,
0x0BE7, 0x0BEC, 0x0BF1, 0x0BF5, 0x0BFA, 0x0BFF, 0x0C03, 0x0C08,
0x0C0D, 0x0C11, 0x0C16, 0x0C1B, 0x0C1F, 0x0C24, 0x0C29, 0x0C2D,
0x0C32, 0x0C37, 0x0C3B, 0x0C40, 0x0C45, 0x0C49, 0x0C4E, 0x0C53,
0x0C57, 0x0C5C, 0x0C60, 0x0C65, 0x0C6A, 0x0C6E, 0x0C73, 0x0C78,
0x0C7C, 0x0C81, 0x0C86, 0x0C8A, 0x0C8F, 0x0C93, 0x0C98, 0x0C9D,
0x0CA1, 0x0CA6, 0x0CAB, 0x0CAF, 0x0CB4, 0x0CB8, 0x0CBD, 0x0CC2,
0x0CC6, 0x0CCB, 0x0CCF, 0x0CD4, 0x0CD9, 0x0CDD, 0x0CE2, 0x0CE6,
0x0CEB, 0x0CF0, 0x0CF4, 0x0CF9, 0x0CFD, 0x0D02, 0x0D07, 0x0D0B,
0x0D10, 0x0D14, 0x0D19, 0x0D1E, 0x0D22, 0x0D27, 0x0D2B, 0x0D30,
0x0D34, 0x0D39, 0x0D3E, 0x0D42, 0x0D47, 0x0D4B, 0x0D50, 0x0D54,
0x0D59, 0x0D5E, 0x0D62, 0x0D67, 0x0D6B, 0x0D70, 0x0D74, 0x0D79,
0x0D7D, 0x0D82, 0x0D87, 0x0D8B, 0x0D90, 0x0D94, 0x0D99, 0x0D9D,
0x0DA2, 0x0DA6, 0x0DAB, 0x0DAF, 0x0DB4, 0x0DB9, 0x0DBD, 0x0DC2,
0x0DC6, 0x0DCB, 0x0DCF, 0x0DD4, 0x0DD8, 0x0DDD, 0x0DE1, 0x0DE6,
0x0DEA, 0x0DEF, 0x0DF3, 0x0DF8, 0x0DFC, 0x0E01, 0x0E05, 0x0E0A,
0x0E0F, 0x0E13, 0x0E18, 0x0E1C, 0x0E21, 0x0E25, 0x0E2A, 0x0E2E,
0x0E33, 0x0E37, 0x0E3C, 0x0E40, 0x0E45, 0x0E49, 0x0E4E, 0x0E52,
0x0E56, 0x0E5B, 0x0E5F, 0x0E64, 0x0E68, 0x0E6D, 0x0E71, 0x0E76,
0x0E7A, 0x0E7F, 0x0E83, 0x0E88, 0x0E8C, 0x0E91, 0x0E95, 0x0E9A,
0x0E9E, 0x0EA3, 0x0EA7, 0x0EAC, 0x0EB0, 0x0EB4, 0x0EB9, 0x0EBD,
0x0EC2, 0x0EC6, 0x0ECB, 0x0ECF, 0x0ED4, 0x0ED8, 0x0EDC, 0x0EE1,
0x0EE5, 0x0EEA, 0x0EEE, 0x0EF3, 0x0EF7, 0x0EFC, 0x0F00, 0x0F04,
0x0F09, 0x0F0D, 0x0F12, 0x0F16, 0x0F1B, 0x0F1F, 0x0F23, 0x0F28,
0x0F2C, 0x0F31, 0x0F35, 0x0F3A, 0x0F3E, 0x0F42, 0x0F47, 0x0F4B,
0x0F50, 0x0F54, 0x0F58, 0x0F5D, 0x0F61, 0x0F66, 0x0F6A, 0x0F6E,
0x0F73, 0x0F77, 0x0F7C, 0x0F80, 0x0F84, 0x0F89, 0x0F8D, 0x0F91,
0x0F96, 0x0F9A, 0x0F9F, 0x0FA3, 0x0FA7, 0x0FAC, 0x0FB0, 0x0FB5,
0x0FB9, 0x0FBD, 0x0FC2, 0x0FC6, 0x0FCA, 0x0FCF, 0x0FD3, 0x0FD7,
0x0FDC, 0x0FE0, 0x0FE5, 0x0FE9, 0x0FED, 0x0FF2, 0x0FF6, 0x0FFA,
0x0FFF, 0x1003, 0x1007, 0x100C, 0x1010, 0x1014, 0x1019, 0x101D,
0x1021, 0x1026, 0x102A, 0x102E, 0x1033, 0x1037, 0x103B, 0x1040,
0x1044, 0x1048, 0x104D, 0x1051, 0x1055, 0x105A, 0x105E, 0x1062,
0x1067, 0x106B, 0x106F, 0x1073, 0x1078, 0x107C, 0x1080, 0x1085,
0x1089, 0x108D, 0x1092, 0x1096, 0x109A, 0x109E, 0x10A3, 0x10A7,
0x10AB, 0x10B0, 0x10B4, 0x10B8, 0x10BC, 0x10C1, 0x10C5, 0x10C9,
0x10CE, 0x10D2, 0x10D6, 0x10DA, 0x10DF, 0x10E3, 0x10E7, 0x10EB,
0x10F0, 0x10F4, 0x10F8, 0x10FD, 0x1101, 0x1105, 0x1109, 0x110E,
0x1112, 0x1116, 0x111A, 0x111F, 0x1123, 0x1127, 0x112B, 0x1130,
0x1134, 0x1138, 0x113C, 0x1140, 0x1145, 0x1149, 0x114D, 0x1151,
0x1156, 0x115A, 0x115E, 0x1162, 0x1166, 0x116B, 0x116F, 0x1173,
0x1177, 0x117C, 0x1180, 0x1184, 0x1188, 0x118C, 0x1191, 0x1195,
0x1199, 0x119D, 0x11A1, 0x11A6, 0x11AA, 0x11AE, 0x11B2, 0x11B6,
0x11BB, 0x11BF, 0x11C3, 0x11C7, 0x11CB, 0x11CF, 0x11D4, 0x11D8,
0x11DC, 0x11E0, 0x11E4, 0x11E9, 0x11ED, 0x11F1, 0x11F5, 0x11F9,
0x11FD, 0x1202, 0x1206, 0x120A, 0x120E, 0x1212, 0x1216, 0x121A,
0x121F, 0x1223, 0x1227, 0x122B, 0x122F, 0x1233, 0x1237, 0x123C,
0x1240, 0x1244, 0x1248, 0x124C, 0x1250, 0x1254, 0x1259, 0x125D,
0x1261, 0x1265, 0x1269, 0x126D, 0x1271, 0x1275, 0x127A, 0x127E,
0x1282, 0x1286, 0x128A, 0x128E, 0x1292, 0x1296, 0x129A, 0x129F,
0x12A3, 0x12A7, 0x12AB, 0x12AF, 0x12B3, 0x12B7, 0x12BB, 0x12BF,
0x12C3, 0x12C7, 0x12CC, 0x12D0, 0x12D4, 0x12D8, 0x12DC, 0x12E0,
0x12E4, 0x12E8, 0x12EC, 0x12F0, 0x12F4, 0x12F8, 0x12FC, 0x1301,
0x1305, 0x1309, 0x130D, 0x1311, 0x1315, 0x1319, 0x131D, 0x1321,
0x1325, 0x1329, 0x132D, 0x1331, 0x1335, 0x1339, 0x133D, 0x1341,
0x1345, 0x1349, 0x134D, 0x1351, 0x1355, 0x135A, 0x135E, 0x1362,
0x1366, 0x136A, 0x136E, 0x1372, 0x1376, 0x137A, 0x137E, 0x1382,
0x1386, 0x138A, 0x138E, 0x1392, 0x1396, 0x139A, 0x139E, 0x13A2,
0x13A6, 0x13AA, 0x13AE, 0x13B2, 0x13B6, 0x13BA, 0x13BE, 0x13C2,
0x13C6, 0x13CA, 0x13CE, 0x13D2, 0x13D6, 0x13DA, 0x13DE, 0x13E2,
0x13E6, 0x13E9, 0x13ED, 0x13F1, 0x13F5, 0x13F9, 0x13FD, 0x1401,
0x1405, 0x1409, 0x140D, 0x1411, 0x1415, 0x1419, 0x141D, 0x1421,
0x1425, 0x1429, 0x142D, 0x1431, 0x1435, 0x1439, 0x143D, 0x1440,
0x1444, 0x1448, 0x144C, 0x1450, 0x1454, 0x1458, 0x145C, 0x1460,
0x1464, 0x1468, 0x146C, 0x1470, 0x1473, 0x1477, 0x147B, 0x147F,
0x1483, 0x1487, 0x148B, 0x148F, 0x1493, 0x1497, 0x149B, 0x149E,
0x14A2, 0x14A6, 0x14AA, 0x14AE, 0x14B2, 0x14B6, 0x14BA, 0x14BE,
0x14C1, 0x14C5, 0x14C9, 0x14CD, 0x14D1, 0x14D5, 0x14D9, 0x14DD,
0x14E0, 0x14E4, 0x14E8, 0x14EC, 0x14F0, 0x14F4, 0x14F8, 0x14FB,
0x14FF, 0x1503, 0x1507, 0x150B, 0x150F, 0x1513, 0x1516, 0x151A,
0x151E, 0x1522, 0x1526, 0x152A, 0x152D, 0x1531, 0x1535, 0x1539,
0x153D, 0x1541, 0x1544, 0x1548, 0x154C, 0x1550, 0x1554, 0x1558,
0x155B, 0x155F, 0x1563, 0x1567, 0x156B, 0x156E, 0x1572, 0x1576,
0x157A, 0x157E, 0x1581, 0x1585, 0x1589, 0x158D, 0x1591, 0x1594,
0x1598, 0x159C, 0x15A0, 0x15A4, 0x15A7, 0x15AB, 0x15AF, 0x15B3,
0x15B7, 0x15BA, 0x15BE, 0x15C2, 0x15C6, 0x15C9, 0x15CD, 0x15D1,
0x15D5, 0x15D8, 0x15DC, 0x15E0, 0x15E4, 0x15E8, 0x15EB, 0x15EF,
0x15F3, 0x15F7, 0x15FA, 0x15FE, 0x1602, 0x1606, 0x1609, 0x160D,
0x1611, 0x1614, 0x1618, 0x161C, 0x1620, 0x1623, 0x1627, 0x162B,
0x162F, 0x1632, 0x1636, 0x163A, 0x163E, 0x1641, 0x1645, 0x1649,
0x164C, 0x1650, 0x1654, 0x1658, 0x165B, 0x165F, 0x1663, 0x1666,
0x166A, 0x166E, 0x1671, 0x1675, 0x1679, 0x167D, 0x1680, 0x1684,
0x1688, 0x168B, 0x168F, 0x1693, 0x1696, 0x169A, 0x169E, 0x16A1,
0x16A5, 0x16A9, 0x16AC, 0x16B0, 0x16B4, 0x16B7, 0x16BB, 0x16BF,
0x16C2, 0x16C6, 0x16CA, 0x16CD, 0x16D1, 0x16D5, 0x16D8, 0x16DC,
0x16E0, 0x16E3, 0x16E7, 0x16EB, 0x16EE, 0x16F2, 0x16F6, 0x16F9,
0x16FD, 0x1700, 0x1704, 0x1708, 0x170B, 0x170F, 0x1713, 0x1716,
0x171A, 0x171D, 0x1721, 0x1725, 0x1728, 0x172C, 0x1730, 0x1733,
0x1737, 0x173A, 0x173E, 0x1742, 0x1745, 0x1749, 0x174C, 0x1750,
0x1754, 0x1757, 0x175B, 0x175E, 0x1762, 0x1766, 0x1769, 0x176D,
0x1770, 0x1774, 0x1778, 0x177B, 0x177F, 0x1782, 0x1786, 0x1789,
0x178D, 0x1791, 0x1794, 0x1798, 0x179B, 0x179F, 0x17A2, 0x17A6,
0x17AA, 0x17AD, 0x17B1, 0x17B4, 0x17B8, 0x17BB, 0x17BF, 0x17C2,
0x17C6, 0x17C9, 0x17CD, 0x17D1, 0x17D4, 0x17D8, 0x17DB, 0x17DF,
0x17E2, 0x17E6, 0x17E9, 0x17ED, 0x17F0, 0x17F4, 0x17F7, 0x17FB,
0x17FE, 0x1802, 0x1806, 0x1809, 0x180D, 0x1810, 0x1814, 0x1817,
0x181B, 0x181E, 0x1822, 0x1825, 0x1829, 0x182C, 0x1830, 0x1833,
0x1837, 0x183A, 0x183E, 0x1841, 0x1845, 0x1848, 0x184C, 0x184F,
0x1853, 0x1856, 0x185A, 0x185D, 0x1860, 0x1864, 0x1867, 0x186B,
0x186E, 0x1872, 0x1875, 0x1879, 0x187C, 0x1880, 0x1883, 0x1887,
0x188A, 0x188E, 0x1891, 0x1894, 0x1898, 0x189B, 0x189F, 0x18A2,
0x18A6, 0x18A9, 0x18AD, 0x18B0, 0x18B3, 0x18B7, 0x18BA, 0x18BE,
0x18C1, 0x18C5, 0x18C8, 0x18CC, 0x18CF, 0x18D2, 0x18D6, 0x18D9,
0x18DD, 0x18E0, 0x18E3, 0x18E7, 0x18EA, 0x18EE, 0x18F1, 0x18F5,
0x18F8, 0x18FB, 0x18FF, 0x1902, 0x1906, 0x1909, 0x190C, 0x1910,
0x1913, 0x1917, 0x191A, 0x191D, 0x1921, 0x1924, 0x1928, 0x192B,
0x192E, 0x1932, 0x1935, 0x1938, 0x193C, 0x193F, 0x1943, 0x1946,
0x1949, 0x194D, 0x1950, 0x1953, 0x1957, 0x195A, 0x195D, 0x1961,
0x1964, 0x1968, 0x196B, 0x196E, 0x1972, 0x1975, 0x1978, 0x197C,
0x197F, 0x1982, 0x1986, 0x1989, 0x198C, 0x1990, 0x1993, 0x1996,
0x199A, 0x199D, 0x19A0, 0x19A4, 0x19A7, 0x19AA, 0x19AE, 0x19B1,
0x19B4, 0x19B8, 0x19BB, 0x19BE, 0x19C2, 0x19C5, 0x19C8, 0x19CC,
0x19CF, 0x19D2, 0x19D5, 0x19D9, 0x19DC, 0x19DF, 0x19E3, 0x19E6,
0x19E9, 0x19ED, 0x19F0, 0x19F3, 0x19F6, 0x19FA, 0x19FD, 0x1A00,
0x1A04, 0x1A07, 0x1A0A, 0x1A0D, 0x1A11, 0x1A14, 0x1A17, 0x1A1B,
0x1A1E, 0x1A21, 0x1A24, 0x1A28, 0x1A2B, 0x1A2E, 0x1A31, 0x1A35,
0x1A38, 0x1A3B, 0x1A3E, 0x1A42, 0x1A45, 0x1A48, 0x1A4B, 0x1A4F,
0x1A52, 0x1A55, 0x1A58, 0x1A5C, 0x1A5F, 0x1A62, 0x1A65, 0x1A69,
0x1A6C, 0x1A6F, 0x1A72, 0x1A76, 0x1A79, 0x1A7C, 0x1A7F, 0x1A83,
0x1A86, 0x1A89, 0x1A8C, 0x1A8F, 0x1A93, 0x1A96, 0x1A99, 0x1A9C,
0x1A9F, 0x1AA3, 0x1AA6, 0x1AA9, 0x1AAC, 0x1AB0, 0x1AB3, 0x1AB6,
0x1AB9, 0x1ABC, 0x1AC0, 0x1AC3, 0x1AC6, 0x1AC9, 0x1ACC, 0x1ACF,
0x1AD3, 0x1AD6, 0x1AD9, 0x1ADC, 0x1ADF, 0x1AE3, 0x1AE6, 0x1AE9,
0x1AEC, 0x1AEF, 0x1AF2, 0x1AF6, 0x1AF9, 0x1AFC, 0x1AFF, 0x1B02,
0x1B05, 0x1B09, 0x1B0C, 0x1B0F, 0x1B12, 0x1B15, 0x1B18, 0x1B1C,
0x1B1F, 0x1B22, 0x1B25, 0x1B28, 0x1B2B, 0x1B2E, 0x1B32, 0x1B35,
0x1B38, 0x1B3B, 0x1B3E, 0x1B41, 0x1B44, 0x1B48, 0x1B4B, 0x1B4E,
0x1B51, 0x1B54, 0x1B57, 0x1B5A, 0x1B5D, 0x1B61, 0x1B64, 0x1B67,
0x1B6A, 0x1B6D, 0x1B70, 0x1B73, 0x1B76, 0x1B79, 0x1B7D, 0x1B80,
0x1B83, 0x1B86, 0x1B89, 0x1B8C, 0x1B8F, 0x1B92, 0x1B95, 0x1B98,
0x1B9C, 0x1B9F, 0x1BA2, 0x1BA5, 0x1BA8, 0x1BAB, 0x1BAE, 0x1BB1,
0x1BB4, 0x1BB7, 0x1BBA, 0x1BBD, 0x1BC1, 0x1BC4, 0x1BC7, 0x1BCA,
0x1BCD, 0x1BD0, 0x1BD3, 0x1BD6, 0x1BD9, 0x1BDC, 0x1BDF, 0x1BE2,
0x1BE5, 0x1BE8, 0x1BEB, 0x1BEE, 0x1BF2, 0x1BF5, 0x1BF8, 0x1BFB,
0x1BFE, 0x1C01, 0x1C04, 0x1C07, 0x1C0A, 0x1C0D, 0x1C10, 0x1C13,
0x1C16, 0x1C19, 0x1C1C, 0x1C1F, 0x1C22, 0x1C25, 0x1C28, 0x1C2B,
0x1C2E, 0x1C31, 0x1C34, 0x1C37, 0x1C3A, 0x1C3D, 0x1C40, 0x1C43,
0x1C46, 0x1C49, 0x1C4C, 0x1C4F, 0x1C52, 0x1C55, 0x1C58, 0x1C5B,
0x1C5E, 0x1C61, 0x1C64, 0x1C67, 0x1C6A, 0x1C6D, 0x1C70, 0x1C73,
0x1C76, 0x1C79, 0x1C7C, 0x1C7F, 0x1C82, 0x1C85, 0x1C88, 0x1C8B,
0x1C8E, 0x1C91, 0x1C94, 0x1C97, 0x1C9A, 0x1C9D, 0x1CA0, 0x1CA3,
0x1CA6, 0x1CA9, 0x1CAC, 0x1CAF, 0x1CB2, 0x1CB5, 0x1CB8, 0x1CBB,
0x1CBE, 0x1CC1, 0x1CC3, 0x1CC6, 0x1CC9, 0x1CCC, 0x1CCF, 0x1CD2,
0x1CD5, 0x1CD8, 0x1CDB, 0x1CDE, 0x1CE1, 0x1CE4, 0x1CE7, 0x1CEA,
0x1CED, 0x1CF0, 0x1CF3, 0x1CF5, 0x1CF8, 0x1CFB, 0x1CFE, 0x1D01,
0x1D04, 0x1D07, 0x1D0A, 0x1D0D, 0x1D10, 0x1D13, 0x1D16, 0x1D18,
0x1D1B, 0x1D1E, 0x1D21, 0x1D24, 0x1D27, 0x1D2A, 0x1D2D, 0x1D30,
0x1D33, 0x1D35, 0x1D38, 0x1D3B, 0x1D3E, 0x1D41, 0x1D44, 0x1D47,
0x1D4A, 0x1D4D, 0x1D4F, 0x1D52, 0x1D55, 0x1D58, 0x1D5B, 0x1D5E,
0x1D61, 0x1D64, 0x1D66, 0x1D69, 0x1D6C, 0x1D6F, 0x1D72, 0x1D75,
0x1D78, 0x1D7B, 0x1D7D, 0x1D80, 0x1D83, 0x1D86, 0x1D89, 0x1D8C,
0x1D8E, 0x1D91, 0x1D94, 0x1D97, 0x1D9A, 0x1D9D, 0x1DA0, 0x1DA2,
0x1DA5, 0x1DA8, 0x1DAB, 0x1DAE, 0x1DB1, 0x1DB3, 0x1DB6, 0x1DB9,
0x1DBC, 0x1DBF, 0x1DC2, 0x1DC4, 0x1DC7, 0x1DCA, 0x1DCD, 0x1DD0,
0x1DD3, 0x1DD5, 0x1DD8, 0x1DDB, 0x1DDE, 0x1DE1, 0x1DE3, 0x1DE6,
0x1DE9, 0x1DEC, 0x1DEF, 0x1DF1, 0x1DF4, 0x1DF7, 0x1DFA, 0x1DFD,
0x1DFF, 0x1E02, 0x1E05, 0x1E08, 0x1E0B, 0x1E0D, 0x1E10, 0x1E13,
0x1E16, 0x1E19, 0x1E1B, 0x1E1E, 0x1E21, 0x1E24, 0x1E26, 0x1E29,
0x1E2C, 0x1E2F, 0x1E32, 0x1E34, 0x1E37, 0x1E3A, 0x1E3D, 0x1E3F,
0x1E42, 0x1E45, 0x1E48, 0x1E4A, 0x1E4D, 0x1E50, 0x1E53, 0x1E55,
0x1E58, 0x1E5B, 0x1E5E, 0x1E60, 0x1E63, 0x1E66, 0x1E69, 0x1E6B,
0x1E6E, 0x1E71, 0x1E74, 0x1E76, 0x1E79, 0x1E7C, 0x1E7F, 0x1E81,
0x1E84, 0x1E87, 0x1E8A, 0x1E8C, 0x1E8F, 0x1E92, 0x1E94, 0x1E97,
0x1E9A, 0x1E9D, 0x1E9F, 0x1EA2, 0x1EA5, 0x1EA8, 0x1EAA, 0x1EAD,
0x1EB0, 0x1EB2, 0x1EB5, 0x1EB8, 0x1EBA, 0x1EBD, 0x1EC0, 0x1EC3,
0x1EC5, 0x1EC8, 0x1ECB, 0x1ECD, 0x1ED0, 0x1ED3, 0x1ED5, 0x1ED8,
0x1EDB, 0x1EDE, 0x1EE0, 0x1EE3, 0x1EE6, 0x1EE8, 0x1EEB, 0x1EEE,
0x1EF0, 0x1EF3, 0x1EF6, 0x1EF8, 0x1EFB, 0x1EFE, 0x1F00, 0x1F03,
0x1F06, 0x1F08, 0x1F0B, 0x1F0E, 0x1F10, 0x1F13, 0x1F16, 0x1F18,
0x1F1B, 0x1F1E, 0x1F20, 0x1F23, 0x1F26, 0x1F28, 0x1F2B, 0x1F2E,
0x1F30, 0x1F33, 0x1F36, 0x1F38, 0x1F3B, 0x1F3D, 0x1F40, 0x1F43,
0x1F45, 0x1F48, 0x1F4B, 0x1F4D, 0x1F50, 0x1F53, 0x1F55, 0x1F58,
0x1F5A, 0x1F5D, 0x1F60, 0x1F62, 0x1F65, 0x1F68, 0x1F6A, 0x1F6D,
0x1F6F, 0x1F72, 0x1F75, 0x1F77, 0x1F7A, 0x1F7C, 0x1F7F, 0x1F82,
0x1F84, 0x1F87, 0x1F8A, 0x1F8C, 0x1F8F, 0x1F91, 0x1F94, 0x1F97,
0x1F99, 0x1F9C, 0x1F9E, 0x1FA1, 0x1FA4, 0x1FA6, 0x1FA9, 0x1FAB,
0x1FAE, 0x1FB0, 0x1FB3, 0x1FB6, 0x1FB8, 0x1FBB, 0x1FBD, 0x1FC0,
0x1FC3, 0x1FC5, 0x1FC8, 0x1FCA, 0x1FCD, 0x1FCF, 0x1FD2, 0x1FD5,
0x1FD7, 0x1FDA, 0x1FDC, 0x1FDF, 0x1FE1, 0x1FE4, 0x1FE6, 0x1FE9,
0x1FEC, 0x1FEE, 0x1FF1, 0x1FF3, 0x1FF6, 0x1FF8, 0x1FFB, 0x1FFD,
0x2000, 0x2000,
};
// Sines integer representation table for angle 0..90 degrees
static const __int16 PhdSinTable[0x402] = {
0x0000, 0x0019, 0x0032, 0x004B, 0x0065, 0x007E, 0x0097, 0x00B0,
0x00C9, 0x00E2, 0x00FB, 0x0114, 0x012E, 0x0147, 0x0160, 0x0179,
0x0192, 0x01AB, 0x01C4, 0x01DD, 0x01F7, 0x0210, 0x0229, 0x0242,
0x025B, 0x0274, 0x028D, 0x02A6, 0x02C0, 0x02D9, 0x02F2, 0x030B,
0x0324, 0x033D, 0x0356, 0x036F, 0x0388, 0x03A1, 0x03BB, 0x03D4,
0x03ED, 0x0406, 0x041F, 0x0438, 0x0451, 0x046A, 0x0483, 0x049C,
0x04B5, 0x04CE, 0x04E7, 0x0500, 0x051A, 0x0533, 0x054C, 0x0565,
0x057E, 0x0597, 0x05B0, 0x05C9, 0x05E2, 0x05FB, 0x0614, 0x062D,
0x0646, 0x065F, 0x0678, 0x0691, 0x06AA, 0x06C3, 0x06DC, 0x06F5,
0x070E, 0x0727, 0x0740, 0x0759, 0x0772, 0x078B, 0x07A4, 0x07BD,
0x07D6, 0x07EF, 0x0807, 0x0820, 0x0839, 0x0852, 0x086B, 0x0884,
0x089D, 0x08B6, 0x08CF, 0x08E8, 0x0901, 0x0919, 0x0932, 0x094B,
0x0964, 0x097D, 0x0996, 0x09AF, 0x09C7, 0x09E0, 0x09F9, 0x0A12,
0x0A2B, 0x0A44, 0x0A5C, 0x0A75, 0x0A8E, 0x0AA7, 0x0AC0, 0x0AD8,
0x0AF1, 0x0B0A, 0x0B23, 0x0B3B, 0x0B54, 0x0B6D, 0x0B85, 0x0B9E,
0x0BB7, 0x0BD0, 0x0BE8, 0x0C01, 0x0C1A, 0x0C32, 0x0C4B, 0x0C64,
0x0C7C, 0x0C95, 0x0CAE, 0x0CC6, 0x0CDF, 0x0CF8, 0x0D10, 0x0D29,
0x0D41, 0x0D5A, 0x0D72, 0x0D8B, 0x0DA4, 0x0DBC, 0x0DD5, 0x0DED,
0x0E06, 0x0E1E, 0x0E37, 0x0E4F, 0x0E68, 0x0E80, 0x0E99, 0x0EB1,
0x0ECA, 0x0EE2, 0x0EFB, 0x0F13, 0x0F2B, 0x0F44, 0x0F5C, 0x0F75,
0x0F8D, 0x0FA5, 0x0FBE, 0x0FD6, 0x0FEE, 0x1007, 0x101F, 0x1037,
0x1050, 0x1068, 0x1080, 0x1099, 0x10B1, 0x10C9, 0x10E1, 0x10FA,
0x1112, 0x112A, 0x1142, 0x115A, 0x1173, 0x118B, 0x11A3, 0x11BB,
0x11D3, 0x11EB, 0x1204, 0x121C, 0x1234, 0x124C, 0x1264, 0x127C,
0x1294, 0x12AC, 0x12C4, 0x12DC, 0x12F4, 0x130C, 0x1324, 0x133C,
0x1354, 0x136C, 0x1384, 0x139C, 0x13B4, 0x13CC, 0x13E4, 0x13FB,
0x1413, 0x142B, 0x1443, 0x145B, 0x1473, 0x148B, 0x14A2, 0x14BA,
0x14D2, 0x14EA, 0x1501, 0x1519, 0x1531, 0x1549, 0x1560, 0x1578,
0x1590, 0x15A7, 0x15BF, 0x15D7, 0x15EE, 0x1606, 0x161D, 0x1635,
0x164C, 0x1664, 0x167C, 0x1693, 0x16AB, 0x16C2, 0x16DA, 0x16F1,
0x1709, 0x1720, 0x1737, 0x174F, 0x1766, 0x177E, 0x1795, 0x17AC,
0x17C4, 0x17DB, 0x17F2, 0x180A, 0x1821, 0x1838, 0x184F, 0x1867,
0x187E, 0x1895, 0x18AC, 0x18C3, 0x18DB, 0x18F2, 0x1909, 0x1920,
0x1937, 0x194E, 0x1965, 0x197C, 0x1993, 0x19AA, 0x19C1, 0x19D8,
0x19EF, 0x1A06, 0x1A1D, 0x1A34, 0x1A4B, 0x1A62, 0x1A79, 0x1A90,
0x1AA7, 0x1ABE, 0x1AD4, 0x1AEB, 0x1B02, 0x1B19, 0x1B30, 0x1B46,
0x1B5D, 0x1B74, 0x1B8A, 0x1BA1, 0x1BB8, 0x1BCE, 0x1BE5, 0x1BFC,
0x1C12, 0x1C29, 0x1C3F, 0x1C56, 0x1C6C, 0x1C83, 0x1C99, 0x1CB0,
0x1CC6, 0x1CDD, 0x1CF3, 0x1D0A, 0x1D20, 0x1D36, 0x1D4D, 0x1D63,
0x1D79, 0x1D90, 0x1DA6, 0x1DBC, 0x1DD3, 0x1DE9, 0x1DFF, 0x1E15,
0x1E2B, 0x1E42, 0x1E58, 0x1E6E, 0x1E84, 0x1E9A, 0x1EB0, 0x1EC6,
0x1EDC, 0x1EF2, 0x1F08, 0x1F1E, 0x1F34, 0x1F4A, 0x1F60, 0x1F76,
0x1F8C, 0x1FA2, 0x1FB7, 0x1FCD, 0x1FE3, 0x1FF9, 0x200F, 0x2024,
0x203A, 0x2050, 0x2065, 0x207B, 0x2091, 0x20A6, 0x20BC, 0x20D1,
0x20E7, 0x20FD, 0x2112, 0x2128, 0x213D, 0x2153, 0x2168, 0x217D,
0x2193, 0x21A8, 0x21BE, 0x21D3, 0x21E8, 0x21FE, 0x2213, 0x2228,
0x223D, 0x2253, 0x2268, 0x227D, 0x2292, 0x22A7, 0x22BC, 0x22D2,
0x22E7, 0x22FC, 0x2311, 0x2326, 0x233B, 0x2350, 0x2365, 0x237A,
0x238E, 0x23A3, 0x23B8, 0x23CD, 0x23E2, 0x23F7, 0x240B, 0x2420,
0x2435, 0x244A, 0x245E, 0x2473, 0x2488, 0x249C, 0x24B1, 0x24C5,
0x24DA, 0x24EF, 0x2503, 0x2518, 0x252C, 0x2541, 0x2555, 0x2569,
0x257E, 0x2592, 0x25A6, 0x25BB, 0x25CF, 0x25E3, 0x25F8, 0x260C,
0x2620, 0x2634, 0x2648, 0x265C, 0x2671, 0x2685, 0x2699, 0x26AD,
0x26C1, 0x26D5, 0x26E9, 0x26FD, 0x2711, 0x2724, 0x2738, 0x274C,
0x2760, 0x2774, 0x2788, 0x279B, 0x27AF, 0x27C3, 0x27D6, 0x27EA,
0x27FE, 0x2811, 0x2825, 0x2838, 0x284C, 0x2860, 0x2873, 0x2886,
0x289A, 0x28AD, 0x28C1, 0x28D4, 0x28E7, 0x28FB, 0x290E, 0x2921,
0x2935, 0x2948, 0x295B, 0x296E, 0x2981, 0x2994, 0x29A7, 0x29BB,
0x29CE, 0x29E1, 0x29F4, 0x2A07, 0x2A1A, 0x2A2C, 0x2A3F, 0x2A52,
0x2A65, 0x2A78, 0x2A8B, 0x2A9D, 0x2AB0, 0x2AC3, 0x2AD6, 0x2AE8,
0x2AFB, 0x2B0D, 0x2B20, 0x2B33, 0x2B45, 0x2B58, 0x2B6A, 0x2B7D,
0x2B8F, 0x2BA1, 0x2BB4, 0x2BC6, 0x2BD8, 0x2BEB, 0x2BFD, 0x2C0F,
0x2C21, 0x2C34, 0x2C46, 0x2C58, 0x2C6A, 0x2C7C, 0x2C8E, 0x2CA0,
0x2CB2, 0x2CC4, 0x2CD6, 0x2CE8, 0x2CFA, 0x2D0C, 0x2D1E, 0x2D2F,
0x2D41, 0x2D53, 0x2D65, 0x2D76, 0x2D88, 0x2D9A, 0x2DAB, 0x2DBD,
0x2DCF, 0x2DE0, 0x2DF2, 0x2E03, 0x2E15, 0x2E26, 0x2E37, 0x2E49,
0x2E5A, 0x2E6B, 0x2E7D, 0x2E8E, 0x2E9F, 0x2EB0, 0x2EC2, 0x2ED3,
0x2EE4, 0x2EF5, 0x2F06, 0x2F17, 0x2F28, 0x2F39, 0x2F4A, 0x2F5B,
0x2F6C, 0x2F7D, 0x2F8D, 0x2F9E, 0x2FAF, 0x2FC0, 0x2FD0, 0x2FE1,
0x2FF2, 0x3002, 0x3013, 0x3024, 0x3034, 0x3045, 0x3055, 0x3066,
0x3076, 0x3087, 0x3097, 0x30A7, 0x30B8, 0x30C8, 0x30D8, 0x30E8,
0x30F9, 0x3109, 0x3119, 0x3129, 0x3139, 0x3149, 0x3159, 0x3169,
0x3179, 0x3189, 0x3199, 0x31A9, 0x31B9, 0x31C8, 0x31D8, 0x31E8,
0x31F8, 0x3207, 0x3217, 0x3227, 0x3236, 0x3246, 0x3255, 0x3265,
0x3274, 0x3284, 0x3293, 0x32A3, 0x32B2, 0x32C1, 0x32D0, 0x32E0,
0x32EF, 0x32FE, 0x330D, 0x331D, 0x332C, 0x333B, 0x334A, 0x3359,
0x3368, 0x3377, 0x3386, 0x3395, 0x33A3, 0x33B2, 0x33C1, 0x33D0,
0x33DF, 0x33ED, 0x33FC, 0x340B, 0x3419, 0x3428, 0x3436, 0x3445,
0x3453, 0x3462, 0x3470, 0x347F, 0x348D, 0x349B, 0x34AA, 0x34B8,
0x34C6, 0x34D4, 0x34E2, 0x34F1, 0x34FF, 0x350D, 0x351B, 0x3529,
0x3537, 0x3545, 0x3553, 0x3561, 0x356E, 0x357C, 0x358A, 0x3598,
0x35A5, 0x35B3, 0x35C1, 0x35CE, 0x35DC, 0x35EA, 0x35F7, 0x3605,
0x3612, 0x3620, 0x362D, 0x363A, 0x3648, 0x3655, 0x3662, 0x366F,
0x367D, 0x368A, 0x3697, 0x36A4, 0x36B1, 0x36BE, 0x36CB, 0x36D8,
0x36E5, 0x36F2, 0x36FF, 0x370C, 0x3718, 0x3725, 0x3732, 0x373F,
0x374B, 0x3758, 0x3765, 0x3771, 0x377E, 0x378A, 0x3797, 0x37A3,
0x37B0, 0x37BC, 0x37C8, 0x37D5, 0x37E1, 0x37ED, 0x37F9, 0x3805,
0x3812, 0x381E, 0x382A, 0x3836, 0x3842, 0x384E, 0x385A, 0x3866,
0x3871, 0x387D, 0x3889, 0x3895, 0x38A1, 0x38AC, 0x38B8, 0x38C3,
0x38CF, 0x38DB, 0x38E6, 0x38F2, 0x38FD, 0x3909, 0x3914, 0x391F,
0x392B, 0x3936, 0x3941, 0x394C, 0x3958, 0x3963, 0x396E, 0x3979,
0x3984, 0x398F, 0x399A, 0x39A5, 0x39B0, 0x39BB, 0x39C5, 0x39D0,
0x39DB, 0x39E6, 0x39F0, 0x39FB, 0x3A06, 0x3A10, 0x3A1B, 0x3A25,
0x3A30, 0x3A3A, 0x3A45, 0x3A4F, 0x3A59, 0x3A64, 0x3A6E, 0x3A78,
0x3A82, 0x3A8D, 0x3A97, 0x3AA1, 0x3AAB, 0x3AB5, 0x3ABF, 0x3AC9,
0x3AD3, 0x3ADD, 0x3AE6, 0x3AF0, 0x3AFA, 0x3B04, 0x3B0E, 0x3B17,
0x3B21, 0x3B2A, 0x3B34, 0x3B3E, 0x3B47, 0x3B50, 0x3B5A, 0x3B63,
0x3B6D, 0x3B76, 0x3B7F, 0x3B88, 0x3B92, 0x3B9B, 0x3BA4, 0x3BAD,
0x3BB6, 0x3BBF, 0x3BC8, 0x3BD1, 0x3BDA, 0x3BE3, 0x3BEC, 0x3BF5,
0x3BFD, 0x3C06, 0x3C0F, 0x3C17, 0x3C20, 0x3C29, 0x3C31, 0x3C3A,
0x3C42, 0x3C4B, 0x3C53, 0x3C5B, 0x3C64, 0x3C6C, 0x3C74, 0x3C7D,
0x3C85, 0x3C8D, 0x3C95, 0x3C9D, 0x3CA5, 0x3CAD, 0x3CB5, 0x3CBD,
0x3CC5, 0x3CCD, 0x3CD5, 0x3CDD, 0x3CE4, 0x3CEC, 0x3CF4, 0x3CFB,
0x3D03, 0x3D0B, 0x3D12, 0x3D1A, 0x3D21, 0x3D28, 0x3D30, 0x3D37,
0x3D3F, 0x3D46, 0x3D4D, 0x3D54, 0x3D5B, 0x3D63, 0x3D6A, 0x3D71,
0x3D78, 0x3D7F, 0x3D86, 0x3D8D, 0x3D93, 0x3D9A, 0x3DA1, 0x3DA8,
0x3DAF, 0x3DB5, 0x3DBC, 0x3DC2, 0x3DC9, 0x3DD0, 0x3DD6, 0x3DDD,
0x3DE3, 0x3DE9, 0x3DF0, 0x3DF6, 0x3DFC, 0x3E03, 0x3E09, 0x3E0F,
0x3E15, 0x3E1B, 0x3E21, 0x3E27, 0x3E2D, 0x3E33, 0x3E39, 0x3E3F,
0x3E45, 0x3E4A, 0x3E50, 0x3E56, 0x3E5C, 0x3E61, 0x3E67, 0x3E6C,
0x3E72, 0x3E77, 0x3E7D, 0x3E82, 0x3E88, 0x3E8D, 0x3E92, 0x3E98,
0x3E9D, 0x3EA2, 0x3EA7, 0x3EAC, 0x3EB1, 0x3EB6, 0x3EBB, 0x3EC0,
0x3EC5, 0x3ECA, 0x3ECF, 0x3ED4, 0x3ED8, 0x3EDD, 0x3EE2, 0x3EE7,
0x3EEB, 0x3EF0, 0x3EF4, 0x3EF9, 0x3EFD, 0x3F02, 0x3F06, 0x3F0A,
0x3F0F, 0x3F13, 0x3F17, 0x3F1C, 0x3F20, 0x3F24, 0x3F28, 0x3F2C,
0x3F30, 0x3F34, 0x3F38, 0x3F3C, 0x3F40, 0x3F43, 0x3F47, 0x3F4B,
0x3F4F, 0x3F52, 0x3F56, 0x3F5A, 0x3F5D, 0x3F61, 0x3F64, 0x3F68,
0x3F6B, 0x3F6E, 0x3F72, 0x3F75, 0x3F78, 0x3F7B, 0x3F7F, 0x3F82,
0x3F85, 0x3F88, 0x3F8B, 0x3F8E, 0x3F91, 0x3F94, 0x3F97, 0x3F99,
0x3F9C, 0x3F9F, 0x3FA2, 0x3FA4, 0x3FA7, 0x3FAA, 0x3FAC, 0x3FAF,
0x3FB1, 0x3FB4, 0x3FB6, 0x3FB8, 0x3FBB, 0x3FBD, 0x3FBF, 0x3FC1,
0x3FC4, 0x3FC6, 0x3FC8, 0x3FCA, 0x3FCC, 0x3FCE, 0x3FD0, 0x3FD2,
0x3FD4, 0x3FD5, 0x3FD7, 0x3FD9, 0x3FDB, 0x3FDC, 0x3FDE, 0x3FE0,
0x3FE1, 0x3FE3, 0x3FE4, 0x3FE6, 0x3FE7, 0x3FE8, 0x3FEA, 0x3FEB,
0x3FEC, 0x3FED, 0x3FEF, 0x3FF0, 0x3FF1, 0x3FF2, 0x3FF3, 0x3FF4,
0x3FF5, 0x3FF6, 0x3FF7, 0x3FF7, 0x3FF8, 0x3FF9, 0x3FFA, 0x3FFA,
0x3FFB, 0x3FFC, 0x3FFC, 0x3FFD, 0x3FFD, 0x3FFE, 0x3FFE, 0x3FFE,
0x3FFF, 0x3FFF, 0x3FFF, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000,
0x4000, 0x4000,
};
int __fastcall phd_atan(int x, int y) {
int result;
int swapBuf;
int flags = 0;
if( x == 0 && y == 0 )
return 0;
if( x < 0 ) {
flags |= 4;
x = -x;
}
if( y < 0 ) {
flags |= 2;
y = -y;
}
if( y > x ) {
flags |= 1;
SWAP(x, y, swapBuf);
}
result = AtanBaseTable[flags] + AtanAngleTable[0x800*y/x];
if ( result < 0 )
result = -result;
return result;
}
int __fastcall phd_cos(__int16 angle) {
return phd_sin(angle + PHD_90);
}
int __fastcall phd_sin(__int16 angle) {
UINT16 sector = (UINT16)angle & (PHD_180-1); // sector range will be: 0..0x7FFF (0..179.99 degrees)
if( sector > PHD_90 )
sector = PHD_180 - sector; // sector range will be: 0x0000..0x4000 (0..90 degrees)
int result = PhdSinTable[sector/16];
if( (UINT16)angle >= PHD_180 )
result = -result;
return result;
}
DWORD __fastcall phd_sqrt(DWORD n) {
DWORD result = 0;
DWORD base = 0x40000000;
DWORD basedResult;
for( ; base != 0; base >>= 2 ) {
for( ; base != 0; base >>= 2 ) {
basedResult = base + result;
result >>= 1;
if( basedResult > n ) {
break;
}
n -= basedResult;
result |= base;
}
}
return result;
}
/*
* Inject function
*/
void Inject_PhdMath() {
INJECT(0x00457EA0, phd_atan);
INJECT(0x00457EE8, phd_cos);
INJECT(0x00457EEE, phd_sin);
INJECT(0x00457F23, phd_sqrt);
}
================================================
FILE: 3dsystem/phd_math.h
================================================
/*
* Copyright (c) 2017-2018 Michael Chaban. All rights reserved.
* Original game is created by Core Design Ltd. in 1997.
* Lara Croft and Tomb Raider are trademarks of Embracer Group AB.
*
* This file is part of TR2Main.
*
* TR2Main is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TR2Main is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TR2Main. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PHD_MATH_H_INCLUDED
#define PHD_MATH_H_INCLUDED
#include "global/types.h"
/*
* Function list
*/
int __fastcall phd_atan(int x, int y); // 0x00457EA0
int __fastcall phd_cos(__int16 angle); // 0x00457EE8
int __fastcall phd_sin(__int16 angle); // 0x00457EEE
DWORD __fastcall phd_sqrt(DWORD n); // 0x00457F23
#endif // PHD_MATH_H_INCLUDED
================================================
FILE: 3dsystem/scalespr.cpp
================================================
/*
* Copyright (c) 2017-2020 Michael Chaban. All rights reserved.
* Original game is created by Core Design Ltd. in 1997.
* Lara Croft and Tomb Raider are trademarks of Embracer Group AB.
*
* This file is part of TR2Main.
*
* TR2Main is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TR2Main is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TR2Main. If not, see <http://www.gnu.org/licenses/>.
*/
#include "global/precompiled.h"
#include "3dsystem/scalespr.h"
#include "specific/output.h"
#include "global/vars.h"
#ifdef FEATURE_VIEW_IMPROVED
extern int CalculateFogShade(int depth);
#endif // FEATURE_VIEW_IMPROVED
#ifdef FEATURE_VIDEOFX_IMPROVED
DWORD PickupItemMode = 1;
#endif // FEATURE_VIDEOFX_IMPROVED
void __cdecl S_DrawSprite(DWORD flags, int x, int y, int z, __int16 spriteIdx, __int16 shade, __int16 scale) {
int xv, yv, zv, zp, depth;
int x1, y1, x2, y2;
if( CHK_ANY(flags, SPR_ABS) ) { // absolute coords
x -= MatrixW2V._03;
y -= MatrixW2V._13;
z -= MatrixW2V._23;
if( x < -PhdViewDistance || x > PhdViewDistance )
return;
if( y < -PhdViewDistance || y > PhdViewDistance)
return;
if( z < -PhdViewDistance || z > PhdViewDistance)
return;
zv = MatrixW2V._20 * x + MatrixW2V._21 * y + MatrixW2V._22 * z;
if( zv < PhdNearZ || zv >= PhdFarZ )
return;
yv = MatrixW2V._10 * x + MatrixW2V._11 * y + MatrixW2V._12 * z;
xv = MatrixW2V._00 * x + MatrixW2V._01 * y + MatrixW2V._02 * z;
} else if( (x|y|z) == 0 ) { // zero point coords
zv = PhdMatrixPtr->_23;
if( zv < PhdNearZ || zv > PhdFarZ )
return;
yv = PhdMatrixPtr->_13;
xv = PhdMatrixPtr->_03;
} else { // relative coords
zv = PhdMatrixPtr->_20 * x + PhdMatrixPtr->_21 * y + PhdMatrixPtr->_22 * z + PhdMatrixPtr->_23;
if( zv < PhdNearZ || zv > PhdFarZ )
return;
yv = PhdMatrixPtr->_10 * x + PhdMatrixPtr->_11 * y + PhdMatrixPtr->_12 * z + PhdMatrixPtr->_13;
xv = PhdMatrixPtr->_00 * x + PhdMatrixPtr->_01 * y + PhdMatrixPtr->_02 * z + PhdMatrixPtr->_03;
}
x1 = PhdSpriteInfo[spriteIdx].x1;
y1 = PhdSpriteInfo[spriteIdx].y1;
x2 = PhdSpriteInfo[spriteIdx].x2;
y2 = PhdSpriteInfo[spriteIdx].y2;
#ifdef FEATURE_VIDEOFX_IMPROVED
if( PickupItemMode == 1 && CHK_ALL(flags, SPR_ITEM|SPR_ABS) ) {
if( y1 < y2 ) {
y1 -= y2;
y2 = 0;
} else {
y2 -= y1;
y1 = 0;
}
}
#endif // FEATURE_VIDEOFX_IMPROVED
if( CHK_ANY(flags, SPR_SCALE) ) { // scaling required
x1 = (x1 * scale) << (W2V_SHIFT - 8);
y1 = (y1 * scale) << (W2V_SHIFT - 8);
x2 = (x2 * scale) << (W2V_SHIFT - 8);
y2 = (y2 * scale) << (W2V_SHIFT - 8);
} else { // default scale
x1 <<= W2V_SHIFT;
y1 <<= W2V_SHIFT;
x2 <<= W2V_SHIFT;
y2 <<= W2V_SHIFT;
}
zp = zv / PhdPersp;
x1 = (x1 + xv) / zp + PhdWinCenterX;
if( x1 >= PhdWinWidth )
return;
y1 = (y1 + yv) / zp + PhdWinCenterY;
if( y1 >= PhdWinHeight )
return;
x2 = (x2 + xv) / zp + PhdWinCenterX;
if( x2 < 0 )
return;
y2 = (y2 + yv) / zp + PhdWinCenterY;
if( y2 < 0 )
return;
if( CHK_ANY(flags, SPR_SHADE) ) { // shading required
depth = zv >> W2V_SHIFT;
#ifdef FEATURE_VIEW_IMPROVED
if( depth > PhdViewDistance )
return;
shade += CalculateFogShade(depth);
CLAMP(shade, 0, 0x1FFF);
#else // !FEATURE_VIEW_IMPROVED
if( depth > DEPTHQ_START ) {
shade += depth - DEPTHQ_START;
if( shade > 0x1FFF ) {
return;
}
}
#endif // FEATURE_VIEW_IMPROVED
} else {
shade = 0x1000;
}
#ifdef FEATURE_VIDEOFX_IMPROVED
if( CHK_ANY(flags, SPR_TINT) && !CHK_ANY(flags, SPR_SHADE) ) {
// NOTE: PS1 tint color brightness must be multiplied by 2 in this case
shade = (shade > 0x1000) ? (shade-0x1000)*2 : 0;
}
ins_sprite(zv, x1, y1, x2, y2, spriteIdx, shade, flags);
#else // FEATURE_VIDEOFX_IMPROVED
ins_sprite(zv, x1, y1, x2, y2, spriteIdx, shade);
#endif // FEATURE_VIDEOFX_IMPROVED
}
void __cdecl S_DrawPickup(int sx, int sy, int scale, __int16 spriteIdx, __int16 shade) {
int x1, x2, y1, y2;
#ifdef FEATURE_HUD_IMPROVED
scale = GetRenderScale(scale);
#endif // FEATURE_HUD_IMPROVED
x1 = sx + (PhdSpriteInfo[spriteIdx].x1 * scale / PHD_ONE);
x2 = sx + (PhdSpriteInfo[spriteIdx].x2 * scale / PHD_ONE);
y1 = sy + (PhdSpriteInfo[spriteIdx].y1 * scale / PHD_ONE);
y2 = sy + (PhdSpriteInfo[spriteIdx].y2 * scale / PHD_ONE);
if( x2 >= 0 && y2 >= 0 && x1 < PhdWinWidth && y1 < PhdWinHeight ) {
#ifdef FEATURE_VIDEOFX_IMPROVED
ins_sprite(200, x1, y1, x2, y2, spriteIdx, shade, 0);
#else // FEATURE_VIDEOFX_IMPROVED
ins_sprite(200, x1, y1, x2, y2, spriteIdx, shade);
#endif // FEATURE_VIDEOFX_IMPROVED
}
}
__int16 *__cdecl ins_room_sprite(__int16 *ptrObj, int vtxCount) {
PHD_VBUF *vbuf;
PHD_SPRITE *sprite;
double zp;
int x1, y1, x2, y2;
for( int i = 0; i < vtxCount; ++i ) {
vbuf = &PhdVBuf[*ptrObj];
if( (vbuf->clip & 0x80) == 0 ) {
sprite = &PhdSpriteInfo[ptrObj[1]];
zp = (double)vbuf->zv / (double)PhdPersp;
x1 = (int)((vbuf->xv + (double)((int)sprite->x1 << W2V_SHIFT)) / zp) + PhdWinCenterX;
y1 = (int)((vbuf->yv + (double)((int)sprite->y1 << W2V_SHIFT)) / zp) + PhdWinCenterY;
x2 = (int)((vbuf->xv + (double)((int)sprite->x2 << W2V_SHIFT)) / zp) + PhdWinCenterX;
y2 = (int)((vbuf->yv + (double)((int)sprite->y2 << W2V_SHIFT)) / zp) + PhdWinCenterY;
if( x2 >= PhdWinLeft && y2 >= PhdWinTop && x1 < PhdWinRight && y1 < PhdWinBottom ) {
#ifdef FEATURE_VIDEOFX_IMPROVED
ins_sprite((int)vbuf->zv, x1, y1, x2, y2, ptrObj[1], vbuf->g, 0);
#else // FEATURE_VIDEOFX_IMPROVED
ins_sprite((int)vbuf->zv, x1, y1, x2, y2, ptrObj[1], vbuf->g);
#endif // FEATURE_VIDEOFX_IMPROVED
}
}
ptrObj += 2;
}
return ptrObj;
}
void __cdecl S_DrawScreenSprite2d(int sx, int sy, int sz, int scaleH, int scaleV, __int16 spriteIdx, __int16 shade, UINT16 flags) {
int x1, y1, x2, y2, z;
PHD_SPRITE *sprite = &PhdSpriteInfo[spriteIdx];
x1 = sx + sprite->x1 * scaleH / PHD_ONE;
y1 = sy + sprite->y1 * scaleV / PHD_ONE;
x2 = sx + sprite->x2 * scaleH / PHD_ONE;
y2 = sy + sprite->y2 * scaleV / PHD_ONE;
z = PhdNearZ + sz * 8;
if( x2 >= 0 && y2 >= 0 && x1 < PhdWinWidth && y1 < PhdWinHeight ) {
#ifdef FEATURE_VIDEOFX_IMPROVED
ins_sprite(z, x1, y1, x2, y2, spriteIdx, shade, 0);
#else // FEATURE_VIDEOFX_IMPROVED
ins_sprite(z, x1, y1, x2, y2, spriteIdx, shade);
#endif // FEATURE_VIDEOFX_IMPROVED
}
}
void __cdecl S_DrawScreenSprite(int sx, int sy, int sz, int scaleH, int scaleV, __int16 spriteIdx, __int16 shade, UINT16 flags) {
int x1, y1, x2, y2, z;
PHD_SPRITE *sprite = &PhdSpriteInfo[spriteIdx];
x1 = sx + (sprite->x1 / 8) * scaleH / PHD_ONE;
y1 = sy + (sprite->y1 / 8) * scaleV / PHD_ONE;
x2 = sx + (sprite->x2 / 8) * scaleH / PHD_ONE;
y2 = sy + (sprite->y2 / 8) * scaleV / PHD_ONE;
z = sz * 8;
if( x2 >= 0 && y2 >= 0 && x1 < PhdWinWidth && y1 < PhdWinHeight ) {
#ifdef FEATURE_VIDEOFX_IMPROVED
ins_sprite(z, x1, y1, x2, y2, spriteIdx, shade, 0);
#else // FEATURE_VIDEOFX_IMPROVED
ins_sprite(z, x1, y1, x2, y2, spriteIdx, shade);
#endif // FEATURE_VIDEOFX_IMPROVED
}
}
void __cdecl draw_scaled_spriteC(__int16 *ptrObj) {
#ifdef FEATURE_NOLEGACY_OPTIONS
extern int GetPitchSWR();
int pitch = GetPitchSWR();
#else // FEATURE_NOLEGACY_OPTIONS
int pitch = PhdScreenWidth; // NOTE: this is the original game bug!
#endif // FEATURE_NOLEGACY_OPTIONS
int i, j;
int x1, y1, x2, y2, width, height;
int u, uBase, vBase, uAdd, vAdd;
__int16 sprIdx, shade;
BYTE *srcBase, *src, *dst;
BYTE pix;
int dstAdd;
bool isDepthQ;
PHD_SPRITE *sprite;
DEPTHQ_ENTRY *depthQ;
x1 = ptrObj[0];
y1 = ptrObj[1];
x2 = ptrObj[2];
y2 = ptrObj[3];
sprIdx = ptrObj[4];
shade = ptrObj[5];
if( x1 >= x2 || y1 >= y2 || x2 <= 0 || y2 <= 0 || x1 >= PhdWinMaxX || y1 >= PhdWinMaxY )
return;
sprite = &PhdSpriteInfo[sprIdx];
depthQ = &DepthQTable[shade >> 8];
uBase = vBase = 0x4000;
uAdd = (sprite->width - 64) * 256 / (x2 - x1);
vAdd = (sprite->height - 64) * 256 / (y2 - y1);
if( x1 < 0 ) {
uBase -= uAdd * x1;
x1 = 0;
}
if( y1 < 0 ) {
vBase -= vAdd * y1;
y1 = 0;
}
CLAMPG(x2, PhdWinMaxX + 1);
CLAMPG(y2, PhdWinMaxY + 1);
width = x2 - x1;
height = y2 - y1;
srcBase = (BYTE *)TexturePageBuffer8[sprite->texPage] + sprite->offset;
dst = PrintSurfacePtr + (PhdWinMinY + y1) * pitch + (PhdWinMinX + x1);
dstAdd = pitch - width;
#if (DIRECT3D_VERSION >= 0x900)
isDepthQ = (depthQ != &DepthQTable[15]);
#else // (DIRECT3D_VERSION >= 0x900)
isDepthQ = (GameVid_IsWindowedVga || depthQ != &DepthQTable[15]); // NOTE: index was 16 in the original code, this was wrong
#endif // (DIRECT3D_VERSION >= 0x900)
for( i = 0; i < height; ++i ) {
u = uBase;
src = srcBase + (vBase >> 16) * 256;
for( j = 0; j < width; ++j ) {
pix = src[u >> 16];
if( pix != 0 ) {
*dst = ( isDepthQ ) ? depthQ->index[pix] : pix;
}
u += uAdd;
++dst;
}
dst += dstAdd;
vBase += vAdd;
}
}
/*
* Inject function
*/
void Inject_ScaleSpr() {
INJECT(0x0040C030, S_DrawSprite);
INJECT(0x0040C300, S_DrawPickup);
INJECT(0x0040C390, ins_room_sprite);
INJECT(0x0040C4F0, S_DrawScreenSprite2d);
INJECT(0x0040C590, S_DrawScreenSprite);
INJECT(0x0040C630, draw_scaled_spriteC);
}
================================================
FILE: 3dsystem/scalespr.h
================================================
/*
* Copyright (c) 2017-2018 Michael Chaban. All rights reserved.
* Original game is created by Core Design Ltd. in 1997.
* Lara Croft and Tomb Raider are trademarks of Embracer Group AB.
*
* This file is part of TR2Main.
*
* TR2Main is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TR2Main is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TR2Main. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SCALESPR_H_INCLUDED
#define SCALESPR_H_INCLUDED
#include "global/types.h"
/*
* Function list
*/
void __cdecl S_DrawSprite(DWORD flags, int x, int y, int z, __int16 spriteIdx, __int16 shade, __int16 scale); // 0x0040C030
void __cdecl S_DrawPickup(int sx, int sy, int scale, __int16 spriteIdx, __int16 shade); // 0x0040C300
__int16 *__cdecl ins_room_sprite(__int16 *ptrObj, int vtxCount); // 0x0040C390
void __cdecl S_DrawScreenSprite2d(int sx, int sy, int sz, int scaleH, int scaleV, __int16 spriteIdx, __int16 shade, UINT16 flags); // 0x0040C4F0
void __cdecl S_DrawScreenSprite(int sx, int sy, int sz, int scaleH, int scaleV, __int16 spriteIdx, __int16 shade, UINT16 flags); // 0x0040C590
void __cdecl draw_scaled_spriteC(__int16 *ptrObj); // 0x0040C630
#endif // SCALESPR_H_INCLUDED
================================================
FILE: CHANGELOG.md
================================================
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [0.9.0] - 2023-06-05
### New features
- The Golden Mask game is included into a release pack, since it's freeware. The original game level files must be officially obtained via Steam/GOG/CD/whatever.
- Added DirectX 9 support. However, TR2Main can be compiled for DirectX 5 too.
- Into TR2Main.dll added information about the current version. Now it will be easier to find out which DLL is which version.
- The number of secrets in the script is taken into account when calculating the total number of secrets in the final statistics. Now it is calculated correctly, regardless of the total number of levels, bonus levels, and even mod levels.
- Additional checks have been implemented to prevent Lara from getting weapons that are not supported by current level. Thus, a number of problems associated with the "Nightmare in Vegas" level are fixed.
- Now *"New Game+"* is activated after the completion of the latest level in the script, and not any in which the final statistics appear. This allows you to activate this mode after the "Nightmare in Vegas" level, and not before.
- Now you can start the game in Gold mode, specifying the option *"-gold"* on the command line or shortcut properties (in the same way as the *"-setup"* option).
- For the Gold mode, Spider and Big Spider AI replaced by Wolf and Bear AI. Also Monk Spirits have no shadow.
- For the Gold mode, the credits slideshow starts from *CREDIT00.PCX*. For the original game mode, it starts from *CREDIT01.PCX*.
- For the Gold mode, the selection of any levels (including bonus levels) is activated after collecting all the secrets (available before the final statistics). The ability to select levels remains even after relaunching the game.
- For the Gold mode, pictures with "g" filename suffix (TITLEg.PCX, LEGALg.PCX, etc.) have higher priority than pictures without "g" filename suffix (TITLE.PCX, LEGAL.PCX, etc.)
- For the Gold mode, instead of the files *"TOMBPC.DAT"* and *"MAIN.SFX"*, the files *"TOMBPCg.DAT"* and *"MAINg.SFX"* are used. However, for both Gold and the original game, *"MAIN.SFX"* is still used for the *"TITLE.TR2"* and *"ASSAULT.TR2"* levels.
- Added separate subfolders for saved games of Gold and the original game.
- Added PlayStation reflection visual effect.
- Z-Buffer is no longer required for PlayStation styled gradient health/air bars.
- Added basic/advanced alpha blending for PlayStation styled semitransparent effects.
- Added glow effect for gunfire/flare (alpha blending required).
- Most sprites, gunfire/flare effects, sunglasses lens, the dragon spheres of doom are made semitransparent (alpha blending required). This is how they look in the PlayStation version.
- Rolling wheel blades, wall mounted blades, swords of statues and flamethrower masks are made reflective. This is how they look in the PlayStation version.
- The armed snowmobile windshield is made reflective. This is not presented in the PlayStation version, but probably it was supposed to be. Anyway it looks cool!
- The original game fast snowmobile windshield is made semitransparent (alpha blending required). This is how it looks in the PlayStation version.
- The Golden Mask fast snowmobile windshield is made reflective. In the Golden Mask it has the same windshield model as the armed snowmobile.
- Boathouse Key and Library Key from Venice levels are made reflective. This is how they look in the PlayStation version.
- The water surfaces and the glass on the sink in Lara's bathroom are made semitransparent (alpha blending required). This is how they look in the PlayStation version.
- Chain-link fence texture from Venice levels and stained glass texture from "Wreck of the Maria Doria" level are made semitransparent (alpha blending required). This is how they look in the PlayStation version.
- The glass on the sink in the "Nightmare in Vegas" level is made semitransparent (alpha blending required).
- Added support for loading screens from the script.
- Added TR2Main.json configuration file for easy game modding in the future.
- Added support for loading screens from TR2Main.json configuration file.
- Added support for custom water color from TR2Main.json configuration file.
- Added support for barefoot steps SFX from TR2Main.json configuration file (BAREFOOT.SFX in the DATA folder required).
- Added support for Legal/Title pictures with both US/EU logo (just a simple option to toggle between logo versions).
- Remastered pictures (PNG/JPG/BMP) support can be disabled now. In this case the game will use only PCX pictures.
- Custom HUD scale can be set to any value in 0.5 - 2.0 (previously it was limited by 1.0 - 2.0).
- Added support for display resolutions higher than 2048x2048.
- Background picture code is redesigned to support resolutions higher than 2048x2048.
- The limitations of the game engine (textures, polygons) are expanded by 4 times for future TR2 mods.
- Added music mute settings for inventory/underwater.
- The music and cut scenes are paused when the game window is not active.
- Added options for level statistics background mode (hardware renderer required).
- Added full inventory cheat on *I* key (cheat flag in *"TOMBPC.DAT"* file required). It gives full health, all weapons, ammo, medipacks, flares and all keys.
- Added Dozy cheat on *O* key (cheat flag in *"TOMBPC.DAT"* file required). It gives fly mode and full health, use *Shift* key to disable it.
- Lara has golden skin while in Dozy mode (hardware renderer and reflection feature required).
- SFX number limit increased from 256 to 370.
- Added automatic cdaudio.dat fix for PaulD's CD Audio solution, if some track has wrong parameters (like in the Steam version).
- Added possibility to customize semitransparent/reflective polygons via TR2Main.json configuration file.
- Added the ability to side step hitting the *Left*/*Right* key while holding *Walk* key (optional feature).
- Added possibility to hold up/down keys to quickly scroll through game menus.
- Added a configurable number of saved game slots (16-24).
- Joystick support completely migrated from WinAPI to DirectInput. Added XInput controllers support. Added DualShock 4 / DualSense support.
- Joystick controls redesigned to use thumb sticks and D-Pad at the same time.
- Added vibration feedback support for XInput gamepads and DualShock 4 / DualSense.
- Added the light bar color feedback support for DualShock 4 / DualSense. The color changes depending from health and oxygen.
- Passport text box height is adjusted depending from HUD scale.
- Some legacy options are removed (Triple Buffer, Dither, Perspective Correction, Texel Adjustment, Disable 16 bit textures, Don't sort transparent polys).
- Screen resolution settings reworked, now the game automatically selects between True Color / High Color.
- Now the game correctly keeps proper resolutions when it switches between Windowed / Full Screen.
- Implemented embedded textures for Keyboard/Joystick button sprites. There are 3 styles for Joystick buttons: Numeric, XBox, PlayStation.
- Added arrows to PlayStation styled inventory text boxes.
- Sound/Music volumes presented as gradient bars if PlayStation styled inventory text boxes are enabled. Also there are PlayStation styled SFX for changing volume.
- Added PlayStation styled Joystick button hints for inventory (optional feature).
- Added Pause feature (P key). Two styles are available: transparent and 50% darkened.
- Controls text box completely redesigned. Now you can view both default and custom keyboard layouts on the same page. Joystick layout is now independent from the custom keyboard layout.
- Fade out to black implemented for levels, demos, cut scenes and statistics.
- Added an option to select Demo Mode text style: none, PC or PlayStation.
- Now the inventory stopwatch (statistics item) position depends from HUD scale and Field of View options. So it looks both PlayStation and PC authentic.
- The message is displayed when Bilinear Filter or Z-Buffer is toggled with F7/F8 hotkey (DirectX 9 only).
- Added high contrast lighting (PlayStation style) for Hardware Renderer (DirectX 9 only).
- Added low contrast lighting (Classic PC Hardware style) for Software Renderer.
- Added F11 hotkey to toggle low/high contrast lighting (in the original game F11 was used to toggle Dither).
- Sunset effect in Bartoli's Hideout now makes skybox a little darker.
- Added "Restart Level" option (available only in case of Lara's death).
- The inventory pattern (both static and animated) is seamless now for Bilinear Filter.
- Added external HD textures support (DirectX 9 only).
- Added iOS/Android texture pack full support (DirectX 9 only).
- Added ffmpeg based FMV player.
- Added loading screens by Lito Perezito for The Golden Mask.
### The original game bugfixes
- Fixed a bug that prevented the display of the save counter until the game relaunch, if the game was saved in an empty slot.
- Fixed a bug that allowed the player to interfere with the control of the demo level.
- Demo levels are excluded from the *"New Game"* menu, if the *"Select Level"* option is active.
- Fixed the statistics reset in case of *"New Game+"*, if the *"Select Level"* option is active.
- Fixed a bug that does not happen in the official levels (this situation is not in the script). Suppose a shotgun and shotgun ammo are set as a bonus for collecting all the secrets in the level. If Lara does not have a shotgun at the moment of picking the last secret, she receives the relying bonus, but the ammo items are not displayed on the screen. This is fixed now.
- Fixed a bug that does not happen in the official levels (this situation is not in the script). Suppose a magnum and magnum ammo are set as a bonus for collecting all the secrets in the level. If Lara does not have a magnum at the moment of picking the last secret, she receives the magnum only, but not the magnum ammo. This is fixed now.
- Fixed a bug that hid the ammo indicator in demo levels if *"New Game+"* is activated.
- Fixed a bug that produced black triangles originating from the top left of the screen on some laptop graphic adapters.
- Fixed a bug that produced traces of previous textures in untextured areas.
- If "Disable 16 bit textures" option is unsupported, it's disabled automatically instead of breaking the textures.
- Fixed a bug that changed the music volume incorrectly when leaving inventory while the camera is underwater.
- Fixed a rare game crash occurring when you explode an enemy with a grenade launcher.
- Fixed incorrect sorting of 3D polygons if Z-Buffer is turned off or the software renderer is used.
- Fixed a bug due to which the skybox was not drawn in some rooms.
- Fixed a bug where pickup sprites were cropped by the floor if Z-Buffer is enabled. Some pickup items are slightly raised (optional fix).
- Fixed a bug due to which the last pressed key was accidentally assigned when redefining keys.
- "Run Control Panel" button in the setup dialog now opens the current DirectInput joystick configuration from Control Panel instead of Control Panel itself.
- Fixed a bug that caused the harpoon gun to reload every single shot in *"New Game+"* after a weapon cheat was used.
- Fixed a bug due to which none of the joystick buttons allowed returning to the previous menu. Now the button assigned to "Draw weapon" is used for this.
- Fixed a bug due to which the accuracy of the M16 did not decrease while running (optional fix).
- Fixed a wrong inventory text position if the game window size is changed.
- Fixed a flashing "Demo Mode" text while demo is playing.
- The *low ceiling jump* bugfix is optional now.
- Fixed a bug due to which non-textured surfaces could appear brighter than textured ones with the same lighting settings.
- Fixed a bug that reset timer of sunset effect in Bartoli's Hideout after saved game is loaded.
### TR2Main bugfixes
- Background capture is optimized even more, now it is 3-4 times faster than v0.8.2. No lags anymore (broken since v0.8.0).
- Fixed game crash in Software Rendered mode with PlayStation styled inventory text box enabled (broken since v0.8.0).
- Fixed a rare game crash occurring when launching the game (broken since v0.1.0).
- Fixed sunset effect in Bartoli's Hideout level (broken since v0.1
gitextract_vwbsridj/
├── .gitignore
├── 3dsystem/
│ ├── 3d_gen.cpp
│ ├── 3d_gen.h
│ ├── 3d_out.cpp
│ ├── 3d_out.h
│ ├── 3dinsert.cpp
│ ├── 3dinsert.h
│ ├── phd_math.cpp
│ ├── phd_math.h
│ ├── scalespr.cpp
│ └── scalespr.h
├── CHANGELOG.md
├── COPYING.md
├── Doxyfile
├── README.md
├── TR2Main.cbp
├── TR2Main.cpp
├── TR2Main.rc
├── TR2_progress.txt
├── binaries/
│ ├── BAREFOOT.SFX
│ └── README.md
├── configs/
│ ├── TR2Main.json
│ └── textures/
│ └── texpages/
│ ├── README.md
│ └── config.json
├── embedded/
│ ├── BUTTONS.JSON
│ └── BUTTONS.PCX
├── game/
│ ├── bear.cpp
│ ├── bear.h
│ ├── bird.cpp
│ ├── bird.h
│ ├── boat.cpp
│ ├── boat.h
│ ├── box.cpp
│ ├── box.h
│ ├── camera.cpp
│ ├── camera.h
│ ├── cinema.cpp
│ ├── cinema.h
│ ├── collide.cpp
│ ├── collide.h
│ ├── control.cpp
│ ├── control.h
│ ├── demo.cpp
│ ├── demo.h
│ ├── diver.cpp
│ ├── diver.h
│ ├── dog.cpp
│ ├── dog.h
│ ├── dragon.cpp
│ ├── dragon.h
│ ├── draw.cpp
│ ├── draw.h
│ ├── eel.cpp
│ ├── eel.h
│ ├── effects.cpp
│ ├── effects.h
│ ├── enemies.cpp
│ ├── enemies.h
│ ├── gameflow.cpp
│ ├── gameflow.h
│ ├── hair.cpp
│ ├── hair.h
│ ├── health.cpp
│ ├── health.h
│ ├── inventory.cpp
│ ├── inventory.h
│ ├── invfunc.cpp
│ ├── invfunc.h
│ ├── invtext.cpp
│ ├── invtext.h
│ ├── items.cpp
│ ├── items.h
│ ├── lara.cpp
│ ├── lara.h
│ ├── lara1gun.cpp
│ ├── lara1gun.h
│ ├── lara2gun.cpp
│ ├── lara2gun.h
│ ├── laraclimb.cpp
│ ├── laraclimb.h
│ ├── larafire.cpp
│ ├── larafire.h
│ ├── laraflare.cpp
│ ├── laraflare.h
│ ├── laramisc.cpp
│ ├── laramisc.h
│ ├── larasurf.cpp
│ ├── larasurf.h
│ ├── laraswim.cpp
│ ├── laraswim.h
│ ├── lot.cpp
│ ├── lot.h
│ ├── missile.cpp
│ ├── missile.h
│ ├── moveblock.cpp
│ ├── moveblock.h
│ ├── objects.cpp
│ ├── objects.h
│ ├── people.cpp
│ ├── people.h
│ ├── pickup.cpp
│ ├── pickup.h
│ ├── rat.cpp
│ ├── rat.h
│ ├── savegame.cpp
│ ├── savegame.h
│ ├── setup.cpp
│ ├── setup.h
│ ├── shark.cpp
│ ├── shark.h
│ ├── skidoo.cpp
│ ├── skidoo.h
│ ├── sound.cpp
│ ├── sound.h
│ ├── sphere.cpp
│ ├── sphere.h
│ ├── spider.cpp
│ ├── spider.h
│ ├── text.cpp
│ ├── text.h
│ ├── traps.cpp
│ ├── traps.h
│ ├── wolf.cpp
│ ├── wolf.h
│ ├── yeti.cpp
│ └── yeti.h
├── global/
│ ├── md5.c
│ ├── md5.h
│ ├── memmem.c
│ ├── memmem.h
│ ├── precompiled.h
│ ├── resource.h
│ ├── types.h
│ └── vars.h
├── json-parser/
│ ├── LICENSE
│ ├── README.md
│ ├── json.c
│ └── json.h
├── modding/
│ ├── background_new.cpp
│ ├── background_new.h
│ ├── cd_pauld.cpp
│ ├── cd_pauld.h
│ ├── file_utils.cpp
│ ├── file_utils.h
│ ├── gdi_utils.cpp
│ ├── gdi_utils.h
│ ├── joy_output.cpp
│ ├── joy_output.h
│ ├── json_utils.cpp
│ ├── json_utils.h
│ ├── mod_utils.cpp
│ ├── mod_utils.h
│ ├── pause.cpp
│ ├── pause.h
│ ├── psx_bar.cpp
│ ├── psx_bar.h
│ ├── raw_input.cpp
│ ├── raw_input.h
│ ├── texture_utils.cpp
│ ├── texture_utils.h
│ ├── xinput_ex.cpp
│ └── xinput_ex.h
└── specific/
├── background.cpp
├── background.h
├── display.cpp
├── display.h
├── file.cpp
├── file.h
├── fmv.cpp
├── fmv.h
├── frontend.cpp
├── frontend.h
├── game.cpp
├── game.h
├── hwr.cpp
├── hwr.h
├── init.cpp
├── init.h
├── init_3d.cpp
├── init_3d.h
├── init_display.cpp
├── init_display.h
├── init_input.cpp
├── init_input.h
├── init_sound.cpp
├── init_sound.h
├── input.cpp
├── input.h
├── option.cpp
├── option.h
├── output.cpp
├── output.h
├── registry.cpp
├── registry.h
├── screenshot.cpp
├── screenshot.h
├── setupdlg.cpp
├── setupdlg.h
├── setupwnd.cpp
├── setupwnd.h
├── smain.cpp
├── smain.h
├── sndpc.cpp
├── sndpc.h
├── texture.cpp
├── texture.h
├── utils.cpp
├── utils.h
├── winmain.cpp
├── winmain.h
├── winvid.cpp
└── winvid.h
SYMBOL INDEX (1174 symbols across 102 files)
FILE: 3dsystem/3d_gen.cpp
function CalculateFogShade (line 73) | int CalculateFogShade(int depth) {
function ClearMeshReflectState (line 101) | void ClearMeshReflectState() {
function SetMeshReflectState (line 107) | void SetMeshReflectState(int objID, int meshIdx) {
function InsertEnvmap (line 236) | static bool InsertEnvmap(__int16 *ptrObj, int vtxCount, bool colored, LP...
function phd_PutEnvmapPolygons (line 241) | static void phd_PutEnvmapPolygons(__int16 *ptrEnv) {
function phd_GenerateW2V (line 290) | void phd_GenerateW2V(PHD_3DPOS *viewPos) {
function phd_LookAt (line 317) | void __cdecl phd_LookAt(int xsrc, int ysrc, int zsrc, int xtar, int ytar...
function phd_GetVectorAngles (line 331) | void __cdecl phd_GetVectorAngles(int x, int y, int z, VECTOR_ANGLES *ang...
function phd_RotX (line 349) | void __cdecl phd_RotX(__int16 angle) {
function phd_RotY (line 370) | void __cdecl phd_RotY(__int16 angle) {
function phd_RotZ (line 391) | void __cdecl phd_RotZ(__int16 angle) {
function phd_RotYXZ (line 412) | void __cdecl phd_RotYXZ(__int16 ry, __int16 rx, __int16 rz) {
function phd_RotYXZpack (line 468) | void __cdecl phd_RotYXZpack(DWORD rpack) {
function BOOL (line 527) | BOOL __cdecl phd_TranslateRel(int x, int y, int z) {
function phd_TranslateAbs (line 541) | void __cdecl phd_TranslateAbs(int x, int y, int z) {
function phd_PutPolygons (line 551) | void __cdecl phd_PutPolygons(__int16 *ptrObj, int clip) {
function S_InsertRoom (line 576) | void __cdecl S_InsertRoom(__int16 *ptrObj, BOOL isOutside) {
function S_InsertBackground (line 614) | void __cdecl S_InsertBackground(__int16 *ptrObj) {
function S_InsertInvBgnd (line 647) | void __cdecl S_InsertInvBgnd(__int16 *ptrObj) {
function phd_RotateLight (line 866) | void __cdecl phd_RotateLight(__int16 pitch, __int16 yaw) {
function phd_InitPolyList (line 888) | void __cdecl phd_InitPolyList() {
function phd_SortPolyList (line 896) | void __cdecl phd_SortPolyList() {
function do_quickysorty (line 908) | void __cdecl do_quickysorty(int left, int right) {
function phd_PrintPolyList (line 934) | void __cdecl phd_PrintPolyList(BYTE *surfacePtr) {
function AlterFOV (line 945) | void __cdecl AlterFOV(__int16 fov) {
function phd_SetNearZ (line 969) | void __cdecl phd_SetNearZ(int nearZ) {
function phd_SetFarZ (line 982) | void __cdecl phd_SetFarZ(int farZ) {
function phd_InitWindow (line 994) | void __cdecl phd_InitWindow(__int16 x, __int16 y, int width, int height,...
function phd_PopMatrix (line 1076) | void __cdecl phd_PopMatrix() {
function phd_PushMatrix (line 1080) | void __cdecl phd_PushMatrix() {
function phd_PushUnitMatrix (line 1085) | void __cdecl phd_PushUnitMatrix() {
function Inject_3Dgen (line 1096) | void Inject_3Dgen() {
FILE: 3dsystem/3d_out.cpp
function GetPitchSWR (line 99) | int GetPitchSWR() {
function PrepareSWR (line 103) | void PrepareSWR(int pitch, int height) {
function draw_poly_line (line 118) | void __cdecl draw_poly_line(__int16 *bufPtr) {
function draw_poly_flat (line 218) | void __cdecl draw_poly_flat(__int16 *bufPtr) {
function draw_poly_trans (line 223) | void __cdecl draw_poly_trans(__int16 *bufPtr) {
function draw_poly_gouraud (line 228) | void __cdecl draw_poly_gouraud(__int16 *bufPtr) {
function draw_poly_gtmap (line 233) | void __cdecl draw_poly_gtmap(__int16 *bufPtr) {
function draw_poly_wgtmap (line 238) | void __cdecl draw_poly_wgtmap(__int16 *bufPtr) {
function BOOL (line 243) | BOOL __cdecl xgen_x(__int16 *bufPtr) {
function BOOL (line 301) | BOOL __cdecl xgen_xg(__int16 *bufPtr) {
function BOOL (line 371) | BOOL __cdecl xgen_xguv(__int16 *bufPtr) {
function BOOL (line 461) | BOOL __cdecl xgen_xguvpersp_fp(__int16 *bufPtr) {
function gtmap_persp32_fp (line 564) | void __cdecl gtmap_persp32_fp(int y0, int y1, BYTE *texPage) {
function wgtmap_persp32_fp (line 682) | void __cdecl wgtmap_persp32_fp(int y0, int y1, BYTE *texPage) {
function draw_poly_gtmap_persp (line 814) | void __cdecl draw_poly_gtmap_persp(__int16 *bufPtr) {
function draw_poly_wgtmap_persp (line 819) | void __cdecl draw_poly_wgtmap_persp(__int16 *bufPtr) {
function flatA (line 824) | void __fastcall flatA(int y0, int y1, BYTE colorIdx) {
function transA (line 845) | void __fastcall transA(int y0, int y1, BYTE depthQ) {
function gourA (line 873) | void __fastcall gourA(int y0, int y1, BYTE colorIdx) {
function gtmapA (line 905) | void __fastcall gtmapA(int y0, int y1, BYTE *texPage) {
function wgtmapA (line 943) | void __fastcall wgtmapA(int y0, int y1, BYTE *texPage) {
function Inject_3Dout (line 987) | void Inject_3Dout() {
FILE: 3dsystem/3dinsert.cpp
function D3DCOLOR (line 52) | static D3DCOLOR shadeColor(DWORD red, DWORD green, DWORD blue, DWORD alp...
function CalculatePolyZ (line 103) | static double CalculatePolyZ(SORTTYPE sortType, double z0, double z1, do...
function POLYTYPE (line 127) | static POLYTYPE GetPolyType(UINT16 drawtype) {
function InsertObjectEM (line 139) | bool InsertObjectEM(__int16 *ptrObj, int vtxCount, D3DCOLOR tint, PHD_UV...
function InsertGourQuad (line 167) | void __cdecl InsertGourQuad(int x0, int y0, int x1, int y1, int z, D3DCO...
function BOOL (line 207) | BOOL __cdecl visible_zclip(PHD_VBUF *vtx0, PHD_VBUF *vtx1, PHD_VBUF *vtx...
function ZedClipper (line 213) | int __cdecl ZedClipper(int vtxCount, POINT_INFO *pts, VERTEX_INFO *vtx) {
function clipGUV (line 255) | static inline void clipGUV(VERTEX_INFO *buf, VERTEX_INFO *vtx1, VERTEX_I...
function XYGUVClipper (line 262) | int __cdecl XYGUVClipper(int vtxCount, VERTEX_INFO *vtx) {
function clipG (line 791) | static inline void clipG(VERTEX_INFO *buf, VERTEX_INFO *vtx1, VERTEX_INF...
function XYGClipper (line 796) | int __cdecl XYGClipper(int vtxCount, VERTEX_INFO *vtx) {
function XYClipper (line 1109) | int __cdecl XYClipper(int vtxCount, VERTEX_INFO *vtx) {
function InsertTrans8 (line 1214) | void __cdecl InsertTrans8(PHD_VBUF *vbuf, __int16 shade) {
function InsertTransQuad (line 1279) | void __cdecl InsertTransQuad(int x, int y, int width, int height, int z) {
function InsertFlatRect (line 1305) | void __cdecl InsertFlatRect(int x0, int y0, int x1, int y1, int z, BYTE ...
function InsertLine (line 1325) | void __cdecl InsertLine(int x0, int y0, int x1, int y1, int z, BYTE colo...
function InsertGT3_ZBuffered (line 1340) | void __cdecl InsertGT3_ZBuffered(PHD_VBUF *vtx0, PHD_VBUF *vtx1, PHD_VBU...
function DrawClippedPoly_Textured (line 1462) | void __cdecl DrawClippedPoly_Textured(int vtxCount) {
function InsertGT4_ZBuffered (line 1489) | void __cdecl InsertGT4_ZBuffered(PHD_VBUF *vtx0, PHD_VBUF *vtx1, PHD_VBU...
function DrawPoly_Gouraud (line 1703) | void __cdecl DrawPoly_Gouraud(int vtxCount, int red, int green, int blue) {
function InsertFlatRect_ZBuffered (line 1820) | void __cdecl InsertFlatRect_ZBuffered(int x0, int y0, int x1, int y1, in...
function InsertLine_ZBuffered (line 1862) | void __cdecl InsertLine_ZBuffered(int x0, int y0, int x1, int y1, int z,...
function InsertGT3_Sorted (line 1893) | void __cdecl InsertGT3_Sorted(PHD_VBUF *vtx0, PHD_VBUF *vtx1, PHD_VBUF *...
function InsertClippedPoly_Textured (line 2024) | void __cdecl InsertClippedPoly_Textured(int vtxCount, float z, __int16 p...
function InsertGT4_Sorted (line 2056) | void __cdecl InsertGT4_Sorted(PHD_VBUF *vtx0, PHD_VBUF *vtx1, PHD_VBUF *...
function InsertPoly_Gouraud (line 2286) | void __cdecl InsertPoly_Gouraud(int vtxCount, float z, int red, int gree...
function InsertSprite_Sorted (line 2417) | void __cdecl InsertSprite_Sorted(int z, int x0, int y0, int x1, int y1, ...
function InsertFlatRect_Sorted (line 2516) | void __cdecl InsertFlatRect_Sorted(int x0, int y0, int x1, int y1, int z...
function InsertLine_Sorted (line 2564) | void __cdecl InsertLine_Sorted(int x0, int y0, int x1, int y1, int z, BY...
function InsertTrans8_Sorted (line 2596) | void __cdecl InsertTrans8_Sorted(PHD_VBUF *vbuf, __int16 shade) {
function InsertTransQuad_Sorted (line 2649) | void __cdecl InsertTransQuad_Sorted(int x, int y, int width, int height,...
function InsertSprite (line 2693) | void __cdecl InsertSprite(int z, int x0, int y0, int x1, int y1, int spr...
function Inject_3Dinsert (line 2713) | void Inject_3Dinsert() {
FILE: 3dsystem/phd_math.cpp
function phd_atan (line 432) | int __fastcall phd_atan(int x, int y) {
function phd_cos (line 462) | int __fastcall phd_cos(__int16 angle) {
function phd_sin (line 466) | int __fastcall phd_sin(__int16 angle) {
function DWORD (line 480) | DWORD __fastcall phd_sqrt(DWORD n) {
function Inject_PhdMath (line 505) | void Inject_PhdMath() {
FILE: 3dsystem/scalespr.cpp
function S_DrawSprite (line 35) | void __cdecl S_DrawSprite(DWORD flags, int x, int y, int z, __int16 spri...
function S_DrawPickup (line 150) | void __cdecl S_DrawPickup(int sx, int sy, int scale, __int16 spriteIdx, ...
function S_DrawScreenSprite2d (line 201) | void __cdecl S_DrawScreenSprite2d(int sx, int sy, int sz, int scaleH, in...
function S_DrawScreenSprite (line 220) | void __cdecl S_DrawScreenSprite(int sx, int sy, int sz, int scaleH, int ...
function draw_scaled_spriteC (line 239) | void __cdecl draw_scaled_spriteC(__int16 *ptrObj) {
function Inject_ScaleSpr (line 320) | void Inject_ScaleSpr() {
FILE: TR2Main.cpp
function Inject (line 132) | static void Inject() {
function DLL_EXPORT (line 216) | DLL_EXPORT int DummyFunction() {
function BOOL (line 229) | BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvRes...
FILE: game/bear.cpp
function BearControl (line 49) | void __cdecl BearControl(__int16 itemID) {
FILE: game/bird.cpp
function Inject_Bird (line 31) | void Inject_Bird() {
FILE: game/boat.cpp
function DoWakeEffect (line 32) | void __cdecl DoWakeEffect(ITEM_INFO *item) {
function GondolaControl (line 64) | void __cdecl GondolaControl(__int16 itemID) {
function Inject_Boat (line 94) | void Inject_Boat() {
FILE: game/box.cpp
function CreatureDie (line 30) | void __cdecl CreatureDie(__int16 itemID, BOOL explode) {
function CreatureKill (line 59) | void __cdecl CreatureKill(ITEM_INFO *item, int killAnim, int killState, ...
function Inject_Box (line 100) | void Inject_Box() {
FILE: game/camera.cpp
function InitialiseCamera (line 40) | void __cdecl InitialiseCamera() {
function MoveCamera (line 67) | void __cdecl MoveCamera(GAME_VECTOR *destination, int speed) {
function LookCamera (line 139) | void __cdecl LookCamera(ITEM_INFO *item) {
function FixedCamera (line 170) | void __cdecl FixedCamera() {
function CalculateCamera (line 187) | void __cdecl CalculateCamera() {
function Inject_Camera (line 319) | void Inject_Camera() {
FILE: game/cinema.cpp
function SetCutsceneTrack (line 37) | void __cdecl SetCutsceneTrack(int track) {
function StartCinematic (line 41) | int __cdecl StartCinematic(int levelID) {
function InitCinematicRooms (line 89) | void __cdecl InitCinematicRooms() {
function DoCinematic (line 104) | int __cdecl DoCinematic(int nTicks) {
function Inject_Cinema (line 154) | void Inject_Cinema() {
FILE: game/collide.cpp
function CollideStaticObjects (line 27) | int __cdecl CollideStaticObjects(COLL_INFO *coll, int x, int y, int z, _...
function GetNearByRooms (line 171) | void __cdecl GetNearByRooms(int x, int y, int z, int r, int h, __int16 r...
function GetNewRoom (line 184) | void __cdecl GetNewRoom(int x, int y, int z, __int16 roomID) {
function Inject_Collide (line 197) | void Inject_Collide() {
FILE: game/control.cpp
function ControlPhase (line 45) | int __cdecl ControlPhase(int nTicks, BOOL demoMode) {
function TriggerCDTrack (line 176) | void __cdecl TriggerCDTrack(__int16 value, UINT16 flags, __int16 type) {
function TriggerNormalCDTrack (line 182) | void __cdecl TriggerNormalCDTrack(__int16 value, UINT16 flags, __int16 t...
function Inject_Control (line 216) | void Inject_Control() {
FILE: game/demo.cpp
function StartDemo (line 37) | int __cdecl StartDemo(int levelID) {
function Inject_Demo (line 114) | void Inject_Demo() {
FILE: game/diver.cpp
function Inject_Diver (line 31) | void Inject_Diver() {
FILE: game/dog.cpp
function Inject_Dog (line 31) | void Inject_Dog() {
FILE: game/dragon.cpp
function Inject_Dragon (line 31) | void Inject_Dragon() {
FILE: game/draw.cpp
function ResetGoldenLaraAlpha (line 42) | void ResetGoldenLaraAlpha() {
function DrawRooms (line 47) | void __cdecl DrawRooms(__int16 currentRoom) {
function GetRoomBounds (line 160) | void __cdecl GetRoomBounds() {
function SetRoomBounds (line 205) | void __cdecl SetRoomBounds(__int16 *ptrObj, int roomNumber, ROOM_INFO *p...
function ClipRoom (line 306) | void __cdecl ClipRoom(ROOM_INFO *room) {
function PrintRooms (line 383) | void __cdecl PrintRooms(__int16 roomNumber) {
function PrintObjects (line 415) | void __cdecl PrintObjects(__int16 roomNumber) {
function DrawEffect (line 479) | void __cdecl DrawEffect(__int16 fx_id) {
function DrawSpriteItem (line 512) | void __cdecl DrawSpriteItem(ITEM_INFO *item) {
function DrawDummyItem (line 529) | void __cdecl DrawDummyItem(ITEM_INFO *item) {
function DrawAnimatingItem (line 532) | void __cdecl DrawAnimatingItem(ITEM_INFO *item) {
function DrawLaraInt (line 658) | void __cdecl DrawLaraInt(ITEM_INFO *item, __int16 *frame1, __int16 *fram...
function phd_RotYXZsuperpack (line 897) | void __cdecl phd_RotYXZsuperpack(UINT16 **pptr, int index) {
function phd_PutPolygons_I (line 925) | void __cdecl phd_PutPolygons_I(__int16 *ptrObj, int clip) {
function DrawGunFlash (line 932) | void __cdecl DrawGunFlash(int weapon, int clip) {
function AddDynamicLight (line 997) | void __cdecl AddDynamicLight(int x, int y, int z, int intensity, int fal...
function Inject_Draw (line 1009) | void Inject_Draw() {
FILE: game/eel.cpp
function Inject_Eel (line 31) | void Inject_Eel() {
FILE: game/effects.cpp
function ItemNearLara (line 39) | int __cdecl ItemNearLara(PHD_3DPOS *pos, int distance) {
function SoundEffects (line 54) | void __cdecl SoundEffects() {
function __int16 (line 66) | __int16 __cdecl DoBloodSplat(int x, int y, int z, __int16 speed, __int16...
function DoLotsOfBlood (line 85) | void __cdecl DoLotsOfBlood(int x, int y, int z, __int16 speed, __int16 d...
function ControlBlood1 (line 97) | void __cdecl ControlBlood1(__int16 fxID) {
function ControlExplosion1 (line 112) | void __cdecl ControlExplosion1(__int16 fxID) {
function Richochet (line 130) | void __cdecl Richochet(GAME_VECTOR *pos) {
function ControlRichochet1 (line 145) | void __cdecl ControlRichochet1(__int16 fxID) {
function CreateBubble (line 154) | void __cdecl CreateBubble(PHD_3DPOS *pos, __int16 roomNumber) {
function LaraBubbles (line 164) | void __cdecl LaraBubbles(ITEM_INFO *item) {
function ControlBubble1 (line 181) | void __cdecl ControlBubble1(__int16 fxID) {
function Splash (line 209) | void __cdecl Splash(ITEM_INFO *item) {
function WadeSplash (line 232) | void WadeSplash(ITEM_INFO *item, int height) {
function ControlSplash1 (line 236) | void __cdecl ControlSplash1(__int16 fxID) {
function ControlWaterSprite (line 249) | void __cdecl ControlWaterSprite(__int16 fxID) {
function ControlSnowSprite (line 271) | void __cdecl ControlSnowSprite(__int16 fxID) {
function ControlHotLiquid (line 288) | void __cdecl ControlHotLiquid(__int16 fxID) {
function WaterFall (line 315) | void __cdecl WaterFall(__int16 itemID) {
function finish_level_effect (line 341) | void __cdecl finish_level_effect(ITEM_INFO *item) {
function turn180_effect (line 345) | void __cdecl turn180_effect(ITEM_INFO *item) {
function floor_shake_effect (line 350) | void __cdecl floor_shake_effect(ITEM_INFO *item) {
function lara_normal_effect (line 360) | void __cdecl lara_normal_effect(ITEM_INFO *item) {
function BoilerFX (line 369) | void __cdecl BoilerFX(ITEM_INFO *item) {
function FloodFX (line 374) | void __cdecl FloodFX(ITEM_INFO *item) {
function RubbleFX (line 392) | void __cdecl RubbleFX(ITEM_INFO *item) {
function ChandelierFX (line 398) | void __cdecl ChandelierFX(ITEM_INFO *item) {
function ExplosionFX (line 405) | void __cdecl ExplosionFX(ITEM_INFO *item) {
function PistonFX (line 411) | void __cdecl PistonFX(ITEM_INFO *item) {
function CurtainFX (line 416) | void __cdecl CurtainFX(ITEM_INFO *item) {
function StatueFX (line 421) | void __cdecl StatueFX(ITEM_INFO *item) {
function SetChangeFX (line 426) | void __cdecl SetChangeFX(ITEM_INFO *item) {
function ControlDingDong (line 431) | void __cdecl ControlDingDong(__int16 itemID) {
function ControlLaraAlarm (line 441) | void __cdecl ControlLaraAlarm(__int16 itemID) {
function ControlAlarmSound (line 449) | void __cdecl ControlAlarmSound(__int16 itemID) {
function ControlBirdTweeter (line 466) | void __cdecl ControlBirdTweeter(__int16 itemID) {
function DoChimeSound (line 479) | void __cdecl DoChimeSound(ITEM_INFO *item) {
function ControlClockChimes (line 488) | void __cdecl ControlClockChimes(__int16 itemID) {
function SphereOfDoomCollision (line 506) | void __cdecl SphereOfDoomCollision(__int16 itemID, ITEM_INFO *laraItem, ...
function SphereOfDoom (line 538) | void __cdecl SphereOfDoom(__int16 itemID) {
function DrawSphereOfDoom (line 559) | void __cdecl DrawSphereOfDoom(ITEM_INFO *item) {
function lara_hands_free (line 582) | void __cdecl lara_hands_free(ITEM_INFO *item) {
function flip_map_effect (line 586) | void __cdecl flip_map_effect(ITEM_INFO *item) {
function draw_right_gun (line 590) | void __cdecl draw_right_gun(ITEM_INFO *item) {
function draw_left_gun (line 597) | void __cdecl draw_left_gun(ITEM_INFO *item) {
function swap_meshes_with_meshswap1 (line 604) | void __cdecl swap_meshes_with_meshswap1(ITEM_INFO *item) {
function swap_meshes_with_meshswap2 (line 612) | void __cdecl swap_meshes_with_meshswap2(ITEM_INFO *item) {
function swap_meshes_with_meshswap3 (line 620) | void __cdecl swap_meshes_with_meshswap3(ITEM_INFO *item) {
function invisibility_on (line 631) | void __cdecl invisibility_on(ITEM_INFO *item) {
function invisibility_off (line 635) | void __cdecl invisibility_off(ITEM_INFO *item) {
function dynamic_light_on (line 639) | void __cdecl dynamic_light_on(ITEM_INFO *item) {
function dynamic_light_off (line 643) | void __cdecl dynamic_light_off(ITEM_INFO *item) {
function reset_hair (line 647) | void __cdecl reset_hair(ITEM_INFO *item) {
function AssaultStart (line 651) | void __cdecl AssaultStart(ITEM_INFO *item) {
function AssaultStop (line 658) | void __cdecl AssaultStop(ITEM_INFO *item) {
function AssaultReset (line 664) | void __cdecl AssaultReset(ITEM_INFO *item) {
function AssaultFinished (line 670) | void __cdecl AssaultFinished(ITEM_INFO *item) {
function Inject_Effects (line 697) | void Inject_Effects() {
FILE: game/enemies.cpp
function Inject_Enemies (line 31) | void Inject_Enemies() {
FILE: game/gameflow.cpp
function GF_GetSequenceValue (line 44) | static bool GF_GetSequenceValue(DWORD levelID, GF_EVENTS event, __int16 ...
function GF_GetNumSecrets (line 107) | int GF_GetNumSecrets(DWORD levelID) {
function GF_IsFinalLevel (line 114) | bool GF_IsFinalLevel(DWORD levelID) {
function BOOL (line 118) | BOOL __cdecl GF_LoadScriptFile(LPCTSTR fileName) {
function BOOL (line 175) | BOOL __cdecl GF_DoFrontEndSequence() {
function GF_DoLevelSequence (line 179) | int __cdecl GF_DoLevelSequence(DWORD levelID, GF_LEVEL_TYPE levelType) {
function GF_InterpretSequence (line 193) | int __cdecl GF_InterpretSequence(__int16 *seq, GF_LEVEL_TYPE levelType, ...
function GF_ModifyInventory (line 418) | void __cdecl GF_ModifyInventory(int levelID, BOOL isSecret) {
function GF_CurrentEvent (line 812) | int __cdecl GF_CurrentEvent() {
function Inject_Gameflow (line 819) | void Inject_Gameflow() {
FILE: game/hair.cpp
function Inject_Hair (line 31) | void Inject_Hair() {
FILE: game/health.cpp
function BOOL (line 40) | BOOL __cdecl FlashIt() {
function DrawAssaultTimer (line 53) | void __cdecl DrawAssaultTimer() {
function DrawGameInfo (line 108) | void __cdecl DrawGameInfo(BOOL pickupState) {
function DrawHealthBar (line 124) | void __cdecl DrawHealthBar(BOOL flashState) {
function DrawAirBar (line 162) | void __cdecl DrawAirBar(BOOL flashState) {
function MakeAmmoString (line 182) | void __cdecl MakeAmmoString(char *str) {
function DrawAmmoInfo (line 195) | void __cdecl DrawAmmoInfo() {
function DrawPickups (line 253) | void __cdecl DrawPickups(BOOL pickupState) {
function AddDisplayPickup (line 293) | void __cdecl AddDisplayPickup(__int16 itemID) {
function DisplayModeInfo (line 307) | void __cdecl DisplayModeInfo(char *modeString) {
function DrawModeInfo (line 331) | void __cdecl DrawModeInfo() {
function InitialisePickUpDisplay (line 341) | void __cdecl InitialisePickUpDisplay() {
function Inject_Health (line 350) | void Inject_Health() {
FILE: game/inventory.cpp
function Display_Inventory (line 81) | int __cdecl Display_Inventory(INVENTORY_MODE invMode) {
function Construct_Inventory (line 745) | void __cdecl Construct_Inventory() {
function SelectMeshes (line 800) | void __cdecl SelectMeshes(INVENTORY_ITEM *invItem) {
function AnimateInventoryItem (line 822) | int __cdecl AnimateInventoryItem(INVENTORY_ITEM *invItem) {
function DrawInventoryItem (line 850) | void __cdecl DrawInventoryItem(INVENTORY_ITEM* invItem) {
function DWORD (line 971) | DWORD __cdecl GetDebouncedInput(DWORD input) {
function DoInventoryPicture (line 996) | void __cdecl DoInventoryPicture() {
function DoInventoryBackground (line 1000) | void __cdecl DoInventoryBackground() {
function Inject_Inventory (line 1038) | void Inject_Inventory() {
FILE: game/invfunc.cpp
function InitColours (line 38) | void __cdecl InitColours() {
function RingIsOpen (line 52) | void __cdecl RingIsOpen(RING_INFO *ring) {
function RingIsNotOpen (line 101) | void __cdecl RingIsNotOpen() {
function RingNotActive (line 114) | void __cdecl RingNotActive(INVENTORY_ITEM *item) {
function RingActive (line 284) | void __cdecl RingActive() {
function BOOL (line 291) | BOOL __cdecl Inv_AddItem(GAME_OBJECT_ID itemID) {
function Inv_InsertItem (line 552) | void __cdecl Inv_InsertItem(INVENTORY_ITEM *item) {
function Inv_RequestItem (line 584) | int __cdecl Inv_RequestItem(GAME_OBJECT_ID itemID) {
function Inv_RemoveAllItems (line 600) | void __cdecl Inv_RemoveAllItems() {
function BOOL (line 608) | BOOL __cdecl Inv_RemoveItem(GAME_OBJECT_ID itemID) {
function GAME_OBJECT_ID (line 644) | GAME_OBJECT_ID __cdecl Inv_GetItemOption(GAME_OBJECT_ID itemID) {
function RemoveInventoryText (line 741) | void __cdecl RemoveInventoryText() {
function Inv_RingInit (line 748) | void __cdecl Inv_RingInit(RING_INFO *ring, __int16 type, INVENTORY_ITEM ...
function Inv_RingGetView (line 784) | void __cdecl Inv_RingGetView(RING_INFO *ring, PHD_3DPOS *view) {
function Inv_RingLight (line 796) | void __cdecl Inv_RingLight(RING_INFO *ring) {
function Inv_RingCalcAdders (line 804) | void __cdecl Inv_RingCalcAdders(RING_INFO *ring, __int16 rotDuration) {
function Inv_RingDoMotions (line 810) | void __cdecl Inv_RingDoMotions(RING_INFO *ring) {
function Inv_RingRotateLeft (line 874) | void __cdecl Inv_RingRotateLeft(RING_INFO *ring) {
function Inv_RingRotateRight (line 884) | void __cdecl Inv_RingRotateRight(RING_INFO *ring) {
function Inv_RingMotionInit (line 894) | void __cdecl Inv_RingMotionInit(RING_INFO *ring, __int16 framesCount, __...
function Inv_RingMotionSetup (line 919) | void __cdecl Inv_RingMotionSetup(RING_INFO *ring, __int16 status, __int1...
function Inv_RingMotionRadius (line 929) | void __cdecl Inv_RingMotionRadius(RING_INFO *ring, __int16 target) {
function Inv_RingMotionRotation (line 936) | void __cdecl Inv_RingMotionRotation(RING_INFO *ring, __int16 rotation, _...
function Inv_RingMotionCameraPos (line 943) | void __cdecl Inv_RingMotionCameraPos(RING_INFO *ring, __int16 target) {
function Inv_RingMotionCameraPitch (line 950) | void __cdecl Inv_RingMotionCameraPitch(RING_INFO *ring, __int16 target) {
function Inv_RingMotionItemSelect (line 957) | void __cdecl Inv_RingMotionItemSelect(RING_INFO *ring, INVENTORY_ITEM *i...
function Inv_RingMotionItemDeselect (line 970) | void __cdecl Inv_RingMotionItemDeselect(RING_INFO *ring, INVENTORY_ITEM ...
function Inject_InvFunc (line 986) | void Inject_InvFunc() {
FILE: game/invtext.cpp
function Init_Requester (line 95) | void __cdecl Init_Requester(REQUEST_INFO *req) {
function Remove_Requester (line 127) | void __cdecl Remove_Requester(REQUEST_INFO *req) {
function ReqItemCentreAlign (line 147) | void __cdecl ReqItemCentreAlign(REQUEST_INFO *req, TEXT_STR_INFO *textIn...
function ReqItemLeftAlign (line 154) | void __cdecl ReqItemLeftAlign(REQUEST_INFO *req, TEXT_STR_INFO *textInfo) {
function ReqItemRightAlign (line 170) | void __cdecl ReqItemRightAlign(REQUEST_INFO *req, TEXT_STR_INFO *textInf...
function Display_Requester (line 186) | int __cdecl Display_Requester(REQUEST_INFO *req, BOOL removeOnDeselect, ...
function SetRequesterHeading (line 468) | void __cdecl SetRequesterHeading(REQUEST_INFO *req, const char *string1,...
function RemoveAllReqItems (line 491) | void __cdecl RemoveAllReqItems(REQUEST_INFO *req) {
function ChangeRequesterItem (line 497) | void __cdecl ChangeRequesterItem(REQUEST_INFO *req, DWORD itemIdx, const...
function AddRequesterItem (line 518) | void __cdecl AddRequesterItem(REQUEST_INFO *req, const char *string1, DW...
function SetPCRequesterSize (line 539) | void __cdecl SetPCRequesterSize(REQUEST_INFO *req, int maxLines, __int16...
function BOOL (line 550) | BOOL __cdecl AddAssaultTime(DWORD newTime) {
function ShowGymStatsText (line 581) | void __cdecl ShowGymStatsText() {
function ShowStatsText (line 632) | void __cdecl ShowStatsText(char *timeString, BOOL removeOnDeselect) {
function ShowEndStatsText (line 741) | void __cdecl ShowEndStatsText() {
function Inject_InvText (line 861) | void Inject_InvText() {
FILE: game/items.cpp
function InitialiseItemArray (line 26) | void __cdecl InitialiseItemArray(int itemCount) {
function InitialiseItem (line 40) | void __cdecl InitialiseItem(__int16 itemIndex) {
function AddActiveItem (line 102) | void __cdecl AddActiveItem(__int16 itemIndex) {
function GlobalItemReplace (line 115) | int __cdecl GlobalItemReplace(int oldItemID, int newItemID) {
function Inject_Items (line 133) | void Inject_Items() {
FILE: game/lara.cpp
function lara_col_jumper (line 30) | void __cdecl lara_col_jumper(ITEM_INFO *item, COLL_INFO *coll) {
function Inject_Lara (line 65) | void Inject_Lara() {
FILE: game/lara1gun.cpp
function RifleHandler (line 45) | void __cdecl RifleHandler(int weaponType) {
function FireShotgun (line 76) | void __cdecl FireShotgun() {
function FireM16 (line 99) | void __cdecl FireM16(BOOL isRunning) {
function FireHarpoon (line 124) | void __cdecl FireHarpoon() {
function FireRocket (line 163) | void __cdecl FireRocket() {
function ControlRocket (line 198) | void __cdecl ControlRocket(__int16 itemID) {
function Inject_Lara1Gun (line 297) | void Inject_Lara1Gun() {
FILE: game/lara2gun.cpp
function PistolHandler (line 33) | void __cdecl PistolHandler(int weaponType) {
function Inject_Lara2Gun (line 82) | void Inject_Lara2Gun() {
FILE: game/laraclimb.cpp
function Inject_LaraClimb (line 31) | void Inject_LaraClimb() {
FILE: game/larafire.cpp
function Inject_LaraFire (line 31) | void Inject_LaraFire() {
FILE: game/laraflare.cpp
function DrawFlareInAir (line 35) | void __cdecl DrawFlareInAir(ITEM_INFO *item) {
function Inject_LaraFlare (line 68) | void Inject_LaraFlare() {
FILE: game/laramisc.cpp
function LaraControl (line 38) | void __cdecl LaraControl(__int16 itemID) {
function UseItem (line 323) | void __cdecl UseItem(__int16 itemID) {
function LaraCheatGetStuff (line 394) | void __cdecl LaraCheatGetStuff() {
function ControlLaraExtra (line 486) | void __cdecl ControlLaraExtra(__int16 itemID) {
function InitialiseLaraLoad (line 490) | void __cdecl InitialiseLaraLoad(__int16 itemID) {
function InitialiseLaraInventory (line 495) | void __cdecl InitialiseLaraInventory(int levelID) {
function Inject_LaraMisc (line 697) | void Inject_LaraMisc() {
FILE: game/larasurf.cpp
function Inject_LaraSurf (line 31) | void Inject_LaraSurf() {
FILE: game/laraswim.cpp
function SwimTurn (line 26) | void __cdecl SwimTurn(ITEM_INFO *item) {
function lara_as_swim (line 44) | void __cdecl lara_as_swim(ITEM_INFO *item, COLL_INFO *coll) {
function Inject_LaraSwim (line 75) | void Inject_LaraSwim() {
FILE: game/lot.cpp
function Inject_Lot (line 31) | void Inject_Lot() {
FILE: game/missile.cpp
function ControlMissile (line 34) | void __cdecl ControlMissile(__int16 fxID) {
function Inject_Missile (line 115) | void Inject_Missile() {
FILE: game/moveblock.cpp
function Inject_MoveBlock (line 31) | void Inject_MoveBlock() {
FILE: game/objects.cpp
function Inject_Objects (line 31) | void Inject_Objects() {
FILE: game/people.cpp
function __int16 (line 35) | __int16 __cdecl GunShot(int x, int y, int z, __int16 speed, __int16 rotY...
function __int16 (line 77) | __int16 __cdecl GunHit(int x, int y, int z, __int16 speed, __int16 rotY,...
function __int16 (line 106) | __int16 __cdecl GunMiss(int x, int y, int z, __int16 speed, __int16 rotY...
function Inject_People (line 119) | void Inject_People() {
FILE: game/pickup.cpp
function Inject_Pickup (line 31) | void Inject_Pickup() {
FILE: game/rat.cpp
function Inject_Rat (line 31) | void Inject_Rat() {
FILE: game/savegame.cpp
function InitialiseStartInfo (line 39) | void __cdecl InitialiseStartInfo() {
function ModifyStartInfo (line 58) | void __cdecl ModifyStartInfo(int levelIdx) {
function CreateStartInfo (line 163) | void __cdecl CreateStartInfo(int levelID) {
function CreateSaveGameInfo (line 226) | void __cdecl CreateSaveGameInfo() {
function ExtractSaveGameInfo (line 361) | void __cdecl ExtractSaveGameInfo() {
function ResetSG (line 569) | void __cdecl ResetSG() {
function WriteSG (line 574) | void __cdecl WriteSG(void *ptr, int len) {
function ReadSG (line 583) | void __cdecl ReadSG(void *ptr, int len) {
function Inject_SaveGame (line 592) | void Inject_SaveGame() {
FILE: game/setup.cpp
function InitialiseLevelFlags (line 50) | void __cdecl InitialiseLevelFlags() {
function InitialiseObjects (line 54) | void __cdecl InitialiseObjects() {
function BaddyObjects (line 79) | void __cdecl BaddyObjects() {
function Inject_Setup (line 707) | void Inject_Setup() {
FILE: game/shark.cpp
function Inject_Shark (line 31) | void Inject_Shark() {
FILE: game/skidoo.cpp
function DoSnowEffect (line 44) | void __cdecl DoSnowEffect(ITEM_INFO *item) {
function SkidooExplode (line 72) | void __cdecl SkidooExplode(ITEM_INFO *item) {
function SkidooGuns (line 95) | void __cdecl SkidooGuns() {
function DrawSkidoo (line 120) | void __cdecl DrawSkidoo(ITEM_INFO *item) {
function Inject_Skidoo (line 247) | void Inject_Skidoo() {
FILE: game/sound.cpp
function GetRealTrack (line 27) | int __cdecl GetRealTrack(int trackID) {
function SOUND_Init (line 41) | void __cdecl SOUND_Init() {
function Inject_Sound (line 53) | void Inject_Sound() {
FILE: game/sphere.cpp
function Inject_Sphere (line 31) | void Inject_Sphere() {
FILE: game/spider.cpp
function Inject_Spider (line 31) | void Inject_Spider() {
FILE: game/text.cpp
function T_InitPrint (line 98) | void __cdecl T_InitPrint() {
function T_ChangeText (line 150) | void __cdecl T_ChangeText(TEXT_STR_INFO *textInfo, const char *newString) {
function T_SetScale (line 160) | void __cdecl T_SetScale(TEXT_STR_INFO *textInfo, int scaleH, int scaleV) {
function T_FlashText (line 167) | void __cdecl T_FlashText(TEXT_STR_INFO *textInfo, __int16 state, __int16...
function T_AddBackground (line 180) | void __cdecl T_AddBackground(TEXT_STR_INFO *textInfo, __int16 xSize, __i...
function T_RemoveBackground (line 204) | void __cdecl T_RemoveBackground(TEXT_STR_INFO *textInfo) {
function T_AddOutline (line 209) | void __cdecl T_AddOutline(TEXT_STR_INFO *textInfo, BOOL state, INV_COLOU...
function T_RemoveOutline (line 218) | void __cdecl T_RemoveOutline(TEXT_STR_INFO *textInfo) {
function T_CentreH (line 223) | void __cdecl T_CentreH(TEXT_STR_INFO *textInfo, UINT16 state) {
function T_CentreV (line 232) | void __cdecl T_CentreV(TEXT_STR_INFO *textInfo, UINT16 state) {
function T_RightAlign (line 241) | void __cdecl T_RightAlign(TEXT_STR_INFO *textInfo, bool state) {
function T_BottomAlign (line 252) | void __cdecl T_BottomAlign(TEXT_STR_INFO *textInfo, bool state) {
function T_DrawTextBox (line 263) | void __cdecl T_DrawTextBox(int sx, int sy, int z, int width, int height) {
function DWORD (line 297) | DWORD __cdecl T_GetTextWidth(TEXT_STR_INFO *textInfo) {
function BOOL (line 366) | BOOL __cdecl T_RemovePrint(TEXT_STR_INFO *textInfo) {
function __int16 (line 375) | __int16 __cdecl T_GetStringLen(const char *str) {
function T_DrawText (line 384) | void __cdecl T_DrawText() {
function T_DrawThisText (line 391) | void __cdecl T_DrawThisText(TEXT_STR_INFO *textInfo) {
function DWORD (line 625) | DWORD __cdecl GetTextScaleH(DWORD baseScale) {
function DWORD (line 639) | DWORD __cdecl GetTextScaleV(DWORD baseScale) {
function T_HideText (line 654) | void T_HideText(TEXT_STR_INFO *textInfo, __int16 state) {
function Inject_Text (line 669) | void Inject_Text() {
FILE: game/traps.cpp
function MineControl (line 39) | void __cdecl MineControl(__int16 mineID) {
function ControlSpikeWall (line 107) | void __cdecl ControlSpikeWall(__int16 itemID) {
function ControlCeilingSpikes (line 136) | void __cdecl ControlCeilingSpikes(__int16 itemID) {
function HookControl (line 163) | void __cdecl HookControl(__int16 itemID) {
function SpinningBlade (line 178) | void __cdecl SpinningBlade(__int16 itemID) {
function IcicleControl (line 215) | void __cdecl IcicleControl(__int16 itemID) {
function InitialiseBlade (line 258) | void __cdecl InitialiseBlade(__int16 itemID) {
function BladeControl (line 267) | void __cdecl BladeControl(__int16 itemID) {
function InitialiseKillerStatue (line 284) | void __cdecl InitialiseKillerStatue(__int16 itemID) {
function KillerStatueControl (line 293) | void __cdecl KillerStatueControl(__int16 itemID) {
function Pendulum (line 315) | void __cdecl Pendulum(__int16 itemID) {
function TeethTrap (line 333) | void __cdecl TeethTrap(__int16 itemID) {
function FallingCeiling (line 360) | void __cdecl FallingCeiling(__int16 itemID) {
function DartEmitterControl (line 391) | void __cdecl DartEmitterControl(__int16 itemID) {
function DartsControl (line 441) | void __cdecl DartsControl(__int16 itemID) {
function DartEffectControl (line 475) | void __cdecl DartEffectControl(__int16 fxID) {
function FlameEmitterControl (line 488) | void __cdecl FlameEmitterControl(__int16 item_id) {
function FlameControl (line 516) | void __cdecl FlameControl(__int16 fx_id) {
function LaraBurn (line 564) | void __cdecl LaraBurn() {
function LavaBurn (line 585) | void __cdecl LavaBurn(ITEM_INFO *item) {
function Inject_Traps (line 616) | void Inject_Traps() {
FILE: game/wolf.cpp
function InitialiseWolf (line 52) | void __cdecl InitialiseWolf(__int16 itemID) {
function WolfControl (line 57) | void __cdecl WolfControl(__int16 itemID) {
FILE: game/yeti.cpp
function Inject_Yeti (line 31) | void Inject_Yeti() {
FILE: global/md5.c
function MD5Init (line 82) | void MD5Init (MD5_CTX *mdContext)
function MD5Update (line 94) | void MD5Update (MD5_CTX *mdContext, unsigned char *inBuf, unsigned int i...
function MD5Final (line 126) | void MD5Final (MD5_CTX *mdContext)
function Transform (line 166) | static void Transform (UINT4 *buf, UINT4 *in)
FILE: global/md5.h
type UINT4 (line 47) | typedef unsigned long int UINT4;
type MD5_CTX (line 50) | typedef struct {
FILE: global/types.h
type JMP (line 30) | typedef struct {
type D3DTLVERTEX (line 275) | typedef struct {
type D3DLOCKED_RECT (line 281) | typedef D3DLOCKED_RECT DDSDESC, *LPDDSDESC;
type LPDIRECT3DSURFACE9 (line 282) | typedef LPDIRECT3DSURFACE9 LPDDS;
type LPDIRECT3DTEXTURE9 (line 283) | typedef LPDIRECT3DTEXTURE9 HWR_TEXHANDLE;
type DDSURFACEDESC (line 285) | typedef DDSURFACEDESC DDSDESC, *LPDDSDESC;
type LPDIRECTDRAWSURFACE3 (line 286) | typedef LPDIRECTDRAWSURFACE3 LPDDS;
type D3DTEXTUREHANDLE (line 287) | typedef D3DTEXTUREHANDLE HWR_TEXHANDLE;
type SWR_BUFFER (line 293) | typedef struct {
type GAME_OBJECT_ID (line 304) | typedef enum {
type LARA_ANIM_STATES (line 574) | typedef enum {
type LARA_EXTRA_STATES (line 649) | typedef enum {
type VGA_MODE (line 663) | typedef enum {
type RENDER_MODE (line 670) | typedef enum {
type ASPECT_MODE (line 676) | typedef enum {
type TEX_ADJUST_MODE (line 682) | typedef enum {
type JOY_INTERFACE (line 689) | typedef enum {
type CONTROL_LAYOUT_PAGE (line 696) | typedef enum {
type INVENTORY_MODE (line 707) | typedef enum {
type LARA_GUN_STATUS (line 717) | typedef enum {
type LARA_GUN_TYPE (line 726) | typedef enum {
type CAMERA_TYPE (line 739) | typedef enum {
type CAMERA_FLAG (line 748) | typedef enum {
type KEYMAP (line 755) | typedef enum {
type SORTTYPE (line 784) | typedef enum {
type DRAWTYPE (line 790) | typedef enum {
type POLYTYPE (line 796) | typedef enum {
type ERROR_CODE (line 829) | typedef enum {
type GAMEALLOC_BUFFER (line 873) | typedef enum {
type GAME_STRING_ID (line 923) | typedef enum {
type SPECIFIC_STRING_ID (line 1009) | typedef enum {
type INV_COLOURS (line 1033) | typedef enum {
type LARA_WATER_STATES (line 1053) | typedef enum {
type RING_TYPE (line 1061) | typedef enum {
type GF_LEVEL_TYPE (line 1067) | typedef enum {
type GF_EVENTS (line 1079) | typedef enum {
type MOOD_TYPE (line 1105) | typedef enum {
type ITEM_STATUS (line 1112) | typedef enum {
type ADDINV_TYPES (line 1119) | typedef enum {
type CHAR_SECRETS (line 1149) | typedef enum {
type SORT_ITEM (line 1167) | typedef struct SortItem_t {
type RGB888 (line 1177) | typedef struct RGB888_t {
type GOURAUD_FILL (line 1183) | typedef struct GouraudFill_t {
type GOURAUD_OUTLINE (line 1187) | typedef struct GouraudOutline_t {
type DEPTHQ_ENTRY (line 1191) | typedef struct DepthQEntry_t {
type GOURAUD_ENTRY (line 1195) | typedef struct GouraudEntry_t {
type DISPLAY_MODE (line 1199) | typedef struct DisplayMode_t {
type DISPLAY_MODE_NODE (line 1206) | typedef struct DisplayModeNode_t {
type DISPLAY_MODE_LIST (line 1212) | typedef struct DisplayModeList_t {
type STRING_FLAGGED (line 1218) | typedef struct StringFlagged_t {
type DISPLAY_ADAPTER (line 1223) | typedef struct DisplayAdapter_t {
type DISPLAY_ADAPTER_NODE (line 1257) | typedef struct DisplayAdapterNode_t {
type DISPLAY_ADAPTER_LIST (line 1263) | typedef struct DisplayAdapterList_t {
type SOUND_ADAPTER (line 1269) | typedef struct SoundAdapter_t {
type SOUND_ADAPTER_NODE (line 1276) | typedef struct SoundAdapterNode_t {
type SOUND_ADAPTER_LIST (line 1282) | typedef struct SoundAdapterList_t {
type JOYSTICK (line 1288) | typedef struct Joystick_t {
type JOYSTICK_NODE (line 1298) | typedef struct JoystickNode_t {
type JOYSTICK_LIST (line 1304) | typedef struct JoystickList_t {
type APP_SETTINGS (line 1310) | typedef struct AppSettings_t {
type TEXPAGE_DESC (line 1340) | struct TEXPAGE_DESC {
type PHD_UV (line 1355) | typedef struct PhdUV_t {
type PHD_TEXTURE (line 1360) | typedef struct PhdTexture_t {
type COLOR_BIT_MASKS (line 1366) | typedef struct ColorBitMasks_t {
type TEXTURE_FORMAT (line 1381) | typedef struct TextureFormat_t {
type TEXT_STR_INFO (line 1389) | typedef struct TextStrInfo_t {
type STRING_FIXED4 (line 1415) | typedef struct StringFixed4_t {
type STRING_FIXED50 (line 1419) | typedef struct StringFixed50_t {
type STRING_FIXED64 (line 1423) | typedef struct StringFixed64_t {
type PCX_HEADER (line 1427) | typedef struct PcxHeader_t {
type TGA_HEADER (line 1448) | typedef struct TgaHeader_t {
type BITMAP_RESOURCE (line 1463) | typedef struct BitmapResource_t {
type ROOM_LIGHT_TABLE (line 1470) | typedef struct RoomLightTable_t {
type WAVEPCM_HEADER (line 1474) | typedef struct WavePcmHeader_t {
type SAMPLE_INFO (line 1490) | typedef struct SampleInfo_t {
type SFX_INFO (line 1497) | typedef struct SfxInfo_t {
type GAME_FLOW (line 1504) | typedef struct GameFlow_t {
type REQUEST_INFO (line 1531) | typedef struct RequestInfo_t {
type INVENTORY_ITEM (line 1569) | typedef struct InventoryItem_t {
type STATISTICS_INFO (line 1600) | typedef struct StatisticsInfo_t {
type START_INFO (line 1610) | typedef struct StartInfo_t {
type SAVEGAME_INFO (line 1637) | typedef struct SaveGame_t {
type POS_2D (line 1649) | typedef struct Pos2D_t {
type POS_3D (line 1654) | typedef struct Pos3D_t {
type PHD_VECTOR (line 1660) | typedef struct PhdVector_t {
type GAME_VECTOR (line 1666) | typedef struct GameVector_t {
type OBJECT_VECTOR (line 1674) | typedef struct ObjectVector_t {
type VECTOR_ANGLES (line 1682) | typedef struct VectorAngles_t {
type PHD_3DPOS (line 1687) | typedef struct Phd3dPos_t {
type ITEM_INFO (line 1696) | typedef struct ItemInfo_t {
type CAMERA_INFO (line 1731) | typedef struct CameraInfo_t {
type COLL_SIDE (line 1758) | typedef struct CollSide_t {
type COLL_INFO (line 1764) | typedef struct CollInfo_t {
type OBJECT_INFO (line 1789) | typedef struct ObjectInfo_t {
type PHD_MATRIX (line 1816) | typedef struct PhdMatrix_t {
type DOOR_INFO (line 1822) | typedef struct DoorInfo_t {
type DOOR_INFOS (line 1830) | typedef struct DoorInfos_t {
type FLOOR_INFO (line 1835) | typedef struct FloorInfo_t {
type LIGHT_INFO (line 1844) | typedef struct LightInfo_t {
type MESH_INFO (line 1854) | typedef struct MeshInfo_t {
type ROOM_INFO (line 1864) | typedef struct RoomInfo_t {
type PHD_VBUF (line 1897) | typedef struct PhdVBuf_t {
type POINT_INFO (line 1910) | typedef struct PointInfo_t {
type VERTEX_INFO (line 1922) | typedef struct VertexInfo_t {
type ROOM_VERTEX_INFO (line 1931) | typedef struct RoomVertexInfo_t {
type ANIM_STRUCT (line 1941) | typedef struct AnimStruct_t {
type CHANGE_STRUCT (line 1957) | typedef struct ChangeStruct_t {
type RANGE_STRUCT (line 1963) | typedef struct RangeStruct_t {
type STATIC_BOUNDS (line 1970) | typedef struct StaticBounds_t {
type STATIC_INFO (line 1979) | typedef struct StaticInfo_t {
type PHD_SPRITE (line 1986) | typedef struct PhdSprite_t {
type BOX_INFO (line 1997) | typedef struct BoxInfo_t {
type CINE_FRAME_INFO (line 2006) | typedef struct CineFrameInfo_t {
type CONTROL_LAYOUT (line 2017) | typedef struct ControlLayout_t {
type INVENTORY_SPRITE (line 2025) | typedef struct InventorySprite_t {
type ASSAULT_STATS (line 2036) | typedef struct AssaultStats_t {
type PICKUP_INFO (line 2042) | typedef struct PickupInfo_t {
type INV_MOTION_INFO (line 2047) | typedef struct InvMotionInfo_t {
type RING_INFO (line 2070) | typedef struct RingInfo_t {
type BOX_NODE (line 2090) | typedef struct BoxNode_t {
type LOT_INFO (line 2097) | typedef struct LotInfo_t {
type FX_INFO (line 2112) | typedef struct FxInfo_t {
type CREATURE_INFO (line 2125) | typedef struct CreatureInfo_t {
type BOAT_INFO (line 2137) | typedef struct BoatInfo_t {
type SKIDOO_INFO (line 2147) | typedef struct SkidooInfo_t {
type LARA_ARM (line 2157) | typedef struct LaraArm_t {
type LARA_INFO (line 2168) | typedef struct LaraInfo_t {
type BITE_INFO (line 2225) | typedef struct BiteInfo_t {
type AI_INFO (line 2233) | typedef struct AIInfo_t {
type WEAPON_INFO (line 2243) | typedef struct WeaponInfo_t {
FILE: json-parser/json.c
type _json_value (line 39) | struct _json_value
type json_uchar (line 46) | typedef unsigned int json_uchar;
function hex_value (line 57) | static unsigned char hex_value (json_char c)
function would_overflow (line 73) | static int would_overflow (json_int_t value, json_char b)
type json_state (line 78) | typedef struct
function default_free (line 98) | static void default_free (void * ptr, void * user_data)
function new_value (line 117) | static int new_value (json_state * state,
function json_value (line 237) | json_value * json_parse_ex (json_settings * settings,
function json_value (line 978) | json_value * json_parse (const json_char * json, size_t length)
function json_value_free_ex (line 984) | void json_value_free_ex (json_settings * settings, json_value * value)
function json_value_free (line 1034) | void json_value_free (json_value * value)
FILE: json-parser/json.h
type json_settings (line 58) | typedef struct
type json_type (line 77) | typedef enum
type _json_value (line 90) | struct _json_value
type json_object_entry (line 92) | typedef struct _json_object_entry
type return (line 101) | typedef struct _json_value
function const (line 192) | inline const struct _json_value &operator [] (const char * index) const
FILE: modding/background_new.cpp
function RenderTexturedFarQuad (line 108) | void RenderTexturedFarQuad(VERTEX2D *vtx0, VERTEX2D *vtx1, VERTEX2D *vtx...
function PSX_Background (line 175) | void PSX_Background(HWR_TEXHANDLE texSource, int tu, int tv, int t_width...
function CreateCaptureTexture (line 241) | static int CreateCaptureTexture(DWORD index, int side) {
function BGND2_CleanupCaptureTextures (line 271) | void BGND2_CleanupCaptureTextures() {
function BGND2_PrepareCaptureTextures (line 277) | int BGND2_PrepareCaptureTextures() {
function MakeBgndTextures (line 297) | static int MakeBgndTextures(DWORD width, DWORD height, DWORD bpp, BYTE *...
function PickBestPictureFile (line 336) | static int PickBestPictureFile(LPTSTR fileName, LPCTSTR modDir) {
function BGND2_FadeTo (line 378) | int __cdecl BGND2_FadeTo(int target, int delta) {
function BGND2_FadeToPal (line 396) | static int __cdecl BGND2_FadeToPal(int fadeValue, RGB888 *palette, int i...
function BGND2_CustomBlt (line 465) | static void BGND2_CustomBlt(LPDDSDESC dst, DWORD dstX, DWORD dstY, LPDDS...
function BGND2_CapturePicture (line 534) | int __cdecl BGND2_CapturePicture() {
function BGND2_LoadPicture (line 677) | int __cdecl BGND2_LoadPicture(LPCTSTR fileName, BOOL isTitle, BOOL isRel...
function BGND2_ShowPicture (line 857) | int __cdecl BGND2_ShowPicture(DWORD fadeIn, DWORD waitIn, DWORD fadeOut,...
function BGND2_DrawTexture (line 981) | static void __cdecl BGND2_DrawTexture(RECT *rect, HWR_TEXHANDLE texSource,
function BGND2_DrawTextures (line 1042) | void __cdecl BGND2_DrawTextures(RECT *rect, D3DCOLOR color) {
function BGND2_CalculatePictureRect (line 1083) | int __cdecl BGND2_CalculatePictureRect(RECT *rect) {
FILE: modding/cd_pauld.cpp
type TrackInfo_t (line 30) | struct TrackInfo_t {
function PaulD_CD_Init (line 39) | bool __cdecl PaulD_CD_Init() {
function PaulD_CD_Cleanup (line 137) | void __cdecl PaulD_CD_Cleanup() {
function PaulD_CDLoop (line 145) | void __cdecl PaulD_CDLoop() {
function PaulD_CDPlay (line 162) | void __cdecl PaulD_CDPlay(__int16 trackID, BOOL isLooped) {
function PaulD_CDStop (line 184) | void __cdecl PaulD_CDStop() {
function BOOL (line 192) | BOOL __cdecl PaulD_StartSyncedAudio(int trackID) {
function DWORD (line 208) | DWORD __cdecl PaulD_CDGetLoc() {
function PaulD_CDVolume (line 220) | void __cdecl PaulD_CDVolume(DWORD volume) {
FILE: modding/file_utils.cpp
function PathStringCombine (line 26) | int PathStringCombine(LPSTR destPath, DWORD destSize, LPCSTR filePath, L...
function AutoSelectExtension (line 44) | int AutoSelectExtension(LPSTR fileName, const STRING_FIXED4 *exts, DWORD...
function AutoSelectPathAndExtension (line 73) | int AutoSelectPathAndExtension(LPSTR fileName, LPCSTR path, const STRING...
function CreateDirectories (line 97) | int CreateDirectories(LPCSTR path, bool isFileName) {
function CreateSequenceFilename (line 118) | int CreateSequenceFilename(LPSTR destName, DWORD destSize, LPCSTR filePa...
function CreateDateTimeFilename (line 144) | int CreateDateTimeFilename(LPSTR destName, DWORD destSize, LPCSTR filePa...
function AddFilenameSuffix (line 176) | int AddFilenameSuffix(LPSTR destName, DWORD destSize, LPCSTR fileName, L...
function LPCVOID (line 188) | LPCVOID GetResourceData(LPCTSTR resName, LPDWORD resSize) {
FILE: modding/gdi_utils.cpp
function GetEncoderClsid (line 37) | static int GetEncoderClsid(const WCHAR *format, CLSID *pClsid) {
function HBITMAP (line 60) | HBITMAP CreateBitmapFromDC(HDC dc, RECT *rect, LPVOID *lpBits, PALETTEEN...
function GDI_Init (line 111) | bool __cdecl GDI_Init() {
function GDI_Cleanup (line 119) | void __cdecl GDI_Cleanup() {
function GDI_SaveImageFile (line 126) | int GDI_SaveImageFile(LPCSTR filename, GDI_FILEFMT format, DWORD quality...
function GDI_LoadImageFile (line 169) | int GDI_LoadImageFile(LPCSTR filename, BYTE **bmPtr, DWORD *width, DWORD...
FILE: modding/gdi_utils.h
type GDI_FILEFMT (line 27) | typedef enum {
FILE: modding/joy_output.cpp
function BlendLedColor (line 49) | static int BlendLedColor(int c1, int c2) {
function SetupVibration (line 60) | static void SetupVibration(int motor, int inc, int val, int sus, int dec...
function JoyOutputReset (line 86) | void JoyOutputReset() {
function JoyVibrationMute (line 91) | void JoyVibrationMute() {
function JoyVibrate (line 95) | void JoyVibrate(int inc, int val, int sus, int dec, int len, bool isCame...
function JoyRumble (line 99) | void JoyRumble(int inc, int val, int sus, int dec, int len, bool isCamer...
function JoyRumbleExplode (line 103) | void JoyRumbleExplode(int x, int y, int z, DWORD range, bool fromLara) {
function UpdateJoyOutput (line 115) | void UpdateJoyOutput(bool isInGame) {
FILE: modding/json_utils.cpp
function json_value (line 26) | json_value *GetJsonField(json_value *root, json_type fieldType, const ch...
function json_value (line 47) | json_value *GetJsonObjectByStringField(json_value *root, const char *nam...
function GetJsonIntegerFieldValue (line 67) | int GetJsonIntegerFieldValue(json_value *root, const char *name, int def...
function GetJsonFloatFieldValue (line 72) | double GetJsonFloatFieldValue(json_value *root, const char *name, double...
FILE: modding/mod_utils.cpp
function POLYFILTER (line 55) | static POLYFILTER *CreatePolyfilterNode(POLYFILTER_NODE **root, int id) {
function FreePolyfilterNodes (line 66) | static void FreePolyfilterNodes(POLYFILTER_NODE **root) {
function IsCompatibleFilter (line 78) | static bool IsCompatibleFilter(__int16 *ptrObj, bool isRoomMesh, POLYFIL...
function __int16 (line 106) | static __int16 *EnumeratePolysSpecific(__int16 *ptrObj, int vtxCount, bo...
function EnumeratePolys (line 136) | bool EnumeratePolys(__int16 *ptrObj, bool isRoomMesh, ENUM_POLYS_CB call...
function IsModConfigLoaded (line 163) | bool IsModConfigLoaded() {
function IsModBarefoot (line 167) | bool IsModBarefoot() {
function DWORD (line 175) | DWORD GetModWaterColor() {
function IsModSemitransConfigLoaded (line 179) | bool IsModSemitransConfigLoaded() {
function POLYINDEX (line 183) | POLYINDEX *GetModSemitransAnimtexFilter() {
function POLYFILTER_NODE (line 187) | POLYFILTER_NODE *GetModSemitransRoomsFilter() {
function POLYFILTER_NODE (line 191) | POLYFILTER_NODE *GetModSemitransStaticsFilter() {
function POLYFILTER_NODE (line 195) | POLYFILTER_NODE **GetModSemitransObjectsFilter() {
function IsModReflectConfigLoaded (line 199) | bool IsModReflectConfigLoaded() {
function POLYFILTER_NODE (line 203) | POLYFILTER_NODE *GetModReflectStaticsFilter() {
function POLYFILTER_NODE (line 207) | POLYFILTER_NODE **GetModReflectObjectsFilter() {
function ParsePolyString (line 211) | static int ParsePolyString(const char *str, POLYINDEX *lst, DWORD lstLen){
function ParsePolyValue (line 288) | static int ParsePolyValue(json_value *value, POLYINDEX *lst, DWORD lstLe...
function ParsePolyfilterConfiguration (line 311) | static bool ParsePolyfilterConfiguration(json_value *root, const char *n...
function ParseSemitransConfiguration (line 345) | static bool ParseSemitransConfiguration(json_value *root) {
function ParseReflectConfiguration (line 379) | static bool ParseReflectConfiguration(json_value *root) {
function ParseLevelConfiguration (line 399) | static bool ParseLevelConfiguration(json_value *root) {
function ParseModConfiguration (line 422) | static bool ParseModConfiguration(char *levelName, json_value *root) {
function UnloadModConfiguration (line 434) | void UnloadModConfiguration() {
function LoadModConfiguration (line 449) | bool LoadModConfiguration(LPCTSTR levelFilePath) {
FILE: modding/mod_utils.h
type POLYINDEX (line 33) | typedef struct {__int16 idx; __int16 num;} POLYINDEX;
type POLYFILTER (line 35) | typedef struct {
type POLYFILTER_NODE (line 43) | typedef struct PolyfilterNode_t {
FILE: modding/pause.cpp
function RemovePausedText (line 42) | static void RemovePausedText() {
function DisplayPausedText (line 47) | static void DisplayPausedText() {
function DisplayPauseRequester (line 55) | static int DisplayPauseRequester(const char *header, const char *option1...
function PauseRequester (line 96) | static int PauseRequester() {
function S_Pause (line 130) | bool S_Pause() {
FILE: modding/psx_bar.cpp
function D3DCOLOR (line 30) | static D3DCOLOR InterpolateColor(D3DCOLOR color0, D3DCOLOR color1, DWORD...
function DrawCololoredRect (line 48) | static void __cdecl DrawCololoredRect(float sx0, float sy0, float sx1, f...
function PSX_DrawBar (line 89) | static void PSX_DrawBar(int x0, int y0, int x1, int y1, int bar, int pix...
function PSX_DrawHealthBar (line 125) | void __cdecl PSX_DrawHealthBar(int x0, int y0, int x1, int y1, int bar, ...
function PSX_DrawAirBar (line 137) | void __cdecl PSX_DrawAirBar(int x0, int y0, int x1, int y1, int bar, int...
function PSX_InsertBar (line 149) | static void PSX_InsertBar(int polytype, int x0, int y0, int x1, int y1, ...
function PSX_InsertHealthBar (line 166) | void __cdecl PSX_InsertHealthBar(int x0, int y0, int x1, int y1, int bar...
function PSX_InsertAirBar (line 170) | void __cdecl PSX_InsertAirBar(int x0, int y0, int x1, int y1, int bar, i...
FILE: modding/raw_input.cpp
function DWORD (line 77) | static DWORD SonyBluetoothCRC(LPCBYTE buf, DWORD len, DWORD crc) {
function IsRawBluetooth (line 118) | static bool IsRawBluetooth(PHIDD_ATTRIBUTES pAttr, PHIDP_CAPS pCaps) {
function CalculateRawGUID (line 143) | static bool CalculateRawGUID(LPCTSTR lpString, LPGUID lpGuid) {
function LPCTSTR (line 154) | LPCTSTR GetRawInputName(WORD vid, WORD pid, BOOL bt) {
function RawInputEnumerate (line 176) | bool RawInputEnumerate(BOOL(CALLBACK *callback)(LPGUID, LPCTSTR, LPCTSTR...
class RawHidDevice (line 226) | class RawHidDevice {
method DWORD (line 246) | static DWORD WINAPI StaticTask(CONST LPVOID lpParam) {
function DWORD (line 272) | DWORD RawHidDevice::Task() {
function RawInputStart (line 878) | bool RawInputStart(LPCTSTR lpName) {
function RawInputStop (line 882) | void RawInputStop() {
function RawInputSetState (line 886) | bool RawInputSetState(WORD leftMotor, WORD rightMotor, DWORD color) {
function RawInputGetState (line 890) | bool RawInputGetState(RINPUT_STATE *pState) {
FILE: modding/raw_input.h
type RINPUT_STATE (line 29) | typedef struct {
FILE: modding/texture_utils.cpp
function compareMap (line 303) | static int compareMap(const void *a, const void *b) {
function sortMaps (line 307) | static void sortMaps() {
function searchMap (line 318) | static int searchMap(const char *name, MAP *mapArray, DWORD mapCount) {
function ParseSpriteInfo (line 325) | static bool ParseSpriteInfo(json_value *root, int id) {
function ParseButtonSprites (line 350) | static bool ParseButtonSprites(json_value *root) {
function BYTE (line 363) | static BYTE FindPaletteEntry(RGB888 *palette, int red, int green, int bl...
function AdaptToPalette (line 380) | static void AdaptToPalette(void *srcData, int width, int height, int src...
function LoadButtonSpriteTexturePage (line 401) | static int LoadButtonSpriteTexturePage(bool *isExternal) {
function LoadButtonSprites (line 447) | bool LoadButtonSprites() {
function GetTextSpriteByName (line 493) | bool GetTextSpriteByName(const char *name, int nameLen, DWORD *sprite, i...
function FillEdgePadding (line 543) | static int FillEdgePadding(DWORD width, DWORD height, DWORD side, BYTE *...
function MakeCustomTexture (line 604) | int MakeCustomTexture(DWORD x, DWORD y, DWORD width, DWORD height, DWORD...
function IsTexPagesConfigLoaded (line 703) | bool IsTexPagesConfigLoaded() {
function IsTexPagesLegacyColors (line 707) | bool IsTexPagesLegacyColors() {
function GetTexPagesAdjustment (line 711) | double GetTexPagesAdjustment() {
function GetTexPagesGlyphSpacing (line 716) | int GetTexPagesGlyphSpacing(int id) {
function GetTexPagesGlyphXOffset (line 725) | int GetTexPagesGlyphXOffset(int id) {
function GetTexPagesGlyphYOffset (line 734) | int GetTexPagesGlyphYOffset(int id) {
function GetTexPagesGlyphXStretch (line 743) | double GetTexPagesGlyphXStretch(int id) {
function GetTexPagesGlyphYStretch (line 753) | double GetTexPagesGlyphYStretch(int id) {
function ParseLevelTexPagesConfiguration (line 764) | static bool ParseLevelTexPagesConfiguration(json_value *root) {
function ParseTexPagesConfiguration (line 799) | static bool ParseTexPagesConfiguration(char *levelName, json_value *root) {
function UnloadTexPagesConfiguration (line 811) | void UnloadTexPagesConfiguration() {
function LoadTexPagesConfiguration (line 815) | bool LoadTexPagesConfiguration(LPCTSTR levelFilePath) {
FILE: modding/xinput_ex.cpp
function XInputLibUnlink (line 31) | static DWORD (WINAPI *_XInputGetCapabilities)(DWORD, DWORD, XINPUT_CAPAB...
function XInputLibLink (line 46) | static bool XInputLibLink(LPCSTR lpLibFileName, bool advanced) {
function XInputLibInit (line 71) | static bool XInputLibInit() {
function XInputEnable (line 96) | void WINAPI XInputEnable(BOOL enable) {
function DWORD (line 103) | DWORD WINAPI XInputGetCapabilities(DWORD dwUserIndex, DWORD dwFlags, XIN...
function DWORD (line 110) | DWORD WINAPI XInputSetState(DWORD dwUserIndex, XINPUT_VIBRATION *pVibrat...
function DWORD (line 117) | DWORD WINAPI XInputGetState(DWORD dwUserIndex, XINPUT_STATE *pState) {
function BOOL (line 132) | BOOL IsXInputDevice(DWORD dwVendorId, DWORD dwProductId) {
FILE: specific/background.cpp
function BGND_Make640x480 (line 40) | void __cdecl BGND_Make640x480(BYTE *bitmap, RGB888 *palette) {
function BGND_AddTexture (line 69) | int __cdecl BGND_AddTexture(int tileIndex, BYTE *bitmap, int palIndex, R...
function BGND_GetPageHandles (line 98) | void __cdecl BGND_GetPageHandles() {
function BGND_DrawInGameBlack (line 107) | void __cdecl BGND_DrawInGameBlack() {
function DrawQuad (line 113) | void __cdecl DrawQuad(float sx, float sy, float width, float height, D3D...
function BGND_DrawInGameBackground (line 140) | void __cdecl BGND_DrawInGameBackground() {
function DrawTextureTile (line 308) | void __cdecl DrawTextureTile(int sx, int sy, int width, int height, HWR_...
function D3DCOLOR (line 381) | D3DCOLOR __cdecl BGND_CenterLighting(int x, int y, int width, int height) {
function BGND_Free (line 399) | void __cdecl BGND_Free() {
function BGND_Init (line 414) | bool __cdecl BGND_Init() {
function Inject_Background (line 427) | void Inject_Background() {
FILE: specific/display.cpp
function IncreaseScreenSize (line 28) | void __cdecl IncreaseScreenSize() {
function DecreaseScreenSize (line 39) | void __cdecl DecreaseScreenSize() {
function setup_screen_size (line 50) | void __cdecl setup_screen_size() {
function TempVideoAdjust (line 80) | void __cdecl TempVideoAdjust(int hires, double sizer) {
function TempVideoRemove (line 88) | void __cdecl TempVideoRemove() {
function S_FadeInInventory (line 96) | void __cdecl S_FadeInInventory(BOOL isFade) {
function S_FadeOutInventory (line 107) | void __cdecl S_FadeOutInventory(BOOL isFade) {
function Inject_Display (line 118) | void Inject_Display() {
FILE: specific/file.cpp
function MarkSemitransPoly (line 65) | static bool MarkSemitransPoly(__int16 *ptrObj, int vtxCount, bool colore...
function MarkSemitransMesh (line 75) | static bool MarkSemitransMesh(int objID, int meshIdx, POLYFILTER *filter) {
function MarkSemitransObjects (line 93) | static void MarkSemitransObjects() {
function MarkSemitransTextureRanges (line 156) | static void MarkSemitransTextureRanges() {
function UpdateDepthQ (line 202) | void UpdateDepthQ(bool isReset) {
function LoadBareFootSFX (line 230) | static void LoadBareFootSFX(int *sampleIndexes, int sampleCount) {
function GetBgndPatternInfo (line 285) | static bool GetBgndPatternInfo() {
function CreateBgndPatternTexture (line 333) | static int CreateBgndPatternTexture(HANDLE hFile) {
function BOOL (line 392) | BOOL __cdecl ReadFileSync(HANDLE hFile, LPVOID lpBuffer, DWORD nBytesToR...
function BOOL (line 402) | BOOL __cdecl LoadTexturePages(HANDLE hFile) {
function BOOL (line 459) | BOOL __cdecl LoadRooms(HANDLE hFile) {
function AdjustTextureUVs (line 556) | void __cdecl AdjustTextureUVs(bool resetUvAdd) {
function BOOL (line 616) | BOOL __cdecl LoadObjects(HANDLE hFile) {
function BOOL (line 730) | BOOL __cdecl LoadSprites(HANDLE hFile) {
function BOOL (line 756) | BOOL __cdecl LoadItems(HANDLE hFile) {
function BOOL (line 796) | BOOL __cdecl LoadDepthQ(HANDLE hFile) {
function BOOL (line 843) | BOOL __cdecl LoadPalettes(HANDLE hFile) {
function BOOL (line 873) | BOOL __cdecl LoadCameras(HANDLE hFile) {
function BOOL (line 887) | BOOL __cdecl LoadSoundEffects(HANDLE hFile) {
function BOOL (line 901) | BOOL __cdecl LoadBoxes(HANDLE hFile) {
function BOOL (line 950) | BOOL __cdecl LoadAnimatedTextures(HANDLE hFile) {
function BOOL (line 959) | BOOL __cdecl LoadCinematic(HANDLE hFile) {
function BOOL (line 973) | BOOL __cdecl LoadDemo(HANDLE hFile) {
function LoadDemoExternal (line 989) | void __cdecl LoadDemoExternal(LPCTSTR levelName) {
function BOOL (line 1004) | BOOL __cdecl LoadSamples(HANDLE hFile) {
function ChangeFileNameExtension (line 1093) | void __cdecl ChangeFileNameExtension(char *fileName, const char *fileExt) {
function LPCTSTR (line 1108) | LPCTSTR __cdecl GetFullPath(LPCTSTR fileName) {
function BOOL (line 1118) | BOOL __cdecl SelectDrive() {
function BOOL (line 1142) | BOOL __cdecl LoadLevel(LPCTSTR fileName, int levelID) {
function BOOL (line 1222) | BOOL __cdecl S_LoadLevelFile(LPCTSTR fileName, int levelID, GF_LEVEL_TYP...
function S_UnloadLevelFile (line 1246) | void __cdecl S_UnloadLevelFile() {
function S_AdjustTexelCoordinates (line 1261) | void __cdecl S_AdjustTexelCoordinates() {
function BOOL (line 1267) | BOOL __cdecl S_ReloadLevelGraphics(BOOL reloadPalettes, BOOL reloadTexPa...
function BOOL (line 1306) | BOOL __cdecl Read_Strings(DWORD dwCount, char **stringTable, char **stri...
function BOOL (line 1332) | BOOL __cdecl S_LoadGameFlow(LPCTSTR fileName) {
function Inject_File (line 1409) | void Inject_File() {
FILE: specific/fmv.cpp
function FFplayInit (line 86) | static bool FFplayInit() {
function FFplayCleanup (line 118) | void __cdecl FFplayCleanup() {
function FMV_Init (line 127) | bool __cdecl FMV_Init() {
function FMV_Cleanup (line 184) | void __cdecl FMV_Cleanup() {
function PlayFMV (line 196) | bool __cdecl PlayFMV(LPCTSTR fileName) {
function WinPlayFMV (line 219) | void __cdecl WinPlayFMV(LPCTSTR fileName, bool isPlayback) {
function WinStopFMV (line 307) | void __cdecl WinStopFMV(bool isPlayback) {
function IntroFMV (line 323) | bool __cdecl IntroFMV(LPCTSTR fileName1, LPCTSTR fileName2) {
function Inject_Fmv (line 352) | void Inject_Fmv() {
FILE: specific/frontend.cpp
function FadeWait (line 43) | static void FadeWait() {
function UINT16 (line 47) | UINT16 __cdecl S_COLOUR(int red, int green, int blue) {
function S_DrawScreenLine (line 51) | void __cdecl S_DrawScreenLine(int x, int y, int z, int xLen, int yLen, B...
function S_DrawScreenBox (line 55) | void __cdecl S_DrawScreenBox(int sx, int sy, int z, int width, int heigh...
function S_DrawScreenFBox (line 154) | void __cdecl S_DrawScreenFBox(int sx, int sy, int z, int width, int heig...
function S_FinishInventory (line 202) | void __cdecl S_FinishInventory() {
function S_FadeToBlack (line 207) | void __cdecl S_FadeToBlack() {
function S_Wait (line 231) | void __cdecl S_Wait(int timeout, BOOL inputCheck) {
function S_PlayFMV (line 251) | bool __cdecl S_PlayFMV(LPCTSTR fileName) {
function S_IntroFMV (line 255) | bool __cdecl S_IntroFMV(LPCTSTR fileName1, LPCTSTR fileName2) {
function Inject_Frontend (line 262) | void Inject_Frontend() {
FILE: specific/game.cpp
function GetSaveFileName (line 70) | static int GetSaveFileName(LPSTR destName, DWORD destSize, int slotNumbe...
function __int16 (line 85) | __int16 __cdecl StartGame(int levelID, GF_LEVEL_TYPE levelType) {
function GameLoop (line 162) | int __cdecl GameLoop(BOOL demoMode) {
function LevelCompleteSequence (line 192) | int __cdecl LevelCompleteSequence() {
function LevelStats (line 196) | int __cdecl LevelStats(int levelID) {
function GameStats (line 288) | int __cdecl GameStats(int levelID) {
function GetRandomControl (line 335) | int __cdecl GetRandomControl() {
function SeedRandomControl (line 342) | void __cdecl SeedRandomControl(int seed) {
function GetRandomDraw (line 346) | int __cdecl GetRandomDraw() {
function SeedRandomDraw (line 353) | void __cdecl SeedRandomDraw(int seed) {
function GetValidLevelsList (line 357) | void __cdecl GetValidLevelsList(REQUEST_INFO *req) {
function GetSavedGamesList (line 369) | void __cdecl GetSavedGamesList(REQUEST_INFO *req) {
function BOOL (line 511) | BOOL __cdecl S_FrontEndCheck() {
function BOOL (line 562) | BOOL __cdecl S_SaveGame(LPCVOID saveData, DWORD saveSize, int slotNumber) {
function BOOL (line 606) | BOOL __cdecl S_LoadGame(LPVOID saveData, DWORD saveSize, int slotNumber) {
function Inject_Game (line 634) | void Inject_Game() {
FILE: specific/hwr.cpp
function SetBlendMode (line 48) | static void SetBlendMode(D3DTLVERTEX *vtxPtr, DWORD vtxCount, DWORD mode) {
function DrawAlphaBlended (line 62) | static void DrawAlphaBlended(D3DTLVERTEX *vtxPtr, DWORD vtxCount, DWORD ...
function HRESULT (line 83) | HRESULT HWR_DrawPrimitive(D3DPRIMITIVETYPE primitiveType, LPVOID vertice...
function HWR_InitState (line 118) | void __cdecl HWR_InitState() {
function HWR_ResetTexSource (line 171) | void __cdecl HWR_ResetTexSource() {
function HWR_ResetColorKey (line 181) | void __cdecl HWR_ResetColorKey() {
function HWR_ResetZBuffer (line 190) | void __cdecl HWR_ResetZBuffer() {
function HWR_TexSource (line 208) | void __cdecl HWR_TexSource(HWR_TEXHANDLE texSource) {
function HWR_EnableColorKey (line 219) | void __cdecl HWR_EnableColorKey(bool state) {
function HWR_EnableZBuffer (line 230) | void __cdecl HWR_EnableZBuffer(bool ZWriteEnable, bool ZEnable) {
function HWR_BeginScene (line 256) | void __cdecl HWR_BeginScene() {
function HWR_DrawPolyList (line 264) | void __cdecl HWR_DrawPolyList() {
function HWR_LoadTexturePages (line 371) | void __cdecl HWR_LoadTexturePages(int pagesCount, LPVOID pagesBuffer, RG...
function HWR_FreeTexturePages (line 409) | void __cdecl HWR_FreeTexturePages() {
function HWR_GetPageHandles (line 423) | void __cdecl HWR_GetPageHandles() {
function HWR_VertexBufferFull (line 432) | bool __cdecl HWR_VertexBufferFull() {
function HWR_Init (line 437) | bool __cdecl HWR_Init() {
function Inject_HWR (line 446) | void Inject_HWR() {
FILE: specific/init.cpp
function BOOL (line 81) | BOOL __cdecl S_InitialiseSystem() {
function ShutdownGame (line 96) | void __cdecl ShutdownGame() {
function init_game_malloc (line 103) | void __cdecl init_game_malloc() {
function game_free (line 124) | void __cdecl game_free(DWORD freeSize) {
function CalculateWibbleTable (line 132) | void __cdecl CalculateWibbleTable() {
function S_SeedRandom (line 144) | void __cdecl S_SeedRandom() {
function Inject_Init (line 155) | void Inject_Init() {
FILE: specific/init_3d.cpp
function Enumerate3DDevices (line 31) | void __cdecl Enumerate3DDevices(DISPLAY_ADAPTER *adapter) {
function D3DCreate (line 39) | bool __cdecl D3DCreate() {
function D3DRelease (line 48) | void __cdecl D3DRelease() {
function HRESULT (line 56) | HRESULT CALLBACK Enum3DDevicesCallback(GUID FAR* lpGuid, LPTSTR lpDevice...
function D3DIsSupported (line 73) | bool __cdecl D3DIsSupported(LPD3DDEVICEDESC desc) {
function D3DSetViewport (line 85) | bool __cdecl D3DSetViewport() {
function D3DDeviceCreate (line 112) | void __cdecl D3DDeviceCreate(LPDDS lpBackBuffer) {
function Direct3DRelease (line 196) | void __cdecl Direct3DRelease() {
function Direct3DInit (line 219) | bool __cdecl Direct3DInit() {
function Inject_Init3d (line 226) | void Inject_Init3d() {
FILE: specific/init_display.cpp
function SWRBufferCreate (line 95) | static bool SWRBufferCreate(SWR_BUFFER *buffer, DWORD width, DWORD heigh...
function SWRBufferFree (line 103) | static void SWRBufferFree(SWR_BUFFER *buffer) {
function SWRBufferClear (line 109) | static bool SWRBufferClear(SWR_BUFFER *buffer, BYTE value) {
function FreeCaptureBuffer (line 117) | static void FreeCaptureBuffer() {
function CreateCaptureBuffer (line 124) | static int CreateCaptureBuffer() {
function CreateCaptureBuffer (line 146) | static int CreateCaptureBuffer() {
function CreateScreenBuffers (line 167) | void __cdecl CreateScreenBuffers() {
function CreatePrimarySurface (line 201) | void __cdecl CreatePrimarySurface() {
function CreateBackBuffer (line 217) | void __cdecl CreateBackBuffer() {
function CreateClipper (line 236) | void __cdecl CreateClipper() {
function CreateWindowPalette (line 248) | void __cdecl CreateWindowPalette() {
function CreateZBuffer (line 280) | void __cdecl CreateZBuffer() {
function DWORD (line 301) | DWORD __cdecl GetZBufferDepth() {
function CreateRenderBuffer (line 310) | void __cdecl CreateRenderBuffer() {
function CreatePictureBuffer (line 333) | void __cdecl CreatePictureBuffer() {
function ClearBuffers (line 358) | void __cdecl ClearBuffers(DWORD flags, DWORD fillColor) {
function RestoreLostBuffers (line 444) | void __cdecl RestoreLostBuffers() {
function UpdateFrame (line 494) | void __cdecl UpdateFrame(bool needRunMessageLoop, LPRECT rect) {
function WaitPrimaryBufferFlip (line 554) | void __cdecl WaitPrimaryBufferFlip() {
function RenderInit (line 562) | bool __cdecl RenderInit() {
function RenderStart (line 566) | void __cdecl RenderStart(bool isReset) {
function RenderFinish (line 727) | void __cdecl RenderFinish(bool needToClearTextures) {
function ApplySettings (line 804) | bool __cdecl ApplySettings(APP_SETTINGS *newSettings) {
function FmvBackToGame (line 897) | void __cdecl FmvBackToGame() {
function UpdateGameResolution (line 1091) | void __cdecl UpdateGameResolution() {
function LPCTSTR (line 1103) | LPCTSTR __cdecl DecodeErrorMessage(DWORD errorCode) {
function Inject_InitDisplay (line 1110) | void Inject_InitDisplay() {
FILE: specific/init_input.cpp
function BOOL (line 57) | BOOL CALLBACK DInputEnumJoystickAxisCallback(LPCDIDEVICEOBJECTINSTANCE p...
function BOOL (line 87) | static BOOL CALLBACK RawInputCallBack(LPGUID lpGuid, LPCTSTR lpDeviceNam...
function SetJoystickOutput (line 119) | void SetJoystickOutput(WORD leftMotor, WORD rightMotor, DWORD ledColor) {
function JOYTYPE (line 147) | JOYTYPE GetJoystickType() {
function IsJoyVibrationSupported (line 162) | bool IsJoyVibrationSupported() {
function IsJoyLedColorSupported (line 172) | bool IsJoyLedColorSupported() {
function IsJoyVibrationEnabled (line 176) | bool IsJoyVibrationEnabled() {
function IsJoyLedColorEnabled (line 180) | bool IsJoyLedColorEnabled() {
function DInputCreate (line 188) | bool __cdecl DInputCreate() {
function DInputRelease (line 196) | void __cdecl DInputRelease() {
function WinInReadKeyboard (line 203) | void __cdecl WinInReadKeyboard(LPVOID lpInputData) {
function PovToPos (line 214) | static void PovToPos(int *xPos, int *yPos, DWORD pov) {
function SelectJoyDirection (line 229) | static int SelectJoyDirection(int dp, int ls, int rs, int threshold) {
function DWORD (line 239) | static DWORD XInputReadJoystick(int *xPos, int *yPos) {
function DWORD (line 284) | static DWORD RawInputReadJoystick(int *xPos, int *yPos) {
function DWORD (line 360) | DWORD __cdecl WinInReadJoystick(int *xPos, int *yPos) {
function WinInputInit (line 406) | bool __cdecl WinInputInit() {
function DInputEnumDevices (line 430) | bool __cdecl DInputEnumDevices(JOYSTICK_LIST *joystickList) {
function BOOL (line 465) | BOOL CALLBACK DInputEnumDevicesCallback(LPCDIDEVICEINSTANCE lpddi, LPVOI...
function FlaggedStringCreate (line 509) | void __thiscall FlaggedStringCreate(STRING_FLAGGED *item, DWORD dwSize) {
function DInputKeyboardCreate (line 533) | void __cdecl DInputKeyboardCreate() {
function DInputKeyboardRelease (line 547) | void __cdecl DInputKeyboardRelease() {
function DInputJoystickCreate (line 555) | bool __cdecl DInputJoystickCreate() {
function DInputJoystickRelease (line 601) | void __cdecl DInputJoystickRelease() {
function WinInStart (line 616) | void __cdecl WinInStart() {
function WinInFinish (line 624) | void __cdecl WinInFinish() {
function WinInRunControlPanel (line 630) | void __cdecl WinInRunControlPanel(HWND hWnd) {
function Inject_InitInput (line 649) | void Inject_InitInput() {
FILE: specific/init_input.h
type JOYTYPE (line 28) | typedef enum {
FILE: specific/init_sound.cpp
function WinSndFreeAllSamples (line 47) | void __cdecl WinSndFreeAllSamples() {
function WinSndMakeSample (line 59) | bool __cdecl WinSndMakeSample(DWORD sampleIdx, LPWAVEFORMATEX format, co...
function WinSndIsChannelPlaying (line 94) | bool __cdecl WinSndIsChannelPlaying(DWORD channel) {
function WinSndPlaySample (line 109) | int __cdecl WinSndPlaySample(DWORD sampleIdx, int volume, DWORD pitch, i...
function WinSndGetFreeChannelIndex (line 132) | int __cdecl WinSndGetFreeChannelIndex() {
function WinSndAdjustVolumeAndPan (line 146) | void __cdecl WinSndAdjustVolumeAndPan(int channel, int volume, int pan) {
function WinSndAdjustPitch (line 153) | void __cdecl WinSndAdjustPitch(int channel, DWORD pitch) {
function WinSndStopSample (line 159) | void __cdecl WinSndStopSample(int channel) {
function WinSndInit (line 167) | bool __cdecl WinSndInit() {
function DSoundEnumerate (line 195) | bool __cdecl DSoundEnumerate(SOUND_ADAPTER_LIST *adapterList) {
function BOOL (line 199) | BOOL CALLBACK DSoundEnumCallback(LPGUID lpGuid, LPCTSTR lpcstrDescriptio...
function WinSndStart (line 234) | void __cdecl WinSndStart(HWND hWnd) {
function DSoundCreate (line 263) | bool __cdecl DSoundCreate(GUID *lpGuid) {
function DSoundBufferTest (line 271) | bool __cdecl DSoundBufferTest() {
function WinSndFinish (line 298) | void __cdecl WinSndFinish() {
function WinSndIsSoundEnabled (line 306) | bool __cdecl WinSndIsSoundEnabled() {
function Inject_InitSound (line 313) | void Inject_InitSound() {
FILE: specific/input.cpp
function BOOL (line 43) | static BOOL JoyKey(KEYMAP keyMap) {
function BOOL (line 55) | static BOOL KbdKey(KEYMAP keyMap, bool isCustom) {
function BOOL (line 72) | BOOL __cdecl Key(KEYMAP keyMap) {
function Inject_Input (line 722) | void Inject_Input() {
FILE: specific/option.cpp
function UpdateJoystickHintText (line 287) | static void UpdateJoystickHintText(HINT_MODE selectMode, HINT_MODE conti...
function RemoveJoystickHintText (line 308) | void RemoveJoystickHintText(bool isSelect, bool isContinue, bool isDesel...
function DisplayJoystickHintText (line 323) | void DisplayJoystickHintText(bool isSelect, bool isContinue, bool isDese...
function DrawVolumeBar (line 359) | static void DrawVolumeBar(int x, int y, int percent, int alpha) {
function DisplayVolumeBars (line 378) | void DisplayVolumeBars(bool isSmooth) {
function SetPassportRequesterSize (line 527) | void SetPassportRequesterSize(REQUEST_INFO *req) {
function do_inventory_options (line 540) | void __cdecl do_inventory_options(INVENTORY_ITEM *item) {
function SetPassportTextInfo (line 612) | static void SetPassportTextInfo(GAME_STRING_ID id, bool left, bool right) {
function do_gamma_option (line 886) | void __cdecl do_gamma_option(INVENTORY_ITEM *item) {
function do_detail_option (line 890) | void __cdecl do_detail_option(INVENTORY_ITEM *item) {
function do_sound_option (line 954) | void __cdecl do_sound_option(INVENTORY_ITEM *item) {
function do_compass_option (line 1118) | void __cdecl do_compass_option(INVENTORY_ITEM *item) {
function FlashConflicts (line 1142) | void __cdecl FlashConflicts() {
function DefaultConflict (line 1164) | void __cdecl DefaultConflict() {
function do_control_option (line 1189) | void __cdecl do_control_option(INVENTORY_ITEM *item) {
function S_ShowControls (line 1503) | void __cdecl S_ShowControls() {
function S_ChangeCtrlText (line 1688) | void __cdecl S_ChangeCtrlText() {
function S_RemoveCtrlText (line 1756) | void __cdecl S_RemoveCtrlText() {
function Inject_Option (line 1772) | void Inject_Option() {
FILE: specific/output.cpp
type ShadowInfo_t (line 71) | struct ShadowInfo_t {
function SWR_StretchBlt (line 85) | static bool SWR_StretchBlt(SWR_BUFFER *dstBuf, RECT *dstRect, SWR_BUFFER...
function GetRenderScale (line 164) | int __cdecl GetRenderScale(int unit) {
function GetRenderHeightDownscaled (line 177) | int __cdecl GetRenderHeightDownscaled() {
function GetRenderWidthDownscaled (line 181) | int __cdecl GetRenderWidthDownscaled() {
function GetRenderHeight (line 185) | int __cdecl GetRenderHeight() {
function GetRenderWidth (line 189) | int __cdecl GetRenderWidth() {
function S_InitialisePolyList (line 193) | void __cdecl S_InitialisePolyList(BOOL clearBackBuffer) {
function DWORD (line 254) | DWORD __cdecl S_DumpScreen() {
function S_ClearScreen (line 260) | void __cdecl S_ClearScreen() {
function S_InitialiseScreen (line 264) | void __cdecl S_InitialiseScreen(GF_LEVEL_TYPE levelType) {
function S_OutputPolyList (line 282) | void __cdecl S_OutputPolyList() {
function S_GetObjectBounds (line 341) | int __cdecl S_GetObjectBounds(__int16 *bPtr) {
function S_InsertBackPolygon (line 416) | void __cdecl S_InsertBackPolygon(int x0, int y0, int x1, int y1) {
function S_PrintShadow (line 422) | void __cdecl S_PrintShadow(__int16 radius, __int16 *bPtr, ITEM_INFO *ite...
function S_CalculateLight (line 500) | void __cdecl S_CalculateLight(int x, int y, int z, __int16 roomNumber) {
function S_CalculateStaticLight (line 614) | void __cdecl S_CalculateStaticLight(__int16 adder) {
function S_CalculateStaticMeshLight (line 629) | void __cdecl S_CalculateStaticMeshLight(int x, int y, int z, int shade1,...
function S_LightRoom (line 665) | void __cdecl S_LightRoom(ROOM_INFO *room) {
function S_DrawHealthBar (line 732) | void __cdecl S_DrawHealthBar(int percent) {
function S_DrawAirBar (line 812) | void __cdecl S_DrawAirBar(int percent) {
function AnimateTextures (line 885) | void __cdecl AnimateTextures(int nTicks) {
function S_SetupBelowWater (line 910) | void __cdecl S_SetupBelowWater(BOOL underwater) {
function S_SetupAboveWater (line 920) | void __cdecl S_SetupAboveWater(BOOL underwater) {
function S_AnimateTextures (line 926) | void __cdecl S_AnimateTextures(int nTicks) {
function S_DisplayPicture (line 941) | void __cdecl S_DisplayPicture(LPCTSTR fileName, BOOL isTitle) {
function S_SyncPictureBufferPalette (line 996) | void __cdecl S_SyncPictureBufferPalette() {
function S_DontDisplayPicture (line 1020) | void __cdecl S_DontDisplayPicture() {
function ScreenDump (line 1027) | void __cdecl ScreenDump() {
function ScreenPartialDump (line 1031) | void __cdecl ScreenPartialDump() {
function FadeToPal (line 1035) | void __cdecl FadeToPal(int fadeValue, RGB888 *palette) {
function ScreenClear (line 1096) | void __cdecl ScreenClear(bool isPhdWinSize) {
function S_CopyBufferToScreen (line 1202) | void __cdecl S_CopyBufferToScreen() {
function BOOL (line 1299) | BOOL __cdecl DecompPCX(LPCBYTE pcx, DWORD pcxSize, LPBYTE pic, RGB888 *p...
function GetPcxResolution (line 1355) | int GetPcxResolution(LPCBYTE pcx, DWORD pcxSize, DWORD *width, DWORD *he...
function Inject_Output (line 1383) | void Inject_Output() {
FILE: specific/registry.cpp
function BYTE (line 29) | static inline BYTE HexChar(char c) {
function LPCTSTR (line 39) | LPCTSTR __cdecl GuidBinaryToString(GUID *guid) {
function GuidStringToBinary (line 56) | bool __cdecl GuidStringToBinary(LPCTSTR lpString, GUID *guid) {
function BOOL (line 73) | BOOL __cdecl OpenRegistryKey(LPCTSTR lpSubKey) {
function IsNewRegistryKeyCreated (line 77) | bool __cdecl IsNewRegistryKeyCreated() {
function LONG (line 81) | LONG __cdecl CloseRegistryKey() {
function LONG (line 85) | LONG __cdecl SetRegistryDwordValue(LPCTSTR lpValueName, DWORD value) {
function LONG (line 89) | LONG __cdecl SetRegistryBoolValue(LPCTSTR lpValueName, bool value) {
function LONG (line 94) | LONG __cdecl SetRegistryFloatValue(LPCTSTR lpValueName, double value) {
function LONG (line 102) | LONG __cdecl SetRegistryBinaryValue(LPCTSTR lpValueName, LPBYTE value, D...
function LONG (line 109) | LONG __cdecl SetRegistryStringValue(LPCTSTR lpValueName, LPCTSTR value, ...
function LONG (line 119) | LONG __cdecl DeleteRegistryValue(LPCTSTR lpValueName) {
function GetRegistryDwordValue (line 123) | bool __cdecl GetRegistryDwordValue(LPCTSTR lpValueName, DWORD *pValue, D...
function GetRegistryBoolValue (line 138) | bool __cdecl GetRegistryBoolValue(LPCTSTR lpValueName, bool *pValue, boo...
function GetRegistryFloatValue (line 154) | bool __cdecl GetRegistryFloatValue(LPCTSTR lpValueName, double *value, d...
function GetRegistryBinaryValue (line 167) | bool __cdecl GetRegistryBinaryValue(LPCTSTR lpValueName, LPBYTE value, D...
function GetRegistryStringValue (line 185) | bool __cdecl GetRegistryStringValue(LPCTSTR lpValueName, LPTSTR value, D...
function GetRegistryGuidValue (line 209) | bool __cdecl GetRegistryGuidValue(LPCTSTR lpValueName, GUID *value, GUID...
function Inject_Registry (line 233) | void Inject_Registry() {
FILE: specific/screenshot.cpp
function DWORD (line 43) | static DWORD WINAPI SaveImageTask(CONST LPVOID lpParam) {
function ScreenShotPNG (line 55) | static void __cdecl ScreenShotPNG(LPDDS screen) {
function ScreenShotTGA (line 136) | static void __cdecl ScreenShotTGA(LPDDS screen, BYTE tgaBpp) {
function ScreenShotPCX (line 327) | void __cdecl ScreenShotPCX() {
function DWORD (line 386) | DWORD __cdecl CompPCX(BYTE *bitmap, DWORD width, DWORD height, RGB888 *p...
function DWORD (line 424) | DWORD __cdecl EncodeLinePCX(BYTE *src, DWORD width, BYTE *dst) {
function DWORD (line 469) | DWORD __cdecl EncodePutPCX(BYTE value, BYTE num, BYTE *buffer) {
function ScreenShot (line 485) | void __cdecl ScreenShot(LPDDS screen) {
function Inject_Screenshot (line 542) | void Inject_Screenshot() {
FILE: specific/setupdlg.cpp
function OpenGameRegistryKey (line 72) | bool __cdecl OpenGameRegistryKey(LPCTSTR key) {
function LONG (line 81) | LONG __cdecl CloseGameRegistryKey() {
function SE_WriteAppSettings (line 85) | bool __cdecl SE_WriteAppSettings(APP_SETTINGS *settings) {
function SE_ReadAppSettings (line 156) | int __cdecl SE_ReadAppSettings(APP_SETTINGS *settings) {
function SE_GraphicsTestStart (line 269) | bool __cdecl SE_GraphicsTestStart() {
function SE_GraphicsTestFinish (line 288) | void __cdecl SE_GraphicsTestFinish() {
function SE_GraphicsTestExecute (line 294) | int __cdecl SE_GraphicsTestExecute() {
function SE_GraphicsTest (line 298) | int __cdecl SE_GraphicsTest() {
function SE_DefaultGraphicsSettings (line 310) | void __cdecl SE_DefaultGraphicsSettings() {
function SE_SoundTestStart (line 393) | bool __cdecl SE_SoundTestStart() {
function SE_SoundTestFinish (line 412) | void __cdecl SE_SoundTestFinish() {
function SE_SoundTestExecute (line 416) | int __cdecl SE_SoundTestExecute() {
function SE_SoundTest (line 425) | int __cdecl SE_SoundTest() {
function SE_PropSheetCallback (line 439) | int CALLBACK SE_PropSheetCallback(HWND hwndDlg, UINT uMsg, LPARAM lParam) {
function LRESULT (line 453) | LRESULT CALLBACK SE_NewPropSheetWndProc(HWND hWnd, UINT uMsg, WPARAM wPa...
function SE_ShowSetupDialog (line 467) | bool __cdecl SE_ShowSetupDialog(HWND hParent, bool isDefault) {
function INT_PTR (line 522) | INT_PTR CALLBACK SE_GraphicsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wPar...
function SE_GraphicsDlgFullScreenModesUpdate (line 648) | void __cdecl SE_GraphicsDlgFullScreenModesUpdate(HWND hwndDlg) {
function SE_GraphicsAdapterSet (line 733) | void __cdecl SE_GraphicsAdapterSet(HWND hwndDlg, DISPLAY_ADAPTER_NODE *a...
function SE_GraphicsDlgUpdate (line 738) | void __cdecl SE_GraphicsDlgUpdate(HWND hwndDlg) {
function SE_GraphicsDlgInit (line 1029) | void __cdecl SE_GraphicsDlgInit(HWND hwndDlg) {
function INT_PTR (line 1071) | INT_PTR CALLBACK SE_SoundDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,...
function SE_SoundAdapterSet (line 1115) | void __cdecl SE_SoundAdapterSet(HWND hwndDlg, SOUND_ADAPTER_NODE *adapte...
function SE_SoundDlgUpdate (line 1119) | void __cdecl SE_SoundDlgUpdate(HWND hwndDlg) {
function SE_SoundDlgInit (line 1151) | void __cdecl SE_SoundDlgInit(HWND hwndDlg) {
function INT_PTR (line 1177) | INT_PTR CALLBACK SE_ControlsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wPar...
function SE_ControlsJoystickSet (line 1211) | void __cdecl SE_ControlsJoystickSet(HWND hwndDlg, JOYSTICK_NODE *joystic...
function SE_ControlsDlgUpdate (line 1215) | void __cdecl SE_ControlsDlgUpdate(HWND hwndDlg) {
function SE_ControlsDlgInit (line 1231) | void __cdecl SE_ControlsDlgInit(HWND hwndDlg) {
function INT_PTR (line 1256) | INT_PTR CALLBACK SE_OptionsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wPara...
function SE_OptionsDlgUpdate (line 1276) | void __cdecl SE_OptionsDlgUpdate(HWND hwndDlg) {
function SE_OptionsStrCat (line 1354) | void __cdecl SE_OptionsStrCat(LPTSTR *dstString, bool isEnabled, bool *i...
function INT_PTR (line 1369) | INT_PTR CALLBACK SE_AdvancedDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wPar...
function SE_AdvancedDlgUpdate (line 1413) | void __cdecl SE_AdvancedDlgUpdate(HWND hwndDlg) {
function SE_AdvancedDlgInit (line 1436) | void __cdecl SE_AdvancedDlgInit(HWND hwndDlg) {
function HWND (line 1440) | HWND __cdecl SE_FindSetupDialog() {
function Inject_SetupDlg (line 1447) | void Inject_SetupDlg() {
FILE: specific/setupwnd.cpp
function SE_CenterBitmapResource (line 32) | static void SE_CenterBitmapResource(HWND hWnd, BITMAP_RESOURCE *pBitmap,...
function SE_ReleaseBitmapResource (line 48) | void __thiscall SE_ReleaseBitmapResource(BITMAP_RESOURCE *bmpRsrc) {
function SE_LoadBitmapResource (line 60) | void __thiscall SE_LoadBitmapResource(BITMAP_RESOURCE *bmpRsrc, LPCTSTR ...
function SE_DrawBitmap (line 92) | void __thiscall SE_DrawBitmap(BITMAP_RESOURCE *bmpRsrc, HDC hdc, int x, ...
function SE_UpdateBitmapPalette (line 108) | void __thiscall SE_UpdateBitmapPalette(BITMAP_RESOURCE *bmpRsrc, HWND hW...
function SE_ChangeBitmapPalette (line 113) | void __thiscall SE_ChangeBitmapPalette(BITMAP_RESOURCE *bmpRsrc, HWND hW...
function SE_RegisterSetupWindowClass (line 128) | bool __cdecl SE_RegisterSetupWindowClass() {
function LRESULT (line 141) | LRESULT CALLBACK SE_SetupWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam,...
function SE_PassMessageToImage (line 200) | void __cdecl SE_PassMessageToImage(HWND hWnd, UINT uMsg, WPARAM wParam) {
function Inject_SetupWnd (line 208) | void Inject_SetupWnd() {
FILE: specific/smain.cpp
function SaveAssault (line 119) | void SaveAssault() {
function BOOL (line 126) | BOOL __cdecl GameMain() {
function __int16 (line 285) | __int16 __cdecl TitleSequence() {
function CheckCheatMode (line 359) | void __cdecl CheckCheatMode() {
function S_SaveSettings (line 520) | void __cdecl S_SaveSettings() {
function S_LoadSettings (line 552) | void __cdecl S_LoadSettings() {
function EnableLevelSelect (line 704) | void __cdecl EnableLevelSelect() {
function Inject_SMain (line 721) | void Inject_SMain() {
FILE: specific/sndpc.cpp
function S_SoundPlaySample (line 47) | int __cdecl S_SoundPlaySample(int channel, UINT16 volume, int pitch, int...
function S_Sound_CalculateSampleVolume (line 56) | int __cdecl S_Sound_CalculateSampleVolume(DWORD volume) {
function S_Sound_CalculateSamplePan (line 60) | int __cdecl S_Sound_CalculateSamplePan(__int16 pan) {
function S_SoundPlaySampleLooped (line 64) | int __cdecl S_SoundPlaySampleLooped(int channel, UINT16 volume, DWORD pi...
function S_SoundSetPanAndVolume (line 73) | void __cdecl S_SoundSetPanAndVolume(int channel, int pan, UINT16 volume) {
function S_SoundSetPitch (line 81) | void __cdecl S_SoundSetPitch(int channel, DWORD pitch) {
function S_SoundSetMasterVolume (line 86) | void __cdecl S_SoundSetMasterVolume(DWORD volume) {
function S_SoundStopSample (line 90) | void __cdecl S_SoundStopSample(int channel) {
function S_SoundStopAllSamples (line 95) | void __cdecl S_SoundStopAllSamples() {
function BOOL (line 101) | BOOL __cdecl S_SoundSampleIsPlaying(int channel) {
function CD_Init (line 108) | bool __cdecl CD_Init() {
function CD_Cleanup (line 137) | void __cdecl CD_Cleanup() {
function S_CDLoop (line 155) | void __cdecl S_CDLoop() {
function S_CDPlay (line 180) | void __cdecl S_CDPlay(__int16 trackID, BOOL isLooped) {
function S_CDStop (line 206) | void __cdecl S_CDStop() {
function BOOL (line 223) | BOOL __cdecl StartSyncedAudio(int trackID) {
function DWORD (line 245) | DWORD __cdecl S_CDGetLoc() {
function S_CDVolume (line 263) | void __cdecl S_CDVolume(DWORD volume) {
function DWORD (line 301) | DWORD __cdecl S_GetCDVolume() {
function Inject_SndPC (line 308) | void Inject_SndPC() {
FILE: specific/texture.cpp
function DWORD (line 69) | static DWORD GetEnvmapSide() {
function CreateEnvmapTexture (line 79) | static bool __cdecl CreateEnvmapTexture() {
function CreateEnvmapBufferSurface (line 87) | static bool __cdecl CreateEnvmapBufferSurface() {
function FreeEnvmapTexture (line 108) | void FreeEnvmapTexture() {
function SetEnvmapTexture (line 116) | bool SetEnvmapTexture(LPDDS surface) {
function HWR_TEXHANDLE (line 153) | HWR_TEXHANDLE GetEnvmapTextureHandle() {
function DWORD (line 162) | DWORD GetMaxTextureSize() {
function GetTextureSideByPage (line 170) | int GetTextureSideByPage(int page) {
function GetTextureSideByHandle (line 177) | int GetTextureSideByHandle(HWR_TEXHANDLE handle) {
function CopyBitmapPalette (line 186) | void __cdecl CopyBitmapPalette(RGB888 *srcPal, BYTE *srcBitmap, int bitm...
function BYTE (line 239) | BYTE __cdecl FindNearestPaletteEntry(RGB888 *palette, int red, int green...
function SyncSurfacePalettes (line 267) | void __cdecl SyncSurfacePalettes(void *srcData, int width, int height, i...
function CreateTexturePalette (line 288) | int __cdecl CreateTexturePalette(RGB888 *pal) {
function GetFreePaletteIndex (line 322) | int __cdecl GetFreePaletteIndex() {
function FreePalette (line 330) | void __cdecl FreePalette(int paletteIndex) {
function SafeFreePalette (line 341) | void __cdecl SafeFreePalette(int paletteIndex) {
function CreateTexturePage (line 350) | int __cdecl CreateTexturePage(int width, int height, LPDIRECTDRAWPALETTE...
function CreateTexturePageSurface (line 375) | bool __cdecl CreateTexturePageSurface(TEXPAGE_DESC *desc) {
function GetFreeTexturePageIndex (line 392) | int __cdecl GetFreeTexturePageIndex() {
function TexturePageInit (line 401) | bool __cdecl TexturePageInit(TEXPAGE_DESC *page) {
function LPDIRECT3DTEXTURE2 (line 450) | LPDIRECT3DTEXTURE2 __cdecl Create3DTexture(LPDDS surface) {
function SafeFreeTexturePage (line 459) | void __cdecl SafeFreeTexturePage(int pageIndex) {
function FreeTexturePage (line 465) | void __cdecl FreeTexturePage(int pageIndex) {
function TexturePageReleaseVidMemSurface (line 483) | void __cdecl TexturePageReleaseVidMemSurface(TEXPAGE_DESC *page) {
function ReloadTextures (line 496) | bool __cdecl ReloadTextures(bool reset) {
function FreeTexturePages (line 507) | void __cdecl FreeTexturePages() {
function LoadTexturePage (line 521) | bool __cdecl LoadTexturePage(int pageIndex, bool reset) {
function HWR_TEXHANDLE (line 553) | HWR_TEXHANDLE __cdecl GetTexturePageHandle(int pageIndex) {
function AddTexturePage8 (line 570) | int __cdecl AddTexturePage8(int width, int height, BYTE *pageBuffer, int...
function AddTexturePage16 (line 627) | int __cdecl AddTexturePage16(int width, int height, BYTE *pageBuffer) {
function AddTexturePage32 (line 706) | int AddTexturePage32(int width, int height, BYTE *pageBuffer, bool alpha) {
function AddExternalTexture (line 727) | int AddExternalTexture(LPCTSTR fileName, bool alpha) {
function IsExternalTexture (line 753) | bool IsExternalTexture(int page) {
function HRESULT (line 765) | HRESULT CALLBACK EnumTextureFormatsCallback(LPDDSDESC lpDdsd, LPVOID lpC...
function HRESULT (line 805) | HRESULT __cdecl EnumerateTextureFormats() {
function CleanupTextures (line 817) | void __cdecl CleanupTextures() {
function InitTextures (line 825) | bool __cdecl InitTextures() {
function Inject_Texture (line 834) | void Inject_Texture() {
FILE: specific/utils.cpp
function DWORD (line 29) | DWORD __cdecl SyncTicks(DWORD skip) {
function UpdateTicks (line 41) | void __cdecl UpdateTicks() {
function TIME_Init (line 48) | bool __cdecl TIME_Init() {
function DWORD (line 60) | DWORD __cdecl Sync() {
function LPVOID (line 66) | LPVOID __cdecl UT_LoadResource(LPCTSTR lpName, LPCTSTR lpType) {
function UT_InitAccurateTimer (line 79) | void __cdecl UT_InitAccurateTimer() {
function UT_Microseconds (line 92) | double __cdecl UT_Microseconds() {
function BOOL (line 99) | BOOL __cdecl UT_CenterWindow(HWND hWnd) {
function LPTSTR (line 111) | LPTSTR __cdecl UT_FindArg(LPCTSTR str) {
function UT_MessageBox (line 116) | int __cdecl UT_MessageBox(LPCTSTR lpText, HWND hWnd) {
function UT_ErrorBox (line 120) | int __cdecl UT_ErrorBox(UINT uID, HWND hWnd) {
function BOOL (line 129) | BOOL __cdecl CD_NoteAlert(LPCTSTR lpTemplateName, HWND hWndParent) {
function INT_PTR (line 133) | INT_PTR CALLBACK DialogBoxProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L...
function UT_MemBlt (line 153) | void __cdecl UT_MemBlt(BYTE *dstBuf, DWORD dstX, DWORD dstY, DWORD width...
function Inject_Utils (line 169) | void Inject_Utils() {
FILE: specific/winmain.cpp
function SEH_TR (line 53) | static void SEH_TR(unsigned int error, EXCEPTION_POINTERS* pExp) {
function SetGold (line 61) | void SetGold(bool state) {
function IsGold (line 65) | bool IsGold() {
function RenderErrorBox (line 70) | int __cdecl RenderErrorBox(int errorCode) {
function WinMain (line 77) | int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTST...
function WinCleanup (line 193) | void __cdecl WinCleanup() {
function WinGameStart (line 202) | int __cdecl WinGameStart() {
function WinGameFinish (line 214) | void __cdecl WinGameFinish() {
function S_ExitSystem (line 224) | void __cdecl S_ExitSystem(LPCTSTR message) {
function Inject_WinMain (line 235) | void Inject_WinMain() {
FILE: specific/winvid.cpp
function setWindowStyle (line 36) | static void setWindowStyle(bool isFullScreen) {
function InsertDisplayModeInListSorted (line 55) | static bool InsertDisplayModeInListSorted(DISPLAY_MODE_LIST *modeList, D...
function DisplayModeListCopy (line 83) | static bool DisplayModeListCopy(DISPLAY_MODE_LIST *dst, DISPLAY_MODE_LIS...
function FlaggedStringCopy (line 98) | bool FlaggedStringCopy(STRING_FLAGGED *dst, STRING_FLAGGED *src) {
function DDrawCreate (line 120) | bool __cdecl DDrawCreate(LPGUID lpGUID) {
function DDrawRelease (line 131) | void __cdecl DDrawRelease() {
function GameWindowCalculateSizeFromClient (line 143) | void __cdecl GameWindowCalculateSizeFromClient(int *width, int *height) {
function GameWindowCalculateSizeFromClientByZero (line 155) | void __cdecl GameWindowCalculateSizeFromClientByZero(int *width, int *he...
function WinVidSetMinWindowSize (line 167) | void __cdecl WinVidSetMinWindowSize(int width, int height) {
function WinVidClearMinWindowSize (line 176) | void __cdecl WinVidClearMinWindowSize() {
function WinVidSetMaxWindowSize (line 180) | void __cdecl WinVidSetMaxWindowSize(int width, int height) {
function WinVidClearMaxWindowSize (line 189) | void __cdecl WinVidClearMaxWindowSize() {
function CalculateWindowWidth (line 193) | int __cdecl CalculateWindowWidth(int width, int height) {
function CalculateWindowHeight (line 205) | int __cdecl CalculateWindowHeight(int width, int height) {
function WinVidGetMinMaxInfo (line 217) | bool __cdecl WinVidGetMinMaxInfo(LPMINMAXINFO info) {
function HWND (line 258) | HWND __cdecl WinVidFindGameWindow() {
function WinVidSpinMessageLoop (line 262) | bool __cdecl WinVidSpinMessageLoop(bool needWait) {
function WinVidShowGameWindow (line 294) | void __cdecl WinVidShowGameWindow(int nCmdShow) {
function WinVidHideGameWindow (line 304) | void __cdecl WinVidHideGameWindow() {
function WinVidSetGameWindowSize (line 314) | void __cdecl WinVidSetGameWindowSize(int width, int height) {
function ShowDDrawGameWindow (line 320) | bool __cdecl ShowDDrawGameWindow(bool active) {
function HideDDrawGameWindow (line 353) | bool __cdecl HideDDrawGameWindow() {
function HRESULT (line 375) | HRESULT __cdecl DDrawSurfaceCreate(LPDDSDESC dsp, LPDDS *surface) {
function HRESULT (line 387) | HRESULT __cdecl DDrawSurfaceRestoreLost(LPDDS surface1, LPDDS surface2, ...
function WinVidClearBuffer (line 402) | bool __cdecl WinVidClearBuffer(LPDDS surface, LPRECT rect, DWORD fillCol...
function HRESULT (line 415) | HRESULT __cdecl WinVidBufferLock(LPDDS surface, LPDDSDESC desc, DWORD fl...
function HRESULT (line 426) | HRESULT __cdecl WinVidBufferUnlock(LPDDS surface, LPDDSDESC desc) {
function WinVidCopyBitmapToBuffer (line 434) | bool __cdecl WinVidCopyBitmapToBuffer(LPDDS surface, BYTE *bitmap) {
function DWORD (line 456) | DWORD __cdecl GetRenderBitDepth(DWORD dwRGBBitCount) {
function WinVidGetColorBitMasks (line 469) | void __thiscall WinVidGetColorBitMasks(COLOR_BIT_MASKS *bm, LPDDPIXELFOR...
function BitMaskGetNumberOfBits (line 481) | void __cdecl BitMaskGetNumberOfBits(DWORD bitMask, DWORD *bitDepth, DWOR...
function DWORD (line 501) | DWORD __cdecl CalculateCompatibleColor(COLOR_BIT_MASKS *mask, int red, i...
function WinVidGetDisplayMode (line 509) | bool __cdecl WinVidGetDisplayMode(DISPLAY_MODE *dispMode) {
function WinVidGoFullScreen (line 555) | bool __cdecl WinVidGoFullScreen(DISPLAY_MODE *dispMode) {
function WinVidGoWindowed (line 590) | bool __cdecl WinVidGoWindowed(int width, int height, DISPLAY_MODE *dispM...
function WinVidSetDisplayAdapter (line 641) | void __cdecl WinVidSetDisplayAdapter(DISPLAY_ADAPTER *dispAdapter) {
function CompareVideoModes (line 675) | bool __thiscall CompareVideoModes(DISPLAY_MODE *mode1, DISPLAY_MODE *mod...
function DeleteDisplayMode (line 698) | static void DeleteDisplayMode(DISPLAY_MODE_LIST *modeList, DISPLAY_MODE_...
function DWORD (line 710) | static DWORD GetProgressiveDisplayModes(DWORD bpp, DEVMODE *modes, DWORD...
function IsModeInList (line 737) | static bool IsModeInList(DISPLAY_MODE *mode, DEVMODE *modes, DWORD modeN...
function FilterDisplayModes (line 750) | static void FilterDisplayModes(DISPLAY_MODE_LIST *modeList) {
function WinVidGetDisplayModes (line 779) | bool __cdecl WinVidGetDisplayModes() {
function HRESULT (line 817) | HRESULT WINAPI EnumDisplayModesCallback(LPDDSDESC lpDDSurfaceDesc, LPVOI...
function WinVidInit (line 893) | bool __cdecl WinVidInit() {
function WinVidGetDisplayAdapters (line 933) | bool __cdecl WinVidGetDisplayAdapters() {
function FlaggedStringDelete (line 968) | void __thiscall FlaggedStringDelete(STRING_FLAGGED *item) {
function EnumerateDisplayAdapters (line 976) | bool __cdecl EnumerateDisplayAdapters(DISPLAY_ADAPTER_LIST *displayAdapt...
function BOOL (line 1026) | BOOL WINAPI EnumDisplayAdaptersCallback(GUID FAR *lpGUID, LPTSTR lpDrive...
function FlaggedStringsCreate (line 1090) | void __thiscall FlaggedStringsCreate(DISPLAY_ADAPTER *adapter) {
function WinVidRegisterGameWindowClass (line 1107) | bool __cdecl WinVidRegisterGameWindowClass() {
function LRESULT (line 1122) | LRESULT CALLBACK WinVidGameWindowProc(HWND hWnd, UINT Msg, WPARAM wParam...
function WinVidResizeGameWindow (line 1320) | void __cdecl WinVidResizeGameWindow(HWND hWnd, int edge, LPRECT rect) {
function WinVidCheckGameWindowPalette (line 1389) | bool __cdecl WinVidCheckGameWindowPalette(HWND hWnd) {
function WinVidCreateGameWindow (line 1410) | bool __cdecl WinVidCreateGameWindow() {
function WinVidFreeWindow (line 1441) | void __cdecl WinVidFreeWindow() {
function WinVidExitMessage (line 1446) | void __cdecl WinVidExitMessage() {
function WinVidStart (line 1466) | void __cdecl WinVidStart() {
function WinVidFinish (line 1492) | void __cdecl WinVidFinish() {
function DisplayModeListInit (line 1500) | void __thiscall DisplayModeListInit(DISPLAY_MODE_LIST *pList) {
function DisplayModeListDelete (line 1506) | void __thiscall DisplayModeListDelete(DISPLAY_MODE_LIST *pList) {
function Inject_WinVid (line 1576) | void Inject_WinVid() {
Condensed preview — 212 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,992K chars).
[
{
"path": ".gitignore",
"chars": 93,
"preview": "*.exe\n*.dll\n*.lib\n*.exp\n*.gch\n*.layout\n*.depend\n*.cscope_file_list\ncscope.out\n\nobj/\nbin/\ndoc/"
},
{
"path": "3dsystem/3d_gen.cpp",
"chars": 34139,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "3dsystem/3d_gen.h",
"chars": 3130,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "3dsystem/3d_out.cpp",
"chars": 21159,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "3dsystem/3d_out.h",
"chars": 2219,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "3dsystem/3dinsert.cpp",
"chars": 79669,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "3dsystem/3dinsert.h",
"chars": 5571,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "3dsystem/phd_math.cpp",
"chars": 27590,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "3dsystem/phd_math.h",
"chars": 1214,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "3dsystem/scalespr.cpp",
"chars": 9541,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "3dsystem/scalespr.h",
"chars": 1663,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "CHANGELOG.md",
"chars": 23041,
"preview": "\n# Changelog\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "COPYING.md",
"chars": 35229,
"preview": "GNU GENERAL PUBLIC LICENSE\n==========================\nVersion 3, 29 June 2007\n==========================\n\n> Copyright (C"
},
{
"path": "Doxyfile",
"chars": 108635,
"preview": "# Doxyfile 1.8.13\n\n# This file describes the settings to be used by the documentation system\n# doxygen (www.doxygen.org)"
},
{
"path": "README.md",
"chars": 2316,
"preview": "# TR2Main\n\nThis is an open source implementation of the classic Tomb Raider II game (1997), made by reverse engineering "
},
{
"path": "TR2Main.cbp",
"chars": 14007,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n<CodeBlocks_project_file>\n\t<FileVersion major=\"1\" minor=\"6\" />\n"
},
{
"path": "TR2Main.cpp",
"chars": 6049,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "TR2Main.rc",
"chars": 2365,
"preview": "/*\n * Copyright (c) 2017-2023 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "TR2_progress.txt",
"chars": 40572,
"preview": "x function is unused / included in another function\n+ function is reimplemented in DLL\n* function used by DLL from EXE\n\n"
},
{
"path": "binaries/README.md",
"chars": 1636,
"preview": "# Tomb Raider 2 binaries\n\nHere are few binary files that are taken from the original game and slightly modified to work "
},
{
"path": "configs/TR2Main.json",
"chars": 15895,
"preview": "{\n \"comment\": [\n \" \",\n \" This is mo"
},
{
"path": "configs/textures/texpages/README.md",
"chars": 277,
"preview": "# Tomb Raider 2 texture pages configuration\n\nHere is [configuration](config.json) file for the official iOS/Android port"
},
{
"path": "configs/textures/texpages/config.json",
"chars": 13548,
"preview": "{\n \"comment\": [\n \" \",\n \" This is te"
},
{
"path": "embedded/BUTTONS.JSON",
"chars": 13503,
"preview": "{\n \"esc\": {\"u\": 0, \"v\": 0, \"x\": 0, \"y\": -15, \"spacing\": 25, \"width\": 25, \"height\": 15},\n \"f1\": {\"u\": 25, \"v\": 0, \""
},
{
"path": "game/bear.cpp",
"chars": 6143,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/bear.h",
"chars": 1121,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/bird.cpp",
"chars": 1075,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/bird.h",
"chars": 1116,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/boat.cpp",
"chars": 3344,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/boat.h",
"chars": 1415,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/box.cpp",
"chars": 4023,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/box.h",
"chars": 2286,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/camera.cpp",
"chars": 10736,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/camera.h",
"chars": 1913,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/cinema.cpp",
"chars": 4092,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/cinema.h",
"chars": 1685,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/collide.cpp",
"chars": 6287,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/collide.h",
"chars": 1976,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/control.cpp",
"chars": 6523,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/control.h",
"chars": 2140,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/demo.cpp",
"chars": 3307,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/demo.h",
"chars": 1219,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/diver.cpp",
"chars": 1109,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/diver.h",
"chars": 1113,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/dog.cpp",
"chars": 1068,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/dog.h",
"chars": 1108,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/dragon.cpp",
"chars": 1350,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/dragon.h",
"chars": 1488,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/draw.cpp",
"chars": 31942,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/draw.h",
"chars": 3255,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/eel.cpp",
"chars": 1069,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/eel.h",
"chars": 1109,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/effects.cpp",
"chars": 20489,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Copyright (c) 2020 ChocolateFan <asasas9500@gmail."
},
{
"path": "game/effects.h",
"chars": 4566,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/enemies.cpp",
"chars": 1384,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/enemies.h",
"chars": 1528,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/gameflow.cpp",
"chars": 25040,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/gameflow.h",
"chars": 1457,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/hair.cpp",
"chars": 1106,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/hair.h",
"chars": 1160,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/health.cpp",
"chars": 9061,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/health.h",
"chars": 1633,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/inventory.cpp",
"chars": 31564,
"preview": "/*\r\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\r\n * Copyright (c) 2019 TokyoSU <vlevasseur5@gmail.co"
},
{
"path": "game/inventory.h",
"chars": 1536,
"preview": "/*\r\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\r\n * Original game is created by Core Design Ltd. in "
},
{
"path": "game/invfunc.cpp",
"chars": 26797,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/invfunc.h",
"chars": 3056,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/invtext.cpp",
"chars": 28278,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/invtext.h",
"chars": 2476,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/items.cpp",
"chars": 4102,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/items.h",
"chars": 1883,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/lara.cpp",
"chars": 7992,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/lara.h",
"chars": 6040,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/lara1gun.cpp",
"chars": 9559,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Copyright (c) 2020 ChocolateFan <asasas9500@gmail."
},
{
"path": "game/lara1gun.h",
"chars": 1559,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/lara2gun.cpp",
"chars": 3129,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/lara2gun.h",
"chars": 1360,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/laraclimb.cpp",
"chars": 1725,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/laraclimb.h",
"chars": 1582,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/larafire.cpp",
"chars": 1422,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/larafire.h",
"chars": 1753,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/laraflare.cpp",
"chars": 2659,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/laraflare.h",
"chars": 1359,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/laramisc.cpp",
"chars": 21334,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/laramisc.h",
"chars": 1525,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/larasurf.cpp",
"chars": 1597,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/larasurf.h",
"chars": 1534,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/laraswim.cpp",
"chars": 2887,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/laraswim.h",
"chars": 1740,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/lot.cpp",
"chars": 1225,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/lot.h",
"chars": 1240,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/missile.cpp",
"chars": 3948,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/missile.h",
"chars": 1201,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/moveblock.cpp",
"chars": 1378,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/moveblock.h",
"chars": 1420,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/objects.cpp",
"chars": 2546,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/objects.h",
"chars": 2265,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/people.cpp",
"chars": 4410,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/people.h",
"chars": 1994,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/pickup.cpp",
"chars": 1438,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/pickup.h",
"chars": 1465,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/rat.cpp",
"chars": 1033,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/rat.h",
"chars": 1050,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/savegame.cpp",
"chars": 18516,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/savegame.h",
"chars": 1418,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/setup.cpp",
"chars": 19000,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/setup.h",
"chars": 1388,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/shark.cpp",
"chars": 1115,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/shark.h",
"chars": 1180,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/skidoo.cpp",
"chars": 8583,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/skidoo.h",
"chars": 1930,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/sound.cpp",
"chars": 1666,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/sound.h",
"chars": 1346,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/sphere.cpp",
"chars": 1160,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/sphere.h",
"chars": 1223,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/spider.cpp",
"chars": 1116,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/spider.h",
"chars": 1152,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/text.cpp",
"chars": 22670,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/text.h",
"chars": 2815,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/traps.cpp",
"chars": 17916,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Copyright (c) 2020 ChocolateFan <asasas9500@gmail."
},
{
"path": "game/traps.h",
"chars": 2653,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/wolf.cpp",
"chars": 6119,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/wolf.h",
"chars": 1193,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/yeti.cpp",
"chars": 1075,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "game/yeti.h",
"chars": 1116,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "global/md5.c",
"chars": 10072,
"preview": "/*\n **********************************************************************\n ** md5.c "
},
{
"path": "global/md5.h",
"chars": 3360,
"preview": "/*\n **********************************************************************\n ** md5.h -- Header file for implementation o"
},
{
"path": "global/memmem.c",
"chars": 2268,
"preview": "/*-\n * Copyright (c) 2005 Pascal Gloor <pascal.gloor@spale.com>\n *\n * Redistribution and use in source and binary forms,"
},
{
"path": "global/memmem.h",
"chars": 1829,
"preview": "/*-\n * Copyright (c) 2005 Pascal Gloor <pascal.gloor@spale.com>\n *\n * Redistribution and use in source and binary forms,"
},
{
"path": "global/precompiled.h",
"chars": 1846,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "global/resource.h",
"chars": 4317,
"preview": "/*\r\n * Copyright (c) 2017 Michael Chaban. All rights reserved.\r\n * Original game is created by Core Design Ltd. in 1997."
},
{
"path": "global/types.h",
"chars": 44762,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "global/vars.h",
"chars": 38600,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "json-parser/LICENSE",
"chars": 1345,
"preview": "\n Copyright (C) 2012, 2013 James McLaughlin et al. All rights reserved.\n \n Redistribution and use in source and binar"
},
{
"path": "json-parser/README.md",
"chars": 3020,
"preview": "Very low footprint JSON parser written in portable ANSI C.\n\n* BSD licensed with no dependencies (i.e. just drop the C fi"
},
{
"path": "json-parser/json.c",
"chars": 30325,
"preview": "/* vim: set et ts=3 sw=3 sts=3 ft=c:\n *\n * Copyright (C) 2012, 2013, 2014 James McLaughlin et al. All rights reserved.\n"
},
{
"path": "json-parser/json.h",
"chars": 6407,
"preview": "\n/* vim: set et ts=3 sw=3 sts=3 ft=c:\n *\n * Copyright (C) 2012, 2013, 2014 James McLaughlin et al. All rights reserved."
},
{
"path": "modding/background_new.cpp",
"chars": 33353,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/background_new.h",
"chars": 1689,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/cd_pauld.cpp",
"chars": 6581,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * CD Audio solution in this file was designed by Pau"
},
{
"path": "modding/cd_pauld.h",
"chars": 1367,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * CD Audio solution in this file was designed by Pau"
},
{
"path": "modding/file_utils.cpp",
"chars": 5747,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/file_utils.h",
"chars": 1765,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/gdi_utils.cpp",
"chars": 6588,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/gdi_utils.h",
"chars": 1496,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/joy_output.cpp",
"chars": 5650,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/joy_output.h",
"chars": 1367,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/json_utils.cpp",
"chars": 2662,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/json_utils.h",
"chars": 1415,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/mod_utils.cpp",
"chars": 14850,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/mod_utils.h",
"chars": 2536,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/pause.cpp",
"chars": 5117,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/pause.h",
"chars": 1085,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/psx_bar.cpp",
"chars": 5716,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/psx_bar.h",
"chars": 1381,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/raw_input.cpp",
"chars": 28851,
"preview": "/*\n * Copyright (c) 2017-2023 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/raw_input.h",
"chars": 1803,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/texture_utils.cpp",
"chars": 23386,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/texture_utils.h",
"chars": 1911,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/xinput_ex.cpp",
"chars": 7516,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "modding/xinput_ex.h",
"chars": 1443,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/background.cpp",
"chars": 13597,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/background.h",
"chars": 1850,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/display.cpp",
"chars": 3193,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/display.h",
"chars": 1377,
"preview": "/*\n * Copyright (c) 2017 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 1997.\n "
},
{
"path": "specific/file.cpp",
"chars": 49309,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/file.h",
"chars": 2773,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/fmv.cpp",
"chars": 10583,
"preview": "/*\n * Copyright (c) 2017-2023 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/fmv.h",
"chars": 1301,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/frontend.cpp",
"chars": 8612,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/frontend.h",
"chars": 1777,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/game.cpp",
"chars": 19611,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/game.h",
"chars": 1872,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/hwr.cpp",
"chars": 17329,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/hwr.h",
"chars": 1930,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/init.cpp",
"chars": 4247,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/init.h",
"chars": 1354,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/init_3d.cpp",
"chars": 7518,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/init_3d.h",
"chars": 1765,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/init_display.cpp",
"chars": 34544,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/init_display.h",
"chars": 2369,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/init_input.cpp",
"chars": 20562,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/init_input.h",
"chars": 2208,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/init_sound.cpp",
"chars": 9323,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/init_sound.h",
"chars": 2273,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/input.cpp",
"chars": 20231,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/input.h",
"chars": 1087,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/option.cpp",
"chars": 66687,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/option.h",
"chars": 1704,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/output.cpp",
"chars": 41212,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/output.h",
"chars": 3133,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/registry.cpp",
"chars": 7346,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/registry.h",
"chars": 6093,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/screenshot.cpp",
"chars": 15029,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/screenshot.h",
"chars": 1375,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/setupdlg.cpp",
"chars": 53557,
"preview": "/*\n * Copyright (c) 2017-2021 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/setupdlg.h",
"chars": 3576,
"preview": "/*\n * Copyright (c) 2017-2018 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/setupwnd.cpp",
"chars": 6595,
"preview": "/*\n * Copyright (c) 2017 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 1997.\n "
},
{
"path": "specific/setupwnd.h",
"chars": 1715,
"preview": "/*\n * Copyright (c) 2017 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 1997.\n "
},
{
"path": "specific/smain.cpp",
"chars": 22638,
"preview": "/*\n * Copyright (c) 2017-2020 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
},
{
"path": "specific/smain.h",
"chars": 1275,
"preview": "/*\n * Copyright (c) 2017-2019 Michael Chaban. All rights reserved.\n * Original game is created by Core Design Ltd. in 19"
}
]
// ... and 12 more files (download for full content)
About this extraction
This page contains the full source code of the Arsunt/TR2Main GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 212 files (1.8 MB), approximately 604.1k tokens, and a symbol index with 1174 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.