Skip to content

Commit

Permalink
Merge pull request #66 from Trxyebeep/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Trxyebeep committed May 5, 2023
2 parents 11cc64b + 090e34a commit 18bb80d
Show file tree
Hide file tree
Showing 17 changed files with 294 additions and 90 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# tomb4 changelog

## Unreleased:
## [2.2.0](https://github.com/Trxyebeep/TOMB4/tree/V2.2.0) (May. 5 2023)

### Original bug fixes

Expand All @@ -18,10 +18,14 @@
- Fix first voncroy cut camera.
- Fix AI (VonCroy, Guide, etc.) interaction position.
- Fix water surface waves.
- Fix monoscreen corruption.

### new tomb4 features

- Improve how the hair interacts with water.
- Improve Rail Switch interaction.
- Add option to scale bars.
- Add times level support.

## [2.1.0](https://github.com/Trxyebeep/TOMB4/tree/V2.1.0) (Mar. 3 2023)

Expand Down
42 changes: 40 additions & 2 deletions TOMB4/game/deltapak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#include "../specific/winmain.h"
#include "lara.h"
#include "gameflow.h"
#ifdef TIMES_LEVEL
#include "../specific/function_table.h"
#endif

static short frig_shadow_bbox[6] = { -165, 150, -777, 1, -87, 78 };
static short frig_jeep_shadow_bbox[6] = { -600, 600, -777, 1, -600, 600 };
Expand Down Expand Up @@ -52,8 +55,16 @@ static short troop_chat_ranges24[16] = { 209, 490, 701, 975, 1146, 1583, 1654, 1
static short lara_chat_ranges25[14] = { 476, 578, 976, 1018, 1028, 1069, 1317, 1340, 2065, 2178, 2835, 2865, -1, -1 };
static short troop_chat_ranges25[26] = { 289, 363, 378, 449, 596, 604, 635, 744, 764, 780, 811, 959, 1088, 1157, 1191, 1313, 1360, 2046, 2227, 2295, 2330, 2821, 2877, 3322, -1, -1 };
static short troop_chat_ranges26[4] = { 108, 432, -1, -1 };
#ifdef TIMES_LEVEL
static short lara_chat_ranges_times[28] = { 188, 271, 307, 330, 584, 638, 668, 700, 728, 755, 763, 819, 1181, 1238, 1263, 1290, 1363, 1411, 1926, 1934, 1981, 2011, 2017, 2045, 3030, 3095, -1, -1 };
static short editor_chat_ranges_times[40] =
{
340, 424, 432, 462, 480, 518, 521, 552, 843, 907, 931, 969, 974, 1002, 1020, 1057, 1060, 1090, 1110, 1119,
1123, 1172, 1299, 1352, 1417, 1423, 1442, 1513, 1544, 1627, 1634, 1691, 1710, 1770, 1775, 1843, 1864, 1902, -1, -1
};
#endif

static CUTSEQ_ROUTINES cutseq_control_routines[31] =
static CUTSEQ_ROUTINES cutseq_control_routines[] =
{
{0, 0, 0},
{do_spade_meshswap, 0, 0},
Expand Down Expand Up @@ -85,7 +96,10 @@ static CUTSEQ_ROUTINES cutseq_control_routines[31] =
{twentyseven_init, twentyseven_control, twentyseven_end},
{special1_init, 0, special1_end},
{special2_init, 0, special2_end},
{special2_init, special3_control, special3_end}
{special2_init, special3_control, special3_end},
#ifdef TIMES_LEVEL
{times_init, times_control, 0}
#endif
};

long cutseq_trig = 0;
Expand Down Expand Up @@ -150,7 +164,10 @@ void handle_cutseq_triggering(long name)
cutseq_busy_timeout--;

if (!cutseq_busy_timeout)
{
cutseq_busy_timeout = 0;
fuck = 1;
}

if (cutseq_num == 27 || lara.gun_status == LG_HANDS_BUSY || lara.gun_status == LG_NO_ARMS && !lara.flare_control_left ||
n == AS_ALL4S || n == AS_CRAWL || n == AS_ALL4TURNL || n == AS_ALL4TURNR || n == AS_CRAWLBACK || fuck)
Expand Down Expand Up @@ -270,9 +287,16 @@ void handle_cutseq_triggering(long name)
if (GLOBAL_cutme->audio_track != -1)
S_StartSyncedAudio(GLOBAL_cutme->audio_track);
}
#ifdef TIMES_LEVEL
else if (fuck == 31)
#else
else if (fuck == 9 || fuck == 11 || fuck == 15 || fuck == 23)
#endif
{
gfLevelComplete = gfCurrentLevel + 1;
#ifdef TIMES_LEVEL
skipped_level = 1;
#endif
gfRequiredStartPos = 0;
cutseq_num = 0;
GLOBAL_playing_cutseq = 0;
Expand Down Expand Up @@ -1803,3 +1827,17 @@ void special1_end()
Chris_Menu = 0;
title_controls_locked_out = 0;
}

#ifdef TIMES_LEVEL
void times_init()
{
SetFogColor(128, 128, 128);
}

void times_control()
{
handle_lara_chatting(lara_chat_ranges_times);
handle_actor_chatting(ACTOR2_SPEECH_HEAD1, 11, 1, ANIMATING16, editor_chat_ranges_times);
actor_chat_cnt = (actor_chat_cnt - 1) & 1;
}
#endif
4 changes: 4 additions & 0 deletions TOMB4/game/deltapak.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ void special3_end();
void special3_control();
void special1_init();
void special1_end();
#ifdef TIMES_LEVEL
void times_init();
void times_control();
#endif

extern long cutseq_trig;
extern long cutseq_num;
Expand Down
8 changes: 8 additions & 0 deletions TOMB4/game/gameflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ void DoGameflow()
uchar* gf;
uchar n;

#ifndef TIMES_LEVEL
PlayFmvNow(0);
#endif
do_boot_screen(Gameflow->Language);
num_fmvs = 0;
fmv_to_play[0] = 0;
Expand All @@ -172,8 +174,10 @@ void DoGameflow()
switch (n = *gf++)
{
case CMD_FMV:
#ifndef TIMES_LEVEL
fmv_to_play[num_fmvs] = gf[0];
num_fmvs++;
#endif
gf++;
break;

Expand Down Expand Up @@ -535,9 +539,11 @@ void DoLevel(uchar Name, uchar Audio)
if (DEL_playingamefmv)
{
DEL_playingamefmv = 0;
#ifndef TIMES_LEVEL
S_CDStop();
PlayFmvNow(7);
DelsHandyTeleportLara(54179, -8192, 50899, -32703);
#endif
}

if (gfLevelComplete)
Expand Down Expand Up @@ -572,6 +578,7 @@ void DoLevel(uchar Name, uchar Audio)
S_SoundStopAllSamples();
S_CDStop();

#ifndef TIMES_LEVEL
if (gfStatus == 3)
{
if (fmv_to_play[0] & 0x80)
Expand All @@ -593,6 +600,7 @@ void DoLevel(uchar Name, uchar Audio)
num_fmvs = 0;
fmv_to_play[0] = 0;
fmv_to_play[1] = 0;
#endif
lara.examine1 = 0;
lara.examine2 = 0;
lara.examine3 = 0;
Expand Down
5 changes: 5 additions & 0 deletions TOMB4/game/gameflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ enum gf_strings //auto generated from the script compiler
TXT_Khufus_Queens_Pyramids,
TXT_Inside_The_Great_Pyramid,
TXT_Temple_Of_Horus,
#ifdef TIMES_LEVEL
TXT_DUMMY1,
TXT_DUMMY2,
TXT_DUMMY3,
#endif
TXT_Unlimited_s,
TXT_USE,
TXT_CHOOSE_AMMO,
Expand Down
12 changes: 7 additions & 5 deletions TOMB4/game/switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ static short UnderwaterSwitchBounds2[12] = { -256, 256, -1280, -512, 0, 512, -14
static short PulleyBounds[12] = { -256, 256, 0, 0, -512, 512, -1820, 1820, -5460, 5460, -1820, 1820 };
static short TurnSwitchBoundsA[12] = { 512, 896, 0, 0, -512, 0, -1820, 1820, -5460, 5460, -1820, 1820 };
static short TurnSwitchBoundsC[12] = { 512, 896, 0, 0, 0, 512, -1820, 1820, -5460, 5460, -1820, 1820 };
static short RailSwitchBounds[12] = { -256, 256, 0, 0, -768, -512, -1820, 1820, -5460, 5460, -1820, 1820 };
static short RailSwitchBounds2[12] = { -256, 256, 0, 0, 512, 768, -1820, 1820, -5460, 5460, -1820, 1820 };
static short RailSwitchBounds[12] = { -256, 256, 0, 0, -768, -224, -1820, 1820, -5460, 5460, -1820, 1820 };
static short RailSwitchBounds2[12] = { -256, 256, 0, 0, 224, 768, -1820, 1820, -5460, 5460, -1820, 1820 };
static short JumpSwitchBounds[12] = { -128, 128, -256, 256, 384, 512, -1820, 1820, -5460, 5460, -1820, 1820 };
static short CrowbarBounds[12] = { -256, 256, 0, 0, -512, -256, -1820, 1820, -5460, 5460, -1820, 1820 };
static short CrowbarBounds2[12] = { -256, 256, 0, 0, 256, 512, -1820, 1820, -5460, 5460, -1820, 1820 };
Expand Down Expand Up @@ -669,9 +669,7 @@ void RailSwitchCollision(short item_number, ITEM_INFO* l, COLL_INFO* coll)
}
}

if (!flag)
ObjectCollision(item_number, l, coll);
else
if (flag)
{
l->anim_number = ANIM_RAILSWITCH;
l->frame_number = anims[ANIM_RAILSWITCH].frame_base;
Expand All @@ -686,7 +684,11 @@ void RailSwitchCollision(short item_number, ITEM_INFO* l, COLL_INFO* coll)
item->status = ITEM_ACTIVE;
AddActiveItem(item_number);
AnimateItem(item);
return;
}

if (!lara.IsMoving)
ObjectCollision(item_number, l, coll);
}

void JumpSwitchCollision(short item_number, ITEM_INFO* l, COLL_INFO* coll)
Expand Down
1 change: 1 addition & 0 deletions TOMB4/global/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2302,5 +2302,6 @@ struct tomb4_options //keep this at the bottom of the file, please
bool static_lighting;
ulong reverb; //1-> off, 2-> Lara room, 3->camera room
ulong distance_fog; //value in blocks
float GUI_Scale;
};
#pragma pack(pop)
35 changes: 16 additions & 19 deletions TOMB4/specific/LoadSave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ long SFXVolume = 80;
long ControlMethod;
char MonoScreenOn;

static MONOSCREEN_STRUCT MonoScreen[5];
static MONOSCREEN_STRUCT MonoScreen;
static SAVEFILE_INFO SaveGames[15];

void DoOptions()
Expand Down Expand Up @@ -461,7 +461,11 @@ void DisplayStatsUCunt()
sprintf(buf, "%d", savegame.Game.HealthUsed);
PrintString(phd_centerx + (phd_centerx >> 2), y + 6 * font_height, 6, buf, 0);

#ifdef TIMES_LEVEL
sprintf(buf, "%d / 2", savegame.Game.Secrets);
#else
sprintf(buf, "%d / 70", savegame.Game.Secrets);
#endif
PrintString(phd_centerx + (phd_centerx >> 2), y + 7 * font_height, 6, buf, 0);
}

Expand Down Expand Up @@ -766,21 +770,14 @@ void S_DrawTile(long x, long y, long w, long h, LPDIRECT3DTEXTUREX t, long tU, l

void S_DisplayMonoScreen()
{
long x[4];
long y[4];
ulong col;

x[0] = phd_winxmin;
y[0] = phd_winymin;
x[1] = phd_winxmin + phd_winwidth;
y[1] = phd_winymin + phd_winheight;

if (tomb4.inv_bg_mode == 1 || tomb4.inv_bg_mode == 3)
col = 0xFFFFFFFF;
else
col = 0xFFFFFF80;

S_DrawTile(x[0], y[0], x[1] - x[0], y[1] - y[0], MonoScreen[0].tex, 0, 0, 256, 256, col, col, col, col);
S_DrawTile(0, 0, phd_winxmax, phd_winymax, MonoScreen.tex, 0, 0, 256, 256, col, col, col, col);
}

void CreateMonoScreen()
Expand All @@ -791,18 +788,18 @@ void CreateMonoScreen()

void FreeMonoScreen()
{
if (MonoScreen[0].surface)
if (MonoScreen.surface)
{
Log(4, "Released %s @ %x - RefCnt = %d", "Mono Screen Surface", MonoScreen[0].surface, MonoScreen[0].surface->Release());
MonoScreen[0].surface = 0;
Log(4, "Released %s @ %x - RefCnt = %d", "Mono Screen Surface", MonoScreen.surface, MonoScreen.surface->Release());
MonoScreen.surface = 0;
}
else
Log(1, "%s Attempt To Release NULL Ptr", "Mono Screen Surface");

if (MonoScreen[0].tex)
if (MonoScreen.tex)
{
Log(4, "Released %s @ %x - RefCnt = %d", "Mono Screen Texture", MonoScreen[0].tex, MonoScreen[0].tex->Release());
MonoScreen[0].tex = 0;
Log(4, "Released %s @ %x - RefCnt = %d", "Mono Screen Texture", MonoScreen.tex, MonoScreen.tex->Release());
MonoScreen.tex = 0;
}
else
Log(1, "%s Attempt To Release NULL Ptr", "Mono Screen Texture");
Expand Down Expand Up @@ -945,11 +942,11 @@ void ConvertSurfaceToTextures(LPDIRECTDRAWSURFACEX surface)
tSurf.dwSize = sizeof(DDSURFACEDESCX);
surface->Lock(0, &tSurf, DDLOCK_WAIT | DDLOCK_NOSYSLOCK, 0);
pSrc = (ushort*)tSurf.lpSurface;
MonoScreen[0].surface = CreateTexturePage(tSurf.dwWidth, tSurf.dwHeight, 0, NULL, RGBM_Mono, -1);
MonoScreen.surface = CreateTexturePage(tSurf.dwWidth, tSurf.dwHeight, 0, 0, RGBM_Mono, -1);

memset(&uSurf, 0, sizeof(uSurf));
uSurf.dwSize = sizeof(DDSURFACEDESCX);
MonoScreen[0].surface->Lock(0, &uSurf, DDLOCK_WAIT | DDLOCK_NOSYSLOCK, 0);
MonoScreen.surface->Lock(0, &uSurf, DDLOCK_WAIT | DDLOCK_NOSYSLOCK, 0);
pTexture = (ushort*)uSurf.lpSurface;

r.left = 0;
Expand All @@ -958,8 +955,8 @@ void ConvertSurfaceToTextures(LPDIRECTDRAWSURFACEX surface)
r.bottom = tSurf.dwHeight;
CustomBlt(&uSurf, 0, 0, &tSurf, &r);

MonoScreen[0].surface->Unlock(0);
DXAttempt(MonoScreen[0].surface->QueryInterface(TEXGUID, (void**)&MonoScreen[0].tex));
MonoScreen.surface->Unlock(0);
DXAttempt(MonoScreen.surface->QueryInterface(TEXGUID, (void**)&MonoScreen.tex));
surface->Unlock(0);
}

Expand Down
Loading

0 comments on commit 18bb80d

Please sign in to comment.