mirror of
https://github.com/LostArtefacts/TR2X.git
synced 2025-03-01 10:36:00 +00:00
port Option_Sound
This commit is contained in:
parent
6da4f19ca8
commit
7d8d4ced64
@ -69,10 +69,10 @@
|
||||
</g>
|
||||
<g transform="translate(0 116)">
|
||||
<text x="0" y="7.50">Tomb2.exe progress according to the physical function order:</text>
|
||||
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">58.13% (708)</tspan> · <tspan class="known">39.41% (480)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
|
||||
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">58.21% (709)</tspan> · <tspan class="known">39.33% (479)</tspan> · <tspan class="todo">0% (0)</tspan> · <tspan class="unused">2.46% (30)</tspan></tspan></text>
|
||||
<g transform="translate(0 20)">
|
||||
<rect width="434.22" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="294.38" height="6" x="434.22" y="0" class="known"/>
|
||||
<rect width="434.83" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="293.77" height="6" x="434.83" y="0" class="known"/>
|
||||
<rect width="18.40" height="6" x="728.60" y="0" class="unused"/>
|
||||
</g>
|
||||
<g transform="translate(0 31)">
|
||||
@ -1124,7 +1124,7 @@
|
||||
<rect width="12" height="12" x="675" y="300" class="decompiled"><title>void __cdecl Option_DoInventory(INVENTORY_ITEM *item);</title></rect>
|
||||
<rect width="12" height="12" x="690" y="300" class="decompiled"><title>void __cdecl Option_Passport(INVENTORY_ITEM *item);</title></rect>
|
||||
<rect width="12" height="12" x="705" y="300" class="decompiled"><title>void __cdecl Option_Detail(INVENTORY_ITEM *item);</title></rect>
|
||||
<rect width="12" height="12" x="720" y="300" class="known"><title>void __cdecl Option_Sound(INVENTORY_ITEM *item);</title></rect>
|
||||
<rect width="12" height="12" x="720" y="300" class="decompiled"><title>void __cdecl Option_Sound(INVENTORY_ITEM *item);</title></rect>
|
||||
<rect width="12" height="12" x="735" y="300" class="decompiled"><title>void __cdecl Option_Compass(INVENTORY_ITEM *item);</title></rect>
|
||||
<rect width="12" height="12" x="0" y="315" class="decompiled"><title>void __cdecl Option_Controls_FlashConflicts(void);</title></rect>
|
||||
<rect width="12" height="12" x="15" y="315" class="decompiled"><title>void __cdecl Option_Controls_DefaultConflict(void);</title></rect>
|
||||
@ -1298,10 +1298,10 @@
|
||||
</g>
|
||||
<g transform="translate(0 546)">
|
||||
<text x="0" y="7.50">Tomb2.exe progress according to the function sizes:</text>
|
||||
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">62.51%</tspan> · <tspan class="known">37.16%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
|
||||
<text class="todo" style="font-size: 12px; " x="747" y="9"><tspan text-anchor="end"><tspan class="decompiled">62.86%</tspan> · <tspan class="known">36.82%</tspan> · <tspan class="todo">0%</tspan> · <tspan class="unused">0.33%</tspan></tspan></text>
|
||||
<g transform="translate(0 20)">
|
||||
<rect width="466.95" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="277.61" height="6" x="466.95" y="0" class="known"/>
|
||||
<rect width="469.54" height="6" x="0" y="0" class="decompiled"/>
|
||||
<rect width="275.02" height="6" x="469.54" y="0" class="known"/>
|
||||
<rect width="2.44" height="6" x="744.56" y="0" class="unused"/>
|
||||
</g>
|
||||
<g transform="translate(0 31)">
|
||||
@ -1350,7 +1350,7 @@
|
||||
<rect width="28.60" height="28.12" x="177.07" y="193.12" class="known"><title>void __cdecl MonkControl(int16_t item_num);</title></rect>
|
||||
<rect width="28.60" height="28.07" x="177.07" y="224.25" class="decompiled"><title>LRESULT __stdcall WinVidGameWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);</title></rect>
|
||||
<rect width="28.60" height="28.04" x="177.07" y="255.32" class="known"><title>int32_t __cdecl SkidooDynamics(ITEM_INFO *skidoo);</title></rect>
|
||||
<rect width="28.60" height="28.02" x="177.07" y="286.36" class="known"><title>void __cdecl Option_Sound(INVENTORY_ITEM *item);</title></rect>
|
||||
<rect width="28.60" height="28.02" x="177.07" y="286.36" class="decompiled"><title>void __cdecl Option_Sound(INVENTORY_ITEM *item);</title></rect>
|
||||
<rect width="28.60" height="27.36" x="177.07" y="317.38" class="decompiled"><title>void __cdecl Sound_Effect(int32_t sample_id, const XYZ_32 *pos, uint32_t flags);</title></rect>
|
||||
<rect width="28.60" height="27.26" x="177.07" y="347.74" class="known"><title>void __cdecl PickUpCollision(int16_t item_num, ITEM_INFO *lara_item, COLL_INFO *coll);</title></rect>
|
||||
<rect width="27.61" height="28.13" x="208.67" y="0" class="decompiled"><title>int32_t __cdecl GF_InterpretSequence(int16_t *ptr, GF_LEVEL_TYPE type, int32_t seq_type);</title></rect>
|
||||
|
Before Width: | Height: | Size: 364 KiB After Width: | Height: | Size: 364 KiB |
@ -3979,7 +3979,7 @@ typedef enum {
|
||||
0x0044EDC0 0x007F + void __cdecl Option_DoInventory(INVENTORY_ITEM *item);
|
||||
0x0044EED0 0x0648 + void __cdecl Option_Passport(INVENTORY_ITEM *item);
|
||||
0x0044F520 0x02DA + void __cdecl Option_Detail(INVENTORY_ITEM *item);
|
||||
0x0044F800 0x049D - void __cdecl Option_Sound(INVENTORY_ITEM *item);
|
||||
0x0044F800 0x049D + void __cdecl Option_Sound(INVENTORY_ITEM *item);
|
||||
0x0044FCA0 0x00C0 + void __cdecl Option_Compass(INVENTORY_ITEM *item);
|
||||
0x0044FD60 0x007E + void __cdecl Option_Controls_FlashConflicts(void);
|
||||
0x0044FDE0 0x0040 + void __cdecl Option_Controls_DefaultConflict(void);
|
||||
|
@ -11,6 +11,7 @@ void __cdecl Option_Passport_Shutdown(void);
|
||||
void __cdecl Option_Detail(INVENTORY_ITEM *item);
|
||||
void __cdecl Option_Detail_Shutdown(void);
|
||||
|
||||
void __cdecl Option_Sound(INVENTORY_ITEM *item);
|
||||
void __cdecl Option_Sound_Shutdown(void);
|
||||
|
||||
void __cdecl Option_Controls_FlashConflicts(void);
|
||||
|
@ -1,12 +1,137 @@
|
||||
#include "game/music.h"
|
||||
#include "game/option/option.h"
|
||||
#include "game/sound.h"
|
||||
#include "game/text.h"
|
||||
#include "global/funcs.h"
|
||||
#include "global/vars.h"
|
||||
|
||||
void Option_Sound_Shutdown(void)
|
||||
#include <libtrx/utils.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static void Option_Sound_InitText(void);
|
||||
static void Option_Sound_ShutdownText(void);
|
||||
|
||||
static void Option_Sound_InitText(void)
|
||||
{
|
||||
CLAMPG(g_OptionMusicVolume, 10);
|
||||
CLAMPG(g_OptionSoundVolume, 10);
|
||||
|
||||
char text[8];
|
||||
sprintf(text, "| %2d", g_OptionMusicVolume);
|
||||
g_SoundText[0] = Text_Create(0, 0, 0, text);
|
||||
Text_AddBackground(g_SoundText[0], 128, 0, 0, 0, 8, 0, 0, 0);
|
||||
Text_AddOutline(g_SoundText[0], 1, 4, 0, 0);
|
||||
|
||||
sprintf(text, "} %2d", g_OptionSoundVolume);
|
||||
g_SoundText[1] = Text_Create(0, 25, 0, text);
|
||||
|
||||
g_SoundText[2] = Text_Create(0, -32, 0, " ");
|
||||
Text_AddBackground(g_SoundText[2], 140, 85, 0, 0, 48, 0, 0, 0);
|
||||
Text_AddOutline(g_SoundText[2], 1, 15, 0, 0);
|
||||
|
||||
g_SoundText[3] =
|
||||
Text_Create(0, -30, 0, g_GF_PCStrings[GF_S_PC_SET_VOLUMES]);
|
||||
Text_AddBackground(g_SoundText[3], 136, 0, 0, 0, 8, 0, 0, 0);
|
||||
Text_AddOutline(g_SoundText[3], 1, 15, 0, 0);
|
||||
|
||||
for (int32_t i = 0; i < 4; i++) {
|
||||
Text_CentreH(g_SoundText[i], true);
|
||||
Text_CentreV(g_SoundText[i], true);
|
||||
}
|
||||
}
|
||||
|
||||
static void Option_Sound_ShutdownText(void)
|
||||
{
|
||||
for (int32_t i = 0; i < 4; i++) {
|
||||
Text_Remove(g_SoundText[i]);
|
||||
g_SoundText[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void Option_Sound_Shutdown(void)
|
||||
{
|
||||
Option_Sound_ShutdownText();
|
||||
}
|
||||
|
||||
void __cdecl Option_Sound(INVENTORY_ITEM *const item)
|
||||
{
|
||||
char text[8];
|
||||
|
||||
if (g_SoundText[0] == NULL) {
|
||||
Option_Sound_InitText();
|
||||
}
|
||||
|
||||
if ((g_InputDB & IN_FORWARD) && g_SoundOptionLine > 0) {
|
||||
Text_RemoveOutline(g_SoundText[g_SoundOptionLine]);
|
||||
Text_RemoveBackground(g_SoundText[g_SoundOptionLine]);
|
||||
g_SoundOptionLine--;
|
||||
Text_AddBackground(
|
||||
g_SoundText[g_SoundOptionLine], 128, 0, 0, 0, 8, 0, 0, 0);
|
||||
Text_AddOutline(g_SoundText[g_SoundOptionLine], 1, 4, 0, 0);
|
||||
}
|
||||
|
||||
if ((g_InputDB & IN_BACK) && g_SoundOptionLine < 1) {
|
||||
Text_RemoveOutline(g_SoundText[g_SoundOptionLine]);
|
||||
Text_RemoveBackground(g_SoundText[g_SoundOptionLine]);
|
||||
g_SoundOptionLine++;
|
||||
Text_AddBackground(
|
||||
g_SoundText[g_SoundOptionLine], 128, 0, 0, 0, 8, 0, 0, 0);
|
||||
Text_AddOutline(g_SoundText[g_SoundOptionLine], 1, 4, 0, 0);
|
||||
}
|
||||
|
||||
if (g_SoundOptionLine) {
|
||||
bool changed = false;
|
||||
if ((g_Input & IN_LEFT) && g_OptionSoundVolume > 0) {
|
||||
g_Inv_IsOptionsDelay = 1;
|
||||
g_Inv_OptionsDelayCounter = 10;
|
||||
g_OptionSoundVolume--;
|
||||
changed = true;
|
||||
} else if ((g_Input & IN_RIGHT) && g_OptionSoundVolume < 10) {
|
||||
g_Inv_IsOptionsDelay = 1;
|
||||
g_Inv_OptionsDelayCounter = 10;
|
||||
g_OptionSoundVolume++;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
sprintf(text, "} %2d", g_OptionSoundVolume);
|
||||
Text_ChangeText(g_SoundText[1], text);
|
||||
if (g_OptionSoundVolume) {
|
||||
Sound_SetMasterVolume(6 * g_OptionSoundVolume + 4);
|
||||
} else {
|
||||
Sound_SetMasterVolume(0);
|
||||
}
|
||||
|
||||
Sound_Effect(SFX_MENU_PASSPORT, NULL, SPM_ALWAYS);
|
||||
}
|
||||
} else {
|
||||
bool changed = false;
|
||||
if ((g_Input & IN_LEFT) && g_OptionMusicVolume > 0) {
|
||||
g_OptionMusicVolume--;
|
||||
changed = true;
|
||||
} else if ((g_Input & IN_RIGHT) && g_OptionMusicVolume < 10) {
|
||||
g_OptionMusicVolume++;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
g_Inv_IsOptionsDelay = 1;
|
||||
g_Inv_OptionsDelayCounter = 10;
|
||||
sprintf(text, "| %2d", g_OptionMusicVolume);
|
||||
Text_ChangeText(g_SoundText[0], text);
|
||||
|
||||
if (g_OptionMusicVolume) {
|
||||
Music_SetVolume(25 * g_OptionMusicVolume + 5);
|
||||
} else {
|
||||
Music_SetVolume(0);
|
||||
}
|
||||
|
||||
Sound_Effect(SFX_MENU_PASSPORT, NULL, SPM_ALWAYS);
|
||||
}
|
||||
}
|
||||
|
||||
if (g_InputDB & (IN_SELECT | IN_DESELECT)) {
|
||||
Option_Sound_Shutdown();
|
||||
}
|
||||
}
|
||||
|
@ -356,7 +356,6 @@
|
||||
#define game_malloc ((void *__cdecl (*)(size_t alloc_size, GAME_BUFFER buf_index))0x0044D6C0)
|
||||
#define game_free ((void __cdecl (*)(size_t free_size))0x0044D740)
|
||||
#define CalculateWibbleTable ((void __cdecl (*)(void))0x0044D780)
|
||||
#define Option_Sound ((void __cdecl (*)(INVENTORY_ITEM *item))0x0044F800)
|
||||
#define GetRenderHeight ((int32_t __cdecl (*)(void))0x00450AE0)
|
||||
#define GetRenderWidth ((int32_t __cdecl (*)(void))0x00450AF0)
|
||||
#define S_InitialisePolyList ((void __cdecl (*)(BOOL clear_back_buffer))0x00450B00)
|
||||
|
@ -368,6 +368,7 @@ static void Inject_Option(const bool enable)
|
||||
INJECT(enable, 0x0044EDC0, Option_DoInventory);
|
||||
INJECT(enable, 0x0044EED0, Option_Passport);
|
||||
INJECT(enable, 0x0044F520, Option_Detail);
|
||||
INJECT(enable, 0x0044F800, Option_Sound);
|
||||
INJECT(enable, 0x0044FCA0, Option_Compass);
|
||||
INJECT(enable, 0x0044FD60, Option_Controls_FlashConflicts);
|
||||
INJECT(enable, 0x0044FDE0, Option_Controls_DefaultConflict);
|
||||
|
Loading…
x
Reference in New Issue
Block a user