Re: OpenGTA2?
Posted: 11 Sep 2019, 14:33
Mm okay, good point. I'll try to to see in slow motion
ThanksSektor wrote: 11 Sep 2019, 14:47 Welcome to the forum. Are you just curious or are you creating something? Why did you post in this topic?
I looked into GTA2.exe, it seems it always calls wasted.wav for dying or something. Its hardcoded.Sektor wrote: 09 Feb 2017, 01:42 Likely way outside the scope of this project but are you able to debug audio? I want the shocking.wav to play when you die on train tracks, it displays the "shocking!" text but instead plays wasted.wav. Other sounds aren't played either like toasted and game over. Shocking.wav will actually play if it's your last life although in that case you'd think gameover.wav should play.
Code: Select all
char * __fastcall FUN_00564430(int param_1)
{
switch(*(undefined4 *)(param_1 + 0x44)) {
case 0:
case 1:
return s_wasted_0061aed4;
case 2:
return s_fried_0061aecc;
case 3:
return s_nicked_0061aec4;
case 4:
return s_shocked_0061aebc;
default:
return (char *)0;
}
}
Just giving a update to this problem. The function of your screenshot is the one below:B-$hep wrote: 26 Sep 2019, 18:20 I looked into GTA2.exe, it seems it always calls wasted.wav for dying or something. Its hardcoded.
I attached the screenshot. The nr 1 in red box is the wasted.wav
Untitled.png
I havent yet digged so deeply into this, this function is choosing what audio is played:
Code: Select all
char * __fastcall FUN_00564430(int param_1) { switch(*(undefined4 *)(param_1 + 0x44)) { case 0: case 1: return s_wasted_0061aed4; case 2: return s_fried_0061aecc; case 3: return s_nicked_0061aec4; case 4: return s_shocked_0061aebc; default: return (char *)0; } }
Code: Select all
void Player::sub_567130() // gta2 10.5 address
{
Ped* pPed_killer;
Player* player_killer; // this function seems to handle the player death
if (bStartNetworkGame_7081F0)
{
// Ped: field_204 = the ID of the ped who killed this player/Player
if (field_2C4_player_ped->field_204 == 0)
{
player_killer = NULL;
}
else if ((pPed_killer = gChar_C_6787BC->sub_4710C0(field_2C4_player_ped->field_204)) == 0)
{
player_killer = NULL;
}
else if (pPed_killer->sub_45EDE0(2) == 0)
{
player_killer = NULL;
}
else if ((player_killer = pPed_killer->field_15C_player_weapons) == NULL)
{
player_killer = NULL;
}
(&gYouthful_einstein_6F8450)->sub_516740( // tag mode death handler
gGame_0x40_67E008->field_4_players[field_2E_idx],
player_killer); // if player_killer != NULL then 'player_killer' now is "IT"
}
field_29 = 0;
field_2C4_player_ped->field_21C &= ~0x800u;
if (field_28 == 0)
{
if (field_0)
{
if (field_684_lives.field_0 > 1 || bStartNetworkGame_7081F0)
{
gGarox_2B00_706620->field_111C.sub_5D1A00( // It's really ugly, it's probably inlined
gText_0x14_704DFC->Find_5B5F90(GetDeathText_569F00()), // GetDeathText_569F00 gives you WASTED, SHOCKED, TOASTED texts
1);
gRoot_sound_66B038.sub_40F090(29); // Wasted.wav
}
else
{
gGarox_2B00_706620->field_111C.sub_5D1A00(gText_0x14_704DFC->Find_5B5F90("g_over"), 3);
gRoot_sound_66B038.sub_40F090(21); // Supposed to be Game_over.wav
}
}
field_44_death_type = 0;
if (field_2D0)
{
Player::sub_5695A0();
}
field_28 = 1;
field_2C = 70;
if (field_684_lives.field_0 > 1)
{
field_2C8_unkq = gChar_C_6787BC->sub_470F90(field_2C4_player_ped);
field_2C8_unkq->field_170_selected_weapon = 0;
field_2C8_unkq->field_200 = 0;
field_2C8_unkq->field_21C &= ~0x800u;
field_2C8_unkq->field_267 = 0;
field_68 = 2;
memcpy(&field_208_aux_game_camera, &field_90_game_camera, sizeof(field_208_aux_game_camera));
field_2D0 = 1;
}
Player::sub_5670B0();
}
else
{
if (field_2C8_unkq)
{
field_2C8_unkq->field_21C &= ~0x800u;
}
if (field_2C == 0)
{
if (field_684_lives.field_0 > 0 || bStartNetworkGame_7081F0)
{
Player::sub_5647D0();
if (!bKeep_weapons_after_death_67D54D)
{
Player::sub_564C00();
Player::sub_564C50(); // remove weapons from dead player
Player::sub_564CF0();
}
field_68 = 0;
field_90_game_camera.sub_435DD0();
field_90_game_camera.inline_sub_475B60();
if (field_2C8_unkq != NULL)
{
field_2C8_unkq->sub_45EB60();
field_2C8_unkq = NULL;
field_2D0 = 0;
}
field_2C4_player_ped->sub_45C410();
field_28 = 0;
}
else
{
gGame_0x40_67E008->sub_4B8C00(0, 3);
}
}
else
{
field_2C--;
}
}
}
Code: Select all
void sound_obj::ProcessType10_418CA0() // gta2 10.5 address
{
s32 voc_idx;
if (field_544C[0].field_4_fp)
{
switch (field_544C[0].field_18)
{
case 9:
voc_idx = 0;
break;
case 10:
voc_idx = 1;
break;
case 17:
voc_idx = 2;
break;
case 7:
voc_idx = 3;
break;
case 6:
voc_idx = 4;
break;
case 8:
voc_idx = 5;
break;
case 4:
voc_idx = 6;
break;
case 18:
voc_idx = 8;
break;
case 19:
voc_idx = 9;
break;
case 20:
voc_idx = 10;
break;
case 5:
voc_idx = 12;
break;
case 2:
voc_idx = 13;
break;
case 1:
voc_idx = 14;
break;
case 22:
voc_idx = 15;
break;
case 23:
voc_idx = 16;
break;
case 12:
voc_idx = 17;
break;
case 11:
voc_idx = 18;
break;
case 24:
voc_idx = 19;
break;
case 25:
voc_idx = 20;
break;
case 26:
voc_idx = 21;
break;
case 27:
voc_idx = 22;
break;
case 28:
voc_idx = 23;
break;
case 29:
voc_idx = 24;
break;
case 3:
voc_idx = 25;
break;
case 30:
voc_idx = 26;
break;
case 33:
voc_idx = 55;
break;
case 34:
voc_idx = 56;
break;
case 35:
voc_idx = 57;
break;
case 36:
voc_idx = 58;
break;
case 37:
voc_idx = 59;
break;
case 38:
voc_idx = 60;
break;
case 39:
voc_idx = 61;
break;
case 40:
voc_idx = 62;
break;
case 41:
voc_idx = 63;
break;
case 42:
voc_idx = 64;
break;
case 43:
voc_idx = 65;
break;
case 44:
voc_idx = 66;
break;
case 45:
voc_idx = 67;
break;
case 46:
voc_idx = 68;
break;
case 47:
voc_idx = 69;
break;
case 48:
voc_idx = 70;
break;
case 49:
voc_idx = 71;
break;
case 50:
voc_idx = 72;
break;
case 51:
voc_idx = 73;
break;
case 52:
voc_idx = 74;
break;
case 53:
voc_idx = 75;
break;
case 54:
voc_idx = 76;
break;
case 55:
voc_idx = 77;
break;
case 56:
voc_idx = 78;
break;
case 57:
voc_idx = 79;
break;
case 58:
voc_idx = 80;
break;
case 59:
voc_idx = 81;
break;
case 60:
voc_idx = 82;
break;
case 61:
voc_idx = 83;
break;
case 62:
voc_idx = 84;
break;
case 31:
case 32:
voc_idx = (field_1454_anRandomTable[0] % 13u) + 85;
if (voc_idx == 99)
{
field_544C[0].field_18 = 0;
return;
}
break;
default:
field_544C[0].field_18 = 0;
return;
}
gSampManager_6FFF00.PlayVocal_58E510(1, voc_idx, 1);
gSampManager_6FFF00.SetVocalVolume_58E6D0(1, 127 * field_24_sfx_vol / 127);
field_544C[0].field_18 = 0;
}
}