From ec1b91e5270b1c91885a5e8000a5ff8286aee140 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 16 May 2020 05:06:51 +0300 Subject: [PATCH 001/133] Remove unused audio enum --- src/audio/AudioManager.cpp | 8 +- src/audio/AudioManager.h | 2 - src/audio/AudioScriptObject.cpp | 2 +- src/audio/AudioScriptObject.h | 130 ------- src/audio/soundlist.h | 586 ++++++++++++++++---------------- src/control/Phones.cpp | 5 +- src/objects/Object.cpp | 9 +- src/peds/Ped.cpp | 10 +- src/render/Glass.cpp | 11 +- src/render/Particle.cpp | 5 +- 10 files changed, 321 insertions(+), 447 deletions(-) diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index b76c2cc3..8ef439d9 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -630,10 +630,10 @@ cAudioManager::CreateEntity(int32 type, void *entity) m_asAudioEntities[i].m_nStatus = 0; m_asAudioEntities[i].m_nType = (eAudioType)type; m_asAudioEntities[i].m_pEntity = entity; - m_asAudioEntities[i].m_awAudioEvent[0] = SOUND_TOTAL_PED_SOUNDS; - m_asAudioEntities[i].m_awAudioEvent[1] = SOUND_TOTAL_PED_SOUNDS; - m_asAudioEntities[i].m_awAudioEvent[2] = SOUND_TOTAL_PED_SOUNDS; - m_asAudioEntities[i].m_awAudioEvent[3] = SOUND_TOTAL_PED_SOUNDS; + m_asAudioEntities[i].m_awAudioEvent[0] = SOUND_NO_SOUND; + m_asAudioEntities[i].m_awAudioEvent[1] = SOUND_NO_SOUND; + m_asAudioEntities[i].m_awAudioEvent[2] = SOUND_NO_SOUND; + m_asAudioEntities[i].m_awAudioEvent[3] = SOUND_NO_SOUND; m_asAudioEntities[i].m_AudioEvents = 0; m_anAudioEntityIndices[m_nAudioEntitiesTotal++] = i; return i; diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 99d67444..bbbc84bd 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -467,8 +467,6 @@ public: // only used in pc void AdjustSamplesVolume(); uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist); - - void DebugShit(); }; #ifdef AUDIO_MSS diff --git a/src/audio/AudioScriptObject.cpp b/src/audio/AudioScriptObject.cpp index 3d84006d..69d80fbc 100644 --- a/src/audio/AudioScriptObject.cpp +++ b/src/audio/AudioScriptObject.cpp @@ -7,7 +7,7 @@ void cAudioScriptObject::Reset() { - AudioId = SCRSOUND_INVALID; + AudioId = SCRIPT_SOUND_INVALID; Posn = CVector(0.0f, 0.0f, 0.0f); AudioEntity = AEHANDLE_NONE; } diff --git a/src/audio/AudioScriptObject.h b/src/audio/AudioScriptObject.h index ecc07fdf..ff36474d 100644 --- a/src/audio/AudioScriptObject.h +++ b/src/audio/AudioScriptObject.h @@ -1,135 +1,5 @@ #pragma once -enum -{ - SCRSOUND_TEST_1, - _SCRSOUND_UNK_1, - _SCRSOUND_UNK_2, - _SCRSOUND_UNK_3, - _SCRSOUND_CLUB_1_S, - _SCRSOUND_CLUB_1_L, - _SCRSOUND_CLUB_2_S, - _SCRSOUND_CLUB_2_L, - _SCRSOUND_CLUB_3_S, - _SCRSOUND_CLUB_3_L, - _SCRSOUND_CLUB_4_S, - _SCRSOUND_CLUB_4_L, - _SCRSOUND_CLUB_5_S, - _SCRSOUND_CLUB_5_L, - _SCRSOUND_CLUB_6_S, - _SCRSOUND_CLUB_6_L, - _SCRSOUND_CLUB_7_S, - _SCRSOUND_CLUB_7_L, - _SCRSOUND_CLUB_8_S, - _SCRSOUND_CLUB_8_L, - _SCRSOUND_CLUB_9_S, - _SCRSOUND_CLUB_9_L, - _SCRSOUND_CLUB_10_S, - _SCRSOUND_CLUB_10_L, - _SCRSOUND_CLUB_11_S, - _SCRSOUND_CLUB_11_L, - _SCRSOUND_CLUB_12_S, - _SCRSOUND_CLUB_12_L, - _SCRSOUND_CLUB_RAGGA_S, - _SCRSOUND_CLUB_RAGGA_L, - SCRSOUND_STRIP_CLUB_LOOP_1_S, - _SCRSOUND_STRIP_CLUB_LOOP_1_L, - SCRSOUND_STRIP_CLUB_LOOP_2_S, - _SCRSOUND_STRIP_CLUB_LOOP_2_L, - _SCRSOUND_SFX_WORKSHOP_1, - _SCRSOUND_SFX_WORKSHOP_2, - _SCRSOUND_SAWMILL_LOOP_S, - SCRSOUND_SAWMILL_LOOP_L, - _SCRSOUND_DOG_FOOD_FACTORY_S, - _SCRSOUND_DOG_FOOD_FACTORY_L, - _SCRSOUND_LAUNDERETTE_1, - _SCRSOUND_LAUNDERETTE_2, - _SCRSOUND_RESTAURANT_CHINATOWN_S, - _SCRSOUND_RESTAURANT_CHINATOWN_L, - _SCRSOUND_RESTAURANT_ITALY_S, - _SCRSOUND_RESTAURANT_ITALY_L, - _SCRSOUND_RESTAURANT_GENERIC_1_S, - _SCRSOUND_RESTAURANT_GENERIC_1_L, - _SCRSOUND_RESTAURANT_GENERIC_2_S, - _SCRSOUND_RESTAURANT_GENERIC_2_L, - _SCRSOUND_AIRPORT_ANNOUNCEMENT_S, - _SCRSOUND_AIRPORT_ANNOUNCEMENT_L, - _SCRSOUND_SHOP_LOOP_1, - _SCRSOUND_SHOP_LOOP_2, - _SCRSOUND_CINEMA_S, - _SCRSOUND_CINEMA_L, - _SCRSOUND_DOCKS_FOGHORN_S, - _SCRSOUND_DOCKS_FOGHORN_L, - _SCRSOUND_HOME_S, - _SCRSOUND_HOME_L, - _SCRSOUND_PIANO_BAR, - _SCRSOUND_CLUB, - SCRSOUND_PORN_CINEMA_1_S, - _SCRSOUND_PORN_CINEMA_1_L, - SCRSOUND_PORN_CINEMA_2_S, - _SCRSOUND_PORN_CINEMA_2_L, - SCRSOUND_PORN_CINEMA_3_S, - _SCRSOUND_PORN_CINEMA_3_L, - _SCRSOUND_BANK_ALARM_LOOP_S, - SCRSOUND_BANK_ALARM_LOOP_L, - _SCRSOUND_POLICE_BALL_LOOP_S, - SCRSOUND_POLICE_BALL_LOOP_L, - _SCRSOUND_RAVE_LOOP_INDUSTRIAL_S, - SCRSOUND_RAVE_LOOP_INDUSTRIAL_L, - _SCRSOUND_UNK_74, - _SCRSOUND_UNK_75, - _SCRSOUND_POLICE_CELL_BEATING_LOOP_S, - SCRSOUND_POLICE_CELL_BEATING_LOOP_L, - SCRSOUND_INJURED_PED_MALE_OUCH_S, - SCRSOUND_INJURED_PED_MALE_OUCH_L, - SCRSOUND_INJURED_PED_FEMALE_OUCH_S, - SCRSOUND_INJURED_PED_FEMALE_OUCH_L, - SCRSOUND_EVIDENCE_PICKUP, - SCRSOUND_UNLOAD_GOLD, - _SCRSOUND_RAVE_INDUSTRIAL_S, - _SCRSOUND_RAVE_INDUSTRIAL_L, - _SCRSOUND_RAVE_COMMERCIAL_S, - _SCRSOUND_RAVE_COMMERCIAL_L, - _SCRSOUND_RAVE_SUBURBAN_S, - _SCRSOUND_RAVE_SUBURBAN_L, - _SCRSOUND_GROAN_S, - _SCRSOUND_GROAN_L, - SCRSOUND_GATE_START_CLUNK, - SCRSOUND_GATE_STOP_CLUNK, - SCRSOUND_PART_MISSION_COMPLETE, - SCRSOUND_CHUNKY_RUN_SHOUT, - SCRSOUND_SECURITY_GUARD_RUN_AWAY_SHOUT, - SCRSOUND_RACE_START_1, - SCRSOUND_RACE_START_2, - SCRSOUND_RACE_START_3, - SCRSOUND_RACE_START_GO, - SCRSOUND_SWAT_PED_SHOUT, - SCRSOUND_PRETEND_FIRE_LOOP, - SCRSOUND_AMMUNATION_CHAT_1, - SCRSOUND_AMMUNATION_CHAT_2, - SCRSOUND_AMMUNATION_CHAT_3, - _SCRSOUND_BULLET_WALL_1, - _SCRSOUND_BULLET_WALL_2, - _SCRSOUND_BULLET_WALL_3, - _SCRSOUND_UNK_109, - _SCRSOUND_GLASSFX2_1, - _SCRSOUND_GLASSFX2_2, - _SCRSOUND_PHONE_RING, - _SCRSOUND_UNK_113, - _SCRSOUND_GLASS_SMASH_1, - _SCRSOUND_GLASS_SMASH_2, - _SCRSOUND_GLASS_CRACK, - _SCRSOUND_GLASS_SHARD, - _SCRSOUND_WOODEN_BOX_SMASH, - _SCRSOUND_CARDBOARD_BOX_SMASH, - _SCRSOUND_COL_CAR, - _SCRSOUND_TYRE_BUMP, - _SCRSOUND_BULLET_SHELL_HIT_GROUND_1, - _SCRSOUND_BULLET_SHELL_HIT_GROUND_2, - TOTAL_SCRSOUNDS, - SCRSOUND_INVALID -}; - class cAudioScriptObject { public: diff --git a/src/audio/soundlist.h b/src/audio/soundlist.h index 64d7dbcb..6d1ff6e3 100644 --- a/src/audio/soundlist.h +++ b/src/audio/soundlist.h @@ -1,301 +1,303 @@ #pragma once -enum eSound : int16 +enum eSound : uint16 { SOUND_CAR_DOOR_CLOSE_BONNET = 0, - SOUND_CAR_DOOR_CLOSE_BUMPER = 1, - SOUND_CAR_DOOR_CLOSE_FRONT_LEFT = 2, - SOUND_CAR_DOOR_CLOSE_FRONT_RIGHT = 3, - SOUND_CAR_DOOR_CLOSE_BACK_LEFT = 4, - SOUND_CAR_DOOR_CLOSE_BACK_RIGHT = 5, - SOUND_CAR_DOOR_OPEN_BONNET = 6, - SOUND_CAR_DOOR_OPEN_BUMPER = 7, - SOUND_CAR_DOOR_OPEN_FRONT_LEFT = 8, - SOUND_CAR_DOOR_OPEN_FRONT_RIGHT = 9, - SOUND_CAR_DOOR_OPEN_BACK_LEFT = 10, - SOUND_CAR_DOOR_OPEN_BACK_RIGHT = 11, - SOUND_CAR_WINDSHIELD_CRACK = 12, - SOUND_CAR_JUMP = 13, - SOUND_E = 14, - SOUND_F = 15, - SOUND_CAR_ENGINE_START = 16, - SOUND_CAR_LIGHT_BREAK = 17, - SOUND_CAR_HYDRAULIC_1 = 18, - SOUND_CAR_HYDRAULIC_2 = 19, - SOUND_CAR_HYDRAULIC_3 = 20, - SOUND_CAR_JERK = 21, - SOUND_CAR_SPLASH = 22, - SOUND_17 = 23, - SOUND_18 = 24, - SOUND_19 = 25, - SOUND_CAR_TANK_TURRET_ROTATE = 26, - SOUND_CAR_BOMB_TICK = 27, - SOUND_PLANE_ON_GROUND = 28, - SOUND_STEP_START = 29, - SOUND_STEP_END = 30, - SOUND_FALL_LAND = 31, - SOUND_FALL_COLLAPSE = 32, - SOUND_FIGHT_PUNCH_33 = 33, - SOUND_FIGHT_KICK_34 = 34, - SOUND_FIGHT_HEADBUTT_35 = 35, - SOUND_FIGHT_PUNCH_36 = 36, - SOUND_FIGHT_PUNCH_37 = 37, - SOUND_FIGHT_CLOSE_PUNCH_38 = 38, - SOUND_FIGHT_PUNCH_39 = 39, - SOUND_FIGHT_PUNCH_OR_KICK_BELOW_40 = 40, - SOUND_FIGHT_PUNCH_41 = 41, - SOUND_FIGHT_PUNCH_FROM_BEHIND_42 = 42, - SOUND_FIGHT_KNEE_OR_KICK_43 = 43, - SOUND_FIGHT_KICK_44 = 44, - SOUND_2D = 45, - SOUND_WEAPON_BAT_ATTACK = 46, - SOUND_WEAPON_SHOT_FIRED = 47, - SOUND_WEAPON_RELOAD = 48, - SOUND_WEAPON_AK47_BULLET_ECHO = 49, - SOUND_WEAPON_UZI_BULLET_ECHO = 50, - SOUND_WEAPON_M16_BULLET_ECHO = 51, - SOUND_WEAPON_FLAMETHROWER_FIRE = 52, - SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM = 53, - SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM = 54, - SOUND_WEAPON_HIT_PED = 55, - SOUND_WEAPON_HIT_VEHICLE = 56, - SOUND_GARAGE_NO_MONEY = 57, - SOUND_GARAGE_BAD_VEHICLE = 58, - SOUND_GARAGE_OPENING = 59, - SOUND_GARAGE_BOMB_ALREADY_SET = 60, - SOUND_GARAGE_BOMB1_SET = 61, - SOUND_GARAGE_BOMB2_SET = 62, - SOUND_GARAGE_BOMB3_SET = 63, - SOUND_40 = 64, - SOUND_41 = 65, - SOUND_GARAGE_VEHICLE_DECLINED = 66, - SOUND_GARAGE_VEHICLE_ACCEPTED = 67, - SOUND_GARAGE_DOOR_CLOSED = 68, - SOUND_GARAGE_DOOR_OPENED = 69, - SOUND_CRANE_PICKUP = 70, - SOUND_PICKUP_WEAPON_BOUGHT = 71, - SOUND_PICKUP_WEAPON = 72, - SOUND_PICKUP_HEALTH = 73, - SOUND_4A = 74, - SOUND_4B = 75, - SOUND_PICKUP_ADRENALINE = 76, - SOUND_PICKUP_ARMOUR = 77, - SOUND_PICKUP_BONUS = 78, - SOUND_PICKUP_MONEY = 79, - SOUND_PICKUP_HIDDEN_PACKAGE = 80, - SOUND_PICKUP_PACMAN_PILL = 81, - SOUND_PICKUP_PACMAN_PACKAGE = 82, - SOUND_PICKUP_FLOAT_PACKAGE = 83, - SOUND_BOMB_TIMED_ACTIVATED = 84, - SOUND_55 = 85, - SOUND_BOMB_ONIGNITION_ACTIVATED = 86, - SOUND_BOMB_TICK = 87, - SOUND_RAMPAGE_START = 88, - SOUND_RAMPAGE_ONGOING = 89, - SOUND_RAMPAGE_PASSED = 90, - SOUND_RAMPAGE_FAILED = 91, - SOUND_RAMPAGE_KILL = 92, - SOUND_RAMPAGE_CAR_BLOWN = 93, - SOUND_EVIDENCE_PICKUP = 94, - SOUND_UNLOAD_GOLD = 95, - SOUND_PAGER = 96, - SOUND_PED_DEATH = 97, // 103 in VC - SOUND_PED_DAMAGE = 98, // 104 in VC - SOUND_PED_HIT = 99, // 105 in VC - SOUND_PED_LAND = 100, // hopefully 106 in VC - SOUND_PED_BULLET_HIT = 101, - SOUND_PED_BOMBER = 102, - SOUND_PED_BURNING = 103, // 108 in VC - SOUND_PED_ARREST_FBI = 104, - SOUND_PED_ARREST_SWAT = 105, - SOUND_PED_ARREST_COP = 106, - SOUND_PED_HELI_PLAYER_FOUND = 107, - SOUND_PED_HANDS_UP = 108, - SOUND_PED_HANDS_COWER = 109, - SOUND_PED_FLEE_SPRINT = 110, // 120 in VC - SOUND_PED_CAR_JACKING = 111, - SOUND_PED_MUGGING = 112, - SOUND_PED_CAR_JACKED = 113, - SOUND_PED_ROBBED = 114, - SOUND_PED_TAXI_WAIT = 115, // 137 in VC - SOUND_PED_ATTACK = 116, - SOUND_PED_DEFEND = 117, - SOUND_PED_PURSUIT_ARMY = 118, - SOUND_PED_PURSUIT_FBI = 119, - SOUND_PED_PURSUIT_SWAT = 120, - SOUND_PED_PURSUIT_COP = 121, - SOUND_PED_HEALING = 122, - SOUND_PED_7B = 123, - SOUND_PED_LEAVE_VEHICLE = 124, - SOUND_PED_EVADE = 125, // 142 in VC - SOUND_PED_FLEE_RUN = 126, - SOUND_PED_CAR_COLLISION = 127, // 144-145-146 in VC - SOUND_PED_SOLICIT = 128, - SOUND_PED_EXTINGUISHING_FIRE = 129, - SOUND_PED_WAIT_DOUBLEBACK = 130, - SOUND_PED_CHAT_SEXY = 131, - SOUND_PED_CHAT_EVENT = 132, - SOUND_PED_CHAT = 133, - SOUND_PED_BODYCAST_HIT = 134, - SOUND_PED_TAXI_CALL = 135, - SOUND_INJURED_PED_MALE_OUCH = 136, - SOUND_INJURED_PED_FEMALE = 137, - SOUND_INJURED_PED_MALE_PRISON = 138, - SOUND_RACE_START_3 = 139, - SOUND_RACE_START_2 = 140, - SOUND_RACE_START_1 = 141, - SOUND_RACE_START_GO = 142, - SOUND_SPLASH = 143, - SOUND_WATER_FALL = 144, - SOUND_SPLATTER = 145, - SOUND_CAR_PED_COLLISION = 146, - SOUND_CLOCK_TICK = 147, - SOUND_PART_MISSION_COMPLETE = 148, - SOUND_FRONTEND_MENU_STARTING = 149, - SOUND_FRONTEND_MENU_COMPLETED = 150, - SOUND_FRONTEND_MENU_DENIED = 151, - SOUND_FRONTEND_MENU_SUCCESS = 152, - SOUND_FRONTEND_EXIT = 153, - SOUND_9A = 154, - SOUND_9B = 155, - SOUND_FRONTEND_AUDIO_TEST = 156, - SOUND_FRONTEND_FAIL = 157, - SOUND_FRONTEND_NO_RADIO = 158, - SOUND_FRONTEND_RADIO_CHANGE = 159, - SOUND_A0 = 160, - SOUND_AMMUNATION_WELCOME_1 = 161, - SOUND_AMMUNATION_WELCOME_2 = 162, - SOUND_AMMUNATION_WELCOME_3 = 163, - SOUND_LIGHTNING = 164, - SOUND_A5 = 165, - SOUND_TOTAL_SOUNDS = 166, - SOUND_TOTAL_PED_SOUNDS = 167, + SOUND_CAR_DOOR_CLOSE_BUMPER, + SOUND_CAR_DOOR_CLOSE_FRONT_LEFT, + SOUND_CAR_DOOR_CLOSE_FRONT_RIGHT, + SOUND_CAR_DOOR_CLOSE_BACK_LEFT, + SOUND_CAR_DOOR_CLOSE_BACK_RIGHT, + SOUND_CAR_DOOR_OPEN_BONNET, + SOUND_CAR_DOOR_OPEN_BUMPER, + SOUND_CAR_DOOR_OPEN_FRONT_LEFT, + SOUND_CAR_DOOR_OPEN_FRONT_RIGHT, + SOUND_CAR_DOOR_OPEN_BACK_LEFT, + SOUND_CAR_DOOR_OPEN_BACK_RIGHT, + SOUND_CAR_WINDSHIELD_CRACK, + SOUND_CAR_JUMP, + SOUND_E, + SOUND_F, + SOUND_CAR_ENGINE_START, + SOUND_CAR_LIGHT_BREAK, + SOUND_CAR_HYDRAULIC_1, + SOUND_CAR_HYDRAULIC_2, + SOUND_CAR_HYDRAULIC_3, + SOUND_CAR_JERK, + SOUND_CAR_SPLASH, + SOUND_17, + SOUND_18, + SOUND_19, + SOUND_CAR_TANK_TURRET_ROTATE, + SOUND_CAR_BOMB_TICK, + SOUND_PLANE_ON_GROUND, + SOUND_STEP_START, + SOUND_STEP_END, + SOUND_FALL_LAND, + SOUND_FALL_COLLAPSE, + SOUND_FIGHT_PUNCH_33, + SOUND_FIGHT_KICK_34, + SOUND_FIGHT_HEADBUTT_35, + SOUND_FIGHT_PUNCH_36, + SOUND_FIGHT_PUNCH_37, + SOUND_FIGHT_CLOSE_PUNCH_38, + SOUND_FIGHT_PUNCH_39, + SOUND_FIGHT_PUNCH_OR_KICK_BELOW_40, + SOUND_FIGHT_PUNCH_41, + SOUND_FIGHT_PUNCH_FROM_BEHIND_42, + SOUND_FIGHT_KNEE_OR_KICK_43, + SOUND_FIGHT_KICK_44, + SOUND_2D, + SOUND_WEAPON_BAT_ATTACK, + SOUND_WEAPON_SHOT_FIRED, + SOUND_WEAPON_RELOAD, + SOUND_WEAPON_AK47_BULLET_ECHO, + SOUND_WEAPON_UZI_BULLET_ECHO, + SOUND_WEAPON_M16_BULLET_ECHO, + SOUND_WEAPON_FLAMETHROWER_FIRE, + SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM, + SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM, + SOUND_WEAPON_HIT_PED, + SOUND_WEAPON_HIT_VEHICLE, + SOUND_GARAGE_NO_MONEY, + SOUND_GARAGE_BAD_VEHICLE, + SOUND_GARAGE_OPENING, + SOUND_GARAGE_BOMB_ALREADY_SET, + SOUND_GARAGE_BOMB1_SET, + SOUND_GARAGE_BOMB2_SET, + SOUND_GARAGE_BOMB3_SET, + SOUND_40, + SOUND_41, + SOUND_GARAGE_VEHICLE_DECLINED, + SOUND_GARAGE_VEHICLE_ACCEPTED, + SOUND_GARAGE_DOOR_CLOSED, + SOUND_GARAGE_DOOR_OPENED, + SOUND_CRANE_PICKUP, + SOUND_PICKUP_WEAPON_BOUGHT, + SOUND_PICKUP_WEAPON, + SOUND_PICKUP_HEALTH, + SOUND_4A, + SOUND_4B, + SOUND_PICKUP_ADRENALINE, + SOUND_PICKUP_ARMOUR, + SOUND_PICKUP_BONUS, + SOUND_PICKUP_MONEY, + SOUND_PICKUP_HIDDEN_PACKAGE, + SOUND_PICKUP_PACMAN_PILL, + SOUND_PICKUP_PACMAN_PACKAGE, + SOUND_PICKUP_FLOAT_PACKAGE, + SOUND_BOMB_TIMED_ACTIVATED, + SOUND_55, + SOUND_BOMB_ONIGNITION_ACTIVATED, + SOUND_BOMB_TICK, + SOUND_RAMPAGE_START, + SOUND_RAMPAGE_ONGOING, + SOUND_RAMPAGE_PASSED, + SOUND_RAMPAGE_FAILED, + SOUND_RAMPAGE_KILL, + SOUND_RAMPAGE_CAR_BLOWN, + SOUND_EVIDENCE_PICKUP, + SOUND_UNLOAD_GOLD, + SOUND_PAGER, + SOUND_PED_DEATH, // 103 in VC + SOUND_PED_DAMAGE, // 104 in VC + SOUND_PED_HIT, // 105 in VC + SOUND_PED_LAND, // hopefully 106 in VC + SOUND_PED_BULLET_HIT, + SOUND_PED_BOMBER, + SOUND_PED_BURNING, // 108 in VC + SOUND_PED_ARREST_FBI, + SOUND_PED_ARREST_SWAT, + SOUND_PED_ARREST_COP, + SOUND_PED_HELI_PLAYER_FOUND, + SOUND_PED_HANDS_UP, + SOUND_PED_HANDS_COWER, + SOUND_PED_FLEE_SPRINT, // 120 in VC + SOUND_PED_CAR_JACKING, + SOUND_PED_MUGGING, + SOUND_PED_CAR_JACKED, + SOUND_PED_ROBBED, + SOUND_PED_TAXI_WAIT, // 137 in VC + SOUND_PED_ATTACK, + SOUND_PED_DEFEND, + SOUND_PED_PURSUIT_ARMY, + SOUND_PED_PURSUIT_FBI, + SOUND_PED_PURSUIT_SWAT, + SOUND_PED_PURSUIT_COP, + SOUND_PED_HEALING, + SOUND_PED_7B, + SOUND_PED_LEAVE_VEHICLE, + SOUND_PED_EVADE, // 142 in VC + SOUND_PED_FLEE_RUN, + SOUND_PED_CAR_COLLISION, // 144-145-146 in VC + SOUND_PED_SOLICIT, + SOUND_PED_EXTINGUISHING_FIRE, + SOUND_PED_WAIT_DOUBLEBACK, + SOUND_PED_CHAT_SEXY, + SOUND_PED_CHAT_EVENT, + SOUND_PED_CHAT, + SOUND_PED_BODYCAST_HIT, + SOUND_PED_TAXI_CALL, + SOUND_INJURED_PED_MALE_OUCH, + SOUND_INJURED_PED_FEMALE, + SOUND_INJURED_PED_MALE_PRISON, + SOUND_RACE_START_3, + SOUND_RACE_START_2, + SOUND_RACE_START_1, + SOUND_RACE_START_GO, + SOUND_SPLASH, + SOUND_WATER_FALL, + SOUND_SPLATTER, + SOUND_CAR_PED_COLLISION, + SOUND_CLOCK_TICK, + SOUND_PART_MISSION_COMPLETE, + SOUND_FRONTEND_MENU_STARTING, + SOUND_FRONTEND_MENU_COMPLETED, + SOUND_FRONTEND_MENU_DENIED, + SOUND_FRONTEND_MENU_SUCCESS, + SOUND_FRONTEND_EXIT, + SOUND_9A, + SOUND_9B, + SOUND_FRONTEND_AUDIO_TEST, + SOUND_FRONTEND_FAIL, + SOUND_FRONTEND_NO_RADIO, + SOUND_FRONTEND_RADIO_CHANGE, + SOUND_A0, + SOUND_AMMUNATION_WELCOME_1, + SOUND_AMMUNATION_WELCOME_2, + SOUND_AMMUNATION_WELCOME_3, + SOUND_LIGHTNING, + SOUND_A5, + SOUND_TOTAL_SOUNDS, + SOUND_NO_SOUND, }; -enum eScriptSounds : int16 { +enum eScriptSounds : uint16 { SCRIPT_SOUND_0 = 0, - SCRIPT_SOUND_1 = 1, - SCRIPT_SOUND_2 = 2, - SCRIPT_SOUND_3 = 3, - SCRIPT_SOUND_PARTY_1_LOOP_S = 4, - SCRIPT_SOUND_PARTY_1_LOOP_L = 5, - SCRIPT_SOUND_PARTY_2_LOOP_S = 6, - SCRIPT_SOUND_PARTY_2_LOOP_L = 7, - SCRIPT_SOUND_PARTY_3_LOOP_S = 8, - SCRIPT_SOUND_PARTY_3_LOOP_L = 9, - SCRIPT_SOUND_PARTY_4_LOOP_S = 10, - SCRIPT_SOUND_PARTY_4_LOOP_L = 11, - SCRIPT_SOUND_PARTY_5_LOOP_S = 12, - SCRIPT_SOUND_PARTY_5_LOOP_L = 13, - SCRIPT_SOUND_PARTY_6_LOOP_S = 14, - SCRIPT_SOUND_PARTY_6_LOOP_L = 15, - SCRIPT_SOUND_PARTY_7_LOOP_S = 16, - SCRIPT_SOUND_PARTY_7_LOOP_L = 17, - SCRIPT_SOUND_PARTY_8_LOOP_S = 18, - SCRIPT_SOUND_PARTY_8_LOOP_L = 19, - SCRIPT_SOUND_PARTY_9_LOOP_S = 20, - SCRIPT_SOUND_PARTY_9_LOOP_L = 21, - SCRIPT_SOUND_PARTY_10_LOOP_S = 22, - SCRIPT_SOUND_PARTY_10_LOOP_L = 23, - SCRIPT_SOUND_PARTY_11_LOOP_S = 24, - SCRIPT_SOUND_PARTY_11_LOOP_L = 25, - SCRIPT_SOUND_PARTY_12_LOOP_S = 26, - SCRIPT_SOUND_PARTY_12_LOOP_L = 27, - SCRIPT_SOUND_PARTY_13_LOOP_S = 28, - SCRIPT_SOUND_PARTY_13_LOOP_L = 29, - SCRIPT_SOUND_STRIP_CLUB_LOOP_1_S = 30, - SCRIPT_SOUND_STRIP_CLUB_LOOP_1_L = 31, - SCRIPT_SOUND_STRIP_CLUB_LOOP_2_S = 32, - SCRIPT_SOUND_STRIP_CLUB_LOOP_2_L = 33, - SCRIPT_SOUND_WORK_SHOP_LOOP_S = 34, - SCRIPT_SOUND_WORK_SHOP_LOOP_L = 35, - SCRIPT_SOUND_SAWMILL_LOOP_S = 36, - SCRIPT_SOUND_SAWMILL_LOOP_L = 37, - SCRIPT_SOUND_38 = 38, - SCRIPT_SOUND_39 = 39, - SCRIPT_SOUND_LAUNDERETTE_LOOP_S = 40, - SCRIPT_SOUND_LAUNDERETTE_LOOP_L = 41, - SCRIPT_SOUND_CHINATOWN_RESTAURANT_S = 42, - SCRIPT_SOUND_CHINATOWN_RESTAURANT_L = 43, - SCRIPT_SOUND_CIPRIANI_RESAURANT_S = 44, - SCRIPT_SOUND_CIPRIANI_RESAURANT_L = 45, - SCRIPT_SOUND_46_S = 46, - SCRIPT_SOUND_47_L = 47, - SCRIPT_SOUND_MARCO_BISTRO_S = 48, - SCRIPT_SOUND_MARCO_BISTRO_L = 49, - SCRIPT_SOUND_AIRPORT_LOOP_S = 50, - SCRIPT_SOUND_AIRPORT_LOOP_L = 51, - SCRIPT_SOUND_SHOP_LOOP_S = 52, - SCRIPT_SOUND_SHOP_LOOP_L = 53, - SCRIPT_SOUND_CINEMA_LOOP_S = 54, - SCRIPT_SOUND_CINEMA_LOOP_L = 55, - SCRIPT_SOUND_DOCKS_LOOP_S = 56, - SCRIPT_SOUND_DOCKS_LOOP_L = 57, - SCRIPT_SOUND_HOME_LOOP_S = 58, - SCRIPT_SOUND_HOME_LOOP_L = 59, - SCRIPT_SOUND_FRANKIE_PIANO = 60, - SCRIPT_SOUND_PARTY_1_LOOP = 61, - SCRIPT_SOUND_PORN_CINEMA_1_S = 62, - SCRIPT_SOUND_PORN_CINEMA_1_L = 63, - SCRIPT_SOUND_PORN_CINEMA_2_S = 64, - SCRIPT_SOUND_PORN_CINEMA_2_L = 65, - SCRIPT_SOUND_PORN_CINEMA_3_S = 66, - SCRIPT_SOUND_PORN_CINEMA_3_L = 67, - SCRIPT_SOUND_BANK_ALARM_LOOP_S = 68, - SCRIPT_SOUND_BANK_ALARM_LOOP_L = 69, - SCRIPT_SOUND_POLICE_BALL_LOOP_S = 70, - SCRIPT_SOUND_POLICE_BALL_LOOP_L = 71, - SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_S = 72, - SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_L = 73, - SCRIPT_SOUND_74 = 74, - SCRIPT_SOUND_75 = 75, - SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S = 76, - SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L = 77, - SCRIPT_SOUND_INJURED_PED_MALE_OUCH_S = 78, - SCRIPT_SOUND_INJURED_PED_MALE_OUCH_L = 79, - SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S = 80, - SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L = 81, - SCRIPT_SOUND_EVIDENCE_PICKUP = 82, - SCRIPT_SOUND_UNLOAD_GOLD = 83, - SCRIPT_SOUND_RAVE_1_LOOP_S = 84, - SCRIPT_SOUND_RAVE_1_LOOP_L = 85, - SCRIPT_SOUND_RAVE_2_LOOP_S = 86, - SCRIPT_SOUND_RAVE_2_LOOP_L = 87, - SCRIPT_SOUND_RAVE_3_LOOP_S = 88, - SCRIPT_SOUND_RAVE_3_LOOP_L = 89, - SCRIPT_SOUND_MISTY_SEX_S = 90, - SCRIPT_SOUND_MISTY_SEX_L = 91, - SCRIPT_SOUND_GATE_START_CLUNK = 92, - SCRIPT_SOUND_GATE_STOP_CLUNK = 93, - SCRIPT_SOUND_PART_MISSION_COMPLETE = 94, - SCRIPT_SOUND_CHUNKY_RUN_SHOUT = 95, - SCRIPT_SOUND_SECURITY_GUARD_AWAY_SHOUT = 96, - SCRIPT_SOUND_RACE_START_3 = 97, - SCRIPT_SOUND_RACE_START_2 = 98, - SCRIPT_SOUND_RACE_START_1 = 99, - SCRIPT_SOUND_RACE_START_GO = 100, - SCRIPT_SOUND_SWAT_PED_SHOUT = 101, - SCRIPT_SOUND_PRETEND_FIRE_LOOP = 102, - SCRIPT_SOUND_AMMUNATION_CHAT_1 = 103, - SCRIPT_SOUND_AMMUNATION_CHAT_2 = 104, - SCRIPT_SOUND_AMMUNATION_CHAT_3 = 105, - SCRIPT_SOUND_BULLET_HIT_GROUND_1 = 106, - SCRIPT_SOUND_BULLET_HIT_GROUND_2 = 107, - SCRIPT_SOUND_BULLET_HIT_GROUND_3 = 108, - SCRIPT_SOUND_BULLET_HIT_WATER = 109, //no sound - SCRIPT_SOUND_110 = 110, - SCRIPT_SOUND_111 = 111, - SCRIPT_SOUND_PAYPHONE_RINGING = 112, - SCRIPT_SOUND_113 = 113, - SCRIPT_SOUND_GLASS_BREAK_L = 114, - SCRIPT_SOUND_GLASS_BREAK_S = 115, - SCRIPT_SOUND_GLASS_CRACK = 116, - SCRIPT_SOUND_GLASS_LIGHT_BREAK = 117, - SCRIPT_SOUND_BOX_DESTROYED_1 = 118, - SCRIPT_SOUND_BOX_DESTROYED_2 = 119, - SCRIPT_SOUND_METAL_COLLISION = 120, - SCRIPT_SOUND_TIRE_COLLISION = 121, - SCRIPT_SOUND_GUNSHELL_DROP = 122, - SCRIPT_SOUND_GUNSHELL_DROP_SOFT = 123, + SCRIPT_SOUND_1, + SCRIPT_SOUND_2, + SCRIPT_SOUND_3, + SCRIPT_SOUND_PARTY_1_LOOP_S, + SCRIPT_SOUND_PARTY_1_LOOP_L, + SCRIPT_SOUND_PARTY_2_LOOP_S, + SCRIPT_SOUND_PARTY_2_LOOP_L, + SCRIPT_SOUND_PARTY_3_LOOP_S, + SCRIPT_SOUND_PARTY_3_LOOP_L, + SCRIPT_SOUND_PARTY_4_LOOP_S, + SCRIPT_SOUND_PARTY_4_LOOP_L, + SCRIPT_SOUND_PARTY_5_LOOP_S, + SCRIPT_SOUND_PARTY_5_LOOP_L, + SCRIPT_SOUND_PARTY_6_LOOP_S, + SCRIPT_SOUND_PARTY_6_LOOP_L, + SCRIPT_SOUND_PARTY_7_LOOP_S, + SCRIPT_SOUND_PARTY_7_LOOP_L, + SCRIPT_SOUND_PARTY_8_LOOP_S, + SCRIPT_SOUND_PARTY_8_LOOP_L, + SCRIPT_SOUND_PARTY_9_LOOP_S, + SCRIPT_SOUND_PARTY_9_LOOP_L, + SCRIPT_SOUND_PARTY_10_LOOP_S, + SCRIPT_SOUND_PARTY_10_LOOP_L, + SCRIPT_SOUND_PARTY_11_LOOP_S, + SCRIPT_SOUND_PARTY_11_LOOP_L, + SCRIPT_SOUND_PARTY_12_LOOP_S, + SCRIPT_SOUND_PARTY_12_LOOP_L, + SCRIPT_SOUND_PARTY_13_LOOP_S, + SCRIPT_SOUND_PARTY_13_LOOP_L, + SCRIPT_SOUND_STRIP_CLUB_LOOP_1_S, + SCRIPT_SOUND_STRIP_CLUB_LOOP_1_L, + SCRIPT_SOUND_STRIP_CLUB_LOOP_2_S, + SCRIPT_SOUND_STRIP_CLUB_LOOP_2_L, + SCRIPT_SOUND_WORK_SHOP_LOOP_S, + SCRIPT_SOUND_WORK_SHOP_LOOP_L, + SCRIPT_SOUND_SAWMILL_LOOP_S, + SCRIPT_SOUND_SAWMILL_LOOP_L, + SCRIPT_SOUND_38, + SCRIPT_SOUND_39, + SCRIPT_SOUND_LAUNDERETTE_LOOP_S, + SCRIPT_SOUND_LAUNDERETTE_LOOP_L, + SCRIPT_SOUND_CHINATOWN_RESTAURANT_S, + SCRIPT_SOUND_CHINATOWN_RESTAURANT_L, + SCRIPT_SOUND_CIPRIANI_RESAURANT_S, + SCRIPT_SOUND_CIPRIANI_RESAURANT_L, + SCRIPT_SOUND_46_S, + SCRIPT_SOUND_47_L, + SCRIPT_SOUND_MARCO_BISTRO_S, + SCRIPT_SOUND_MARCO_BISTRO_L, + SCRIPT_SOUND_AIRPORT_LOOP_S, + SCRIPT_SOUND_AIRPORT_LOOP_L, + SCRIPT_SOUND_SHOP_LOOP_S, + SCRIPT_SOUND_SHOP_LOOP_L, + SCRIPT_SOUND_CINEMA_LOOP_S, + SCRIPT_SOUND_CINEMA_LOOP_L, + SCRIPT_SOUND_DOCKS_LOOP_S, + SCRIPT_SOUND_DOCKS_LOOP_L, + SCRIPT_SOUND_HOME_LOOP_S, + SCRIPT_SOUND_HOME_LOOP_L, + SCRIPT_SOUND_FRANKIE_PIANO, + SCRIPT_SOUND_PARTY_1_LOOP, + SCRIPT_SOUND_PORN_CINEMA_1_S, + SCRIPT_SOUND_PORN_CINEMA_1_L, + SCRIPT_SOUND_PORN_CINEMA_2_S, + SCRIPT_SOUND_PORN_CINEMA_2_L, + SCRIPT_SOUND_PORN_CINEMA_3_S, + SCRIPT_SOUND_PORN_CINEMA_3_L, + SCRIPT_SOUND_BANK_ALARM_LOOP_S, + SCRIPT_SOUND_BANK_ALARM_LOOP_L, + SCRIPT_SOUND_POLICE_BALL_LOOP_S, + SCRIPT_SOUND_POLICE_BALL_LOOP_L, + SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_S, + SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_L, + SCRIPT_SOUND_74, + SCRIPT_SOUND_75, + SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S, + SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L, + SCRIPT_SOUND_INJURED_PED_MALE_OUCH_S, + SCRIPT_SOUND_INJURED_PED_MALE_OUCH_L, + SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S, + SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L, + SCRIPT_SOUND_EVIDENCE_PICKUP, + SCRIPT_SOUND_UNLOAD_GOLD, + SCRIPT_SOUND_RAVE_1_LOOP_S, + SCRIPT_SOUND_RAVE_1_LOOP_L, + SCRIPT_SOUND_RAVE_2_LOOP_S, + SCRIPT_SOUND_RAVE_2_LOOP_L, + SCRIPT_SOUND_RAVE_3_LOOP_S, + SCRIPT_SOUND_RAVE_3_LOOP_L, + SCRIPT_SOUND_MISTY_SEX_S, + SCRIPT_SOUND_MISTY_SEX_L, + SCRIPT_SOUND_GATE_START_CLUNK, + SCRIPT_SOUND_GATE_STOP_CLUNK, + SCRIPT_SOUND_PART_MISSION_COMPLETE, + SCRIPT_SOUND_CHUNKY_RUN_SHOUT, + SCRIPT_SOUND_SECURITY_GUARD_AWAY_SHOUT, + SCRIPT_SOUND_RACE_START_3, + SCRIPT_SOUND_RACE_START_2, + SCRIPT_SOUND_RACE_START_1, + SCRIPT_SOUND_RACE_START_GO, + SCRIPT_SOUND_SWAT_PED_SHOUT, + SCRIPT_SOUND_PRETEND_FIRE_LOOP, + SCRIPT_SOUND_AMMUNATION_CHAT_1, + SCRIPT_SOUND_AMMUNATION_CHAT_2, + SCRIPT_SOUND_AMMUNATION_CHAT_3, + SCRIPT_SOUND_BULLET_HIT_GROUND_1, + SCRIPT_SOUND_BULLET_HIT_GROUND_2, + SCRIPT_SOUND_BULLET_HIT_GROUND_3, + SCRIPT_SOUND_BULLET_HIT_WATER, // no sound + SCRIPT_SOUND_110, + SCRIPT_SOUND_111, + SCRIPT_SOUND_PAYPHONE_RINGING, + SCRIPT_SOUND_113, + SCRIPT_SOUND_GLASS_BREAK_L, + SCRIPT_SOUND_GLASS_BREAK_S, + SCRIPT_SOUND_GLASS_CRACK, + SCRIPT_SOUND_GLASS_LIGHT_BREAK, + SCRIPT_SOUND_BOX_DESTROYED_1, + SCRIPT_SOUND_BOX_DESTROYED_2, + SCRIPT_SOUND_METAL_COLLISION, + SCRIPT_SOUND_TIRE_COLLISION, + SCRIPT_SOUND_GUNSHELL_DROP, + SCRIPT_SOUND_GUNSHELL_DROP_SOFT, + SCRIPT_SOUND_TOTAL, + SCRIPT_SOUND_INVALID, }; diff --git a/src/control/Phones.cpp b/src/control/Phones.cpp index ee01b6c4..6fac3f9d 100644 --- a/src/control/Phones.cpp +++ b/src/control/Phones.cpp @@ -12,6 +12,7 @@ #include "AudioScriptObject.h" #include "RpAnimBlend.h" #include "AnimBlendAssociation.h" +#include "soundlist.h" #ifdef FIX_BUGS #include "Replay.h" #endif @@ -97,7 +98,7 @@ CPhoneInfo::Update(void) if (scratchTheCabinet) { m_aPhones[phoneId].m_pEntity->GetUp().z = (CGeneral::GetRandomNumber() % 1024) / 16000.0f + 1.0f; if (!phoneRings) - PlayOneShotScriptObject(_SCRSOUND_PHONE_RING, m_aPhones[phoneId].m_pEntity->GetPosition()); + PlayOneShotScriptObject(SCRIPT_SOUND_PAYPHONE_RINGING, m_aPhones[phoneId].m_pEntity->GetPosition()); } else { m_aPhones[phoneId].m_pEntity->GetUp().z = 1.0f; } @@ -136,7 +137,7 @@ CPhoneInfo::Update(void) if (scratchTheCabinet) { m_aPhones[phoneId].m_pEntity->GetUp().z = (CGeneral::GetRandomNumber() % 1024) / 16000.0f + 1.0f; if (!phoneRings) - PlayOneShotScriptObject(_SCRSOUND_PHONE_RING, m_aPhones[phoneId].m_pEntity->GetPosition()); + PlayOneShotScriptObject(SCRIPT_SOUND_PAYPHONE_RINGING, m_aPhones[phoneId].m_pEntity->GetPosition()); } else { m_aPhones[phoneId].m_pEntity->GetUp().z = 1.0f; } diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp index cd2cd688..c5f73987 100644 --- a/src/objects/Object.cpp +++ b/src/objects/Object.cpp @@ -11,6 +11,7 @@ #include "ObjectData.h" #include "World.h" #include "Floater.h" +#include "soundlist.h" int16 CObject::nNoTempObjects; int16 CObject::nBodyCastHealth = 1000; @@ -219,7 +220,7 @@ CObject::ObjectDamage(float amount) int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80); CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0); } - PlayOneShotScriptObject(_SCRSOUND_CARDBOARD_BOX_SMASH, vecPos); + PlayOneShotScriptObject(SCRIPT_SOUND_BOX_DESTROYED_2, vecPos); break; } case DAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: { @@ -242,7 +243,7 @@ CObject::ObjectDamage(float amount) int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80); CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0); } - PlayOneShotScriptObject(_SCRSOUND_WOODEN_BOX_SMASH, vecPos); + PlayOneShotScriptObject(SCRIPT_SOUND_BOX_DESTROYED_1, vecPos); break; } case DAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: { @@ -267,7 +268,7 @@ CObject::ObjectDamage(float amount) int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80); CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0); } - PlayOneShotScriptObject(_SCRSOUND_TYRE_BUMP, vecPos); + PlayOneShotScriptObject(SCRIPT_SOUND_TIRE_COLLISION, vecPos); break; } case DAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: { @@ -292,7 +293,7 @@ CObject::ObjectDamage(float amount) int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80); CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0); } - PlayOneShotScriptObject(_SCRSOUND_COL_CAR, vecPos); + PlayOneShotScriptObject(SCRIPT_SOUND_METAL_COLLISION, vecPos); break; } } diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index fd8fd540..a1709fd7 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -441,8 +441,8 @@ CPed::CPed(uint32 pedType) : m_pedIK(this) m_nPedType = pedType; m_lastSoundStart = 0; m_soundStart = 0; - m_lastQueuedSound = SOUND_TOTAL_PED_SOUNDS; - m_queuedSound = SOUND_TOTAL_PED_SOUNDS; + m_lastQueuedSound = SOUND_NO_SOUND; + m_queuedSound = SOUND_NO_SOUND; m_objective = OBJECTIVE_NONE; m_prevObjective = OBJECTIVE_NONE; CharCreatedBy = RANDOM_CHAR; @@ -5537,7 +5537,7 @@ CPed::PlayHitSound(CPed *hitTo) S42 = SOUND_FIGHT_PUNCH_FROM_BEHIND_42, S43 = SOUND_FIGHT_KNEE_OR_KICK_43, S44 = SOUND_FIGHT_KICK_44, - NO_SND = SOUND_TOTAL_PED_SOUNDS + NO_SND = SOUND_NO_SOUND }; uint16 hitSoundsByFightMoves[12][10] = { {S39,S42,S43,S43,S39,S39,S39,S39,S39,S42}, @@ -16283,7 +16283,7 @@ CPed::ServiceTalking(void) } else { m_queuedSound = SOUND_PED_BOMBER; } - if (m_queuedSound != SOUND_TOTAL_PED_SOUNDS) { + if (m_queuedSound != SOUND_NO_SOUND) { if (m_queuedSound == SOUND_PED_DEATH) m_soundStart = CTimer::GetTimeInMilliseconds() - 1; @@ -16295,7 +16295,7 @@ CPed::ServiceTalking(void) + CTimer::GetTimeInMilliseconds() + CGeneral::GetRandomNumberInRange(0, CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nOverrideFixedDelayTime); m_lastQueuedSound = m_queuedSound; - m_queuedSound = SOUND_TOTAL_PED_SOUNDS; + m_queuedSound = SOUND_NO_SOUND; } } } diff --git a/src/render/Glass.cpp b/src/render/Glass.cpp index 6f17013c..ac892ddb 100644 --- a/src/render/Glass.cpp +++ b/src/render/Glass.cpp @@ -13,6 +13,7 @@ #include "Shadows.h" #include "ModelIndices.h" #include "main.h" +#include "soundlist.h" uint32 CGlass::NumGlassEntities; @@ -101,7 +102,7 @@ CFallingGlassPane::Update(void) pos = CVector(GetPosition().x, GetPosition().y, m_fGroundZ); - PlayOneShotScriptObject(_SCRSOUND_GLASS_SHARD, pos); + PlayOneShotScriptObject(SCRIPT_SOUND_GLASS_LIGHT_BREAK, pos); RwRGBA color = { 255, 255, 255, 255 }; @@ -627,7 +628,7 @@ CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed, if ( amount > 300.0f ) { - PlayOneShotScriptObject(_SCRSOUND_GLASS_SMASH_1, object->GetPosition()); + PlayOneShotScriptObject(SCRIPT_SOUND_GLASS_BREAK_L, object->GetPosition()); GeneratePanesForWindow(0, CVector(minx, miny, minz), @@ -637,7 +638,7 @@ CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed, } else { - PlayOneShotScriptObject(_SCRSOUND_GLASS_SMASH_2, object->GetPosition()); + PlayOneShotScriptObject(SCRIPT_SOUND_GLASS_BREAK_S, object->GetPosition()); GeneratePanesForWindow(1, CVector(minx, miny, minz), @@ -659,7 +660,7 @@ CGlass::WindowRespondsToSoftCollision(CEntity *entity, float amount) if ( amount > 50.0f && !object->bGlassCracked ) { - PlayOneShotScriptObject(_SCRSOUND_GLASS_CRACK, object->GetPosition()); + PlayOneShotScriptObject(SCRIPT_SOUND_GLASS_CRACK, object->GetPosition()); object->bGlassCracked = true; } } @@ -675,7 +676,7 @@ CGlass::WasGlassHitByBullet(CEntity *entity, CVector point) { if ( !object->bGlassCracked ) { - PlayOneShotScriptObject(_SCRSOUND_GLASS_CRACK, object->GetPosition()); + PlayOneShotScriptObject(SCRIPT_SOUND_GLASS_CRACK, object->GetPosition()); object->bGlassCracked = true; } else diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp index 4223ac10..a867ae13 100644 --- a/src/render/Particle.cpp +++ b/src/render/Particle.cpp @@ -11,6 +11,7 @@ #include "AudioScriptObject.h" #include "ParticleObject.h" #include "Particle.h" +#include "soundlist.h" #define MAX_PARTICLES_ON_SCREEN (1000) @@ -1268,7 +1269,7 @@ void CParticle::Update() nil, particle->m_fSize, color, particle->m_nRotationStep, 0, 0, 0); - PlayOneShotScriptObject(_SCRSOUND_BULLET_SHELL_HIT_GROUND_1, particle->m_vecPosition); + PlayOneShotScriptObject(SCRIPT_SOUND_GUNSHELL_DROP, particle->m_vecPosition); } break; @@ -1287,7 +1288,7 @@ void CParticle::Update() nil, particle->m_fSize, color, 0, 0, 0, 0); - PlayOneShotScriptObject(_SCRSOUND_BULLET_SHELL_HIT_GROUND_2, particle->m_vecPosition); + PlayOneShotScriptObject(SCRIPT_SOUND_GUNSHELL_DROP_SOFT, particle->m_vecPosition); } break; From 0c231663188ff4b639549c1be3c6f08df9a5afe1 Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 16 May 2020 10:33:19 +0200 Subject: [PATCH 002/133] changed CPedIK names --- src/peds/Ped.cpp | 30 ++++----- src/peds/PedIK.cpp | 160 ++++++++++++++++++++++----------------------- src/peds/PedIK.h | 12 ++-- 3 files changed, 101 insertions(+), 101 deletions(-) diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index a1709fd7..d48a6a2f 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -2514,37 +2514,37 @@ CPed::CalculateNewVelocity(void) if ((!idleAssoc || idleAssoc->blendAmount < 0.5f) && !fightAssoc) { #endif LimbOrientation newUpperLegs; - newUpperLegs.phi = localWalkAngle; + newUpperLegs.yaw = localWalkAngle; - if (newUpperLegs.phi < -DEGTORAD(100.0f)) { - newUpperLegs.phi += PI; - } else if (newUpperLegs.phi > DEGTORAD(100.0f)) { - newUpperLegs.phi -= PI; + if (newUpperLegs.yaw < -DEGTORAD(100.0f)) { + newUpperLegs.yaw += PI; + } else if (newUpperLegs.yaw > DEGTORAD(100.0f)) { + newUpperLegs.yaw -= PI; } - if (newUpperLegs.phi > -DEGTORAD(50.0f) && newUpperLegs.phi < DEGTORAD(50.0f)) { + if (newUpperLegs.yaw > -DEGTORAD(50.0f) && newUpperLegs.yaw < DEGTORAD(50.0f)) { #ifdef PED_SKIN if(IsClumpSkinned(GetClump())){ /* // this looks shit - newUpperLegs.theta = 0.0f; + newUpperLegs.pitch = 0.0f; RwV3d axis = { -1.0f, 0.0f, 0.0f }; - RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &axis, RADTODEG(newUpperLegs.phi), rwCOMBINEPRECONCAT); - RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &axis, RADTODEG(newUpperLegs.phi), rwCOMBINEPRECONCAT); + RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &axis, RADTODEG(newUpperLegs.yaw), rwCOMBINEPRECONCAT); + RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &axis, RADTODEG(newUpperLegs.yaw), rwCOMBINEPRECONCAT); */ - newUpperLegs.theta = 0.1f; + newUpperLegs.pitch = 0.1f; RwV3d Xaxis = { 1.0f, 0.0f, 0.0f }; RwV3d Zaxis = { 0.0f, 0.0f, 1.0f }; - RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.theta), rwCOMBINEPOSTCONCAT); - RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.phi), rwCOMBINEPOSTCONCAT); - RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.theta), rwCOMBINEPOSTCONCAT); - RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.phi), rwCOMBINEPOSTCONCAT); + RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.pitch), rwCOMBINEPOSTCONCAT); + RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.yaw), rwCOMBINEPOSTCONCAT); + RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.pitch), rwCOMBINEPOSTCONCAT); + RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.yaw), rwCOMBINEPOSTCONCAT); bDontAcceptIKLookAts = true; }else #endif { - newUpperLegs.theta = 0.0f; + newUpperLegs.pitch = 0.0f; m_pedIK.RotateTorso(m_pFrames[PED_UPPERLEGL], &newUpperLegs, false); m_pedIK.RotateTorso(m_pFrames[PED_UPPERLEGR], &newUpperLegs, false); } diff --git a/src/peds/PedIK.cpp b/src/peds/PedIK.cpp index ae9a85b4..ebd41296 100644 --- a/src/peds/PedIK.cpp +++ b/src/peds/PedIK.cpp @@ -21,14 +21,14 @@ CPedIK::CPedIK(CPed *ped) { m_ped = ped; m_flags = 0; - m_headOrient.phi = 0.0f; - m_headOrient.theta = 0.0f; - m_torsoOrient.phi = 0.0f; - m_torsoOrient.theta = 0.0f; - m_upperArmOrient.phi = 0.0f; - m_upperArmOrient.theta = 0.0f; - m_lowerArmOrient.phi = 0.0f; - m_lowerArmOrient.theta = 0.0f; + m_headOrient.yaw = 0.0f; + m_headOrient.pitch = 0.0f; + m_torsoOrient.yaw = 0.0f; + m_torsoOrient.pitch = 0.0f; + m_upperArmOrient.yaw = 0.0f; + m_upperArmOrient.pitch = 0.0f; + m_lowerArmOrient.yaw = 0.0f; + m_lowerArmOrient.pitch = 0.0f; } #ifdef PED_SKIN @@ -55,8 +55,8 @@ CPedIK::RotateTorso(AnimBlendFrameData *node, LimbOrientation *limb, bool change RtQuat *q = &node->hanimFrame->q; #ifndef FIX_BUGS // this is what the game does (also VC), but it does not look great - RtQuatRotate(q, &XaxisIK, RADTODEG(limb->phi), rwCOMBINEPRECONCAT); - RtQuatRotate(q, &ZaxisIK, RADTODEG(limb->theta), rwCOMBINEPRECONCAT); // pitch + RtQuatRotate(q, &XaxisIK, RADTODEG(limb->yaw), rwCOMBINEPRECONCAT); + RtQuatRotate(q, &ZaxisIK, RADTODEG(limb->pitch), rwCOMBINEPRECONCAT); // pitch #else // copied the code from the non-skinned case // this seems to work ok @@ -78,8 +78,8 @@ CPedIK::RotateTorso(AnimBlendFrameData *node, LimbOrientation *limb, bool change vec2.z = -(c*mat->at.x + s*mat->at.y); // Not sure what exactly to do here - RtQuatRotate(q, &vec1, RADTODEG(limb->phi), rwCOMBINEPRECONCAT); - RtQuatRotate(q, &vec2, RADTODEG(limb->theta), rwCOMBINEPRECONCAT); + RtQuatRotate(q, &vec1, RADTODEG(limb->yaw), rwCOMBINEPRECONCAT); + RtQuatRotate(q, &vec2, RADTODEG(limb->pitch), rwCOMBINEPRECONCAT); #endif m_ped->bDontAcceptIKLookAts = true; }else @@ -122,14 +122,14 @@ CPedIK::RotateTorso(AnimBlendFrameData *node, LimbOrientation *limb, bool change float curYaw, curPitch; ExtractYawAndPitchWorld(mat, &curYaw, &curPitch); - RwMatrixRotate(RwFrameGetMatrix(f), &rightVector, RADTODEG(limb->theta), rwCOMBINEPOSTCONCAT); - RwMatrixRotate(RwFrameGetMatrix(f), &upVector, RADTODEG(limb->phi - (curYaw - m_ped->m_fRotationCur)), rwCOMBINEPOSTCONCAT); + RwMatrixRotate(RwFrameGetMatrix(f), &rightVector, RADTODEG(limb->pitch), rwCOMBINEPOSTCONCAT); + RwMatrixRotate(RwFrameGetMatrix(f), &upVector, RADTODEG(limb->yaw - (curYaw - m_ped->m_fRotationCur)), rwCOMBINEPOSTCONCAT); RwMatrixRotate(RwFrameGetMatrix(f), &forwardVector, RADTODEG(alpha), rwCOMBINEPOSTCONCAT); }else{ // pitch - RwMatrixRotate(RwFrameGetMatrix(f), &rightVector, RADTODEG(limb->theta), rwCOMBINEPOSTCONCAT); + RwMatrixRotate(RwFrameGetMatrix(f), &rightVector, RADTODEG(limb->pitch), rwCOMBINEPOSTCONCAT); // yaw - RwMatrixRotate(RwFrameGetMatrix(f), &upVector, RADTODEG(limb->phi), rwCOMBINEPOSTCONCAT); + RwMatrixRotate(RwFrameGetMatrix(f), &upVector, RADTODEG(limb->yaw), rwCOMBINEPOSTCONCAT); } RwFrameGetMatrix(f)->pos = pos; RwMatrixDestroy(mat); @@ -176,43 +176,43 @@ CPedIK::GetWorldMatrix(RwFrame *source, RwMatrix *destination) } LimbMoveStatus -CPedIK::MoveLimb(LimbOrientation &limb, float approxPhi, float approxTheta, LimbMovementInfo &moveInfo) +CPedIK::MoveLimb(LimbOrientation &limb, float targetYaw, float targetPitch, LimbMovementInfo &moveInfo) { LimbMoveStatus result = ONE_ANGLE_COULDNT_BE_SET_EXACTLY; - // phi + // yaw - if (limb.phi > approxPhi) { - limb.phi -= moveInfo.yawD; - } else if (limb.phi < approxPhi) { - limb.phi += moveInfo.yawD; + if (limb.yaw > targetYaw) { + limb.yaw -= moveInfo.yawD; + } else if (limb.yaw < targetYaw) { + limb.yaw += moveInfo.yawD; } - if (Abs(limb.phi - approxPhi) < moveInfo.yawD) { - limb.phi = approxPhi; + if (Abs(limb.yaw - targetYaw) < moveInfo.yawD) { + limb.yaw = targetYaw; result = ANGLES_SET_EXACTLY; } - if (limb.phi > moveInfo.maxYaw || limb.phi < moveInfo.minYaw) { - limb.phi = clamp(limb.phi, moveInfo.minYaw, moveInfo.maxYaw); + if (limb.yaw > moveInfo.maxYaw || limb.yaw < moveInfo.minYaw) { + limb.yaw = clamp(limb.yaw, moveInfo.minYaw, moveInfo.maxYaw); result = ANGLES_SET_TO_MAX; } - // theta + // pitch - if (limb.theta > approxTheta) { - limb.theta -= moveInfo.pitchD; - } else if (limb.theta < approxTheta) { - limb.theta += moveInfo.pitchD; + if (limb.pitch > targetPitch) { + limb.pitch -= moveInfo.pitchD; + } else if (limb.pitch < targetPitch) { + limb.pitch += moveInfo.pitchD; } - if (Abs(limb.theta - approxTheta) < moveInfo.pitchD) - limb.theta = approxTheta; + if (Abs(limb.pitch - targetPitch) < moveInfo.pitchD) + limb.pitch = targetPitch; else result = ONE_ANGLE_COULDNT_BE_SET_EXACTLY; - if (limb.theta > moveInfo.maxPitch || limb.theta < moveInfo.minPitch) { - limb.theta = clamp(limb.theta, moveInfo.minPitch, moveInfo.maxPitch); + if (limb.pitch > moveInfo.maxPitch || limb.pitch < moveInfo.minPitch) { + limb.pitch = clamp(limb.pitch, moveInfo.minPitch, moveInfo.maxPitch); result = ANGLES_SET_TO_MAX; } return result; @@ -231,14 +231,14 @@ void CPedIK::RotateHead(void) { RtQuat *q = &m_ped->m_pFrames[PED_HEAD]->hanimFrame->q; - RtQuatRotate(q, &XaxisIK, RADTODEG(m_headOrient.phi), rwCOMBINEREPLACE); - RtQuatRotate(q, &ZaxisIK, RADTODEG(m_headOrient.theta), rwCOMBINEPOSTCONCAT); + RtQuatRotate(q, &XaxisIK, RADTODEG(m_headOrient.yaw), rwCOMBINEREPLACE); + RtQuatRotate(q, &ZaxisIK, RADTODEG(m_headOrient.pitch), rwCOMBINEPOSTCONCAT); m_ped->bDontAcceptIKLookAts = true; } #endif bool -CPedIK::LookInDirection(float phi, float theta) +CPedIK::LookInDirection(float targetYaw, float targetPitch) { bool success = true; float yaw, pitch; @@ -246,21 +246,21 @@ CPedIK::LookInDirection(float phi, float theta) if(IsClumpSkinned(m_ped->GetClump())){ if (!(m_ped->m_pFrames[PED_HEAD]->flag & AnimBlendFrameData::IGNORE_ROTATION)) { m_ped->m_pFrames[PED_HEAD]->flag |= AnimBlendFrameData::IGNORE_ROTATION; - ExtractYawAndPitchLocalSkinned(m_ped->m_pFrames[PED_HEAD], &m_headOrient.phi, &m_headOrient.theta); + ExtractYawAndPitchLocalSkinned(m_ped->m_pFrames[PED_HEAD], &m_headOrient.yaw, &m_headOrient.pitch); } // parent of head is torso RwMatrix worldMat = *GetBoneMatrix(m_ped, BONE_torso); ExtractYawAndPitchWorld(&worldMat, &yaw, &pitch); - LimbMoveStatus headStatus = MoveLimb(m_headOrient, CGeneral::LimitRadianAngle(phi - yaw), + LimbMoveStatus headStatus = MoveLimb(m_headOrient, CGeneral::LimitRadianAngle(targetYaw - yaw), CGeneral::LimitRadianAngle(DEGTORAD(10.0f)), ms_headInfo); if (headStatus == ANGLES_SET_TO_MAX) success = false; if (headStatus != ANGLES_SET_EXACTLY){ if (!(m_flags & LOOKAROUND_HEAD_ONLY)){ - if (MoveLimb(m_torsoOrient, CGeneral::LimitRadianAngle(phi), theta, ms_torsoInfo)) + if (MoveLimb(m_torsoOrient, CGeneral::LimitRadianAngle(targetYaw), targetPitch, ms_torsoInfo)) success = true; }else{ RotateHead(); @@ -279,7 +279,7 @@ CPedIK::LookInDirection(float phi, float theta) if (!(m_ped->m_pFrames[PED_HEAD]->flag & AnimBlendFrameData::IGNORE_ROTATION)) { m_ped->m_pFrames[PED_HEAD]->flag |= AnimBlendFrameData::IGNORE_ROTATION; - ExtractYawAndPitchLocal(frameMat, &m_headOrient.phi, &m_headOrient.theta); + ExtractYawAndPitchLocal(frameMat, &m_headOrient.yaw, &m_headOrient.pitch); } RwMatrix *worldMat = RwMatrixCreate(); @@ -288,25 +288,25 @@ CPedIK::LookInDirection(float phi, float theta) ExtractYawAndPitchWorld(worldMat, &yaw, &pitch); RwMatrixDestroy(worldMat); - yaw += m_torsoOrient.phi; - float neededPhiTurn = CGeneral::LimitRadianAngle(phi - yaw); - pitch *= Cos(neededPhiTurn); + yaw += m_torsoOrient.yaw; + float neededYawTurn = CGeneral::LimitRadianAngle(targetYaw - yaw); + pitch *= Cos(neededYawTurn); - float neededThetaTurn = CGeneral::LimitRadianAngle(theta - pitch); - LimbMoveStatus headStatus = MoveLimb(m_headOrient, neededPhiTurn, neededThetaTurn, ms_headInfo); + float neededPitchTurn = CGeneral::LimitRadianAngle(targetPitch - pitch); + LimbMoveStatus headStatus = MoveLimb(m_headOrient, neededYawTurn, neededPitchTurn, ms_headInfo); if (headStatus == ANGLES_SET_TO_MAX) success = false; if (headStatus != ANGLES_SET_EXACTLY && !(m_flags & LOOKAROUND_HEAD_ONLY)) { - float remainingTurn = CGeneral::LimitRadianAngle(phi - m_ped->m_fRotationCur); - if (MoveLimb(m_torsoOrient, remainingTurn, theta, ms_torsoInfo)) + float remainingTurn = CGeneral::LimitRadianAngle(targetYaw - m_ped->m_fRotationCur); + if (MoveLimb(m_torsoOrient, remainingTurn, targetPitch, ms_torsoInfo)) success = true; } CMatrix nextFrame = CMatrix(frameMat); CVector framePos = nextFrame.GetPosition(); - nextFrame.SetRotateZ(m_headOrient.theta); - nextFrame.RotateX(m_headOrient.phi); + nextFrame.SetRotateZ(m_headOrient.pitch); + nextFrame.RotateX(m_headOrient.yaw); nextFrame.GetPosition() += framePos; nextFrame.UpdateRW(); @@ -320,32 +320,32 @@ CPedIK::LookInDirection(float phi, float theta) bool CPedIK::LookAtPosition(CVector const &pos) { - float phiToFace = CGeneral::GetRadianAngleBetweenPoints( + float yawToFace = CGeneral::GetRadianAngleBetweenPoints( pos.x, pos.y, m_ped->GetPosition().x, m_ped->GetPosition().y); - float thetaToFace = CGeneral::GetRadianAngleBetweenPoints( + float pitchToFace = CGeneral::GetRadianAngleBetweenPoints( pos.z, (m_ped->GetPosition() - pos).Magnitude2D(), m_ped->GetPosition().z, 0.0f); - return LookInDirection(phiToFace, thetaToFace); + return LookInDirection(yawToFace, pitchToFace); } bool -CPedIK::PointGunInDirection(float phi, float theta) +CPedIK::PointGunInDirection(float targetYaw, float targetPitch) { bool result = true; bool armPointedToGun = false; - float angle = CGeneral::LimitRadianAngle(phi - m_ped->m_fRotationCur); + float angle = CGeneral::LimitRadianAngle(targetYaw - m_ped->m_fRotationCur); m_flags &= (~GUN_POINTED_SUCCESSFULLY); m_flags |= LOOKAROUND_HEAD_ONLY; if (m_flags & AIMS_WITH_ARM) { - armPointedToGun = PointGunInDirectionUsingArm(angle, theta); - angle = CGeneral::LimitRadianAngle(angle - m_upperArmOrient.phi); + armPointedToGun = PointGunInDirectionUsingArm(angle, targetPitch); + angle = CGeneral::LimitRadianAngle(angle - m_upperArmOrient.yaw); } if (armPointedToGun) { - if (m_flags & AIMS_WITH_ARM && m_torsoOrient.phi * m_upperArmOrient.phi < 0.0f) - MoveLimb(m_torsoOrient, 0.0f, m_torsoOrient.theta, ms_torsoInfo); + if (m_flags & AIMS_WITH_ARM && m_torsoOrient.yaw * m_upperArmOrient.yaw < 0.0f) + MoveLimb(m_torsoOrient, 0.0f, m_torsoOrient.pitch, ms_torsoInfo); } else { // Unused code RwMatrix *matrix; @@ -365,7 +365,7 @@ CPedIK::PointGunInDirection(float phi, float theta) } // - LimbMoveStatus status = MoveLimb(m_torsoOrient, angle, theta, ms_torsoInfo); + LimbMoveStatus status = MoveLimb(m_torsoOrient, angle, targetPitch, ms_torsoInfo); if (status == ANGLES_SET_TO_MAX) result = false; else if (status == ANGLES_SET_EXACTLY) @@ -379,7 +379,7 @@ CPedIK::PointGunInDirection(float phi, float theta) } bool -CPedIK::PointGunInDirectionUsingArm(float phi, float theta) +CPedIK::PointGunInDirectionUsingArm(float targetYaw, float targetPitch) { bool result = false; @@ -410,18 +410,18 @@ CPedIK::PointGunInDirectionUsingArm(float phi, float theta) RwV3d rightVector = { 0.0f, 0.0f, 1.0f }; RwV3d forwardVector = { 1.0f, 0.0f, 0.0f }; - float uaPhi, uaTheta; + float uaYaw, uaPitch; #ifdef PED_SKIN if(IsClumpSkinned(m_ped->GetClump())){ - uaPhi = phi; - uaTheta = theta + DEGTORAD(10.0f); + uaYaw = targetYaw; + uaPitch = targetPitch + DEGTORAD(10.0f); }else #endif { - uaPhi = phi - m_torsoOrient.phi - DEGTORAD(15.0f); - uaTheta = CGeneral::LimitRadianAngle(theta - pitch); + uaYaw = targetYaw - m_torsoOrient.yaw - DEGTORAD(15.0f); + uaPitch = CGeneral::LimitRadianAngle(targetPitch - pitch); } - LimbMoveStatus uaStatus = MoveLimb(m_upperArmOrient, uaPhi, uaTheta, ms_upperArmInfo); + LimbMoveStatus uaStatus = MoveLimb(m_upperArmOrient, uaYaw, uaPitch, ms_upperArmInfo); if (uaStatus == ANGLES_SET_EXACTLY) { m_flags |= GUN_POINTED_SUCCESSFULLY; result = true; @@ -433,13 +433,13 @@ CPedIK::PointGunInDirectionUsingArm(float phi, float theta) if(!IsClumpSkinned(m_ped->GetClump())) #endif if (uaStatus == ANGLES_SET_TO_MAX) { - float laPhi = uaPhi - m_upperArmOrient.phi; + float laYaw = uaYaw - m_upperArmOrient.yaw; LimbMoveStatus laStatus; - if (laPhi > 0.0f) - laStatus = MoveLimb(m_lowerArmOrient, laPhi, -DEGTORAD(45.0f), ms_lowerArmInfo); + if (laYaw > 0.0f) + laStatus = MoveLimb(m_lowerArmOrient, laYaw, -DEGTORAD(45.0f), ms_lowerArmInfo); else - laStatus = MoveLimb(m_lowerArmOrient, laPhi, 0.0f, ms_lowerArmInfo); + laStatus = MoveLimb(m_lowerArmOrient, laYaw, 0.0f, ms_lowerArmInfo); if (laStatus == ANGLES_SET_EXACTLY) { m_flags |= GUN_POINTED_SUCCESSFULLY; @@ -447,16 +447,16 @@ CPedIK::PointGunInDirectionUsingArm(float phi, float theta) } RwFrame *child = GetFirstChild(m_ped->m_pFrames[PED_UPPERARMR]->frame); RwV3d pos = RwFrameGetMatrix(child)->pos; - RwMatrixRotate(RwFrameGetMatrix(child), &forwardVector, RADTODEG(m_lowerArmOrient.theta), rwCOMBINEPOSTCONCAT); - RwMatrixRotate(RwFrameGetMatrix(child), &rightVector, RADTODEG(-m_lowerArmOrient.phi), rwCOMBINEPOSTCONCAT); + RwMatrixRotate(RwFrameGetMatrix(child), &forwardVector, RADTODEG(m_lowerArmOrient.pitch), rwCOMBINEPOSTCONCAT); + RwMatrixRotate(RwFrameGetMatrix(child), &rightVector, RADTODEG(-m_lowerArmOrient.yaw), rwCOMBINEPOSTCONCAT); RwFrameGetMatrix(child)->pos = pos; } #ifdef PED_SKIN if(IsClumpSkinned(m_ped->GetClump())){ RtQuat *q = &m_ped->m_pFrames[PED_UPPERARMR]->hanimFrame->q; - RtQuatRotate(q, &XaxisIK, RADTODEG(m_upperArmOrient.phi), rwCOMBINEPOSTCONCAT); - RtQuatRotate(q, &ZaxisIK, RADTODEG(m_upperArmOrient.theta), rwCOMBINEPOSTCONCAT); + RtQuatRotate(q, &XaxisIK, RADTODEG(m_upperArmOrient.yaw), rwCOMBINEPOSTCONCAT); + RtQuatRotate(q, &ZaxisIK, RADTODEG(m_upperArmOrient.pitch), rwCOMBINEPOSTCONCAT); m_ped->bDontAcceptIKLookAts = true; }else #endif @@ -464,8 +464,8 @@ CPedIK::PointGunInDirectionUsingArm(float phi, float theta) RwFrame *frame = m_ped->m_pFrames[PED_UPPERARMR]->frame; // with PED_SKIN we're also getting upVector here RwV3d pos = RwFrameGetMatrix(frame)->pos; - RwMatrixRotate(RwFrameGetMatrix(frame), &rightVector, RADTODEG(m_upperArmOrient.theta), rwCOMBINEPOSTCONCAT); - RwMatrixRotate(RwFrameGetMatrix(frame), &upVector, RADTODEG(m_upperArmOrient.phi), rwCOMBINEPOSTCONCAT); + RwMatrixRotate(RwFrameGetMatrix(frame), &rightVector, RADTODEG(m_upperArmOrient.pitch), rwCOMBINEPOSTCONCAT); + RwMatrixRotate(RwFrameGetMatrix(frame), &upVector, RADTODEG(m_upperArmOrient.yaw), rwCOMBINEPOSTCONCAT); RwFrameGetMatrix(frame)->pos = pos; } return result; @@ -511,8 +511,8 @@ CPedIK::RestoreLookAt(void) CMatrix matrix(mat); CVector pos = matrix.GetPosition(); - matrix.SetRotateZ(m_headOrient.theta); - matrix.RotateX(m_headOrient.phi); + matrix.SetRotateZ(m_headOrient.pitch); + matrix.RotateX(m_headOrient.yaw); matrix.Translate(pos); matrix.UpdateRW(); } diff --git a/src/peds/PedIK.h b/src/peds/PedIK.h index a1cb5d13..e91d7c06 100644 --- a/src/peds/PedIK.h +++ b/src/peds/PedIK.h @@ -4,8 +4,8 @@ struct LimbOrientation { - float phi; - float theta; + float yaw; + float pitch; }; struct LimbMovementInfo { @@ -48,8 +48,8 @@ public: static LimbMovementInfo ms_lowerArmInfo; CPedIK(CPed *ped); - bool PointGunInDirection(float phi, float theta); - bool PointGunInDirectionUsingArm(float phi, float theta); + bool PointGunInDirection(float targetYaw, float targetPitch); + bool PointGunInDirectionUsingArm(float targetYaw, float targetPitch); bool PointGunAtPosition(CVector const& position); void GetComponentPosition(RwV3d *pos, uint32 node); static RwMatrix *GetWorldMatrix(RwFrame *source, RwMatrix *destination); @@ -57,10 +57,10 @@ public: void ExtractYawAndPitchLocal(RwMatrix *mat, float *yaw, float *pitch); void ExtractYawAndPitchLocalSkinned(AnimBlendFrameData *node, float *yaw, float *pitch); void ExtractYawAndPitchWorld(RwMatrix *mat, float *yaw, float *pitch); - LimbMoveStatus MoveLimb(LimbOrientation &limb, float approxPhi, float approxTheta, LimbMovementInfo &moveInfo); + LimbMoveStatus MoveLimb(LimbOrientation &limb, float targetYaw, float targetPitch, LimbMovementInfo &moveInfo); bool RestoreGunPosn(void); void RotateHead(void); - bool LookInDirection(float phi, float theta); + bool LookInDirection(float targetYaw, float targetPitch); bool LookAtPosition(CVector const& pos); bool RestoreLookAt(void); }; From b21f49ad6b2c3f7a22690254321776a0b15c2fed Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 16 May 2020 12:51:54 +0200 Subject: [PATCH 003/133] fixed CText to be 64 bit compatible --- src/text/Text.cpp | 16 ++++++++++++++++ src/text/Text.h | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/src/text/Text.cpp b/src/text/Text.cpp index 549f68d9..1e58fcd1 100644 --- a/src/text/Text.cpp +++ b/src/text/Text.cpp @@ -97,7 +97,11 @@ CText::Unload(void) wchar* CText::Get(const char *key) { +#ifdef FIX_BUGS + return keyArray.Search(key, data.chars); +#else return keyArray.Search(key); +#endif } wchar UpperCaseTable[128] = { @@ -196,9 +200,11 @@ CKeyArray::Unload(void) void CKeyArray::Update(wchar *chars) { +#ifndef FIX_BUGS int i; for(i = 0; i < numEntries; i++) entries[i].value = (wchar*)((uint8*)chars + (uintptr)entries[i].value); +#endif } CKeyEntry* @@ -222,15 +228,25 @@ CKeyArray::BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 hi } wchar* +#ifdef FIX_BUGS +CKeyArray::Search(const char *key, wchar *data) +#else CKeyArray::Search(const char *key) +#endif { CKeyEntry *found; char errstr[25]; int i; +#ifdef FIX_BUGS + found = BinarySearch(key, entries, 0, numEntries-1); + if(found) + return (wchar*)((uint8*)data + found->valueOffset); +#else found = BinarySearch(key, entries, 0, numEntries-1); if(found) return found->value; +#endif sprintf(errstr, "%s missing", key); for(i = 0; i < 25; i++) WideErrorString[i] = errstr[i]; diff --git a/src/text/Text.h b/src/text/Text.h index 4255e2a5..18a904bc 100644 --- a/src/text/Text.h +++ b/src/text/Text.h @@ -9,7 +9,11 @@ void TextCopy(wchar *dst, const wchar *src); struct CKeyEntry { +#ifdef FIX_BUGS + uint32 valueOffset; +#else wchar *value; +#endif char key[8]; }; @@ -28,7 +32,11 @@ public: void Unload(void); void Update(wchar *chars); CKeyEntry *BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 high); +#ifdef FIX_BUGS + wchar *Search(const char *key, wchar *data); +#else wchar *Search(const char *key); +#endif }; class CData From c54d3ba2ab218b9545e784abaf39b4054d3de4bc Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 16 May 2020 14:34:51 +0200 Subject: [PATCH 004/133] fixes for 64 bit build --- premake5.lua | 36 +++++++++++++++++++++++++++--------- src/control/Script.cpp | 2 +- src/fakerw/fake.cpp | 2 +- src/rw/RwHelper.cpp | 11 +++++++++++ 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/premake5.lua b/premake5.lua index 64b12d3a..c8494884 100644 --- a/premake5.lua +++ b/premake5.lua @@ -23,6 +23,22 @@ else Librw = os.getenv("LIBRW") or "librw" end +function getsys(a) + if a == 'windows' then + return 'win' + end + return a +end + +function getarch(a) + if a == 'x86_64' then + return 'amd64' + elseif a == 'ARM' then + return 'arm' + end + return a +end + workspace "re3" language "C++" configurations { "Debug", "Release" } @@ -40,6 +56,8 @@ workspace "re3" filter { "system:linux" } platforms { "linux-x86-librw_gl3_glfw-oal", + "linux-amd64-librw_gl3_glfw-oal", + "linux-arm-librw_gl3_glfw-oal", } filter "configurations:Debug" @@ -58,6 +76,12 @@ workspace "re3" filter { "platforms:*x86*" } architecture "x86" + filter { "platforms:*amd64*" } + architecture "amd64" + + filter { "platforms:*arm*" } + architecture "ARM" + filter { "platforms:*librw_d3d9*" } defines { "RW_D3D9" } if(not _OPTIONS["with-librw"]) then @@ -68,17 +92,12 @@ workspace "re3" defines { "RW_GL3" } includedirs { path.join(_OPTIONS["glfwdir"], "include") } includedirs { path.join(_OPTIONS["glewdir"], "include") } + if(not _OPTIONS["with-librw"]) then + libdirs { path.join(Librw, "lib/%{getsys(cfg.system)}-%{getarch(cfg.architecture)}-gl3/%{cfg.buildcfg}") } + end filter "platforms:win*librw_gl3_glfw*" defines { "GLEW_STATIC" } - if(not _OPTIONS["with-librw"]) then - libdirs { path.join(Librw, "lib/win-x86-gl3/%{cfg.buildcfg}") } - end - - filter "platforms:linux*librw_gl3_glfw*" - if(not _OPTIONS["with-librw"]) then - libdirs { path.join(Librw, "lib/linux-x86-gl3/%{cfg.buildcfg}") } - end filter {} @@ -181,7 +200,6 @@ project "re3" targetextension ".exe" filter "platforms:linux*" - targetextension ".elf" defines { "OPENAL" } links { "openal", "mpg123", "sndfile", "pthread" } diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 357436c6..631ca436 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -506,7 +506,7 @@ void CRunningScript::Init() #ifdef USE_DEBUG_SCRIPT_LOADER int open_script() { - static int scriptToLoad = 0; + static int scriptToLoad = 1; #ifdef _WIN32 if (GetAsyncKeyState('G') & 0x8000) diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp index 50d12b2f..71646020 100644 --- a/src/fakerw/fake.cpp +++ b/src/fakerw/fake.cpp @@ -470,7 +470,7 @@ RwBool RwRenderStateSet(RwRenderState state, void *value) uint32 uival = (uintptr)value; uint32 fog; switch(state){ - case rwRENDERSTATETEXTURERASTER: SetRenderState(TEXTURERASTER, uival); return true; + case rwRENDERSTATETEXTURERASTER: SetRenderStatePtr(TEXTURERASTER, value); return true; case rwRENDERSTATETEXTUREADDRESS: SetRenderState(TEXTUREADDRESS, uival); return true; case rwRENDERSTATETEXTUREADDRESSU: SetRenderState(TEXTUREADDRESSU, uival); return true; case rwRENDERSTATETEXTUREADDRESSV: SetRenderState(TEXTUREADDRESSV, uival); return true; diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp index 5026e2c8..191fc7ab 100644 --- a/src/rw/RwHelper.cpp +++ b/src/rw/RwHelper.cpp @@ -59,6 +59,16 @@ void FlushObrsPrintfs() void * RwMallocAlign(RwUInt32 size, RwUInt32 align) { +#ifdef FIX_BUGS + uintptr ptralign = align-1; + void *mem = (void *)malloc(size + sizeof(uintptr) + ptralign); + + ASSERT(mem != nil); + + void *addr = (void *)((((uintptr)mem) + sizeof(uintptr) + ptralign) & ~ptralign); + + ASSERT(addr != nil); +#else void *mem = (void *)malloc(size + align); ASSERT(mem != nil); @@ -66,6 +76,7 @@ RwMallocAlign(RwUInt32 size, RwUInt32 align) void *addr = (void *)((((uintptr)mem) + align) & ~(align - 1)); ASSERT(addr != nil); +#endif *(((void **)addr) - 1) = mem; From dc5ece83278aca64c33f344be9d94e055c5c8fb7 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 16 May 2020 16:55:37 +0300 Subject: [PATCH 005/133] Fix audio use of number instead of enum for CAR_ACCEL --- src/audio/AudioManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 8ef439d9..ec46aa53 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -7368,7 +7368,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * return; } if (processedAccelSampleStopped) { - if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + 345, 0)) + if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + SFX_CAR_ACCEL_1, 0)) return; SampleManager.SetChannelLoopCount(m_nActiveSamples, 1); SampleManager.SetChannelLoopPoints(m_nActiveSamples, 0, -1); @@ -7391,7 +7391,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * } if (CurrentPretendGear < params->m_pTransmission->nNumberOfGears - 1) { ++CurrentPretendGear; - if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + 345, 0)) + if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + SFX_CAR_ACCEL_1, 0)) return; SampleManager.SetChannelLoopCount(m_nActiveSamples, 1); SampleManager.SetChannelLoopPoints(m_nActiveSamples, 0, -1); From 13a0bf1c436d6d2d66d4c53c845114fa1718ad0b Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 16 May 2020 20:29:13 +0300 Subject: [PATCH 006/133] Move sound processors to AudioLogic.cpp, plus small fixes --- src/audio/AudioLogic.cpp | 8838 ++++++++++++++++++++++++++++++ src/audio/AudioManager.cpp | 10056 +++-------------------------------- src/audio/AudioManager.h | 22 +- src/audio/DMAudio.cpp | 6 +- src/audio/DMAudio.h | 2 +- 5 files changed, 9476 insertions(+), 9448 deletions(-) create mode 100644 src/audio/AudioLogic.cpp diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp new file mode 100644 index 00000000..05483617 --- /dev/null +++ b/src/audio/AudioLogic.cpp @@ -0,0 +1,8838 @@ +#include "common.h" + +#include "AudioManager.h" +#include "audio_enums.h" + +#include "Automobile.h" +#include "Boat.h" +#include "Bridge.h" +#include "Camera.h" +#include "Cranes.h" +#include "DMAudio.h" +#include "Entity.h" +#include "Explosion.h" +#include "Fire.h" +#include "Garages.h" +#include "General.h" +#include "HandlingMgr.h" +#include "Heli.h" +#include "ModelIndices.h" +#include "MusicManager.h" +#include "Pad.h" +#include "Ped.h" +#include "Physical.h" +#include "Placeable.h" +#include "Plane.h" +#include "PlayerPed.h" +#include "Pools.h" +#include "Projectile.h" +#include "ProjectileInfo.h" +#include "Replay.h" +#include "Stats.h" +#include "SurfaceTable.h" +#include "Train.h" +#include "Transmission.h" +#include "Vehicle.h" +#include "WaterCannon.h" +#include "Weather.h" +#include "ZoneCull.h" +#include "sampman.h" + +const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); +const int policeChannel = channels + 1; +const int allChannels = channels + 2; +const int maxVolume = 127; + +uint32 gPornNextTime; +uint32 gSawMillNextTime; +uint32 gShopNextTime; +uint32 gAirportNextTime; +uint32 gCinemaNextTime; +uint32 gDocksNextTime; +uint32 gHomeNextTime; +uint32 gCellNextTime; +uint32 gNextCryTime; + +enum PLAY_STATUS : uint8 { PLAY_STATUS_STOPPED = 0, PLAY_STATUS_PLAYING = 1, PLAY_STATUS_FINISHED = 2 }; +enum LOADING_STATUS : uint8 { LOADING_STATUS_NOT_LOADED = 0, LOADING_STATUS_LOADED = 1 }; + +void +cAudioManager::PreInitialiseGameSpecificSetup() const +{ + BankStartOffset[SAMPLEBANK_MAIN] = SAMPLEBANK_START; + BankStartOffset[SAMPLEBANK_PED] = SAMPLEBANK_PED_START; +} + +void +cAudioManager::PostInitialiseGameSpecificSetup() +{ + m_nFireAudioEntity = CreateEntity(AUDIOTYPE_FIRE, &gFireManager); + if (m_nFireAudioEntity >= 0) + SetEntityStatus(m_nFireAudioEntity, 1); + + m_nCollisionEntity = CreateEntity(AUDIOTYPE_COLLISION, (void *)1); + if (m_nCollisionEntity >= 0) + SetEntityStatus(m_nCollisionEntity, 1); + + m_nFrontEndEntity = CreateEntity(AUDIOTYPE_FRONTEND, (void *)1); + if (m_nFrontEndEntity >= 0) + SetEntityStatus(m_nFrontEndEntity, 1); + + m_nProjectileEntity = CreateEntity(AUDIOTYPE_PROJECTILE, (void *)1); + if (m_nProjectileEntity >= 0) + SetEntityStatus(m_nProjectileEntity, 1); + + m_nWaterCannonEntity = CreateEntity(AUDIOTYPE_WATERCANNON, (void *)1); + if (m_nWaterCannonEntity >= 0) + SetEntityStatus(m_nWaterCannonEntity, 1); + + m_nPoliceChannelEntity = CreateEntity(AUDIOTYPE_POLICERADIO, (void *)1); + if (m_nPoliceChannelEntity >= 0) + SetEntityStatus(m_nPoliceChannelEntity, 1); + + m_nBridgeEntity = CreateEntity(AUDIOTYPE_BRIDGE, (void *)1); + if (m_nBridgeEntity >= 0) + SetEntityStatus(m_nBridgeEntity, 1); + + m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; + m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_NOT_LOADED; + m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_STOPPED; + m_sMissionAudio.field_22 = 0; + m_sMissionAudio.m_bIsPlayed = false; + m_sMissionAudio.m_bPredefinedProperties = 1; + m_sMissionAudio.m_nMissionAudioCounter = 0; + ResetAudioLogicTimers(CTimer::GetTimeInMilliseconds()); +} +void +cAudioManager::PreTerminateGameSpecificShutdown() +{ + if (m_nBridgeEntity >= 0) { + DestroyEntity(m_nBridgeEntity); + m_nBridgeEntity = AEHANDLE_NONE; + } + if (m_nPoliceChannelEntity >= 0) { + DestroyEntity(m_nPoliceChannelEntity); + m_nPoliceChannelEntity = AEHANDLE_NONE; + } + if (m_nWaterCannonEntity >= 0) { + DestroyEntity(m_nWaterCannonEntity); + m_nWaterCannonEntity = AEHANDLE_NONE; + } + if (m_nFireAudioEntity >= 0) { + DestroyEntity(m_nFireAudioEntity); + m_nFireAudioEntity = AEHANDLE_NONE; + } + if (m_nCollisionEntity >= 0) { + DestroyEntity(m_nCollisionEntity); + m_nCollisionEntity = AEHANDLE_NONE; + } + if (m_nFrontEndEntity >= 0) { + DestroyEntity(m_nFrontEndEntity); + m_nFrontEndEntity = AEHANDLE_NONE; + } + if (m_nProjectileEntity >= 0) { + DestroyEntity(m_nProjectileEntity); + m_nProjectileEntity = AEHANDLE_NONE; + } +} + +void +cAudioManager::PostTerminateGameSpecificShutdown() +{ + ; +} + +void +cAudioManager::ResetAudioLogicTimers(uint32 timer) +{ + gPornNextTime = timer; + gNextCryTime = timer; + gSawMillNextTime = timer; + gCellNextTime = timer; + gShopNextTime = timer; + gHomeNextTime = timer; + gAirportNextTime = timer; + gDocksNextTime = timer; + gCinemaNextTime = timer; + for (int32 i = 0; i < m_nAudioEntitiesTotal; i++) { + if (m_asAudioEntities[m_anAudioEntityIndices[i]].m_nType == AUDIOTYPE_PHYSICAL) { + CPed *ped = (CPed *)m_asAudioEntities[m_anAudioEntityIndices[i]].m_pEntity; + if (ped->IsPed()) { + ped->m_lastSoundStart = timer; + ped->m_soundStart = timer + m_anRandomTable[0] % 3000; + } + } + } + ClearMissionAudio(); + SampleManager.StopChannel(policeChannel); +} + +void +cAudioManager::ProcessReverb() const +{ + if (SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) { + for (uint32 i = 0; i < +#ifdef FIX_BUGS + channels +#else + 28 +#endif + ; + i++) { + if (m_asActiveSamples[i].m_bReverbFlag) + SampleManager.SetChannelReverbFlag(i, 1); + } + } +} + +float +cAudioManager::GetDistanceSquared(const CVector &v) const +{ + const CVector &c = TheCamera.GetPosition(); + return sq(v.x - c.x) + sq(v.y - c.y) + sq((v.z - c.z) * 0.2f); +} + +void +cAudioManager::CalculateDistance(bool &distCalculated, float dist) +{ + if (!distCalculated) { + m_sQueueSample.m_fDistance = Sqrt(dist); + distCalculated = true; + } +} + +void +cAudioManager::ProcessSpecial() +{ + if (m_nUserPause) { + if (!m_nPreviousUserPause) { + MusicManager.ChangeMusicMode(MUSICMODE_FRONTEND); + SampleManager.SetEffectsFadeVolume(maxVolume); + SampleManager.SetMusicFadeVolume(maxVolume); + } + } else { + if (m_nPreviousUserPause) { + MusicManager.StopFrontEndTrack(); + MusicManager.ChangeMusicMode(MUSICMODE_GAME); + } + CPlayerPed *playerPed = FindPlayerPed(); + if (playerPed) { + const PedState &state = playerPed->m_nPedState; + if (state != PED_ENTER_CAR && state != PED_STEAL_CAR && !playerPed->bInVehicle) + SampleManager.StopChannel(m_nActiveSamples); + } + } +} + +void +cAudioManager::ProcessEntity(int32 id) +{ + if (m_asAudioEntities[id].m_nStatus) { + m_sQueueSample.m_nEntityIndex = id; + switch (m_asAudioEntities[id].m_nType) { + case AUDIOTYPE_PHYSICAL: + if (!m_nUserPause) { + m_sQueueSample.m_bReverbFlag = true; + ProcessPhysical(id); + } + break; + case AUDIOTYPE_EXPLOSION: + if (!m_nUserPause) { + m_sQueueSample.m_bReverbFlag = true; + ProcessExplosions(id); + } + break; + case AUDIOTYPE_FIRE: + if (!m_nUserPause) { + m_sQueueSample.m_bReverbFlag = true; + ProcessFires(id); + } + break; + case AUDIOTYPE_WEATHER: + if (!m_nUserPause) { + m_sQueueSample.m_bReverbFlag = true; + ProcessWeather(id); + } + break; + case AUDIOTYPE_CRANE: + if (!m_nUserPause) { + m_sQueueSample.m_bReverbFlag = true; + ProcessCrane(); + } + break; + case AUDIOTYPE_SCRIPTOBJECT: + if (!m_nUserPause) { + m_sQueueSample.m_bReverbFlag = true; + ProcessScriptObject(id); + } + break; + case AUDIOTYPE_BRIDGE: + if (!m_nUserPause) { + m_sQueueSample.m_bReverbFlag = true; + ProcessBridge(); + } + break; + case AUDIOTYPE_FRONTEND: + m_sQueueSample.m_bReverbFlag = false; + ProcessFrontEnd(); + break; + case AUDIOTYPE_PROJECTILE: + if (!m_nUserPause) { + m_sQueueSample.m_bReverbFlag = true; + ProcessProjectiles(); + } + break; + case AUDIOTYPE_GARAGE: + if (!m_nUserPause) + ProcessGarages(); + break; + case AUDIOTYPE_FIREHYDRANT: + if (!m_nUserPause) { + m_sQueueSample.m_bReverbFlag = true; + ProcessFireHydrant(); + } + break; + case AUDIOTYPE_WATERCANNON: + if (!m_nUserPause) { + m_sQueueSample.m_bReverbFlag = true; + ProcessWaterCannon(id); + } + break; + default: + return; + } + } +} + +void +cAudioManager::ProcessPhysical(int32 id) +{ + CPhysical *entity = (CPhysical *)m_asAudioEntities[id].m_pEntity; + if (entity) { + switch (entity->GetType()) { + case ENTITY_TYPE_VEHICLE: + ProcessVehicle((CVehicle *)m_asAudioEntities[id].m_pEntity); + break; + case ENTITY_TYPE_PED: + ProcessPed((CPhysical *)m_asAudioEntities[id].m_pEntity); + break; + default: + return; + } + } +} + +#pragma region VEHICLE AUDIO +enum eVehicleModel { + LANDSTAL, + IDAHO, + STINGER, + LINERUN, + PEREN, + SENTINEL, + PATRIOT, + FIRETRUK, + TRASH, + STRETCH, + MANANA, + INFERNUS, + BLISTA, + PONY, + MULE, + CHEETAH, + AMBULAN, + FBICAR, + MOONBEAM, + ESPERANT, + TAXI, + KURUMA, + BOBCAT, + MRWHOOP, + BFINJECT, + CORPSE, + POLICE, + ENFORCER, + SECURICA, + BANSHEE, + PREDATOR, + BUS, + RHINO, + BARRACKS, + TRAIN, + CHOPPER, + DODO, + COACH, + CABBIE, + STALLION, + RUMPO, + RCBANDIT, + BELLYUP, + MRWONGS, + MAFIA, + YARDIE, + YAKUZA, + DIABLOS, + COLUMB, + HOODS, + AIRTRAIN, + DEADDODO, + SPEEDER, + REEFER, + PANLANT, + FLATBED, + YANKEE, + ESCAPE, + BORGNINE, + TOYZ, + GHOST, + CAR151, + CAR152, + CAR153, + CAR154, + CAR155, + CAR156, + CAR157, + CAR158, + CAR159, + MAX_CARS +}; + + +struct tVehicleSampleData { + eSfxSample m_nAccelerationSampleIndex; + uint8 m_bEngineSoundType; + eSfxSample m_nHornSample; + int32 m_nHornFrequency; + uint8 m_nSirenOrAlarmSample; + int32 m_nSirenOrAlarmFrequency; + uint8 m_bDoorType; +}; + +const tVehicleSampleData aVehicleSettings[MAX_CARS] = {{SFX_CAR_REV_2, 2, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, 1}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 11487, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_8, 8, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_ALARM_1, 10928, 1}, + {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 9935, 2}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 12893, SFX_CAR_ALARM_1, 8941, 0}, + {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 10706, SFX_CAR_ALARM_1, 11922, 1}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 7948, 2}, + {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_POLICE_SIREN_SLOW, 11556, 2}, + {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 31478, SFX_CAR_ALARM_1, 8941, 2}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_BMW328, 9538, SFX_CAR_ALARM_1, 12220, 1}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_3, 3, SFX_CAR_HORN_BMW328, 12017, SFX_CAR_ALARM_1, 9935, 1}, + {SFX_CAR_REV_2, 2, SFX_CAR_HORN_JEEP, 22295, SFX_CAR_ALARM_1, 12200, 1}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_ALARM_1, 13400, 1}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 18286, SFX_CAR_ALARM_1, 9935, 2}, + {SFX_CAR_REV_3, 3, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_ALARM_1, 13600, 1}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 22295, SFX_AMBULANCE_SIREN_SLOW, 8795, 2}, + {SFX_CAR_REV_5, 5, SFX_CAR_HORN_PORSCHE, 9271, SFX_POLICE_SIREN_SLOW, 16168, 1}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 12170, SFX_CAR_ALARM_1, 8000, 1}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_BUS2, 12345, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_2, 2, SFX_CAR_HORN_BMW328, 10796, SFX_CAR_ALARM_1, 8543, 1}, + {SFX_CAR_REV_5, 5, SFX_CAR_HORN_PORSCHE, 9271, SFX_CAR_ALARM_1, 9935, 1}, + {SFX_CAR_REV_2, 2, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_ALARM_1, 9935, 1}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_PICKUP, 11025, SFX_ICE_CREAM_TUNE, 11025, 0}, + {SFX_CAR_REV_7, 7, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, 1}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 10000, 0}, + {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 10706, SFX_POLICE_SIREN_SLOW, 13596, 1}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 17260, SFX_POLICE_SIREN_SLOW, 13000, 2}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_ALARM_1, 9935, 2}, + {SFX_CAR_REV_8, 8, SFX_CAR_HORN_PORSCHE, 10400, SFX_CAR_ALARM_1, 10123, 1}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 26513, SFX_POLICE_SIREN_SLOW, 13596, 0}, + {SFX_CAR_REV_6, 6, SFX_CAR_HORN_BUS2, 11652, SFX_CAR_ALARM_1, 10554, 3}, + {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 8000, 2}, + {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_ALARM_1, 9935, 2}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 9935, 3}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CESNA_IDLE, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_6, 6, SFX_CAR_HORN_BUS, 16291, SFX_CAR_ALARM_1, 7500, 3}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10233, SFX_CAR_ALARM_1, 8935, 0}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_ALARM_1, 8935, 0}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_PICKUP, 2000, SFX_CAR_ALARM_1, 17000, 0}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 9003, SFX_CAR_ALARM_1, 9935, 1}, + {SFX_CAR_REV_2, 2, SFX_CAR_HORN_PORSCHE, 12375, SFX_CAR_ALARM_1, 9935, 1}, + {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BUS2, 15554, SFX_CAR_ALARM_1, 9935, 1}, + {SFX_CAR_REV_7, 7, SFX_CAR_HORN_BUS2, 13857, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_7, 7, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 2}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 20143, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9000, 0}, + {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_ALARM_1, 9935, 2}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 18286, SFX_CAR_ALARM_1, 9935, 2}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_ALARM_1, 13400, 1}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}}; + + +bool bPlayerJustEnteredCar; + +const bool hornPatternsArray[8][44] = { + {false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, + false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false}, + {false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false}, + {false, false, true, true, true, true, true, true, true, true, true, true, false, false, false, false, true, true, true, true, true, false, + false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false}, + {false, false, true, true, true, true, true, false, false, true, true, true, true, true, false, false, false, true, true, true, true, true, + true, true, true, true, true, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, false}, + {false, false, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false}, + {false, false, true, true, true, false, false, false, true, true, true, false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false}, + {false, false, true, true, true, true, false, false, false, false, true, true, true, false, false, true, true, true, false, false, true, true, + true, true, true, true, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, false, false}, + {false, false, true, true, true, true, false, false, true, true, true, true, true, false, false, false, true, true, true, true, true, true, + false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false}, +}; + + +void +cAudioManager::ProcessVehicle(CVehicle *veh) +{ + tHandlingData *handling = veh->pHandling; + float velChange; + cVehicleParams params; + m_sQueueSample.m_vecPos = veh->GetPosition(); + + params.m_bDistanceCalculated = false; + params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); + params.m_pVehicle = veh; + params.m_pTransmission = nil; + params.m_nIndex = 0; + params.m_fVelocityChange = 0.0f; + + if (handling) + params.m_pTransmission = &handling->Transmission; + + params.m_nIndex = veh->GetModelIndex() - MI_FIRST_VEHICLE; + if (params.m_pVehicle->GetStatus() == STATUS_SIMPLE) + velChange = params.m_pVehicle->AutoPilot.m_fMaxTrafficSpeed * 0.02f; + else + velChange = DotProduct(params.m_pVehicle->m_vecMoveSpeed, params.m_pVehicle->GetForward()); + params.m_fVelocityChange = velChange; + switch (params.m_pVehicle->m_vehType) { + case VEHICLE_TYPE_CAR: + UpdateGasPedalAudio((CAutomobile *)veh); + if (params.m_nIndex == RCBANDIT) { + ProcessModelCarEngine(¶ms); + ProcessVehicleOneShots(¶ms); + ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; + ProcessRainOnVehicle(¶ms); + break; + } + if (params.m_nIndex == DODO) { + if (!ProcessVehicleRoadNoise(¶ms)) { + ProcessVehicleOneShots(¶ms); + ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; + ProcessRainOnVehicle(¶ms); + break; + } + if (CWeather::WetRoads > 0.f) + ProcessWetRoadNoise(¶ms); + ProcessVehicleSkidding(¶ms); + } else { + if (!ProcessVehicleRoadNoise(¶ms)) { + ProcessVehicleOneShots(¶ms); + ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; + ProcessRainOnVehicle(¶ms); + break; + } + ProcessReverseGear(¶ms); + if (CWeather::WetRoads > 0.f) + ProcessWetRoadNoise(¶ms); + ProcessVehicleSkidding(¶ms); + ProcessVehicleHorn(¶ms); + ProcessVehicleSirenOrAlarm(¶ms); + if (UsesReverseWarning(params.m_nIndex)) + ProcessVehicleReverseWarning(¶ms); + if (HasAirBrakes(params.m_nIndex)) + ProcessAirBrakes(¶ms); + } + ProcessCarBombTick(¶ms); + ProcessVehicleEngine(¶ms); + ProcessEngineDamage(¶ms); + ProcessVehicleDoors(¶ms); + ProcessVehicleOneShots(¶ms); + ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; + ProcessRainOnVehicle(¶ms); + break; + case VEHICLE_TYPE_BOAT: + ProcessBoatEngine(¶ms); + ProcessBoatMovingOverWater(¶ms); + ProcessVehicleOneShots(¶ms); + ProcessRainOnVehicle(¶ms); + break; + case VEHICLE_TYPE_TRAIN: + ProcessTrainNoise(¶ms); + ProcessVehicleOneShots(¶ms); + ProcessRainOnVehicle(¶ms); + break; + case VEHICLE_TYPE_HELI: + ProcessHelicopter(¶ms); + ProcessVehicleOneShots(¶ms); + ProcessRainOnVehicle(¶ms); + break; + case VEHICLE_TYPE_PLANE: + ProcessPlane(¶ms); + ProcessVehicleOneShots(¶ms); + ProcessRainOnVehicle(¶ms); + break; + default: + ProcessRainOnVehicle(¶ms); + break; + } +} + +void +cAudioManager::ProcessRainOnVehicle(cVehicleParams *params) +{ + const int rainOnVehicleIntensity = 22; + if (params->m_fDistance < SQR(rainOnVehicleIntensity) && CWeather::Rain > 0.01f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) { + CVehicle *veh = params->m_pVehicle; + ++veh->m_bRainAudioCounter; + if (veh->m_bRainAudioCounter >= 2) { + veh->m_bRainAudioCounter = 0; + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + float emittingVol = 30.f * CWeather::Rain; + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, rainOnVehicleIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = veh->m_bRainSamplesCounter++; + if (veh->m_bRainSamplesCounter > 4) + veh->m_bRainSamplesCounter = 68; + m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] & 3) + SFX_CAR_RAIN_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 9; + m_sQueueSample.m_nFrequency = m_anRandomTable[1] % 4000 + 28000; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nEmittingVolume = (uint8)emittingVol; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = rainOnVehicleIntensity; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bReverbFlag = false; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + } +} + +bool +cAudioManager::ProcessReverseGear(cVehicleParams *params) +{ + const int reverseGearIntensity = 30; + + CVehicle *veh; + CAutomobile *automobile; + int32 emittingVol; + float modificator; + + if (params->m_fDistance >= SQR(reverseGearIntensity)) + return false; + veh = params->m_pVehicle; + if (veh->bEngineOn && (veh->m_fGasPedal < 0.0f || !veh->m_nCurrentGear)) { + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + automobile = (CAutomobile *)params->m_pVehicle; + if (automobile->m_nWheelsOnGround) { + modificator = params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity; + } else { + if (automobile->m_nDriveWheelsOnGround) + automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.4f; + modificator = automobile->m_fGasPedalAudio; + } + modificator = Abs(modificator); + emittingVol = (24.f * modificator); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, reverseGearIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + if (params->m_pVehicle->m_fGasPedal >= 0.0f) { + m_sQueueSample.m_nCounter = 62; + m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR_2; + } else { + m_sQueueSample.m_nCounter = 61; + m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR; + } + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nFrequency = (6000.f * modificator) + 7000; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 3.0f; + m_sQueueSample.m_fSoundIntensity = reverseGearIntensity; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 5; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + return true; +} + +void +cAudioManager::ProcessModelCarEngine(cVehicleParams *params) +{ + const float SOUND_INTENSITY = 30.0f; + CAutomobile *automobile; + float allowedVelocity; + int32 emittingVol; + float velocityChange; + + if (params->m_fDistance < SQR(SOUND_INTENSITY)) { + automobile = (CAutomobile *)params->m_pVehicle; + if (automobile->bEngineOn) { + if (automobile->m_nWheelsOnGround) { + velocityChange = Abs(params->m_fVelocityChange); + } else { + if (automobile->m_nDriveWheelsOnGround) + automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.4f; + velocityChange = automobile->m_fGasPedalAudio * params->m_pTransmission->fMaxVelocity; + } + if (velocityChange > 0.001f) { + allowedVelocity = 0.5f * params->m_pTransmission->fMaxVelocity; + if (velocityChange < allowedVelocity) + emittingVol = (90.f * velocityChange / allowedVelocity); + else + emittingVol = 90; + if (emittingVol) { + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 2; + m_sQueueSample.m_nSampleIndex = SFX_REMOTE_CONTROLLED_CAR; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 1; + m_sQueueSample.m_nFrequency = (11025.f * velocityChange / params->m_pTransmission->fMaxVelocity + 11025.f); + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 3.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + } + } + } +} + + + +bool +cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params) +{ + const float SOUND_INTENSITY = 95.0f; + + int32 emittingVol; + uint32 freq; + float modificator; + int sampleFreq; + float velocity; + + if (params->m_fDistance >= SQR(SOUND_INTENSITY)) + return false; + if (params->m_pTransmission) { + if (params->m_pVehicle->m_vecMoveSpeed.z) { + velocity = Abs(params->m_fVelocityChange); + if (velocity > 0.0f) { + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + emittingVol = 30.f * Min(1.f, velocity / (0.5f * params->m_pTransmission->fMaxVelocity)); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 0; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + if (params->m_pVehicle->m_nSurfaceTouched == SURFACE_PUDDLE) { + m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP; + freq = 6050 * emittingVol / 30 + 16000; + } else { + m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE; + modificator = m_sQueueSample.m_fDistance / 190.f; + sampleFreq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE); + freq = (sampleFreq * modificator) + ((3 * sampleFreq) / 4); + } + m_sQueueSample.m_nFrequency = freq; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 6.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 4; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + } + } + return true; +} + +bool +cAudioManager::ProcessWetRoadNoise(cVehicleParams *params) +{ + const float SOUND_INTENSITY = 30.0f; + + float relativeVelocity; + int32 emittingVol; + float modificator; + int freq; + float velChange; + + if (params->m_fDistance >= SQR(SOUND_INTENSITY)) + return false; + if (params->m_pTransmission) { + if (params->m_pVehicle->m_vecMoveSpeed.z) { + velChange = Abs(params->m_fVelocityChange); + if (velChange > 0.f) { + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + relativeVelocity = Min(1.0f, velChange / (0.5f * params->m_pTransmission->fMaxVelocity)); + emittingVol = 23.0f * relativeVelocity * CWeather::WetRoads; + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 1; + m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + modificator = m_sQueueSample.m_fDistance / 6.f; + freq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE); + m_sQueueSample.m_nFrequency = freq + freq * modificator; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 6.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 4; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + } + } + return true; +} + +void +cAudioManager::ProcessVehicleEngine(cVehicleParams *params) +{ + const float SOUND_INTENSITY = 50.0f; + + CVehicle *playerVeh; + CVehicle *veh; + CAutomobile *automobile; + float relativeGearChange; + float relativeChange; + uint8 volume; + int32 freq = 0; // uinitialized variable + uint8 emittingVol; + cTransmission *transmission; + uint8 currentGear; + float modificator; + float traction = 0.f; + + if (params->m_fDistance < SQR(SOUND_INTENSITY)) { + playerVeh = FindPlayerVehicle(); + veh = params->m_pVehicle; + if (playerVeh == veh && veh->GetStatus() == STATUS_WRECKED) { + SampleManager.StopChannel(m_nActiveSamples); + return; + } + if (veh->bEngineOn) { + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + automobile = (CAutomobile *)params->m_pVehicle; + if (params->m_nIndex == DODO) { + ProcessCesna(params); + return; + } + if (FindPlayerVehicle() == veh) { + ProcessPlayersVehicleEngine(params, automobile); + return; + } + transmission = params->m_pTransmission; + if (transmission) { + currentGear = params->m_pVehicle->m_nCurrentGear; + if (automobile->m_nWheelsOnGround) { + if (automobile->bIsHandbrakeOn) { + if (params->m_fVelocityChange == 0.0f) + traction = 0.9f; + } else if (params->m_pVehicle->GetStatus() == STATUS_SIMPLE) { + traction = 0.0f; + } else { + switch (transmission->nDriveType) { + case '4': + for (int32 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) { + if (automobile->m_aWheelState[i] == WHEEL_STATE_SPINNING) + traction += 0.05f; + } + break; + case 'F': + if (automobile->m_aWheelState[0] == WHEEL_STATE_SPINNING) + traction += 0.1f; + if (automobile->m_aWheelState[2] == WHEEL_STATE_SPINNING) + traction += 0.1f; + break; + case 'R': + if (automobile->m_aWheelState[1] == WHEEL_STATE_SPINNING) + traction += 0.1f; + if (automobile->m_aWheelState[3] == WHEEL_STATE_SPINNING) + traction += 0.1f; + break; + } + } + if (transmission->fMaxVelocity <= 0.f) { + relativeChange = 0.f; + } else if (currentGear) { + relativeGearChange = + Min(1.0f, (params->m_fVelocityChange - transmission->Gears[currentGear].fShiftDownVelocity) / transmission->fMaxVelocity * 2.5f); + if (traction == 0.0f && automobile->GetStatus() != STATUS_SIMPLE && + params->m_fVelocityChange >= transmission->Gears[1].fShiftUpVelocity) { + traction = 0.7f; + } + relativeChange = traction * automobile->m_fGasPedalAudio * 0.95f + (1.0f - traction) * relativeGearChange; + } else + relativeChange = + Min(1.0f, 1.0f - Abs((params->m_fVelocityChange - transmission->Gears[0].fShiftDownVelocity) / transmission->fMaxReverseVelocity)); + } else { + if (automobile->m_nDriveWheelsOnGround) + automobile->m_fGasPedalAudio *= 0.4f; + relativeChange = automobile->m_fGasPedalAudio; + } + modificator = relativeChange; + if (currentGear || !automobile->m_nWheelsOnGround) + freq = 1200 * currentGear + 18000.f * modificator + 14000; + else + freq = 13000.f * modificator + 14000; + if (modificator >= 0.75f) { + emittingVol = 120; + volume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + } else { + emittingVol = modificator * 4.0f / 3.0f * 40.f + 80.f; + volume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + } + } else { + modificator = 0.f; + emittingVol = 80; + volume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + } + m_sQueueSample.m_nVolume = volume; + if (m_sQueueSample.m_nVolume) { + if (automobile->GetStatus() == STATUS_SIMPLE) { + if (modificator < 0.02f) { + m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_bEngineSoundType - 1 + SFX_CAR_IDLE_1; + freq = modificator * 10000 + 22050; + m_sQueueSample.m_nCounter = 52; + } else { + m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nAccelerationSampleIndex; + m_sQueueSample.m_nCounter = 2; + } + } else { + if (automobile->m_fGasPedal < 0.05f) { + m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_bEngineSoundType - 1 + SFX_CAR_IDLE_1; + freq = modificator * 10000 + 22050; + m_sQueueSample.m_nCounter = 52; + } else { + m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nAccelerationSampleIndex; + m_sQueueSample.m_nCounter = 2; + } + } + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nFrequency = freq + 100 * m_sQueueSample.m_nEntityIndex % 1000; + if (m_sQueueSample.m_nSampleIndex == SFX_CAR_IDLE_6 || m_sQueueSample.m_nSampleIndex == SFX_CAR_REV_6) + m_sQueueSample.m_nFrequency /= 2; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 6.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 8; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + } +} + +void +cAudioManager::UpdateGasPedalAudio(CAutomobile *automobile) +{ + float newGasPedalAudio; + + float gasPedal = Abs(automobile->m_fGasPedal); + float gasPedalAudio = automobile->m_fGasPedalAudio; + + if (gasPedalAudio < gasPedal) { + newGasPedalAudio = gasPedalAudio + 0.09f; + if (gasPedal <= newGasPedalAudio) + newGasPedalAudio = gasPedal; + } else { + newGasPedalAudio = gasPedalAudio - 0.07f; + if (gasPedal >= newGasPedalAudio) + newGasPedalAudio = gasPedal; + } + automobile->m_fGasPedalAudio = newGasPedalAudio; +} + +void +cAudioManager::PlayerJustGotInCar() const +{ + if (m_bIsInitialised) { + bPlayerJustEnteredCar = true; + } +} + +void +cAudioManager::PlayerJustLeftCar(void) const +{ + // UNUSED: This is a perfectly empty function. +} + +void +cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1, uint8 counter, bool notLooping) +{ + m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, 50.f, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = counter; + m_sQueueSample.m_nSampleIndex = sample; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 0; + m_sQueueSample.m_nFrequency = freq; + if (notLooping) { + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nReleasingVolumeDivider = 8; + } else { + m_sQueueSample.m_nLoopCount = 1; + } + m_sQueueSample.m_nEmittingVolume = emittingVolume; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 6.0f; + m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } +} + +void +cAudioManager::ProcessCesna(cVehicleParams *params) +{ + static uint8 nAccel = 0; + + //((CAutomobile *)params->m_pVehicle)->Damage.GetEngineStatus(); + + if (FindPlayerVehicle() == params->m_pVehicle) { + if (params->m_nIndex == DODO) { + if (Pads[0].GetAccelerate() <= 0) { + if (nAccel) + --nAccel; + } else if (nAccel < 60) { + ++nAccel; + } + AddPlayerCarSample(85 * (60 - nAccel) / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_IDLE, 0, 52, 1); + AddPlayerCarSample(85 * nAccel / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_REV, 0, 2, 1); + } + } else if (params->m_nIndex == DODO) { + AddPlayerCarSample(105, 17000, SFX_CESNA_IDLE, 0, 52, 1); + } else if (params->m_fDistance < 40000.f) { + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(80, 200.f, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 52; + m_sQueueSample.m_nSampleIndex = SFX_CESNA_IDLE; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 0; + m_sQueueSample.m_nFrequency = 12500; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nReleasingVolumeDivider = 8; + m_sQueueSample.m_nEmittingVolume = 80; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 8.0f; + m_sQueueSample.m_fSoundIntensity = 200.0f; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + if (params->m_fDistance < 8100.f) { + m_sQueueSample.m_nVolume = ComputeVolume(80, 90.f, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 2; + m_sQueueSample.m_nSampleIndex = SFX_CESNA_REV; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 0; + m_sQueueSample.m_nFrequency = 25000; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nReleasingVolumeDivider = 4; + m_sQueueSample.m_nEmittingVolume = 80; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 8.0f; + m_sQueueSample.m_fSoundIntensity = 90.0f; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + } +} + +void +cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *automobile) +{ + static int32 GearFreqAdj[] = {6000, 6000, 3400, 1200, 0, -1000}; + + cTransmission *transmission; + float velocityChange; + float relativeVelocityChange; + float accelerationMultipler; + uint8 wheelInUseCounter; + float time; + int baseFreq; + uint8 vol; + int gearNr; + int32 freq; + + int freqModifier; + int soundOffset; + uint8 engineSoundType; + int32 accelerateState; + bool channelUsed; + char lostTraction; + bool processedAccelSampleStopped; + uint8 currentGear; + float gasPedalAudio; + CVector pos; + + static int16 LastAccel = 0; + static int16 LastBrake = 0; + static uint8 CurrentPretendGear = 1; + static bool bLostTractionLastFrame = false; + static bool bHandbrakeOnLastFrame = 0; + static int32 nCruising = 0; + static bool bAccelSampleStopped = true; + + lostTraction = 0; + processedAccelSampleStopped = 0; + if (bPlayerJustEnteredCar) { + bAccelSampleStopped = true; + bPlayerJustEnteredCar = false; + nCruising = 0; + LastAccel = 0; + bLostTractionLastFrame = false; + LastBrake = 0; + bHandbrakeOnLastFrame = 0; + CurrentPretendGear = 1; + } + if (CReplay::IsPlayingBack()) { + accelerateState = 255.f * Max(0.0f, Min(1.0f, automobile->m_fGasPedal)); + } else { + accelerateState = Pads->GetAccelerate(); + } + channelUsed = SampleManager.GetChannelUsedFlag(m_nActiveSamples); + transmission = params->m_pTransmission; + velocityChange = params->m_fVelocityChange; + relativeVelocityChange = 2.0f * velocityChange / transmission->fMaxVelocity; + + accelerationMultipler = Min(Min(1.f, relativeVelocityChange), 0.f); + gasPedalAudio = accelerationMultipler; + currentGear = params->m_pVehicle->m_nCurrentGear; + + if (transmission->nDriveType == '4') { + wheelInUseCounter = 0; + for (uint8 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) { + if (automobile->m_aWheelState[i]) + ++wheelInUseCounter; + } + if (wheelInUseCounter > 2) + lostTraction = 1; + } else if (transmission->nDriveType == 'F') { + if ((automobile->m_aWheelState[0] || automobile->m_aWheelState[2]) && (automobile->m_aWheelState[1] || automobile->m_aWheelState[3])) { + lostTraction = 1; + } + } else if (transmission->nDriveType == 'R' && (automobile->m_aWheelState[1] || automobile->m_aWheelState[3])) { + lostTraction = 1; + } + if (0.0f != velocityChange) { + time = params->m_pVehicle->m_vecMoveSpeed.z / velocityChange; + if (time <= 0.0f) { + freqModifier = Max(-0.2f, time) * -15000.f; + } else { + freqModifier = -(Min(0.2f, time) * 15000.f); + } + if (params->m_fVelocityChange < -0.001f) + freqModifier = -freqModifier; + } else { + freqModifier = 0; + } + engineSoundType = aVehicleSettings[params->m_nIndex].m_bEngineSoundType; + soundOffset = 3 * (engineSoundType - 1); + if (accelerateState <= 0) { + if (params->m_fVelocityChange < -0.001f) { + if (channelUsed) { + SampleManager.StopChannel(m_nActiveSamples); + bAccelSampleStopped = true; + } + if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction) { + gasPedalAudio = automobile->m_fGasPedalAudio; + } else { + gasPedalAudio = Min(1.0f, params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity); + } + gasPedalAudio = Max(0.0f, gasPedalAudio); + automobile->m_fGasPedalAudio = gasPedalAudio; + } else if (LastAccel > 0) { + if (channelUsed) { + SampleManager.StopChannel(m_nActiveSamples); + bAccelSampleStopped = true; + } + nCruising = 0; + if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction || + params->m_fVelocityChange >= 0.01f && automobile->m_fGasPedalAudio > 0.2f) { + automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.6f; + gasPedalAudio = automobile->m_fGasPedalAudio; + } + if (gasPedalAudio > 0.05f) { + freq = (5000.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 19000; + if (engineSoundType == 6) + freq /= 2; + AddPlayerCarSample((25.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 40, freq, (soundOffset + SFX_CAR_FINGER_OFF_ACCEL_1), engineSoundType, 63, 0); + } + } + freq = (10000.f * gasPedalAudio) + 22050; + if (engineSoundType == 6) + freq /= 2; + AddPlayerCarSample(110 - (40.f * gasPedalAudio), freq, (engineSoundType + SFX_CAR_REV_10), 0, 52, 1); + + CurrentPretendGear = Max(1, currentGear); + LastAccel = accelerateState; + + bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; + bLostTractionLastFrame = lostTraction; + return; + } + if (!nCruising) { + if (accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction || + currentGear < 2 && velocityChange - automobile->m_fVelocityChangeForAudio < 0.01f) { // here could be used abs + if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction) { + if (!automobile->m_nWheelsOnGround && automobile->m_nDriveWheelsOnGround || + (automobile->bIsHandbrakeOn && !bHandbrakeOnLastFrame || lostTraction && !bLostTractionLastFrame) && automobile->m_nWheelsOnGround) { + automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.6f; + } + freqModifier = 0; + baseFreq = (15000.f * automobile->m_fGasPedalAudio) + 14000; + vol = (25.0f * automobile->m_fGasPedalAudio) + 60; + } else { + baseFreq = (8000.f * accelerationMultipler) + 16000; + vol = (25.0f * accelerationMultipler) + 60; + automobile->m_fGasPedalAudio = accelerationMultipler; + } + freq = freqModifier + baseFreq; + if (engineSoundType == 6) + freq /= 2; + if (channelUsed) { + SampleManager.StopChannel(m_nActiveSamples); + bAccelSampleStopped = true; + } + AddPlayerCarSample(vol, freq, (engineSoundType + SFX_PHONE_RING), 0, 2, 1); + LastAccel = accelerateState; + + bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; + bLostTractionLastFrame = lostTraction; + return; + } + TranslateEntity(&m_sQueueSample.m_vecPos, &pos); + if (bAccelSampleStopped) { + if (CurrentPretendGear != 1 || currentGear != 2) { + gearNr = currentGear - 1; + if (gearNr < 1) + gearNr = 1; + CurrentPretendGear = gearNr; + } + processedAccelSampleStopped = 1; + bAccelSampleStopped = false; + } + if (channelUsed) { + SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 85); + SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z); + SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.f, 12.5f); + if (engineSoundType == 6) + freq = (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050) / 2; + else + freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050; + SampleManager.SetChannelFrequency(m_nActiveSamples, freq); + if (!channelUsed) { + SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != 0); + SampleManager.StartChannel(m_nActiveSamples); + } + LastAccel = accelerateState; + + bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; + bLostTractionLastFrame = lostTraction; + return; + } + if (processedAccelSampleStopped) { + if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + SFX_CAR_ACCEL_1, 0)) + return; + SampleManager.SetChannelLoopCount(m_nActiveSamples, 1); + SampleManager.SetChannelLoopPoints(m_nActiveSamples, 0, -1); + SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 85); + SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z); + SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.f, 12.5f); + freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050; + if (engineSoundType == 6) + freq /= 2; + SampleManager.SetChannelFrequency(m_nActiveSamples, freq); + if (!channelUsed) { + SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != 0); + SampleManager.StartChannel(m_nActiveSamples); + } + LastAccel = accelerateState; + + bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; + bLostTractionLastFrame = lostTraction; + return; + } + if (CurrentPretendGear < params->m_pTransmission->nNumberOfGears - 1) { + ++CurrentPretendGear; + if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + SFX_CAR_ACCEL_1, 0)) + return; + SampleManager.SetChannelLoopCount(m_nActiveSamples, 1); + SampleManager.SetChannelLoopPoints(m_nActiveSamples, 0, -1); + SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 85); + SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z); + SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.f, 12.5f); + freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050; + if (engineSoundType == 6) + freq /= 2; + SampleManager.SetChannelFrequency(m_nActiveSamples, freq); + if (!channelUsed) { + SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != 0); + SampleManager.StartChannel(m_nActiveSamples); + } + LastAccel = accelerateState; + + bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; + bLostTractionLastFrame = lostTraction; + return; + } + nCruising = 1; + } + bAccelSampleStopped = true; + if (accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction || + currentGear < params->m_pTransmission->nNumberOfGears - 1) { + nCruising = 0; + } else { + if (accelerateState >= 220 && 0.001f + params->m_fVelocityChange < automobile->m_fVelocityChangeForAudio) { + if (nCruising < 800) + ++nCruising; + } else if (nCruising > 3) { + --nCruising; + } + freq = 27 * nCruising + freqModifier + 22050; + if (engineSoundType == 6) + freq /= 2; + AddPlayerCarSample(85, freq, (soundOffset + SFX_CAR_AFTER_ACCEL_1), engineSoundType, 64, 1); + } + LastAccel = accelerateState; + + bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; + bLostTractionLastFrame = lostTraction; +} + +void +cAudioManager::ProcessVehicleSkidding(cVehicleParams *params) +{ + const float SOUND_INTENSITY = 40.0f; + + CAutomobile *automobile; + cTransmission *transmission; + int32 emittingVol; + float newSkidVal = 0.0f; + float skidVal = 0.0f; + + if (params->m_fDistance >= SQR(SOUND_INTENSITY)) + return; + automobile = (CAutomobile *)params->m_pVehicle; + if (!automobile->m_nWheelsOnGround) + return; + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + for (int32 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) { + if (automobile->m_aWheelState[i] == WHEEL_STATE_NORMAL || automobile->Damage.GetWheelStatus(i) == WHEEL_STATUS_MISSING) + continue; + transmission = params->m_pTransmission; + switch (transmission->nDriveType) { + case '4': + newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); + break; + case 'F': + if (i == CARWHEEL_FRONT_LEFT || i == CARWHEEL_FRONT_RIGHT) + newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); + else + newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); + break; + case 'R': + if (i == CARWHEEL_REAR_LEFT || i == CARWHEEL_REAR_RIGHT) + newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); + else + newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); + break; + default: + break; + } + skidVal = Max(skidVal, newSkidVal); + } + + if (skidVal > 0.0f) { + emittingVol = 50.f * skidVal; + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume != 0) { + m_sQueueSample.m_nCounter = 3; + switch (params->m_pVehicle->m_nSurfaceTouched) { + case SURFACE_GRASS: + case SURFACE_HEDGE: + m_sQueueSample.m_nSampleIndex = SFX_RAIN; + emittingVol /= 4; + m_sQueueSample.m_nFrequency = 13000.f * skidVal + 35000.f; + m_sQueueSample.m_nVolume /= 4; + break; + case SURFACE_DIRT: + case SURFACE_DIRTTRACK: + case SURFACE_SAND: + case SURFACE_PUDDLE: + m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID; + m_sQueueSample.m_nFrequency = 6000.f * skidVal + 10000.f; + break; + + default: + m_sQueueSample.m_nSampleIndex = SFX_SKID; + m_sQueueSample.m_nFrequency = 5000.f * skidVal + 11000.f; + break; + } + + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 8; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 3.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } +} + +float +cAudioManager::GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange) +{ + tWheelState wheelState; + float relativeVelChange; + float gasPedalAudio = automobile->m_fGasPedalAudio; + float modificator; + float velChange; + float relativeVel; + + wheelState = automobile->m_aWheelState[wheel]; + if (wheelState == WHEEL_STATE_SPINNING && gasPedalAudio > 0.4f) { + relativeVelChange = (gasPedalAudio - 0.4f) * 1.25f; + + } else if (wheelState == WHEEL_STATE_SKIDDING) { + relativeVelChange = Min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity); + } else if (wheelState == WHEEL_STATE_FIXED) { + modificator = 0.4f; + relativeVelChange = gasPedalAudio; + if (relativeVelChange > 0.4f) { + relativeVelChange = relativeVelChange - 0.4f; + modificator = 5.f / 3.f; + } + velChange = Abs(velocityChange); + if (relativeVelChange > 0.4f) + relativeVelChange = relativeVelChange * modificator; + if (velChange > 0.04f) { + relativeVel = Min(1.0f, velChange / transmission->fMaxVelocity); + } else { + relativeVel = 0.0f; + } + if (relativeVel >= relativeVelChange) + relativeVelChange = relativeVel; + } else { + relativeVelChange = 0.0f; + } + + return Max(relativeVelChange, Min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f)); +} + +float +cAudioManager::GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange) +{ + float relativeVelChange; + + if (automobile->m_aWheelState[wheel] == 2) { + relativeVelChange = Min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity); + } else { + relativeVelChange = 0.0f; + } + + return Max(relativeVelChange, Min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f)); +} + +void +cAudioManager::ProcessVehicleHorn(cVehicleParams *params) +{ + const float SOUND_INTENSITY = 40.0f; + + CAutomobile *automobile; + + if (params->m_fDistance < SQR(SOUND_INTENSITY)) { + automobile = (CAutomobile *)params->m_pVehicle; + if ((!automobile->m_bSirenOrAlarm || !UsesSirenSwitching(params->m_nIndex)) && automobile->GetModelIndex() != MI_MRWHOOP) { + if (automobile->m_nCarHornTimer) { + if (params->m_pVehicle->GetStatus() != STATUS_PLAYER) { + automobile->m_nCarHornTimer = Min(44, automobile->m_nCarHornTimer); + if (automobile->m_nCarHornTimer == 44) + automobile->m_nCarHornPattern = (m_FrameCounter + m_sQueueSample.m_nEntityIndex) & 7; + if (!hornPatternsArray[automobile->m_nCarHornPattern][44 - automobile->m_nCarHornTimer]) + return; + } + + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 4; + m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nHornSample; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 2; + m_sQueueSample.m_nFrequency = aVehicleSettings[params->m_nIndex].m_nHornFrequency; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = 80; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 5.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + } + } +} + +bool +cAudioManager::UsesSiren(int32 model) const +{ + switch (model) { + case FIRETRUK: + case AMBULAN: + case FBICAR: + case POLICE: + case ENFORCER: + case PREDATOR: + return true; + default: + return false; + } +} + +bool +cAudioManager::UsesSirenSwitching(int32 model) const +{ + switch (model) { + case AMBULAN: + case POLICE: + case ENFORCER: + case PREDATOR: + return true; + default: + return false; + } +} + +void +cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params) +{ + const float SOUND_INTENSITY = 110.0f; + + if (params->m_fDistance < SQR(SOUND_INTENSITY)) { + CVehicle *veh = params->m_pVehicle; + if (veh->m_bSirenOrAlarm == 0 && veh->m_nAlarmState <= 0) + return; + +#ifdef FIX_BUGS + if (params->m_pVehicle->GetStatus() == STATUS_WRECKED) + return; +#endif + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 5; + if (UsesSiren(params->m_nIndex)) { + if (params->m_pVehicle->GetStatus() == STATUS_ABANDONED) + return; + if (veh->m_nCarHornTimer && params->m_nIndex != FIRETRUK) { + m_sQueueSample.m_nSampleIndex = SFX_SIREN_FAST; + if (params->m_nIndex == FBICAR) + m_sQueueSample.m_nFrequency = 16113; + else + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SIREN_FAST); + m_sQueueSample.m_nCounter = 60; + } else { + m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmSample; + m_sQueueSample.m_nFrequency = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmFrequency; + } + } else { + m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmSample; + m_sQueueSample.m_nFrequency = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmFrequency; + } + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 1; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = 80; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 7.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 5; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + return; + } + } +} + +bool +cAudioManager::UsesReverseWarning(int32 model) const +{ + return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS || model == COACH; +} + +bool +cAudioManager::ProcessVehicleReverseWarning(cVehicleParams *params) +{ + const float SOUND_INTENSITY = 50.0f; + + CVehicle *veh = params->m_pVehicle; + + if (params->m_fDistance >= SQR(SOUND_INTENSITY)) + return false; + + if (veh->bEngineOn && veh->m_fGasPedal < 0.0f) { + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(60, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 12; + m_sQueueSample.m_nSampleIndex = SFX_REVERSE_WARNING; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 2; + m_sQueueSample.m_nFrequency = (100 * m_sQueueSample.m_nEntityIndex & 1023) + SampleManager.GetSampleBaseFrequency(SFX_REVERSE_WARNING); + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = 60; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 3.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + return true; +} + +bool +cAudioManager::ProcessVehicleDoors(cVehicleParams *params) +{ + const float SOUND_INTENSITY = 40.0f; + + CAutomobile *automobile; + int8 doorState; + int32 emittingVol; + float velocity; + + if (params->m_fDistance >= SQR(SOUND_INTENSITY)) + return false; + + automobile = (CAutomobile *)params->m_pVehicle; + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + for (int32 i = 0; i < ARRAY_SIZE(automobile->Doors); i++) { + if (automobile->Damage.GetDoorStatus(i) == DOOR_STATUS_SWINGING) { + doorState = automobile->Doors[i].m_nDoorState; + if (doorState == DOOR_STATUS_SMASHED || doorState == DOOR_STATUS_SWINGING) { + velocity = Min(0.3f, Abs(automobile->Doors[i].m_fAngVel)); + if (velocity > 0.0035f) { + emittingVol = (100.f * velocity * 10.f / 3.f); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = i + 6; + m_sQueueSample.m_nSampleIndex = m_anRandomTable[1] % 6 + SFX_COL_CAR_PANEL_1; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) + RandomDisplacement(1000); + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 10; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_fSpeedMultiplier = 1.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = true; + AddSampleToRequestedQueue(); + } + } + } + } + } + return true; +} + +bool +cAudioManager::ProcessAirBrakes(cVehicleParams *params) +{ + CAutomobile *automobile; + uint8 rand; + + if (params->m_fDistance > 900.0f) + return false; + automobile = (CAutomobile *)params->m_pVehicle; + if (!automobile->bEngineOn) + return true; + + if ((automobile->m_fVelocityChangeForAudio < 0.025f || params->m_fVelocityChange >= 0.025f) && + (automobile->m_fVelocityChangeForAudio > -0.025f || params->m_fVelocityChange <= 0.025f)) + return true; + + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + rand = m_anRandomTable[0] % 10 + 70; + m_sQueueSample.m_nVolume = ComputeVolume(rand, 30.0f, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 13; + m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AIR_BRAKES); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 10; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nEmittingVolume = rand; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + + return true; +} + +bool +cAudioManager::HasAirBrakes(int32 model) const +{ + return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS || model == COACH; +} + +bool +cAudioManager::ProcessEngineDamage(cVehicleParams *params) +{ + const int engineDamageIntensity = 40; + + CAutomobile *veh; + uint8 engineStatus; + uint8 emittingVolume; + + if (params->m_fDistance >= SQR(engineDamageIntensity)) + return false; + veh = (CAutomobile *)params->m_pVehicle; + if (veh->bEngineOn) { + engineStatus = veh->Damage.GetEngineStatus(); + if (engineStatus > 250 || engineStatus < 100) + return true; + if (engineStatus < 225) { + m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; + emittingVolume = 6; + m_sQueueSample.m_nReleasingVolumeModificator = 7; + m_sQueueSample.m_nFrequency = 40000; + } else { + emittingVolume = 60; + m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; + m_sQueueSample.m_nReleasingVolumeModificator = 7; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); + } + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, engineDamageIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 28; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = emittingVolume; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_fSoundIntensity = engineDamageIntensity; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + return true; +} + +bool +cAudioManager::ProcessCarBombTick(cVehicleParams *params) +{ + CAutomobile *automobile; + + if (params->m_fDistance >= SQR(40.f)) + return false; + automobile = (CAutomobile *)params->m_pVehicle; + if (automobile->bEngineOn && automobile->m_bombType == CARBOMB_TIMEDACTIVE) { + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(60, 40.f, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 35; + m_sQueueSample.m_nSampleIndex = SFX_COUNTDOWN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 0; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COUNTDOWN); + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = 60; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_fSoundIntensity = 40.0f; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + return true; +} + +void +cAudioManager::ProcessVehicleOneShots(cVehicleParams *params) +{ + int16 event; + uint8 emittingVol; + float relVol; + float vol; + bool noReflections; + float maxDist; + cPedParams pedParams; + + static uint8 WaveIndex = 41; + static uint8 GunIndex = 53; + static uint8 iWheelIndex = 82; + static uint8 CrunchOffset = 0; + + for (int i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) { + noReflections = 0; + m_sQueueSample.m_bRequireReflection = false; + event = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]; + switch (event) { + case SOUND_CAR_DOOR_CLOSE_BONNET: + case SOUND_CAR_DOOR_CLOSE_BUMPER: + case SOUND_CAR_DOOR_CLOSE_FRONT_LEFT: + case SOUND_CAR_DOOR_CLOSE_FRONT_RIGHT: + case SOUND_CAR_DOOR_CLOSE_BACK_LEFT: + case SOUND_CAR_DOOR_CLOSE_BACK_RIGHT: { + const float SOUND_INTENSITY = 50.0f; + maxDist = SQR(SOUND_INTENSITY); + emittingVol = m_anRandomTable[2] % 5 + 122; + switch (aVehicleSettings[params->m_nIndex].m_bDoorType) { + case 0: + m_sQueueSample.m_nSampleIndex = SFX_OLD_CAR_DOOR_CLOSE; + break; + case 2: + m_sQueueSample.m_nSampleIndex = SFX_TRUCK_DOOR_CLOSE; + break; + case 3: + m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES; + break; + default: + m_sQueueSample.m_nSampleIndex = SFX_NEW_CAR_DOOR_CLOSE; + break; + } + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] + 22; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bRequireReflection = true; + break; + } + case SOUND_CAR_DOOR_OPEN_BONNET: + case SOUND_CAR_DOOR_OPEN_BUMPER: + case SOUND_CAR_DOOR_OPEN_FRONT_LEFT: + case SOUND_CAR_DOOR_OPEN_FRONT_RIGHT: + case SOUND_CAR_DOOR_OPEN_BACK_LEFT: + case SOUND_CAR_DOOR_OPEN_BACK_RIGHT: { + const float SOUND_INTENSITY = 50.0f; + maxDist = SQR(SOUND_INTENSITY); + emittingVol = m_anRandomTable[1] % 10 + 117; + switch (aVehicleSettings[params->m_nIndex].m_bDoorType) { + case 0: + m_sQueueSample.m_nSampleIndex = SFX_OLD_CAR_DOOR_OPEN; + break; + case 2: + m_sQueueSample.m_nSampleIndex = SFX_TRUCK_DOOR_OPEN; + break; + case 3: + m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES; + break; + default: + m_sQueueSample.m_nSampleIndex = SFX_NEW_CAR_DOOR_OPEN; + break; + } + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] + 10; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bRequireReflection = true; + break; + } + case SOUND_CAR_WINDSHIELD_CRACK: { + const float SOUND_INTENSITY = 30.0f; + maxDist = SQR(SOUND_INTENSITY); + m_sQueueSample.m_nSampleIndex = SFX_GLASS_CRACK; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = 68; + emittingVol = m_anRandomTable[1] % 30 + 60; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_CRACK); + m_sQueueSample.m_nReleasingVolumeModificator = 5; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + } break; + case SOUND_CAR_JUMP: { + const float SOUND_INTENSITY = 35.0f; + emittingVol = Max(80.f, 2 * (100.f * m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i])); + maxDist = SQR(SOUND_INTENSITY); + m_sQueueSample.m_nSampleIndex = SFX_TYRE_BUMP; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iWheelIndex++; + if (iWheelIndex > 85) + iWheelIndex = 82; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TYRE_BUMP); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); + if (params->m_nIndex == 41) { + m_sQueueSample.m_nFrequency *= 2; + emittingVol /= 2; + } + m_sQueueSample.m_nReleasingVolumeModificator = 6; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + break; + } + case SOUND_CAR_ENGINE_START: { + const float SOUND_INTENSITY = 40.0f; + emittingVol = 60; + maxDist = SQR(SOUND_INTENSITY); + m_sQueueSample.m_nSampleIndex = SFX_CAR_STARTER; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = 33; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_STARTER); + m_sQueueSample.m_nReleasingVolumeModificator = 1; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bRequireReflection = true; + break; + } + case SOUND_CAR_LIGHT_BREAK: { + const float SOUND_INTENSITY = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_GLASS_SHARD_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = 37; + m_sQueueSample.m_nFrequency = 9 * SampleManager.GetSampleBaseFrequency(SFX_GLASS_SHARD_1) / 10; + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8); + m_sQueueSample.m_nReleasingVolumeModificator = 5; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + maxDist = SQR(SOUND_INTENSITY); + emittingVol = m_anRandomTable[4] % 10 + 30; + break; + } + case SOUND_CAR_HYDRAULIC_1: + case SOUND_CAR_HYDRAULIC_2: { + const float SOUND_INTENSITY = 35.0f; + if (event == MOONBEAM) // todo check + m_sQueueSample.m_nFrequency = 15600; + else + m_sQueueSample.m_nFrequency = 13118; + m_sQueueSample.m_nSampleIndex = SFX_SUSPENSION_FAST_MOVE; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = 51; + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8); + m_sQueueSample.m_nReleasingVolumeModificator = 5; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + maxDist = SQR(SOUND_INTENSITY); + emittingVol = m_anRandomTable[0] % 15 + 55; + break; + } + case SOUND_CAR_HYDRAULIC_3: { + const float SOUND_INTENSITY = 35.0f; + m_sQueueSample.m_nSampleIndex = SFX_SUSPENSION_SLOW_MOVE_LOOP; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = 86; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SUSPENSION_SLOW_MOVE_LOOP); + m_sQueueSample.m_nReleasingVolumeModificator = 5; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_nReleasingVolumeDivider = 7; + noReflections = true; + maxDist = SQR(SOUND_INTENSITY); + emittingVol = m_anRandomTable[0] % 15 + 55; + break; + } + case SOUND_CAR_JERK: { + const float SOUND_INTENSITY = 35.0f; + m_sQueueSample.m_nSampleIndex = SFX_SHAG_SUSPENSION; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = 87; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SHAG_SUSPENSION); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8); + m_sQueueSample.m_nReleasingVolumeModificator = 5; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + maxDist = SQR(SOUND_INTENSITY); + emittingVol = m_anRandomTable[1] % 15 + 55; + break; + } + case SOUND_CAR_SPLASH: { + const float SOUND_INTENSITY = 40.0f; + vol = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]; + if (vol <= 300.f) + continue; + if (vol > 1200.f) + m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i] = 1200.0f; + relVol = (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i] - 300.f) / 900.f; + m_sQueueSample.m_nSampleIndex = (m_anRandomTable[0] & 1) + SFX_BOAT_SPLASH_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = WaveIndex++; + if (WaveIndex > 46) + WaveIndex = 41; + m_sQueueSample.m_nFrequency = (7000.f * relVol) + 6000; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + emittingVol = (55.f * relVol); + maxDist = SQR(SOUND_INTENSITY); + break; + } + case SOUND_17: { + const float SOUND_INTENSITY = 50.0f; + m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_THUMB_OFF; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = 47; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BOAT_THUMB_OFF) + RandomDisplacement(600); + m_sQueueSample.m_nReleasingVolumeModificator = 2; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + emittingVol = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]; + maxDist = SQR(SOUND_INTENSITY); + break; + } + case SOUND_18: + case SOUND_19: { + const float SOUND_INTENSITY = 35.0f; + m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = 59; + m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 11025; + m_sQueueSample.m_nReleasingVolumeModificator = 5; + m_sQueueSample.m_fSpeedMultiplier = 5.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + maxDist = SQR(SOUND_INTENSITY); + emittingVol = m_anRandomTable[1] % 20 + 70; + break; + } + case SOUND_CAR_TANK_TURRET_ROTATE: { + const float SOUND_INTENSITY = 40.0f; + vol = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]; + if (vol > 96.0f / 2500.0f) + vol = 96.0f / 2500.0f; + m_sQueueSample.m_nSampleIndex = SFX_TANK_TURRET; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = 79; + m_sQueueSample.m_nFrequency = (3000.f * vol * 2500.0f / 96.0f) + 9000; + m_sQueueSample.m_nReleasingVolumeModificator = 2; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + emittingVol = (37.f * vol * 2500.0f / 96.0f) + 90; + maxDist = SQR(SOUND_INTENSITY); + noReflections = true; + break; + } + case SOUND_CAR_BOMB_TICK: { + const float SOUND_INTENSITY = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_BOMB_BEEP; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = 80; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BOMB_BEEP); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + maxDist = SQR(SOUND_INTENSITY); + m_sQueueSample.m_bRequireReflection = true; + emittingVol = 60; + break; + } + case SOUND_PLANE_ON_GROUND: { + const float SOUND_INTENSITY = 180.0f; + m_sQueueSample.m_nSampleIndex = SFX_JUMBO_LAND_WHEELS; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = 81; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_LAND_WHEELS); + m_sQueueSample.m_nReleasingVolumeModificator = 2; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + maxDist = SQR(SOUND_INTENSITY); + emittingVol = m_anRandomTable[4] % 25 + 75; + break; + } + case SOUND_WEAPON_SHOT_FIRED: { + const float SOUND_INTENSITY = 120.0f; + emittingVol = m_anRandomTable[2]; + maxDist = SQR(SOUND_INTENSITY); + m_sQueueSample.m_nSampleIndex = SFX_UZI_LEFT; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = GunIndex++; + emittingVol = emittingVol % 15 + 65; + if (GunIndex > 58) + GunIndex = 53; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_UZI_LEFT); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + break; + } + case SOUND_WEAPON_HIT_VEHICLE: { + const float SOUND_INTENSITY = 40.0f; + m_sQueueSample.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex % ARRAY_SIZE(m_anRandomTable)] % 6 + SFX_BULLET_CAR_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = 34; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); + m_sQueueSample.m_nReleasingVolumeModificator = 7; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + maxDist = SQR(SOUND_INTENSITY); + emittingVol = m_anRandomTable[3] % 20 + 90; + break; + } + case SOUND_BOMB_TIMED_ACTIVATED: + case SOUND_55: + case SOUND_BOMB_ONIGNITION_ACTIVATED: + case SOUND_BOMB_TICK: { + const float SOUND_INTENSITY = 50.0f; + m_sQueueSample.m_nSampleIndex = SFX_ARM_BOMB; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = 36; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ARM_BOMB); + m_sQueueSample.m_nReleasingVolumeModificator = 0; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bRequireReflection = true; + emittingVol = 50; + maxDist = SQR(SOUND_INTENSITY); + break; + } + case SOUND_PED_HELI_PLAYER_FOUND: + pedParams.m_pPed = nil; + pedParams.m_bDistanceCalculated = false; + pedParams.m_fDistance = 0.0f; + pedParams.m_bDistanceCalculated = params->m_bDistanceCalculated; + pedParams.m_fDistance = params->m_fDistance; + SetupPedComments(&pedParams, SOUND_PED_HELI_PLAYER_FOUND); + continue; + case SOUND_PED_BODYCAST_HIT: + pedParams.m_pPed = nil; + pedParams.m_bDistanceCalculated = false; + pedParams.m_fDistance = 0.0f; + pedParams.m_bDistanceCalculated = params->m_bDistanceCalculated; + pedParams.m_fDistance = params->m_fDistance; + SetupPedComments(&pedParams, SOUND_PED_BODYCAST_HIT); + continue; + case SOUND_WATER_FALL: { + const float SOUND_INTENSITY = 40.0f; + m_sQueueSample.m_nSampleIndex = SFX_SPLASH_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = 15; + m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 16000; + m_sQueueSample.m_nReleasingVolumeModificator = 1; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + maxDist = SQR(SOUND_INTENSITY); + m_sQueueSample.m_bRequireReflection = true; + emittingVol = m_anRandomTable[4] % 20 + 90; + break; + } + case SOUND_SPLATTER: { + const float SOUND_INTENSITY = 40.0f; + m_sQueueSample.m_nSampleIndex = CrunchOffset + SFX_PED_CRUNCH_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = 48; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PED_CRUNCH_1) + RandomDisplacement(600); + m_sQueueSample.m_nReleasingVolumeModificator = 1; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 40.0f; + ++CrunchOffset; + maxDist = SQR(SOUND_INTENSITY); + emittingVol = m_anRandomTable[4] % 20 + 55; + CrunchOffset %= 2; + m_sQueueSample.m_bRequireReflection = true; + break; + } + case SOUND_CAR_PED_COLLISION: { + const float SOUND_INTENSITY = 40.0f; + vol = Min(20.0f, m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]); + emittingVol = (vol / 20.0f * 127.f); + if (!emittingVol) + continue; + + m_sQueueSample.m_nSampleIndex = (m_anRandomTable[2] & 3) + SFX_FIGHT_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = 50; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) / 2; + m_sQueueSample.m_nReleasingVolumeModificator = 1; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + maxDist = SQR(SOUND_INTENSITY); + break; + } + default: + continue; + } + if (params->m_fDistance < maxDist) { + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume != 0) { + if (noReflections) { + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bReleasingSoundFlag = false; + } else { + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_bReleasingSoundFlag = true; + } + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bIs2D = false; + AddSampleToRequestedQueue(); + } + } + } +} + +bool +cAudioManager::ProcessTrainNoise(cVehicleParams *params) +{ + const float SOUND_INTENSITY = 300.0f; + + CTrain *train; + uint8 emittingVol; + float speedMultipler; + + if (params->m_fDistance >= SQR(SOUND_INTENSITY)) + return false; + + if (params->m_fVelocityChange > 0.0f) { + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + train = (CTrain *)params->m_pVehicle; + speedMultipler = Min(1.0f, train->m_fSpeed * 250.f / 51.f); + emittingVol = (75.f * speedMultipler); + if (train->m_fWagonPosition == 0.0f) { + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume != 0) { + m_sQueueSample.m_nCounter = 32; + m_sQueueSample.m_nSampleIndex = SFX_TRAIN_FAR; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 2; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_FAR); + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 3.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + const float SOUND_INTENSITY = 70.0f; + if (params->m_fDistance < SQR(SOUND_INTENSITY)) { + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume != 0) { + m_sQueueSample.m_nCounter = 33; + m_sQueueSample.m_nSampleIndex = SFX_TRAIN_NEAR; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 5; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_NEAR) + 100 * m_sQueueSample.m_nEntityIndex % 987; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 6.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + } + return true; +} + +bool +cAudioManager::ProcessBoatEngine(cVehicleParams *params) +{ + CBoat *boat; + float padRelativeAccerate; + float gasPedal; + int32 padAccelerate; + uint8 emittingVol; + float oneShotVol; + + static uint16 LastAccel = 0; + static uint8 LastVol = 0; + + static const int intensity = 50; + + if (params->m_fDistance < SQR(intensity)) { + boat = (CBoat *)params->m_pVehicle; + if (params->m_nIndex == REEFER) { + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(80, 50.f, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 39; + m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; + m_sQueueSample.m_nFrequency = 10386; + m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex * 65536) % 1000; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = 80; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_fSoundIntensity = intensity; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 7; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + if (FindPlayerVehicle() == params->m_pVehicle) { + if (Pads[0].GetAccelerate() <= Pads[0].GetBrake()) + padAccelerate = Pads[0].GetBrake(); + else + padAccelerate = Pads[0].GetAccelerate(); + padRelativeAccerate = padAccelerate / 255; + emittingVol = (100.f * padRelativeAccerate) + 15; + m_sQueueSample.m_nFrequency = (3000.f * padRelativeAccerate) + 6000; + if (!boat->m_bIsAnchored) + m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10; + } else { + gasPedal = Abs(boat->m_fGasPedal); + if (gasPedal > 0.0f) { + m_sQueueSample.m_nFrequency = 6000; + emittingVol = 15; + } else { + emittingVol = (100.f * gasPedal) + 15; + m_sQueueSample.m_nFrequency = (3000.f * gasPedal) + 6000; + if (!boat->m_bIsAnchored) + m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10; + } + } + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance); + if (!m_sQueueSample.m_nVolume) + return true; + m_sQueueSample.m_nCounter = 40; + m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL; + m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex * 65536) % 1000; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_fSoundIntensity = intensity; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 7; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + } else { + if (FindPlayerVehicle() == params->m_pVehicle) { + if (Pads[0].GetAccelerate() <= Pads[0].GetBrake()) + padAccelerate = Pads[0].GetBrake(); + else + padAccelerate = Pads[0].GetAccelerate(); + if (padAccelerate <= 20) { + emittingVol = 45 - 45 * padAccelerate / 40; + m_sQueueSample.m_nFrequency = 100 * padAccelerate + 11025; + m_sQueueSample.m_nCounter = 39; + m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_IDLE; + if (LastAccel > 20) { + oneShotVol = LastVol; + PlayOneShot(m_sQueueSample.m_nEntityIndex, SOUND_17, oneShotVol); + } + } else { + emittingVol = 105 * padAccelerate / 255 + 15; + m_sQueueSample.m_nFrequency = 4000 * padAccelerate / 255 + 8000; + if (!boat->m_bIsAnchored) + m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10; + m_sQueueSample.m_nCounter = 40; + m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL; + } + LastVol = emittingVol; + LastAccel = padAccelerate; + } else { + gasPedal = Abs(boat->m_fGasPedal); + if (gasPedal > 0.0f) { + m_sQueueSample.m_nFrequency = 11025; + emittingVol = 45; + m_sQueueSample.m_nCounter = 39; + m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_IDLE; + } else { + emittingVol = (105.f * gasPedal) + 15; + m_sQueueSample.m_nFrequency = (4000.f * gasPedal) + 8000; + if (!boat->m_bIsAnchored) + m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10; + m_sQueueSample.m_nCounter = 40; + m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL; + } + } + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance); + if (!m_sQueueSample.m_nVolume) + return true; + m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex * 65536) % 1000; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_fSoundIntensity = intensity; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 7; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + } + AddSampleToRequestedQueue(); + return true; + } + return false; +} + +bool +cAudioManager::ProcessBoatMovingOverWater(cVehicleParams *params) +{ + float velocityChange; + int32 vol; + float multiplier; + + if (params->m_fDistance > 2500.f) + return false; + + velocityChange = Abs(params->m_fVelocityChange); + if (velocityChange <= 0.0005f && params->m_pVehicle->GetPosition().y) + return true; + + velocityChange = Min(0.75f, velocityChange); + multiplier = (velocityChange - 0.0005f) * 1.3342f; + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + vol = (30.f * multiplier); + m_sQueueSample.m_nVolume = ComputeVolume(vol, 50.f, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 38; + m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nFrequency = (6050.f * multiplier) + 16000; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = vol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + + return true; +} + +struct tHelicopterSampleData { + float m_fMaxDistance; + float m_fBaseDistance; + uint8 m_bBaseVolume; +}; + +bool +cAudioManager::ProcessHelicopter(cVehicleParams *params) +{ + CHeli *heli; + float MaxDist; + float dist; + float baseDist; + int32 emittingVol; + static const tHelicopterSampleData gHeliSfxRanges[3] = {{400.f, 380.f, 100}, {100.f, 70.f, maxVolume}, {60.f, 30.f, maxVolume}}; + + if (gHeliSfxRanges[0].m_fMaxDistance * gHeliSfxRanges[0].m_fMaxDistance <= params->m_fDistance) + return false; + + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + heli = (CHeli *)params->m_pVehicle; + for (uint32 i = 0; i < ARRAY_SIZE(gHeliSfxRanges); i++) { + MaxDist = gHeliSfxRanges[i].m_fMaxDistance; + dist = m_sQueueSample.m_fDistance; + if (dist >= MaxDist) + return true; + baseDist = gHeliSfxRanges[i].m_fBaseDistance; + if (dist < baseDist) + emittingVol = (gHeliSfxRanges[i].m_bBaseVolume * ((MaxDist - dist) / (MaxDist - baseDist))); + else + emittingVol = gHeliSfxRanges[i].m_bBaseVolume; + + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, gHeliSfxRanges[i].m_fMaxDistance, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = i + 65; + m_sQueueSample.m_nSampleIndex = i + SFX_HELI_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 0; + m_sQueueSample.m_nFrequency = 1200 * heli->m_nHeliId + SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 6.0f; + m_sQueueSample.m_fSoundIntensity = gHeliSfxRanges[i].m_fMaxDistance; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + return true; +} + +void +cAudioManager::ProcessPlane(cVehicleParams *params) +{ + switch (params->m_nIndex) { + case AIRTRAIN: + ProcessJumbo(params); + break; + case DEADDODO: + ProcessCesna(params); + break; + default: + debug("Plane Model Id is %d\n, ", params->m_pVehicle->GetModelIndex()); + break; + } +} + +#pragma region JUMBO +uint8 gJumboVolOffsetPercentage; + +void +DoJumboVolOffset() +{ + if (!(AudioManager.GetFrameCounter() % (AudioManager.GetRandomNumber(0) % 6 + 3))) + gJumboVolOffsetPercentage = AudioManager.GetRandomNumber(1) % 60; +} + +void +cAudioManager::ProcessJumbo(cVehicleParams *params) +{ + CPlane *plane; + float position; + + if (params->m_fDistance < 193600.0f) { + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + plane = (CPlane *)params->m_pVehicle; + DoJumboVolOffset(); + position = PlanePathPosition[plane->m_nPlaneId]; + if (position <= TakeOffPoint) { + if (plane->m_fSpeed <= 0.10334f) { + ProcessJumboTaxi(); + return; + } + + ProcessJumboAccel(plane); + } else if (300.0f + TakeOffPoint >= position) { + ProcessJumboTakeOff(plane); + } else if (LandingPoint - 350.0f >= position) { + ProcessJumboFlying(); + } else { + if (position > LandingPoint) { + if (plane->m_fSpeed > 0.10334f) { + ProcessJumboDecel(plane); + return; + } + ProcessJumboTaxi(); + return; + } + ProcessJumboLanding(plane); + } + } +} + +void +cAudioManager::ProcessJumboTaxi() +{ + if (SetupJumboFlySound(20)) { + if (SetupJumboTaxiSound(75)) + SetupJumboWhineSound(18, 29500); + } +} + +void +cAudioManager::ProcessJumboAccel(CPlane *plane) +{ + int32 engineFreq; + int32 vol; + float whineSoundFreq; + float modificator; + + if (SetupJumboFlySound(20)) { + modificator = (plane->m_fSpeed - 0.10334f) * 1.676f; + if (modificator > 1.0f) + modificator = 1.0f; + if (SetupJumboRumbleSound(maxVolume * modificator) && SetupJumboTaxiSound((1.0f - modificator) * 75.f)) { + if (modificator < 0.2f) { + whineSoundFreq = modificator * 5.f * 14600.0f + 29500; + vol = modificator * 5.f * maxVolume; + engineFreq = modificator * 5.f * 6050.f + 16000; + } else { + whineSoundFreq = 44100; + engineFreq = 22050; + vol = maxVolume; + } + SetupJumboEngineSound(vol, engineFreq); + SetupJumboWhineSound(18, whineSoundFreq); + } + } +} + +void +cAudioManager::ProcessJumboTakeOff(CPlane *plane) +{ + const float modificator = (PlanePathPosition[plane->m_nPlaneId] - TakeOffPoint) / 300.f; + + if (SetupJumboFlySound((107.f * modificator) + 20) && SetupJumboRumbleSound(maxVolume * (1.f - modificator))) { + if (SetupJumboEngineSound(maxVolume, 22050)) + SetupJumboWhineSound(18.f * (1.f - modificator), 44100); + } +} + +void +cAudioManager::ProcessJumboFlying() +{ + if (SetupJumboFlySound(maxVolume)) + SetupJumboEngineSound(63, 22050); +} + +void +cAudioManager::ProcessJumboLanding(CPlane *plane) +{ + const float modificator = (LandingPoint - PlanePathPosition[plane->m_nPlaneId]) / 350.f; + if (SetupJumboFlySound(107.f * modificator + 20)) { + if (SetupJumboTaxiSound(75.f * (1.f - modificator))) { + SetupJumboEngineSound(maxVolume, 22050); + SetupJumboWhineSound(18.f * (1.f - modificator), 14600.f * modificator + 29500); + } + } +} + +void +cAudioManager::ProcessJumboDecel(CPlane *plane) +{ + if (SetupJumboFlySound(20) && SetupJumboTaxiSound(75)) { + const float modificator = Min(1.f, (plane->m_fSpeed - 0.10334f) * 1.676f); + SetupJumboEngineSound(maxVolume * modificator, 6050.f * modificator + 16000); + SetupJumboWhineSound(18, 29500); + } +} + +bool +cAudioManager::SetupJumboTaxiSound(uint8 vol) +{ + const float SOUND_INTENSITY = 180.0f; + if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY) + return false; + + uint8 emittingVol = (vol / 2) + ((vol / 2) * m_sQueueSample.m_fDistance / SOUND_INTENSITY); + + if (m_sQueueSample.m_fDistance / SOUND_INTENSITY < 0.7f) + emittingVol -= emittingVol * gJumboVolOffsetPercentage / 100; + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + + if (m_sQueueSample.m_nVolume != 0) { + m_sQueueSample.m_nCounter = 1; + m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 1; + m_sQueueSample.m_nFrequency = GetJumboTaxiFreq(); + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 4; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + return true; +} + +bool +cAudioManager::SetupJumboWhineSound(uint8 emittingVol, int32 freq) +{ + const float SOUND_INTENSITY = 170.0f; + + if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY) + return false; + + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + + if (m_sQueueSample.m_nVolume != 0) { + m_sQueueSample.m_nCounter = 2; + m_sQueueSample.m_nSampleIndex = SFX_JUMBO_WHINE; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 1; + m_sQueueSample.m_nFrequency = freq; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 4; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + return true; +} + +bool +cAudioManager::SetupJumboEngineSound(uint8 vol, int32 freq) +{ + const float SOUND_INTENSITY = 180.0f; + if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY) + return false; + + uint8 emittingVol = vol - gJumboVolOffsetPercentage / 100; + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume != 0) { + m_sQueueSample.m_nCounter = 3; + m_sQueueSample.m_nSampleIndex = SFX_JUMBO_ENGINE; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 1; + m_sQueueSample.m_nFrequency = freq; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 4; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + return true; +} + +bool +cAudioManager::SetupJumboFlySound(uint8 emittingVol) +{ + const float SOUND_INTENSITY = 440.0f; + if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY) + return false; + + int32 vol = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = vol; + if (m_sQueueSample.m_nVolume != 0) { + m_sQueueSample.m_nSampleIndex = SFX_JUMBO_DIST_FLY; + m_sQueueSample.m_nCounter = 0; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_DIST_FLY); + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_nReleasingVolumeDivider = 5; + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + AddSampleToRequestedQueue(); + } + return true; +} + +bool +cAudioManager::SetupJumboRumbleSound(uint8 emittingVol) +{ + const float SOUND_INTENSITY = 240.0f; + if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY) + return false; + + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + + if (m_sQueueSample.m_nVolume != 0) { + m_sQueueSample.m_nCounter = 5; + m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = true; + m_sQueueSample.m_nReleasingVolumeModificator = 1; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_RUMBLE); + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 12; + m_sQueueSample.m_nOffset = 0; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + m_sQueueSample.m_nCounter = 6; + m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE; + m_sQueueSample.m_nFrequency += 200; + m_sQueueSample.m_nOffset = maxVolume; + AddSampleToRequestedQueue(); + } + return true; +} + +int32 +cAudioManager::GetJumboTaxiFreq() const +{ + return (60.833f * m_sQueueSample.m_fDistance) + 22050; +} + +#pragma endregion Some jumbo crap + +#pragma endregion All the vehicle audio code + +#pragma region PED AUDIO +void +cAudioManager::ProcessPed(CPhysical *ped) +{ + cPedParams params; + + params.m_pPed = nil; + params.m_bDistanceCalculated = false; + params.m_fDistance = 0.0f; + + m_sQueueSample.m_vecPos = ped->GetPosition(); + + // params.m_bDistanceCalculated = false; + params.m_pPed = (CPed *)ped; + params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (ped->GetModelIndex() == MI_FATMALE02) + ProcessPedHeadphones(¶ms); + ProcessPedOneShots(¶ms); +} + +void +cAudioManager::ProcessPedHeadphones(cPedParams *params) +{ + CPed *ped; + CAutomobile *veh; + uint8 emittingVol; + + if (params->m_fDistance < 49.f) { + ped = params->m_pPed; + if (!ped->bIsAimingGun || ped->m_bodyPartBleeding != PED_HEAD) { + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + if (ped->bInVehicle && ped->m_nPedState == PED_DRIVING) { + emittingVol = 10; + veh = (CAutomobile *)ped->m_pMyVehicle; + if (veh && veh->IsCar()) { + for (int32 i = 2; i < ARRAY_SIZE(veh->Doors); i++) { + if (!veh->IsDoorClosed((eDoors)i) || veh->IsDoorMissing((eDoors)i)) { + emittingVol = 42; + break; + } + } + } + } else { + emittingVol = 42; + } + + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 7.f, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 64; + m_sQueueSample.m_nSampleIndex = SFX_HEADPHONES; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 5; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_HEADPHONES); + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_fSoundIntensity = 7.0f; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 5; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + return; + } + } +} + +void +cAudioManager::ProcessPedOneShots(cPedParams *params) +{ + uint8 emittingVol; + int32 sampleIndex; + + CPed *ped = params->m_pPed; + + bool stereo; + int16 sound; + bool noReflection; + CWeapon *weapon; + float maxDist = 0.f; // uninitialized variable + + static uint8 iSound = 21; + + weapon = params->m_pPed->GetWeapon(); + for (uint32 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) { + noReflection = false; + stereo = false; + m_sQueueSample.m_bRequireReflection = false; + sound = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]; + switch (sound) { + case SOUND_STEP_START: + case SOUND_STEP_END: + if (!params->m_pPed->bIsLooking) { + emittingVol = m_anRandomTable[3] % 15 + 45; + if (FindPlayerPed() != m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity) + emittingVol /= 2; + maxDist = 400.f; + switch (params->m_pPed->m_nSurfaceTouched) { + case SURFACE_GRASS: + sampleIndex = m_anRandomTable[1] % 5 + SFX_FOOTSTEP_GRASS_1; + break; + case SURFACE_DIRT: + case SURFACE_DIRTTRACK: + sampleIndex = m_anRandomTable[4] % 5 + SFX_FOOTSTEP_GRAVEL_1; + break; + case SURFACE_METAL6: + case SURFACE_METAL_DOOR: + case SURFACE_BILLBOARD: + case SURFACE_STEEL: + case SURFACE_METAL_POLE: + case SURFACE_STREET_LIGHT: + case SURFACE_METAL14: + case SURFACE_METAL15: + case SURFACE_METAL_FENCE: + case SURFACE_METAL27: + case SURFACE_METAL28: + sampleIndex = m_anRandomTable[0] % 5 + SFX_FOOTSTEP_METAL_1; + break; + case SURFACE_SAND: + sampleIndex = (m_anRandomTable[4] & 3) + SFX_FOOTSTEP_SAND_1; + break; + case SURFACE_PUDDLE: + sampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1; + break; + case SURFACE_WOOD: + case SURFACE_WOOD_BOX: + case SURFACE_WOOD_PLANK: + sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_WOOD_1; + break; + case SURFACE_HEDGE: + sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_VEG_1; + break; + default: + sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_CONCRETE_1; + break; + } + m_sQueueSample.m_nSampleIndex = sampleIndex; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] - 28; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17); + switch (params->m_pPed->m_nMoveState) { + case PEDMOVE_WALK: + emittingVol /= 4; + m_sQueueSample.m_nFrequency = 9 * m_sQueueSample.m_nFrequency / 10; + break; + case PEDMOVE_RUN: + emittingVol /= 2; + m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10; + break; + case PEDMOVE_SPRINT: + m_sQueueSample.m_nFrequency = 12 * m_sQueueSample.m_nFrequency / 10; + break; + default: + break; + } + m_sQueueSample.m_nReleasingVolumeModificator = 5; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 20.0f; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bRequireReflection = true; + } + break; + case SOUND_FALL_LAND: + case SOUND_FALL_COLLAPSE: + if (!ped->bIsLooking) { + maxDist = SQR(30); + emittingVol = m_anRandomTable[3] % 20 + 80; + if (ped->m_nSurfaceTouched == SURFACE_PUDDLE) { + m_sQueueSample.m_nSampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1; + } else if (sound == SOUND_FALL_LAND) { + m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND; + } else { + m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND_AND_FALL; + } + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = 1; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17); + m_sQueueSample.m_nReleasingVolumeModificator = 2; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bRequireReflection = true; + } + break; + case SOUND_FIGHT_PUNCH_33: + m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1; + m_sQueueSample.m_nFrequency = 18000; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound; + stereo = true; + ++iSound; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + maxDist = SQR(30); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + emittingVol = m_anRandomTable[3] % 26 + 100; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bRequireReflection = true; + break; + case SOUND_FIGHT_KICK_34: + m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1; + m_sQueueSample.m_nFrequency = 16500; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound; + stereo = true; + ++iSound; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + maxDist = SQR(30); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + emittingVol = m_anRandomTable[3] % 26 + 100; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bRequireReflection = true; + break; + case SOUND_FIGHT_HEADBUTT_35: + m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1; + m_sQueueSample.m_nFrequency = 20000; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound; + stereo = true; + ++iSound; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + maxDist = SQR(30); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + emittingVol = m_anRandomTable[3] % 26 + 100; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bRequireReflection = true; + break; + case SOUND_FIGHT_PUNCH_36: + m_sQueueSample.m_nSampleIndex = SFX_FIGHT_2; + m_sQueueSample.m_nFrequency = 18000; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound; + stereo = true; + ++iSound; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + maxDist = SQR(30); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + emittingVol = m_anRandomTable[3] % 26 + 100; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bRequireReflection = true; + break; + case SOUND_FIGHT_PUNCH_37: + m_sQueueSample.m_nSampleIndex = SFX_FIGHT_2; + m_sQueueSample.m_nFrequency = 16500; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound; + stereo = true; + ++iSound; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + maxDist = SQR(30); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + emittingVol = m_anRandomTable[3] % 26 + 100; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bRequireReflection = true; + break; + case SOUND_FIGHT_CLOSE_PUNCH_38: + m_sQueueSample.m_nSampleIndex = SFX_FIGHT_2; + m_sQueueSample.m_nFrequency = 20000; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound; + stereo = true; + ++iSound; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + maxDist = SQR(30); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + emittingVol = m_anRandomTable[3] % 26 + 100; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bRequireReflection = true; + break; + case SOUND_FIGHT_PUNCH_39: + m_sQueueSample.m_nSampleIndex = SFX_FIGHT_4; + m_sQueueSample.m_nFrequency = 18000; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound; + stereo = true; + ++iSound; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + maxDist = SQR(30); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + emittingVol = m_anRandomTable[3] % 26 + 100; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bRequireReflection = true; + break; + case SOUND_FIGHT_PUNCH_OR_KICK_BELOW_40: + m_sQueueSample.m_nSampleIndex = SFX_FIGHT_4; + m_sQueueSample.m_nFrequency = 16500; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound; + stereo = true; + ++iSound; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + maxDist = SQR(30); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + emittingVol = m_anRandomTable[3] % 26 + 100; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bRequireReflection = true; + break; + case SOUND_FIGHT_PUNCH_41: + m_sQueueSample.m_nSampleIndex = SFX_FIGHT_4; + m_sQueueSample.m_nFrequency = 20000; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound; + stereo = true; + ++iSound; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + maxDist = SQR(30); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + emittingVol = m_anRandomTable[3] % 26 + 100; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bRequireReflection = true; + break; + case SOUND_FIGHT_PUNCH_FROM_BEHIND_42: + m_sQueueSample.m_nSampleIndex = SFX_FIGHT_5; + m_sQueueSample.m_nFrequency = 18000; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound; + stereo = true; + ++iSound; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + maxDist = SQR(30); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + emittingVol = m_anRandomTable[3] % 26 + 100; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bRequireReflection = true; + break; + case SOUND_FIGHT_KNEE_OR_KICK_43: + m_sQueueSample.m_nSampleIndex = SFX_FIGHT_5; + m_sQueueSample.m_nFrequency = 16500; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound; + stereo = true; + ++iSound; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + maxDist = SQR(30); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + emittingVol = m_anRandomTable[3] % 26 + 100; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bRequireReflection = true; + break; + case SOUND_FIGHT_KICK_44: + m_sQueueSample.m_nSampleIndex = SFX_FIGHT_5; + m_sQueueSample.m_nFrequency = 20000; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound; + stereo = true; + ++iSound; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + maxDist = SQR(30); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + emittingVol = m_anRandomTable[3] % 26 + 100; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bRequireReflection = true; + break; + case SOUND_WEAPON_BAT_ATTACK: + m_sQueueSample.m_nSampleIndex = SFX_BAT_HIT_LEFT; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound++; + stereo = true; + m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 22000; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + maxDist = SQR(30); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + emittingVol = m_anRandomTable[2] % 20 + 100; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + if (m_bDynamicAcousticModelingStatus) + m_sQueueSample.m_bRequireReflection = true; + else + noReflection = true; + break; + case SOUND_WEAPON_SHOT_FIRED: + weapon = &ped->m_weapons[ped->m_currentWeapon]; + switch (weapon->m_eWeaponType) { + case WEAPONTYPE_COLT45: + m_sQueueSample.m_nSampleIndex = SFX_COLT45_LEFT; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound++; + stereo = true; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COLT45_LEFT); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 50.0f; + maxDist = SQR(50); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + emittingVol = m_anRandomTable[1] % 10 + 90; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + if (m_bDynamicAcousticModelingStatus) + m_sQueueSample.m_bRequireReflection = true; + else + noReflection = true; + break; + case WEAPONTYPE_UZI: + m_sQueueSample.m_nSampleIndex = SFX_UZI_LEFT; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound++; + stereo = true; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_UZI_LEFT); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + maxDist = SQR(80); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + emittingVol = m_anRandomTable[3] % 15 + 70; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + break; + case WEAPONTYPE_SHOTGUN: + m_sQueueSample.m_nSampleIndex = SFX_SHOTGUN_LEFT; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound++; + stereo = true; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SHOTGUN_LEFT); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 60.0f; + maxDist = 3600.f; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + emittingVol = m_anRandomTable[2] % 10 + 100; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + if (m_bDynamicAcousticModelingStatus) + m_sQueueSample.m_bRequireReflection = true; + else + noReflection = true; + break; + case WEAPONTYPE_AK47: + m_sQueueSample.m_nSampleIndex = SFX_AK47_LEFT; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound++; + stereo = true; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AK47_LEFT); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + maxDist = SQR(80); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + emittingVol = m_anRandomTable[1] % 15 + 70; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + break; + case WEAPONTYPE_M16: + m_sQueueSample.m_nSampleIndex = SFX_M16_LEFT; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound++; + stereo = true; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_M16_LEFT); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + maxDist = SQR(80); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + emittingVol = m_anRandomTable[4] % 15 + 70; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + break; + case WEAPONTYPE_SNIPERRIFLE: + m_sQueueSample.m_nSampleIndex = SFX_SNIPER_LEFT; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound++; + stereo = true; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SNIPER_LEFT); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 60.0f; + maxDist = 3600.f; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + emittingVol = m_anRandomTable[4] % 10 + 110; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + if (m_bDynamicAcousticModelingStatus) + m_sQueueSample.m_bRequireReflection = true; + else + noReflection = true; + break; + case WEAPONTYPE_ROCKETLAUNCHER: + m_sQueueSample.m_nSampleIndex = SFX_ROCKET_LEFT; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound++; + stereo = true; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ROCKET_LEFT); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); + m_sQueueSample.m_nReleasingVolumeModificator = 1; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 90.0f; + maxDist = 8100.f; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + emittingVol = m_anRandomTable[0] % 20 + 80; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + if (m_bDynamicAcousticModelingStatus) + m_sQueueSample.m_bRequireReflection = true; + else + noReflection = true; + break; + case WEAPONTYPE_FLAMETHROWER: + m_sQueueSample.m_nSampleIndex = SFX_FLAMETHROWER_LEFT; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = 9; + emittingVol = 90; + m_sQueueSample.m_nFrequency = (10 * m_sQueueSample.m_nEntityIndex & 2047) + SampleManager.GetSampleBaseFrequency(SFX_FLAMETHROWER_LEFT); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_fSoundIntensity = 60.0f; + maxDist = 3600.f; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nEmittingVolume = 90; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 6; + if (m_bDynamicAcousticModelingStatus) + m_sQueueSample.m_bRequireReflection = true; + else + noReflection = true; + break; + default: + continue; + } + + break; + case SOUND_WEAPON_RELOAD: + weapon = &ped->m_weapons[ped->m_currentWeapon]; + switch (weapon->m_eWeaponType) { + case WEAPONTYPE_COLT45: + m_sQueueSample.m_nSampleIndex = SFX_PISTOL_RELOAD; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PISTOL_RELOAD) + RandomDisplacement(300); + break; + case WEAPONTYPE_UZI: + m_sQueueSample.m_nSampleIndex = SFX_M16_RELOAD; + m_sQueueSample.m_nFrequency = 39243; + break; + case WEAPONTYPE_SHOTGUN: + m_sQueueSample.m_nSampleIndex = SFX_AK47_RELOAD; + m_sQueueSample.m_nFrequency = 30290; + break; + case WEAPONTYPE_AK47: + m_sQueueSample.m_nSampleIndex = SFX_AK47_RELOAD; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AK47_RELOAD); + break; + case WEAPONTYPE_M16: + m_sQueueSample.m_nSampleIndex = SFX_M16_RELOAD; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_M16_RELOAD); + break; + case WEAPONTYPE_SNIPERRIFLE: + m_sQueueSample.m_nSampleIndex = SFX_RIFLE_RELOAD; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RIFLE_RELOAD); + break; + case WEAPONTYPE_ROCKETLAUNCHER: + m_sQueueSample.m_nSampleIndex = SFX_ROCKET_RELOAD; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ROCKET_RELOAD); + break; + default: + continue; + } + emittingVol = 75; + m_sQueueSample.m_nCounter = iSound++; + stereo = true; + m_sQueueSample.m_nFrequency += RandomDisplacement(300); + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nReleasingVolumeModificator = 5; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + maxDist = SQR(30); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = 75; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bRequireReflection = true; + break; + case SOUND_WEAPON_AK47_BULLET_ECHO: + case SOUND_WEAPON_UZI_BULLET_ECHO: + case SOUND_WEAPON_M16_BULLET_ECHO: + m_sQueueSample.m_nSampleIndex = SFX_UZI_END_LEFT; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound++; + stereo = true; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_UZI_END_LEFT); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + maxDist = SQR(80); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + emittingVol = m_anRandomTable[4] % 10 + 40; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + if (m_bDynamicAcousticModelingStatus) + m_sQueueSample.m_bRequireReflection = true; + else + noReflection = true; + break; + case SOUND_WEAPON_FLAMETHROWER_FIRE: + m_sQueueSample.m_nSampleIndex = SFX_FLAMETHROWER_START_LEFT; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound++; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_FLAMETHROWER_START_LEFT); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_fSoundIntensity = 60.0f; + maxDist = 3600.f; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + emittingVol = 70; + m_sQueueSample.m_nEmittingVolume = 70; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + break; + case SOUND_WEAPON_HIT_PED: + m_sQueueSample.m_nSampleIndex = SFX_BULLET_PED; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound++; + stereo = true; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BULLET_PED); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8); + m_sQueueSample.m_nReleasingVolumeModificator = 7; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 30.0f; + maxDist = SQR(30); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + emittingVol = m_anRandomTable[0] % 20 + 90; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + break; + case SOUND_SPLASH: + m_sQueueSample.m_nSampleIndex = SFX_SPLASH_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nCounter = iSound++; + stereo = true; + m_sQueueSample.m_nFrequency = RandomDisplacement(1400) + 20000; + m_sQueueSample.m_nReleasingVolumeModificator = 1; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = 40.0f; + maxDist = 1600.f; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + emittingVol = m_anRandomTable[2] % 30 + 70; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bRequireReflection = true; + break; + default: + SetupPedComments(params, sound); + continue; + } + + if (stereo && iSound > 60) + iSound = 21; + if (params->m_fDistance < maxDist) { + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + if (noReflection) { + if (0.2f * m_sQueueSample.m_fSoundIntensity <= m_sQueueSample.m_fDistance) { + noReflection = 0; + } else { + m_sQueueSample.m_bIs2D = true; + m_sQueueSample.m_nOffset = 0; + } + } + m_sQueueSample.m_bReverbFlag = true; + AddSampleToRequestedQueue(); + if (noReflection) { + m_sQueueSample.m_nOffset = 127; + ++m_sQueueSample.m_nSampleIndex; + if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] != SOUND_WEAPON_SHOT_FIRED || + weapon->m_eWeaponType != WEAPONTYPE_FLAMETHROWER) { + m_sQueueSample.m_nCounter = iSound++; + if (iSound > 60) + iSound = 21; + } else { + ++m_sQueueSample.m_nCounter; + } + AddSampleToRequestedQueue(); + } + } + } + } +} + +void +cAudioManager::SetupPedComments(cPedParams *params, uint32 sound) +{ + CPed *ped = params->m_pPed; + uint8 emittingVol; + float soundIntensity; + tPedComment pedComment; + + if (ped != nil) { + switch (sound) { + case SOUND_AMMUNATION_WELCOME_1: + pedComment.m_nSampleIndex = SFX_AMMU_D; + break; + case SOUND_AMMUNATION_WELCOME_2: + pedComment.m_nSampleIndex = SFX_AMMU_E; + break; + case SOUND_AMMUNATION_WELCOME_3: + pedComment.m_nSampleIndex = SFX_AMMU_F; + break; + default: + pedComment.m_nSampleIndex = GetPedCommentSfx(ped, sound); + if (pedComment.m_nSampleIndex == NO_SAMPLE) + return; + break; + } + + soundIntensity = 50.0f; + } else { + switch (sound) { + case SOUND_PED_HELI_PLAYER_FOUND: + soundIntensity = 400.0f; + pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_POLICE_HELI_1, SFX_POLICE_HELI_29); + break; + case SOUND_PED_BODYCAST_HIT: + if (CTimer::GetTimeInMilliseconds() <= gNextCryTime) + return; + soundIntensity = 50.0f; + gNextCryTime = CTimer::GetTimeInMilliseconds() + 500; + pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_PLASTER_BLOKE_1, SFX_PLASTER_BLOKE_4); + break; + case SOUND_INJURED_PED_MALE_OUCH: + case SOUND_INJURED_PED_MALE_PRISON: + soundIntensity = 50.0f; + pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_GENERIC_MALE_GRUNT_1, SFX_GENERIC_MALE_GRUNT_15); + break; + case SOUND_INJURED_PED_FEMALE: + soundIntensity = 50.0f; + pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_GENERIC_FEMALE_GRUNT_1, SFX_GENERIC_FEMALE_GRUNT_11); + break; + default: + return; + } + } + + if (params->m_fDistance < SQR(soundIntensity)) { + CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); + if (sound != SOUND_PAGER) { + switch (sound) { + case SOUND_AMMUNATION_WELCOME_1: + case SOUND_AMMUNATION_WELCOME_2: + case SOUND_AMMUNATION_WELCOME_3: + emittingVol = maxVolume; + break; + default: + if (CWorld::GetIsLineOfSightClear(TheCamera.GetPosition(), m_sQueueSample.m_vecPos, true, false, false, false, false, false)) + emittingVol = maxVolume; + else + emittingVol = 31; + break; + } + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, soundIntensity, m_sQueueSample.m_fDistance); + pedComment.m_nProcess = 10; + if (m_sQueueSample.m_nVolume != 0) { + pedComment.m_nEntityIndex = m_sQueueSample.m_nEntityIndex; + pedComment.m_vecPos = m_sQueueSample.m_vecPos; + pedComment.m_fDistance = m_sQueueSample.m_fDistance; + pedComment.m_bVolume = m_sQueueSample.m_nVolume; + m_sPedComments.Add(&pedComment); + } + } + } +} + +int32 +cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound) +{ + if (ped->IsPlayer()) + return GetPlayerTalkSfx(sound); + + switch (ped->GetModelIndex()) { + case MI_COP: + return GetCopTalkSfx(sound); + case MI_SWAT: + return GetSwatTalkSfx(sound); + case MI_FBI: + return GetFBITalkSfx(sound); + case MI_ARMY: + return GetArmyTalkSfx(sound); + case MI_MEDIC: + return GetMedicTalkSfx(sound); + case MI_FIREMAN: + return GetFiremanTalkSfx(sound); + case MI_MALE01: + return GetNormalMaleTalkSfx(sound); + case MI_TAXI_D: + return GetTaxiDriverTalkSfx(sound); + case MI_PIMP: + return GetPimpTalkSfx(sound); + case MI_GANG01: + case MI_GANG02: + return GetMafiaTalkSfx(sound); + case MI_GANG03: + case MI_GANG04: + return GetTriadTalkSfx(sound); + case MI_GANG05: + case MI_GANG06: + return GetDiabloTalkSfx(sound); + case MI_GANG07: + case MI_GANG08: + return GetYakuzaTalkSfx(sound); + case MI_GANG09: + case MI_GANG10: + return GetYardieTalkSfx(sound); + case MI_GANG11: + case MI_GANG12: + return GetColumbianTalkSfx(sound); + case MI_GANG13: + case MI_GANG14: + return GetHoodTalkSfx(sound); + case MI_CRIMINAL01: + return GetBlackCriminalTalkSfx(sound); + case MI_CRIMINAL02: + return GetWhiteCriminalTalkSfx(sound); + case MI_SPECIAL01: + case MI_SPECIAL02: + case MI_SPECIAL03: + case MI_SPECIAL04: + return GetSpecialCharacterTalkSfx(ped->GetModelIndex(), sound); + case MI_MALE02: + return GetMaleNo2TalkSfx(sound); + case MI_MALE03: + case MI_P_MAN1: + case MI_P_MAN2: + return GetBlackProjectMaleTalkSfx(sound, ped->GetModelIndex()); + case MI_FATMALE01: + return GetWhiteFatMaleTalkSfx(sound); + case MI_FATMALE02: + return GetBlackFatMaleTalkSfx(sound); + case MI_FEMALE01: + return GetBlackCasualFemaleTalkSfx(sound); + case MI_FEMALE02: + case MI_CAS_WOM: + return GetWhiteCasualFemaleTalkSfx(sound); + case MI_FEMALE03: + return GetFemaleNo3TalkSfx(sound); + case MI_FATFEMALE01: + return GetBlackFatFemaleTalkSfx(sound); + case MI_FATFEMALE02: + return GetWhiteFatFemaleTalkSfx(sound); + case MI_PROSTITUTE: + return GetBlackFemaleProstituteTalkSfx(sound); + case MI_PROSTITUTE2: + return GetWhiteFemaleProstituteTalkSfx(sound); + case MI_P_WOM1: + return GetBlackProjectFemaleOldTalkSfx(sound); + case MI_P_WOM2: + return GetBlackProjectFemaleYoungTalkSfx(sound); + case MI_CT_MAN1: + return GetChinatownMaleOldTalkSfx(sound); + case MI_CT_MAN2: + return GetChinatownMaleYoungTalkSfx(sound); + case MI_CT_WOM1: + return GetChinatownFemaleOldTalkSfx(sound); + case MI_CT_WOM2: + return GetChinatownFemaleYoungTalkSfx(sound); + case MI_LI_MAN1: + case MI_LI_MAN2: + return GetLittleItalyMaleTalkSfx(sound); + case MI_LI_WOM1: + return GetLittleItalyFemaleOldTalkSfx(sound); + case MI_LI_WOM2: + return GetLittleItalyFemaleYoungTalkSfx(sound); + case MI_DOCKER1: + return GetWhiteDockerMaleTalkSfx(sound); + case MI_DOCKER2: + return GetBlackDockerMaleTalkSfx(sound); + case MI_SCUM_MAN: + return GetScumMaleTalkSfx(sound); + case MI_SCUM_WOM: + return GetScumFemaleTalkSfx(sound); + case MI_WORKER1: + return GetWhiteWorkerMaleTalkSfx(sound); + case MI_WORKER2: + return GetBlackWorkerMaleTalkSfx(sound); + case MI_B_MAN1: + case MI_B_MAN3: + return GetBusinessMaleYoungTalkSfx(sound, ped->GetModelIndex()); + case MI_B_MAN2: + return GetBusinessMaleOldTalkSfx(sound); + case MI_B_WOM1: + case MI_B_WOM2: + return GetWhiteBusinessFemaleTalkSfx(sound, ped->GetModelIndex()); + case MI_B_WOM3: + return GetBlackBusinessFemaleTalkSfx(sound); + case MI_MOD_MAN: + return GetSupermodelMaleTalkSfx(sound); + case MI_MOD_WOM: + return GetSupermodelFemaleTalkSfx(sound); + case MI_ST_MAN: + return GetStewardMaleTalkSfx(sound); + case MI_ST_WOM: + return GetStewardFemaleTalkSfx(sound); + case MI_FAN_MAN1: + case MI_FAN_MAN2: + return GetFanMaleTalkSfx(sound, ped->GetModelIndex()); + case MI_FAN_WOM: + return GetFanFemaleTalkSfx(sound); + case MI_HOS_MAN: + return GetHospitalMaleTalkSfx(sound); + case MI_HOS_WOM: + return GetHospitalFemaleTalkSfx(sound); + case MI_CONST1: + return GetWhiteConstructionWorkerTalkSfx(sound); + case MI_CONST2: + return GetBlackConstructionWorkerTalkSfx(sound); + case MI_SHOPPER1: + case MI_SHOPPER2: + case MI_SHOPPER3: + return GetShopperFemaleTalkSfx(sound, ped->GetModelIndex()); + case MI_STUD_MAN: + return GetStudentMaleTalkSfx(sound); + case MI_STUD_WOM: + return GetStudentFemaleTalkSfx(sound); + case MI_CAS_MAN: + return GetCasualMaleOldTalkSfx(sound); + default: + return GetGenericMaleTalkSfx(sound); + } +} + +void +cAudioManager::GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset) const +{ + *phrase = sample + m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % maxOffset; + + // check if the same sfx like last time, if yes, then try use next one, + // if exceeded range, then choose first available sample + if (*phrase == *prevPhrase && ++*phrase >= sample + maxOffset) + *phrase = sample; + *prevPhrase = *phrase; +} + +#pragma region PED_COMMENTS + +uint32 +cAudioManager::GetPlayerTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_DAMAGE: + GetPhrase(&sfx, &lastSfx, SFX_CLAUDE_HIGH_DAMAGE_GRUNT_1, 11); + break; + case SOUND_PED_HIT: + GetPhrase(&sfx, &lastSfx, SFX_CLAUDE_LOW_DAMAGE_GRUNT_1, 10); + break; + case SOUND_PED_LAND: + GetPhrase(&sfx, &lastSfx, SFX_CLAUDE_HIT_GROUND_GRUNT_1, 6); + break; + default: + sfx = NO_SAMPLE; + break; + } + return sfx; +} + +uint32 +cAudioManager::GetCopTalkSfx(int16 sound) +{ + uint32 sfx; + PedState pedState; + static uint32 lastSfx = NO_SAMPLE; + + if (sound == SOUND_PED_ARREST_COP) { + GetPhrase(&sfx, &lastSfx, SFX_COP_VOICE_1_ARREST_1, 6); + } else { + if (sound != SOUND_PED_PURSUIT_COP) { + return GetGenericMaleTalkSfx(sound); + } + + pedState = FindPlayerPed()->m_nPedState; + if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) + return NO_SAMPLE; + GetPhrase(&sfx, &lastSfx, SFX_COP_VOICE_1_CHASE_1, 7); + } + + return (SFX_COP_VOICE_2_ARREST_1 - SFX_COP_VOICE_1_ARREST_1) * (m_sQueueSample.m_nEntityIndex % 5) + sfx; +} + +uint32 +cAudioManager::GetSwatTalkSfx(int16 sound) +{ + uint32 sfx; + PedState pedState; + static uint32 lastSfx = NO_SAMPLE; + + if (sound == SOUND_PED_ARREST_SWAT) { + GetPhrase(&sfx, &lastSfx, SFX_SWAT_VOICE_1_CHASE_1, 6); + } else { + if (sound != SOUND_PED_PURSUIT_SWAT) { + return GetGenericMaleTalkSfx(sound); + } + + pedState = FindPlayerPed()->m_nPedState; + if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) + return NO_SAMPLE; + GetPhrase(&sfx, &lastSfx, SFX_SWAT_VOICE_1_CHASE_1, 6); + } + + return (SFX_SWAT_VOICE_2_CHASE_1 - SFX_SWAT_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 4) + sfx; +} + +uint32 +cAudioManager::GetFBITalkSfx(int16 sound) +{ + uint32 sfx; + PedState pedState; + static uint32 lastSfx = NO_SAMPLE; + + if (sound == SOUND_PED_ARREST_FBI) { + GetPhrase(&sfx, &lastSfx, SFX_FBI_VOICE_1_CHASE_1, 6); + } else { + if (sound != SOUND_PED_PURSUIT_FBI) { + return GetGenericMaleTalkSfx(sound); + } + + pedState = FindPlayerPed()->m_nPedState; + if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) + return NO_SAMPLE; + GetPhrase(&sfx, &lastSfx, SFX_FBI_VOICE_1_CHASE_1, 6); + } + + return (SFX_FBI_VOICE_2_CHASE_1 - SFX_FBI_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 3) + sfx; +} + +uint32 +cAudioManager::GetArmyTalkSfx(int16 sound) +{ + uint32 sfx; + PedState pedState; + static uint32 lastSfx = NO_SAMPLE; + + if (sound != SOUND_PED_PURSUIT_ARMY) { + return GetGenericMaleTalkSfx(sound); + } + + pedState = FindPlayerPed()->m_nPedState; + if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) + return NO_SAMPLE; + GetPhrase(&sfx, &lastSfx, SFX_ARMY_VOICE_1_CHASE_1, 15); + + return (SFX_ARMY_VOICE_2_CHASE_1 - SFX_ARMY_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; +} + +uint32 +cAudioManager::GetMedicTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_GUN_PANIC_1, 5); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_CARJACKED_1, 5); + break; + case SOUND_PED_HEALING: + GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_AT_VICTIM_1, 12); + break; + case SOUND_PED_LEAVE_VEHICLE: + GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_GET_OUT_VAN_CHAT_1, 9); + break; + case SOUND_PED_FLEE_RUN: + GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_RUN_FROM_FIGHT_1, 6); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return (SFX_MEDIC_VOICE_2_GUN_PANIC_1 - SFX_MEDIC_VOICE_1_GUN_PANIC_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; +} + +uint32 +cAudioManager::GetFiremanTalkSfx(int16 sound) +{ + return GetGenericMaleTalkSfx(sound); +} + +uint32 +cAudioManager::GetNormalMaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_GUN_PANIC_1, 7); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_CARJACKED_1, 7); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_DODGE_1, 9); + break; + case SOUND_PED_FLEE_RUN: + GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_RUN_FROM_FIGHT_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_DRIVER_ABUSE_1, 12); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_EYING_1, 8); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_SHOCKED_1, 10); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_CHAT_1, 25); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetTaxiDriverTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + if (sound == SOUND_PED_CAR_JACKED) { + GetPhrase(&sfx, &lastSfx, SFX_ASIAN_TAXI_DRIVER_VOICE_1_CARJACKED_1, 7); + } else { + if (sound != SOUND_PED_CAR_COLLISION) + return GetGenericMaleTalkSfx(sound); + GetPhrase(&sfx, &lastSfx, SFX_ASIAN_TAXI_DRIVER_VOICE_1_DRIVER_ABUSE_1, 6); + } + return (SFX_ASIAN_TAXI_DRIVER_VOICE_2_DRIVER_ABUSE_1 - SFX_ASIAN_TAXI_DRIVER_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; +} + +uint32 +cAudioManager::GetPimpTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_UP: + GetPhrase(&sfx, &lastSfx, SFX_PIMP_GUN_COOL_1, 7); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_PIMP_CARJACKED_1, 4); + break; + case SOUND_PED_DEFEND: + GetPhrase(&sfx, &lastSfx, SFX_PIMP_FIGHT_1, 9); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_PIMP_DODGE_1, 6); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_PIMP_DRIVER_ABUSE_1, 5); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_PIMP_SHOCKED_1, 2); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_PIMP_CHAT_1, 17); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetMafiaTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_CAR_JACKING: + GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_CARJACKING_1, 2); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_FIGHT_1, 5); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_DODGE_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_DRIVER_ABUSE_1, 6); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_EYING_1, 3); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_CHAT_1, 7); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return (SFX_MAFIA_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_MAFIA_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 3) + sfx; +} + +uint32 +cAudioManager::GetTriadTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_UP: + GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_GUN_COOL_1, 3); + break; + case SOUND_PED_CAR_JACKING: + GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_CARJACKING_1, 2); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_FIGHT_1, 5); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_DODGE_1, 4); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_DRIVER_ABUSE_1, 7); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_EYING_1, 3); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_CHAT_1, 8); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetDiabloTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_UP: + GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_GUN_COOL_1, 4); + break; + case SOUND_PED_HANDS_COWER: + sound = SOUND_PED_FLEE_SPRINT; + return GetGenericMaleTalkSfx(sound); + break; + case SOUND_PED_CAR_JACKING: + GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_CARJACKING_1, 2); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_FIGHT_1, 4); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_DODGE_1, 4); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_DRIVER_ABUSE_1, 5); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_EYING_1, 4); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_CHAT_1, 5); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return (SFX_DIABLO_MALE_VOICE_2_CHAT_1 - SFX_DIABLO_MALE_VOICE_1_CHAT_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; +} + +uint32 +cAudioManager::GetYakuzaTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_CAR_JACKING: + GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_CARJACKING_1, 2); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_FIGHT_1, 5); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_DODGE_1, 4); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_DRIVER_ABUSE_1, 6); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_CHAT_1, 5); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return (SFX_YAKUZA_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_YAKUZA_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; +} + +uint32 +cAudioManager::GetYardieTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_UP: + sfx = SFX_YARDIE_MALE_VOICE_1_GUN_COOL_1; + break; + case SOUND_PED_CAR_JACKING: + GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_CARJACKING_1, 2); + break; + case SOUND_PED_CAR_JACKED: + sfx = SFX_YARDIE_MALE_VOICE_1_CARJACKED_1; + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_FIGHT_1, 6); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_DODGE_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_DRIVER_ABUSE_1, 6); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_EYING_1, 2); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_CHAT_1, 8); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return (SFX_YARDIE_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_YARDIE_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; +} + +uint32 +cAudioManager::GetColumbianTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_CAR_JACKING: + GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_CARJACKING_1, 2); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_FIGHT_1, 5); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_DODGE_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_DRIVER_ABUSE_1, 6); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_EYING_1, 2); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_CHAT_1, 5); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return (SFX_COLUMBIAN_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_COLUMBIAN_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; +} + +uint32 +cAudioManager::GetHoodTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_UP: + GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_GUN_COOL_1, 5); + break; + case SOUND_PED_CAR_JACKING: + GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_CARJACKING_1, 2); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_FIGHT_1, 6); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_DODGE_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_DRIVER_ABUSE_1, 7); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_EYING_1, 2); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_CHAT_1, 6); + break; + + default: + return GetGenericMaleTalkSfx(sound); + break; + } + return (SFX_HOOD_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_HOOD_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; +} + +uint32 +cAudioManager::GetBlackCriminalTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_UP: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_GUN_COOL_1, 4); + break; + case SOUND_PED_CAR_JACKING: + sfx = SFX_BLACK_CRIMINAL_VOICE_1_CARJACKING_1; + break; + case SOUND_PED_MUGGING: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_MUGGING_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_FIGHT_1, 5); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_DODGE_1, 6); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_DRIVER_ABUSE_1, 5); + break; + default: + return GetGenericMaleTalkSfx(sound); + break; + } + return sfx; +} + +uint32 +cAudioManager::GetWhiteCriminalTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_UP: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_GUN_COOL_1, 3); + break; + case SOUND_PED_CAR_JACKING: + sfx = SFX_WHITE_CRIMINAL_VOICE_1_CARJACKING_1; + break; + case SOUND_PED_MUGGING: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_MUGGING_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_FIGHT_1, 4); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_DODGE_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_DRIVER_ABUSE_1, 4); + break; + default: + return GetGenericMaleTalkSfx(sound); + break; + } + return sfx; +} + +uint32 +cAudioManager::GetMaleNo2TalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_CARJACKED_1, 3); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_MUGGED_1, 4); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_FIGHT_1, 4); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_DODGE_1, 4); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_DRIVER_ABUSE_1, 7); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_EYING_1, 5); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_CHAT_1, 7); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetBlackProjectMaleTalkSfx(int16 sound, int32 model) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_UP: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_GUN_COOL_1, 3); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_FIGHT_1, 6); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_DODGE_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_DRIVER_ABUSE_1, 7); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_EYING_1, 3); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_CHAT_1, 6); + default: + return GetGenericMaleTalkSfx(sound); + } + + if (model == MI_P_MAN2) + sfx += (SFX_BLACK_PROJECT_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_BLACK_PROJECT_MALE_VOICE_1_DRIVER_ABUSE_1); + return sfx; +} + +uint32 +cAudioManager::GetWhiteFatMaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_CARJACKED_1, 3); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_MUGGED_1, 3); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_DODGE_1, 9); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_DRIVER_ABUSE_1, 9); + break; + case SOUND_PED_WAIT_DOUBLEBACK: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_LOST_1, 2); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_CHAT_1, 9); + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetBlackFatMaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_CARJACKED_1, 4); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_MUGGED_1, 3); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_DODGE_1, 7); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_DRIVER_ABUSE_1, 6); + break; + case SOUND_PED_WAIT_DOUBLEBACK: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_LOST_1, 3); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_CHAT_1, 8); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetBlackCasualFemaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_GUN_PANIC_1, 2); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_MUGGED_1, 3); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_DODGE_1, 6); + break; + case SOUND_PED_FLEE_RUN: + GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_RUN_FROM_FIGHT_1, 2); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_DRIVER_ABUSE_1, 7); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_SHOCKED_1, 4); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_CHAT_1, 8); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetWhiteCasualFemaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_GUN_PANIC_1, 2); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ROBBED: + sfx = SFX_WHITE_CASUAL_FEMALE_VOICE_1_MUGGED_1; + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_DODGE_1, 3); + break; + case SOUND_PED_FLEE_RUN: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_RUN_FROM_FIGHT_1, 2); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_DRIVER_ABUSE_1, 8); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_SHOCKED_1, 2); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_CHAT_1, 4); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetFemaleNo3TalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_GUN_PANIC_1, 5); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_CARJACKED_1, 3); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_MUGGED_1, 3); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_DODGE_1, 6); + break; + case SOUND_PED_FLEE_RUN: + GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_RUN_FROM_FIGHT_1, 4); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_DRIVER_ABUSE_1, 6); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_SHOCKED_1, 4); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_CHAT_1, 5); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetBlackFatFemaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_GUN_PANIC_1, 4); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_DODGE_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_DRIVER_ABUSE_1, 6); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_SHOCKED_1, 5); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_CHAT_1, 7); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetWhiteFatFemaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_DODGE_1, 6); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_DRIVER_ABUSE_1, 8); + break; + case SOUND_PED_WAIT_DOUBLEBACK: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_LOST_1, 2); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_SHOCKED_1, 4); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_CHAT_1, 8); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetBlackFemaleProstituteTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_UP: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_GUN_COOL_1, 4); + break; + case SOUND_PED_ROBBED: + sfx = SFX_BLACK_PROSTITUTE_VOICE_1_MUGGED_1; + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_FIGHT_1, 4); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_DODGE_1, 3); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_DRIVER_ABUSE_1, 4); + break; + case SOUND_PED_SOLICIT: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_SOLICIT_1, 8); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_CHAT_1, 4); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return (SFX_BLACK_PROSTITUTE_VOICE_2_CHAT_1 - SFX_BLACK_PROSTITUTE_VOICE_1_CHAT_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; +} + +uint32 +cAudioManager::GetWhiteFemaleProstituteTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_FIGHT_1, 4); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_DODGE_1, 3); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_DRIVER_ABUSE_1, 4); + break; + case SOUND_PED_SOLICIT: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_SOLICIT_1, 8); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_CHAT_1, 4); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return (SFX_WHITE_PROSTITUTE_VOICE_2_CHAT_1 - SFX_WHITE_PROSTITUTE_VOICE_1_CHAT_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; +} + +uint32 +cAudioManager::GetBlackProjectFemaleOldTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_CARJACKED_1, 6); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_DODGE_1, 10); + break; + case SOUND_PED_FLEE_RUN: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_RUN_FROM_FIGHT_1, 6); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_DRIVER_ABUSE_1, 7); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_SHOCKED_1, 2); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_CHAT_1, 10); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetBlackProjectFemaleYoungTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_GUN_PANIC_1, 4); + break; + case SOUND_PED_CAR_JACKED: + sfx = SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_CARJACKED_1; + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_DODGE_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_DRIVER_ABUSE_1, 6); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_SHOCKED_1, 5); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_CHAT_1, 7); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetChinatownMaleOldTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_GUN_PANIC_1, 3); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_FIGHT_1, 5); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_DODGE_1, 6); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_DRIVER_ABUSE_1, 6); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_EYING_1, 3); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_CHAT_1, 7); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetChinatownMaleYoungTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_GUN_PANIC_1, 2); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_FIGHT_1, 6); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_DODGE_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_DRIVER_ABUSE_1, 6); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_EYING_1, 3); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_CHAT_1, 6); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetChinatownFemaleOldTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_GUN_PANIC_1, 3); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_DODGE_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5); + break; + case SOUND_PED_CHAT_EVENT: + sfx = SFX_CHINATOWN_OLD_FEMALE_VOICE_1_SHOCKED_1; + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_CHAT_1, 6); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetChinatownFemaleYoungTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_DODGE_1, 6); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_DRIVER_ABUSE_1, 7); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_SHOCKED_1, 4); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_CHAT_1, 7); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetLittleItalyMaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_GUN_PANIC_1, 3); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_FIGHT_1, 5); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_DODGE_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_DRIVER_ABUSE_1, 7); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_CHAT_1, 6); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return (SFX_LITTLE_ITALY_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_LITTLE_ITALY_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; +} + +uint32 +cAudioManager::GetLittleItalyFemaleOldTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_DODGE_1, 6); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_DRIVER_ABUSE_1, 7); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_SHOCKED_1, 4); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_CHAT_1, 7); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetLittleItalyFemaleYoungTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_DODGE_1, 7); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_DRIVER_ABUSE_1, 6); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_SHOCKED_1, 4); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_CHAT_1, 6); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetWhiteDockerMaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_GUN_PANIC_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_FIGHT_1, 3); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_DODGE_1, 4); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_DRIVER_ABUSE_1, 4); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_EYING_1, 3); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_CHAT_1, 5); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetBlackDockerMaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_GUN_PANIC_1, 3); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_FIGHT_1, 5); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_DODGE_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_DRIVER_ABUSE_1, 6); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_EYING_1, 3); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_CHAT_1, 5); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetScumMaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_GUN_PANIC_1, 5); + break; + case SOUND_PED_ROBBED: + sfx = SFX_SCUM_MALE_VOICE_1_MUGGED_1; + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_FIGHT_1, 10); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_DODGE_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_DRIVER_ABUSE_1, 6); + break; + case SOUND_PED_WAIT_DOUBLEBACK: + GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_LOST_1, 3); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_EYING_1, 5); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_CHAT_1, 9); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetScumFemaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_GUN_PANIC_1, 4); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_FIGHT_1, 4); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_DODGE_1, 8); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_CHAT_1, 13); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetWhiteWorkerMaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_GUN_PANIC_1, 3); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_FIGHT_1, 3); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_DODGE_1, 4); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_DRIVER_ABUSE_1, 6); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_EYING_1, 2); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_CHAT_1, 6); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetBlackWorkerMaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_GUN_PANIC_1, 4); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_FIGHT_1, 3); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_DODGE_1, 3); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_DRIVER_ABUSE_1, 4); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_EYING_1, 3); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_CHAT_1, 4); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetBusinessMaleYoungTalkSfx(int16 sound, int32 model) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_GUN_PANIC_1, 3); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_FIGHT_1, 4); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_DODGE_1, 4); + break; + case SOUND_PED_FLEE_RUN: + GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_RUN_FROM_FIGHT_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_DRIVER_ABUSE_1, 6); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_CHAT_1, 6); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + + if (model == MI_B_MAN3) + sfx += (SFX_BUSINESS_MALE_YOUNG_VOICE_2_DRIVER_ABUSE_1 - SFX_BUSINESS_MALE_YOUNG_VOICE_1_DRIVER_ABUSE_1); + return sfx; +} + +uint32 +cAudioManager::GetBusinessMaleOldTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_GUN_PANIC_1, 3); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_FIGHT_1, 5); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_DODGE_1, 4); + break; + case SOUND_PED_FLEE_RUN: + GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_MRUN_FROM_FIGHT_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_DRIVER_ABUSE_1, 5); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_CHAT_1, 5); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetWhiteBusinessFemaleTalkSfx(int16 sound, int32 model) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_GUN_PANIC_1, 4); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DODGE_1, 6); + break; + case SOUND_PED_FLEE_RUN: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_RUN_FROM_FIGHT_1, 4); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_SHOCKED_1, 4); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_CHAT_1, 7); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + + if (model == MI_B_WOM2) + sfx += (SFX_WHITE_BUSINESS_FEMALE_VOICE_2_DRIVER_ABUSE_1 - SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DRIVER_ABUSE_1); + return sfx; +} + +uint32 +cAudioManager::GetBlackBusinessFemaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_GUN_PANIC_1, 5); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_CARAJACKED_1, 4); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_MUGGED_1, 3); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_DODGE_1, 6); + break; + case SOUND_PED_FLEE_RUN: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_RUN_FROM_FIGHT_1, 6); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_DRIVER_ABUSE_1, 7); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_SHOCKED_1, 4); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_CHAT_1, 7); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetSupermodelMaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_FIGHT_1, 5); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_DODGE_1, 6); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_DRIVER_ABUSE_1, 6); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_EYING_1, 3); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_CHAT_1, 6); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetSupermodelFemaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_GUN_PANIC_1, 4); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_MUGGED_1, 3); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_DODGE_1, 4); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_DRIVER_ABUSE_1, 7); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_SHOCKED_1, 5); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_CHAT_1, 8); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetStewardMaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_GUN_PANIC_1, 3); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_FIGHT_1, 4); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_DODGE_1, 3); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_DRIVER_ABUSE_1, 5); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_CHAT_1, 4); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetStewardFemaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_STEWARD_FEMALE_VOICE_1_GUN_PANIC_1, 3); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_STEWARD_FEMALE_VOICE_1_DODGE_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_STEWARD_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_STEWARD_FEMALE_VOICE_1_CHAT_1, 5); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return (SFX_STEWARD_FEMALE_VOICE_2_DRIVER_ABUSE_1 - SFX_STEWARD_FEMALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; +} + +uint32 +cAudioManager::GetFanMaleTalkSfx(int16 sound, int32 model) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_FIGHT_1, 3); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_DODGE_1, 4); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_DRIVER_ABUSE_1, 5); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_SHOCKED_1, 2); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_CHAT_1, 6); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + + if (model == MI_FAN_MAN2) + sfx += (SFX_FOOTBALL_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_FOOTBALL_MALE_VOICE_1_DRIVER_ABUSE_1); + return sfx; +} + +uint32 +cAudioManager::GetFanFemaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_ROBBED: + sfx = SFX_FOOTBALL_FEMALE_VOICE_1_MUGGED_1; + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_FEMALE_VOICE_1_DODGE_1, 4); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_FEMALE_VOICE_1_SHOCKED_1, 2); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_FEMALE_VOICE_1_CHAT_1, 6); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return (SFX_FOOTBALL_FEMALE_VOICE_2_DRIVER_ABUSE_1 - SFX_FOOTBALL_FEMALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; +} + +uint32 +cAudioManager::GetHospitalMaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_GUN_PANIC_1, 4); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_FIGHT_1, 4); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_DODGE_1, 4); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_DRIVER_ABUSE_1, 5); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_CHAT_1, 5); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetHospitalFemaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_FEMALE_VOICE_1_DODGE_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_FEMALE_VOICE_1_DRIVER_ABUSE_1, 6); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_FEMALE_VOICE_1_CHAT_1, 6); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetWhiteConstructionWorkerTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_GUN_PANIC_1, 3); + break; + case SOUND_PED_CAR_JACKED: + sfx = SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_CARJACKED_1; + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_FIGHT_1, 5); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_DODGE_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_DRIVER_ABUSE_1, 4); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_EYING_1, 3); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_CHAT_1, 7); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetBlackConstructionWorkerTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_GUN_PANIC_1, 3); + break; + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_FIGHT_1, 5); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_DODGE_1, 5); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_DRIVER_ABUSE_1, 5); + break; + case SOUND_PED_CHAT_SEXY: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_EYING_1, 4); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_CHAT_1, 4); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetShopperFemaleTalkSfx(int16 sound, int32 model) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_CAR_JACKED: + GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_CARJACKED_1, 2); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_DODGE_1, 6); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_DRIVER_ABUSE_1, 7); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_SHOCKED_1, 4); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_CHAT_1, 7); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + + if (model == MI_SHOPPER2) { + sfx += (SFX_SHOPPER_VOICE_2_DRIVER_ABUSE_1 - SFX_SHOPPER_VOICE_1_DRIVER_ABUSE_1); + } else if (model == MI_SHOPPER3) { + sfx += (SFX_SHOPPER_VOICE_3_DRIVER_ABUSE_1 - SFX_SHOPPER_VOICE_1_DRIVER_ABUSE_1); + } + return sfx; +} + +uint32 +cAudioManager::GetStudentMaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_GUN_PANIC_1, 2); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_FIGHT_1, 4); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_DODGE_1, 4); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_DRIVER_ABUSE_1, 4); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_SHOCKED_1, 3); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_CHAT_1, 5); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetStudentFemaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_COWER: + GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_GUN_PANIC_1, 4); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_MUGGED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_FIGHT_1, 4); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_DODGE_1, 4); + break; + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_DRIVER_ABUSE_1, 4); + break; + case SOUND_PED_CHAT_EVENT: + GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_SHOCKED_1, 2); + break; + case SOUND_PED_CHAT: + GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_CHAT_1, 4); + break; + default: + return GetGenericFemaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetCasualMaleOldTalkSfx(int16 sound) +{ + return GetGenericMaleTalkSfx(sound); +} + +uint32 +cAudioManager::GetSpecialCharacterTalkSfx(int32 modelIndex, int32 sound) +{ + char *modelName = CModelInfo::GetModelInfo(modelIndex)->GetName(); + if (!CGeneral::faststricmp(modelName, "eight") || !CGeneral::faststricmp(modelName, "eight2")) { + return GetEightTalkSfx(sound); + } + if (!CGeneral::faststricmp(modelName, "frankie")) { + return GetFrankieTalkSfx(sound); + } + if (!CGeneral::faststricmp(modelName, "misty")) { + return GetMistyTalkSfx(sound); + } + if (!CGeneral::faststricmp(modelName, "ojg") || !CGeneral::faststricmp(modelName, "ojg_p")) { + return GetOJGTalkSfx(sound); + } + if (!CGeneral::faststricmp(modelName, "cat")) { + return GetCatatalinaTalkSfx(sound); + } + if (!CGeneral::faststricmp(modelName, "bomber")) { + return GetBomberTalkSfx(sound); + } + if (!CGeneral::faststricmp(modelName, "s_guard")) { + return GetSecurityGuardTalkSfx(sound); + } + if (!CGeneral::faststricmp(modelName, "chunky")) { + return GetChunkyTalkSfx(sound); + } + if (!CGeneral::faststricmp(modelName, "asuka")) { + return GetGenericFemaleTalkSfx(sound); + } + if (!CGeneral::faststricmp(modelName, "maria")) { + return GetGenericFemaleTalkSfx(sound); + } + + return GetGenericMaleTalkSfx(sound); +} +uint32 +cAudioManager::GetEightTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_UP: + GetPhrase(&sfx, &lastSfx, SFX_8BALL_GUN_COOL_1, 2); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_8BALL_MUGGED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_8BALL_FIGHT_1, 6); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_8BALL_DODGE_1, 7); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetFrankieTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_UP: + GetPhrase(&sfx, &lastSfx, SFX_SALVATORE_GUN_COOL_1, 4); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_SALVATORE_MUGGED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_SALVATORE_FIGHT_1, 6); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_SALVATORE_DODGE_1, 3); + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetMistyTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_UP: + GetPhrase(&sfx, &lastSfx, SFX_MISTY_GUN_COOL_1, 5); + break; + case SOUND_PED_ROBBED: + GetPhrase(&sfx, &lastSfx, SFX_MISTY_MUGGED_1, 2); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_MISTY_FIGHT_1, 4); + break; + case SOUND_PED_EVADE: + GetPhrase(&sfx, &lastSfx, SFX_MISTY_DODGE_1, 5); + break; + case SOUND_PED_TAXI_CALL: + GetPhrase(&sfx, &lastSfx, SFX_MISTY_HERE_1, 4); + break; + default: + return GetGenericFemaleTalkSfx(sound); + break; + } + return sfx; +} + +uint32 +cAudioManager::GetOJGTalkSfx(int16 sound) +{ + return GetGenericMaleTalkSfx(sound); +} + +uint32 +cAudioManager::GetCatatalinaTalkSfx(int16 sound) +{ + return GetGenericFemaleTalkSfx(sound); +} + +uint32 +cAudioManager::GetBomberTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + if (sound != SOUND_PED_BOMBER) + return GetGenericMaleTalkSfx(sound); + + GetPhrase(&sfx, &lastSfx, SFX_BOMBERMAN_1, 7); + return sfx; +} + +uint32 +cAudioManager::GetSecurityGuardTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_HANDS_UP: + GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_GUN_COOL_1, 2); + break; + case SOUND_PED_HANDS_COWER: + sfx = SFX_SECURITY_GUARD_VOICE_1_GUN_PANIC_1; + break; + case SOUND_PED_CAR_JACKED: + case SOUND_PED_CAR_COLLISION: + GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_DRIVER_ABUSE_1, 6); + break; + case SOUND_PED_ATTACK: + GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_FIGHT_1, 2); + break; + case SOUND_PED_FLEE_RUN: +#ifdef FIX_BUGS + sfx = SFX_SECURITY_GUARD_VOICE_1_RUN_FROM_FIGHT_1; +#else + GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_DRIVER_ABUSE_1, 12); +#endif + break; + default: + return GetGenericMaleTalkSfx(sound); + } + return sfx; +} + +uint32 +cAudioManager::GetChunkyTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + if (sound == SOUND_PED_DEATH) + return SFX_CHUNKY_DEATH; + + if (sound != SOUND_PED_FLEE_RUN) + return GetGenericMaleTalkSfx(sound); + + GetPhrase(&sfx, &lastSfx, SFX_CHUNKY_RUN_1, 5); + return sfx; +} + +uint32 +cAudioManager::GetGenericMaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_DEATH: + GetPhrase(&sfx, &lastSfx, SFX_GENERIC_MALE_DEATH_1, 8); + break; + case SOUND_PED_BULLET_HIT: + case SOUND_PED_DEFEND: + GetPhrase(&sfx, &lastSfx, SFX_GENERIC_MALE_GRUNT_1, 15); + break; + case SOUND_PED_BURNING: + GetPhrase(&sfx, &lastSfx, SFX_GENERIC_MALE_FIRE_1, 8); + break; + case SOUND_PED_FLEE_SPRINT: + GetPhrase(&sfx, &lastSfx, SFX_GENERIC_MALE_PANIC_1, 6); + break; + default: + return NO_SAMPLE; + } + return sfx; +} + +uint32 +cAudioManager::GetGenericFemaleTalkSfx(int16 sound) +{ + uint32 sfx; + static uint32 lastSfx = NO_SAMPLE; + + switch (sound) { + case SOUND_PED_DEATH: + GetPhrase(&sfx, &lastSfx, SFX_GENERIC_FEMALE_DEATH_1, 10); + break; + case SOUND_PED_BULLET_HIT: + case SOUND_PED_DEFEND: + GetPhrase(&sfx, &lastSfx, SFX_GENERIC_FEMALE_GRUNT_1, 11); + break; + case SOUND_PED_BURNING: + GetPhrase(&sfx, &lastSfx, SFX_GENERIC_FEMALE_FIRE_1, 9); + break; + case SOUND_PED_FLEE_SPRINT: + GetPhrase(&sfx, &lastSfx, SFX_GENERIC_FEMALE_PANIC_1, 8); + break; + default: + return NO_SAMPLE; + } + return sfx; +} + + + +void +cPedComments::Add(tPedComment *com) +{ + uint8 index; + + if (m_nCommentsInBank[m_nActiveBank] >= NUM_PED_COMMENTS_SLOTS) { + index = m_nIndexMap[m_nActiveBank][NUM_PED_COMMENTS_SLOTS - 1]; + if (m_asPedComments[m_nActiveBank][index].m_bVolume > com->m_bVolume) + return; + } else { + index = m_nCommentsInBank[m_nActiveBank]++; + } + + m_asPedComments[m_nActiveBank][index].m_nSampleIndex = com->m_nSampleIndex; + m_asPedComments[m_nActiveBank][index].m_nEntityIndex = com->m_nEntityIndex; + m_asPedComments[m_nActiveBank][index].m_vecPos = com->m_vecPos; + m_asPedComments[m_nActiveBank][index].m_fDistance = com->m_fDistance; + m_asPedComments[m_nActiveBank][index].m_bVolume = com->m_bVolume; + + uint32 i = 0; + if (index != 0) { + for (i = 0; i < index; i++) { + if (m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][i]].m_bVolume < m_asPedComments[m_nActiveBank][index].m_bVolume) { + break; + } + } + + if (i < index) + memmove(&m_nIndexMap[m_nActiveBank][i + 1], &m_nIndexMap[m_nActiveBank][i], NUM_PED_COMMENTS_SLOTS - 1 - i); + } + + m_nIndexMap[m_nActiveBank][i] = index; +} + +void +cPedComments::Process() +{ + int sampleIndex; + uint8 actualUsedBank; + tPedComment *comment; + + static const int defaultIntensity = 50; + static const int policeHeliIntensity = 400; + + if (!AudioManager.m_nUserPause) { + if (m_nCommentsInBank[m_nActiveBank]) { + sampleIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nSampleIndex; + if (!SampleManager.IsPedCommentLoaded(sampleIndex)) + SampleManager.LoadPedComment(sampleIndex); + + AudioManager.m_sQueueSample.m_nEntityIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nEntityIndex; + AudioManager.m_sQueueSample.m_nCounter = 0; + AudioManager.m_sQueueSample.m_nSampleIndex = sampleIndex; + AudioManager.m_sQueueSample.m_nBankIndex = SAMPLEBANK_PED; + AudioManager.m_sQueueSample.m_nReleasingVolumeModificator = 3; + AudioManager.m_sQueueSample.m_nVolume = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_bVolume; + AudioManager.m_sQueueSample.m_fDistance = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_fDistance; + AudioManager.m_sQueueSample.m_nLoopCount = 1; + AudioManager.m_sQueueSample.m_nLoopStart = 0; + AudioManager.m_sQueueSample.m_nLoopEnd = -1; + AudioManager.m_sQueueSample.m_nEmittingVolume = maxVolume; + AudioManager.m_sQueueSample.m_fSpeedMultiplier = 3.0f; + switch (sampleIndex) { + case SFX_POLICE_HELI_1: + case SFX_POLICE_HELI_2: + case SFX_POLICE_HELI_3: + AudioManager.m_sQueueSample.m_fSoundIntensity = policeHeliIntensity; + break; + default: + AudioManager.m_sQueueSample.m_fSoundIntensity = defaultIntensity; + break; + } + AudioManager.m_sQueueSample.m_bReleasingSoundFlag = true; + AudioManager.m_sQueueSample.m_vecPos = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_vecPos; + + if (sampleIndex >= SFX_AMMU_D && sampleIndex <= SFX_AMMU_F) { + AudioManager.m_sQueueSample.m_bReverbFlag = false; + AudioManager.m_sQueueSample.m_bRequireReflection = false; + } else { + AudioManager.m_sQueueSample.m_bReverbFlag = true; + AudioManager.m_sQueueSample.m_bRequireReflection = true; + } + + AudioManager.m_sQueueSample.m_bIs2D = false; + AudioManager.m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(AudioManager.m_sQueueSample.m_nSampleIndex) + AudioManager.RandomDisplacement(750); + if (CTimer::GetIsSlowMotionActive()) + AudioManager.m_sQueueSample.m_nFrequency /= 2; + m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nProcess = -1; + AudioManager.AddSampleToRequestedQueue(); + } + + // Switch bank + if (m_nActiveBank) { + actualUsedBank = SAMPLEBANK_PED; + m_nActiveBank = SAMPLEBANK_MAIN; + } else { + actualUsedBank = SAMPLEBANK_MAIN; + m_nActiveBank = SAMPLEBANK_PED; + } + comment = m_asPedComments[actualUsedBank]; + for (uint32 i = 0; i < m_nCommentsInBank[actualUsedBank]; i++) { + if (m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess > 0) { + --m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess; + Add(&comment[m_nIndexMap[actualUsedBank][i]]); + } + } + + for (uint32 i = 0; i < NUM_PED_COMMENTS_SLOTS; i++) { + m_nIndexMap[actualUsedBank][i] = NUM_PED_COMMENTS_SLOTS; + } + m_nCommentsInBank[actualUsedBank] = 0; + } +} + +#pragma endregion + +#pragma endregion All the ped audio code + +void +cAudioManager::ProcessExplosions(int32 explosion) +{ + uint8 type; + CVector *pos; + float distSquared; + + for (uint8 i = 0; i < ARRAY_SIZE(gaExplosion); i++) { + if (CExplosion::GetExplosionActiveCounter(i) == 1) { + CExplosion::ResetExplosionActiveCounter(i); + type = CExplosion::GetExplosionType(i); + switch (type) { + case EXPLOSION_GRENADE: + case EXPLOSION_ROCKET: + case EXPLOSION_BARREL: + case EXPLOSION_TANK_GRENADE: + m_sQueueSample.m_fSoundIntensity = 400.0f; + m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_2; + m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 38000; + m_sQueueSample.m_nReleasingVolumeModificator = 0; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + break; + case EXPLOSION_MOLOTOV: + m_sQueueSample.m_fSoundIntensity = 200.0f; + m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_3; + m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000; + m_sQueueSample.m_nReleasingVolumeModificator = 0; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + break; + case EXPLOSION_MINE: + case EXPLOSION_HELI_BOMB: + m_sQueueSample.m_fSoundIntensity = 300.0f; + m_sQueueSample.m_nSampleIndex = SFX_ROCKET_LEFT; + m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 12347; + m_sQueueSample.m_nReleasingVolumeModificator = 0; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + break; + default: + m_sQueueSample.m_fSoundIntensity = 400.0f; + m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_1; + m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 38000; + if (type == EXPLOSION_HELI) + m_sQueueSample.m_nFrequency = 8 * m_sQueueSample.m_nFrequency / 10; + m_sQueueSample.m_nReleasingVolumeModificator = 0; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + break; + } + pos = CExplosion::GetExplosionPosition(i); + m_sQueueSample.m_vecPos = *pos; + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = i; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_nEmittingVolume = maxVolume; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = true; + AddSampleToRequestedQueue(); + } + } + } + } +} + +void +cAudioManager::ProcessFires(int32) +{ + CEntity *entity; + uint8 emittingVol; + float distSquared; + + for (uint8 i = 0; i < NUM_FIRES; i++) { + if (gFireManager.m_aFires[i].m_bIsOngoing && gFireManager.m_aFires[i].m_bAudioSet) { + entity = gFireManager.m_aFires[i].m_pEntity; + if (entity) { + switch (entity->GetType()) { + case ENTITY_TYPE_BUILDING: + m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; + emittingVol = 100; + m_sQueueSample.m_nFrequency = 8 * SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE) / 10; + m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64); + m_sQueueSample.m_nReleasingVolumeModificator = 6; + break; + case ENTITY_TYPE_PED: + m_sQueueSample.m_fSoundIntensity = 25.0f; + m_sQueueSample.m_nSampleIndex = SFX_PED_ON_FIRE; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PED_ON_FIRE); + emittingVol = 60; + m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64); + m_sQueueSample.m_nReleasingVolumeModificator = 10; + break; + default: + m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); + m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64); + emittingVol = 80; + m_sQueueSample.m_nReleasingVolumeModificator = 8; + } + } else { + m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); + m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64); + emittingVol = 80; + m_sQueueSample.m_nReleasingVolumeModificator = 8; + } + m_sQueueSample.m_vecPos = gFireManager.m_aFires[i].m_vecPos; + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = i; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_nReleasingVolumeDivider = 10; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + } + } +} + +void +cAudioManager::ProcessWaterCannon(int32) +{ + const float SOUND_INTENSITY = 900.0f; + + for (int32 i = 0; i < NUM_WATERCANNONS; i++) { + if (CWaterCannons::aCannons[i].m_nId) { + m_sQueueSample.m_vecPos = CWaterCannons::aCannons[0].m_avecPos[CWaterCannons::aCannons[i].m_nCur]; + float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < SOUND_INTENSITY) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + m_sQueueSample.m_nVolume = ComputeVolume(50, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = 15591; + m_sQueueSample.m_nReleasingVolumeModificator = 5; + m_sQueueSample.m_nCounter = i; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_nReleasingVolumeDivider = 8; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nEmittingVolume = 50; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + } + } +} + +#pragma region SCRIPT_OBJECTS +const int scriptObjectIntensityS = 30; +const int scriptObjectIntensityL = 80; + +void +cAudioManager::ProcessScriptObject(int32 id) +{ + cAudioScriptObject *entity = (cAudioScriptObject *)m_asAudioEntities[id].m_pEntity; + if (entity) { + m_sQueueSample.m_vecPos = entity->Posn; + if (m_asAudioEntities[id].m_AudioEvents == 1) + ProcessOneShotScriptObject(m_asAudioEntities[id].m_awAudioEvent[0]); + else + ProcessLoopingScriptObject(entity->AudioId); + } +} + +void +cAudioManager::ProcessOneShotScriptObject(uint8 sound) +{ + CPlayerPed *playerPed; + uint8 emittingVolume; + float distSquared; + + cPedParams male; + cPedParams female; + + static uint8 iSound = 0; + + switch (sound) { + case SCRIPT_SOUND_INJURED_PED_MALE_OUCH_S: + case SCRIPT_SOUND_INJURED_PED_MALE_OUCH_L: + male.m_pPed = nil; + male.m_bDistanceCalculated = false; + male.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); + SetupPedComments(&male, SOUND_INJURED_PED_MALE_OUCH); + return; + case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S: + case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L: + female.m_pPed = nil; + female.m_bDistanceCalculated = false; + female.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); + SetupPedComments(&female, SOUND_INJURED_PED_FEMALE); + return; + case SCRIPT_SOUND_GATE_START_CLUNK: + case SCRIPT_SOUND_GATE_STOP_CLUNK: + m_sQueueSample.m_fSoundIntensity = 40.0f; + m_sQueueSample.m_nSampleIndex = SFX_COL_GATE; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + if (sound == SCRIPT_SOUND_GATE_START_CLUNK) + m_sQueueSample.m_nFrequency = 10600; + else + m_sQueueSample.m_nFrequency = 9000; + m_sQueueSample.m_nReleasingVolumeModificator = 1; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bRequireReflection = true; + emittingVolume = RandomDisplacement(10) + 50; + break; + case SCRIPT_SOUND_BULLET_HIT_GROUND_1: + case SCRIPT_SOUND_BULLET_HIT_GROUND_2: + case SCRIPT_SOUND_BULLET_HIT_GROUND_3: + m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_nSampleIndex = m_anRandomTable[iSound % 5] % 3 + SFX_BULLET_WALL_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); + m_sQueueSample.m_nReleasingVolumeModificator = 9; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_bIs2D = false; + emittingVolume = m_anRandomTable[2] % 20 + 90; + break; + case SCRIPT_SOUND_110: + case SCRIPT_SOUND_111: + if (SampleManager.IsSampleBankLoaded(0) != 1) + return; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_TRAIN_STATION_ANNOUNCE; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_STATION_ANNOUNCE); + m_sQueueSample.m_nReleasingVolumeModificator = 0; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_bIs2D = false; + break; + case SCRIPT_SOUND_PAYPHONE_RINGING: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_PHONE_RING; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = 80; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PHONE_RING); + m_sQueueSample.m_nReleasingVolumeModificator = 1; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bRequireReflection = false; + break; + case SCRIPT_SOUND_GLASS_BREAK_L: + m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_nSampleIndex = SFX_GLASS_SMASH; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = 70; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_SMASH); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_bIs2D = false; + break; + case SCRIPT_SOUND_GLASS_BREAK_S: + m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_nSampleIndex = SFX_GLASS_SMASH; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = 60; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_SMASH); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_bIs2D = false; + break; + case SCRIPT_SOUND_GLASS_CRACK: + m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_nSampleIndex = SFX_GLASS_CRACK; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = 70; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_CRACK); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bRequireReflection = true; + break; + case SCRIPT_SOUND_GLASS_LIGHT_BREAK: + m_sQueueSample.m_fSoundIntensity = 55.0f; + m_sQueueSample.m_nSampleIndex = (m_anRandomTable[4] & 3) + SFX_GLASS_SHARD_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 19000; + m_sQueueSample.m_nReleasingVolumeModificator = 9; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_bIs2D = false; + emittingVolume = RandomDisplacement(11) + 25; + break; + case SCRIPT_SOUND_BOX_DESTROYED_1: + m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_nSampleIndex = SFX_WOODEN_BOX_SMASH; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = RandomDisplacement(1500) + 18600; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bRequireReflection = true; + emittingVolume = m_anRandomTable[2] % 20 + 80; + break; + case SCRIPT_SOUND_BOX_DESTROYED_2: + m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_nSampleIndex = SFX_CARDBOARD_BOX_SMASH; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = RandomDisplacement(1500) + 18600; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bRequireReflection = true; + emittingVolume = m_anRandomTable[2] % 20 + 80; + break; + case SCRIPT_SOUND_METAL_COLLISION: + m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_nSampleIndex = m_anRandomTable[3] % 5 + SFX_COL_CAR_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bRequireReflection = true; + emittingVolume = m_anRandomTable[2] % 30 + 70; + break; + case SCRIPT_SOUND_TIRE_COLLISION: + m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_nSampleIndex = SFX_TYRE_BUMP; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bRequireReflection = true; + emittingVolume = m_anRandomTable[2] % 30 + 60; + break; + case SCRIPT_SOUND_GUNSHELL_DROP: + playerPed = FindPlayerPed(); + if (playerPed) { + switch (playerPed->m_nSurfaceTouched) { + case SURFACE_GRASS: + case SURFACE_DIRT: + case SURFACE_DIRTTRACK: + case SURFACE_SCAFFOLD: + case SURFACE_FLESH: + case SURFACE_SAND: + case SURFACE_TIRE: + case SURFACE_HEDGE: + m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_2; + m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 11000; + m_sQueueSample.m_nReleasingVolumeModificator = 18; + m_sQueueSample.m_fSoundIntensity = 20.0f; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_bIs2D = false; + emittingVolume = m_anRandomTable[2] % 20 + 30; + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = iSound++; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_nEmittingVolume = emittingVolume; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_bReverbFlag = true; + AddSampleToRequestedQueue(); + } + } + return; + case SURFACE_PUDDLE: + return; + default: + break; + } + } + m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_1; + m_sQueueSample.m_nFrequency = RandomDisplacement(750) + 18000; + m_sQueueSample.m_nReleasingVolumeModificator = 15; + m_sQueueSample.m_fSoundIntensity = 20.0f; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_bIs2D = false; + emittingVolume = m_anRandomTable[2] % 20 + 30; + break; + case SCRIPT_SOUND_GUNSHELL_DROP_SOFT: + m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_2; + m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 11000; + m_sQueueSample.m_nReleasingVolumeModificator = 18; + m_sQueueSample.m_fSoundIntensity = 20.0f; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_bIs2D = false; + emittingVolume = m_anRandomTable[2] % 20 + 30; + break; + default: + return; + } + + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = iSound++; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_nEmittingVolume = emittingVolume; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_bReverbFlag = true; + AddSampleToRequestedQueue(); + } + } +} + +void +cAudioManager::ProcessLoopingScriptObject(uint8 sound) +{ + uint8 emittingVolume; + float distSquared; + + switch (sound) { + case SCRIPT_SOUND_PARTY_1_LOOP_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_1_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_2_LOOP_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_2; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_2); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_2_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_2; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_2); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_3_LOOP_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_3; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_3); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_3_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_3; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_3); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_4_LOOP_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_4; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_4); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_4_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_4; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_4); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_5_LOOP_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_5; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_5); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_5_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_5; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_5); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_6_LOOP_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_6; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_6); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_6_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_6; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_6); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_7_LOOP_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_7; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_7); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_7_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_7; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_7); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_8_LOOP_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_8; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_8); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_8_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_8; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_8); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_9_LOOP_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_9; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_9); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_9_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_9; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_9); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_10_LOOP_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_10; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_10); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_10_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_10; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_10); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_11_LOOP_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_11; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_11); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_11_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_11; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_11); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_12_LOOP_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_12; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_12); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_12_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_12; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_12); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_13_LOOP_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_RAGGA; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_RAGGA); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_13_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_RAGGA; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_RAGGA); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_STRIP_CLUB_LOOP_1_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_1); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_STRIP_CLUB_LOOP_1_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_1); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_STRIP_CLUB_LOOP_2_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_2); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_STRIP_CLUB_LOOP_2_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_2); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_WORK_SHOP_LOOP_S: + case SCRIPT_SOUND_WORK_SHOP_LOOP_L: + ProcessWorkShopScriptObject(sound); + return; + case SCRIPT_SOUND_SAWMILL_LOOP_S: + case SCRIPT_SOUND_SAWMILL_LOOP_L: + ProcessSawMillScriptObject(sound); + return; + case SCRIPT_SOUND_38: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_DOG_FOOD_FACTORY; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOG_FOOD_FACTORY); + m_sQueueSample.m_nReleasingVolumeModificator = 6; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_39: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_DOG_FOOD_FACTORY; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOG_FOOD_FACTORY); + m_sQueueSample.m_nReleasingVolumeModificator = 6; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_LAUNDERETTE_LOOP_S: + case SCRIPT_SOUND_LAUNDERETTE_LOOP_L: + ProcessLaunderetteScriptObject(sound); + return; + case SCRIPT_SOUND_CHINATOWN_RESTAURANT_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_CHINATOWN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_CHINATOWN); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_CHINATOWN_RESTAURANT_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_CHINATOWN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_CHINATOWN); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_CIPRIANI_RESAURANT_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_ITALY; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_ITALY); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_CIPRIANI_RESAURANT_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_ITALY; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_ITALY); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_46_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_1); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_47_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_1); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_MARCO_BISTRO_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_2; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_2); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_MARCO_BISTRO_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_2; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = 110; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_2); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_AIRPORT_LOOP_S: + case SCRIPT_SOUND_AIRPORT_LOOP_L: + ProcessAirportScriptObject(sound); + return; + case SCRIPT_SOUND_SHOP_LOOP_S: + case SCRIPT_SOUND_SHOP_LOOP_L: + ProcessShopScriptObject(sound); + return; + case SCRIPT_SOUND_CINEMA_LOOP_S: + case SCRIPT_SOUND_CINEMA_LOOP_L: + ProcessCinemaScriptObject(sound); + return; + case SCRIPT_SOUND_DOCKS_LOOP_S: + case SCRIPT_SOUND_DOCKS_LOOP_L: + ProcessDocksScriptObject(sound); + return; + case SCRIPT_SOUND_HOME_LOOP_S: + case SCRIPT_SOUND_HOME_LOOP_L: + ProcessHomeScriptObject(sound); + return; + case SCRIPT_SOUND_FRANKIE_PIANO: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_PIANO_BAR_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PIANO_BAR_1); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PARTY_1_LOOP: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PORN_CINEMA_1_S: + case SCRIPT_SOUND_PORN_CINEMA_1_L: + case SCRIPT_SOUND_PORN_CINEMA_2_S: + case SCRIPT_SOUND_PORN_CINEMA_2_L: + case SCRIPT_SOUND_PORN_CINEMA_3_S: + case SCRIPT_SOUND_PORN_CINEMA_3_L: + case SCRIPT_SOUND_MISTY_SEX_S: + case SCRIPT_SOUND_MISTY_SEX_L: + ProcessPornCinema(sound); + return; + case SCRIPT_SOUND_BANK_ALARM_LOOP_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_BANK_ALARM_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = 90; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BANK_ALARM_1); + m_sQueueSample.m_nReleasingVolumeModificator = 2; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_BANK_ALARM_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_BANK_ALARM_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = 90; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BANK_ALARM_1); + m_sQueueSample.m_nReleasingVolumeModificator = 2; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_POLICE_BALL_LOOP_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BALL_1); + m_sQueueSample.m_nReleasingVolumeModificator = 2; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_POLICE_BALL_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BALL_1); + m_sQueueSample.m_nReleasingVolumeModificator = 2; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_INDUSTRIAL); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_INDUSTRIAL); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S: + case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L: + ProcessPoliceCellBeatingScriptObject(sound); + return; + case SCRIPT_SOUND_RAVE_1_LOOP_S: + case SCRIPT_SOUND_RAVE_2_LOOP_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_RAVE_1_LOOP_L: + case SCRIPT_SOUND_RAVE_2_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_RAVE_3_LOOP_S: + m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_SUBURBAN); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_RAVE_3_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = maxVolume; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_SUBURBAN); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + case SCRIPT_SOUND_PRETEND_FIRE_LOOP: + m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + emittingVolume = 80; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); + m_sQueueSample.m_nReleasingVolumeModificator = 8; + m_sQueueSample.m_nReleasingVolumeDivider = 10; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + break; + default: + return; + } + + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 0; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_nEmittingVolume = emittingVolume; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } +} + +void +cAudioManager::ProcessPornCinema(uint8 sound) +{ + + eSfxSample sample; + uint32 time; + int32 rand; + float distSquared; + + switch (sound) { + case SCRIPT_SOUND_PORN_CINEMA_1_S: + case SCRIPT_SOUND_MISTY_SEX_S: + m_sQueueSample.m_nSampleIndex = SFX_PORN_1_LOOP; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + sample = SFX_PORN_1_GROAN_1; + m_sQueueSample.m_fSoundIntensity = 20.0f; + break; + case SCRIPT_SOUND_PORN_CINEMA_1_L: + case SCRIPT_SOUND_MISTY_SEX_L: + m_sQueueSample.m_nSampleIndex = SFX_PORN_1_LOOP; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + sample = SFX_PORN_1_GROAN_1; + m_sQueueSample.m_fSoundIntensity = 80.0f; + break; + case SCRIPT_SOUND_PORN_CINEMA_2_S: + m_sQueueSample.m_nSampleIndex = SFX_PORN_2_LOOP; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + sample = SFX_PORN_2_GROAN_1; + m_sQueueSample.m_fSoundIntensity = 20.0f; + break; + case SCRIPT_SOUND_PORN_CINEMA_2_L: + m_sQueueSample.m_nSampleIndex = SFX_PORN_2_LOOP; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + sample = SFX_PORN_2_GROAN_1; + m_sQueueSample.m_fSoundIntensity = 80.0f; + break; + case SCRIPT_SOUND_PORN_CINEMA_3_S: + m_sQueueSample.m_nSampleIndex = SFX_PORN_3_LOOP; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_fSoundIntensity = 20.0f; + sample = SFX_PORN_3_GROAN_1; + break; + case SCRIPT_SOUND_PORN_CINEMA_3_L: + m_sQueueSample.m_nSampleIndex = SFX_PORN_3_LOOP; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_fSoundIntensity = 80.0f; + sample = SFX_PORN_3_GROAN_1; + break; + default: + return; + } + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + if (sound != SCRIPT_SOUND_MISTY_SEX_S && sound != SCRIPT_SOUND_MISTY_SEX_L) { + m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nCounter = 0; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_nEmittingVolume = maxVolume; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + + time = CTimer::GetTimeInMilliseconds(); + if (time > gPornNextTime) { + m_sQueueSample.m_nVolume = ComputeVolume(90, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + rand = m_anRandomTable[1] & 1; + m_sQueueSample.m_nSampleIndex = rand + sample; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); + m_sQueueSample.m_nCounter = rand + 1; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_nReleasingVolumeModificator = 6; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + gPornNextTime = time + 2000 + m_anRandomTable[3] % 6000; + } + } + } +} + +void +cAudioManager::ProcessWorkShopScriptObject(uint8 sound) +{ + float distSquared; + + switch (sound) { + case SCRIPT_SOUND_WORK_SHOP_LOOP_S: + case SCRIPT_SOUND_WORK_SHOP_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 20.0f; + break; + default: + return; + } + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nSampleIndex = SFX_WORKSHOP_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_WORKSHOP_1); + m_sQueueSample.m_nCounter = 0; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeModificator = 5; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_nEmittingVolume = 30; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } +} + +void +cAudioManager::ProcessSawMillScriptObject(uint8 sound) +{ + + uint32 time; + float distSquared; + + switch (sound) { + case SCRIPT_SOUND_SAWMILL_LOOP_S: + case SCRIPT_SOUND_SAWMILL_LOOP_L: + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; + break; + default: + return; + } + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nSampleIndex = SFX_SAWMILL_LOOP; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SAWMILL_LOOP); + m_sQueueSample.m_nCounter = 0; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeModificator = 5; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_nEmittingVolume = 30; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + time = CTimer::GetTimeInMilliseconds(); + if (time > gSawMillNextTime) { + m_sQueueSample.m_nVolume = ComputeVolume(70, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nSampleIndex = SFX_SAWMILL_CUT_WOOD; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nCounter = 1; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + gSawMillNextTime = time + 2000 + m_anRandomTable[3] % 4000; + } + } + } +} + +void +cAudioManager::ProcessLaunderetteScriptObject(uint8 sound) +{ + switch (sound) { + case SCRIPT_SOUND_LAUNDERETTE_LOOP_S: + case SCRIPT_SOUND_LAUNDERETTE_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 30.0f; + break; + default: + return; + } + float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + m_sQueueSample.m_nVolume = ComputeVolume(45, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nSampleIndex = SFX_LAUNDERETTE_LOOP; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_LAUNDERETTE_LOOP); + m_sQueueSample.m_nCounter = 0; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeModificator = 5; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_nEmittingVolume = 45; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + m_sQueueSample.m_nVolume = ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nSampleIndex = SFX_LAUNDERETTE_SONG_LOOP; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_LAUNDERETTE_SONG_LOOP); + m_sQueueSample.m_nCounter = 1; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_nEmittingVolume = 110; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } +} + +void +cAudioManager::ProcessShopScriptObject(uint8 sound) +{ + uint32 time; + int32 rand; + float distSquared; + + switch (sound) { + case SCRIPT_SOUND_SHOP_LOOP_S: + case SCRIPT_SOUND_SHOP_LOOP_L: + m_sQueueSample.m_fSoundIntensity = 30.0f; + break; + default: + return; + } + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nSampleIndex = SFX_SHOP_LOOP; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SHOP_LOOP); + m_sQueueSample.m_nCounter = 0; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeModificator = 5; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_nEmittingVolume = 30; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + time = CTimer::GetTimeInMilliseconds(); + if (time > gShopNextTime) { + m_sQueueSample.m_nVolume = ComputeVolume(70, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + rand = m_anRandomTable[1] & 1; + m_sQueueSample.m_nSampleIndex = rand + SFX_SHOP_TILL_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nCounter = rand + 1; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_nEmittingVolume = 70; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + gShopNextTime = time + 3000 + m_anRandomTable[3] % 7000; + } + } + } +} + +void +cAudioManager::ProcessAirportScriptObject(uint8 sound) +{ + static uint8 counter = 0; + + uint32 time = CTimer::GetTimeInMilliseconds(); + if (time > gAirportNextTime) { + switch (sound) { + case SCRIPT_SOUND_AIRPORT_LOOP_S: + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; + break; + case SCRIPT_SOUND_AIRPORT_LOOP_L: + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; + break; + default: + return; + } + float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + m_sQueueSample.m_nVolume = ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] & 3) + SFX_AIRPORT_ANNOUNCEMENT_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nCounter = counter++; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_nEmittingVolume = 110; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + gAirportNextTime = time + 10000 + m_anRandomTable[3] % 20000; + } + } + } +} + +void +cAudioManager::ProcessCinemaScriptObject(uint8 sound) +{ + uint8 rand; + + static uint8 counter = 0; + + uint32 time = CTimer::GetTimeInMilliseconds(); + if (time > gCinemaNextTime) { + switch (sound) { + case SCRIPT_SOUND_CINEMA_LOOP_S: + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; + break; + case SCRIPT_SOUND_CINEMA_LOOP_L: + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; + break; + default: + return; + } + float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + rand = m_anRandomTable[0] % 90 + 30; + m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nSampleIndex = counter % 3 + SFX_CINEMA_BASS_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 4); + m_sQueueSample.m_nCounter = counter++; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_nEmittingVolume = rand; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + gCinemaNextTime = time + 1000 + m_anRandomTable[3] % 4000; + } + } + } +} + +void +cAudioManager::ProcessDocksScriptObject(uint8 sound) +{ + uint32 time; + uint8 rand; + float distSquared; + + static uint32 counter = 0; + + time = CTimer::GetTimeInMilliseconds(); + if (time > gDocksNextTime) { + switch (sound) { + case SCRIPT_SOUND_DOCKS_LOOP_S: + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; + break; + case SCRIPT_SOUND_DOCKS_LOOP_L: + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; + break; + default: + return; + } + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + rand = m_anRandomTable[0] % 60 + 40; + m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nSampleIndex = SFX_DOCKS_FOGHORN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOCKS_FOGHORN); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8); + m_sQueueSample.m_nCounter = counter++; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_nEmittingVolume = rand; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + gDocksNextTime = time + 10000 + m_anRandomTable[3] % 40000; + } + } + } +} +void +cAudioManager::ProcessHomeScriptObject(uint8 sound) +{ + uint32 time; + uint8 rand; + float dist; + + static uint8 counter = 0; + + time = CTimer::GetTimeInMilliseconds(); + if (time > gHomeNextTime) { + switch (sound) { + case SCRIPT_SOUND_HOME_LOOP_S: + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; + break; + case SCRIPT_SOUND_HOME_LOOP_L: + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; + break; + default: + return; + } + dist = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (dist < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(dist); + rand = m_anRandomTable[0] % 30 + 40; + m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nSampleIndex = m_anRandomTable[0] % 5 + SFX_HOME_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); + m_sQueueSample.m_nCounter = counter++; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_nEmittingVolume = rand; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = true; + AddSampleToRequestedQueue(); + gHomeNextTime = time + 1000 + m_anRandomTable[3] % 4000; + } + } + } +} +void +cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound) +{ + uint32 time = CTimer::GetTimeInMilliseconds(); + int32 sampleIndex; + uint8 emittingVol; + float distSquared; + cPedParams params; + + static uint8 counter = 0; + + if (time > gCellNextTime) { + switch (sound) { + case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S: + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; + break; + case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L: + m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; + break; + default: + return; + } + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + if (m_FrameCounter & 1) + sampleIndex = (m_anRandomTable[1] & 3) + SFX_FIGHT_1; + else + sampleIndex = (m_anRandomTable[3] & 1) + SFX_BAT_HIT_LEFT; + m_sQueueSample.m_nSampleIndex = sampleIndex; + emittingVol = m_anRandomTable[0] % 50 + 55; + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); + m_sQueueSample.m_nCounter = counter++; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + params.m_bDistanceCalculated = true; + params.m_fDistance = distSquared; + params.m_pPed = nil; + SetupPedComments(¶ms, SOUND_INJURED_PED_MALE_PRISON); + } + gCellNextTime = time + 500 + m_anRandomTable[3] % 1500; + } + } +} +#pragma endregion All the code for script object audio on the map + +void +cAudioManager::ProcessWeather(int32 id) +{ + uint8 vol; + static uint8 counter = 0; + + if (m_asAudioEntities[id].m_AudioEvents && m_asAudioEntities[id].m_awAudioEvent[0] == SOUND_LIGHTNING) { + if (m_asAudioEntities[id].m_afVolume[0] >= 10.f) { + m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_1; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 4000; + vol = (m_asAudioEntities[id].m_afVolume[0] - 10.f) + 40; + } else { + m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_2; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 4000; + vol = (m_asAudioEntities[id].m_afVolume[0]) + 35; + } + m_sQueueSample.m_nVolume = vol; + if (TheCamera.SoundDistUp < 20.f) + m_sQueueSample.m_nVolume /= 2; + if (counter == 4) + counter = 0; + m_sQueueSample.m_nCounter = counter++; + m_sQueueSample.m_nReleasingVolumeModificator = 0; + m_sQueueSample.m_nOffset = (m_anRandomTable[2] & 15) + 55; + m_sQueueSample.m_bIs2D = true; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_bReverbFlag = false; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + if (CWeather::Rain > 0.0f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) { + m_sQueueSample.m_nSampleIndex = SFX_RAIN; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAIN); + m_sQueueSample.m_nVolume = (int32)(25.f * CWeather::Rain); + m_sQueueSample.m_nCounter = 4; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nReleasingVolumeModificator = 0; + m_sQueueSample.m_nOffset = 63; + m_sQueueSample.m_bIs2D = true; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 30; + m_sQueueSample.m_bReverbFlag = false; + m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } +} + +void +cAudioManager::ProcessFrontEnd() +{ + bool stereo; + bool processedPickup; + bool processedMission; + int16 sample; + + static uint8 counter = 0; + static uint32 cPickupNextFrame = 0; + static uint32 cPartMisComNextFrame = 0; + + for (uint32 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) { + processedPickup = false; + stereo = false; + processedMission = false; + switch (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]) { + case SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM: + m_sQueueSample.m_nSampleIndex = SFX_ERROR_FIRE_RIFLE; + break; + case SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM: + m_sQueueSample.m_nSampleIndex = SFX_ERROR_FIRE_ROCKET_LAUNCHER; + break; + case SOUND_GARAGE_NO_MONEY: + case SOUND_GARAGE_BAD_VEHICLE: + case SOUND_GARAGE_BOMB_ALREADY_SET: + m_sQueueSample.m_nSampleIndex = SFX_PICKUP_ERROR_LEFT; + stereo = true; + break; + case SOUND_GARAGE_OPENING: + case SOUND_GARAGE_BOMB1_SET: + case SOUND_GARAGE_BOMB2_SET: + case SOUND_GARAGE_BOMB3_SET: + case SOUND_41: + case SOUND_GARAGE_VEHICLE_DECLINED: + case SOUND_GARAGE_VEHICLE_ACCEPTED: + case SOUND_PICKUP_HEALTH: + case SOUND_4B: + case SOUND_PICKUP_ADRENALINE: + case SOUND_PICKUP_ARMOUR: + case SOUND_EVIDENCE_PICKUP: + case SOUND_UNLOAD_GOLD: + m_sQueueSample.m_nSampleIndex = SFX_PICKUP_2_LEFT; + processedPickup = true; + stereo = true; + break; + case SOUND_PICKUP_WEAPON_BOUGHT: + case SOUND_PICKUP_WEAPON: + m_sQueueSample.m_nSampleIndex = SFX_PICKUP_1_LEFT; + processedPickup = true; + stereo = true; + break; + case SOUND_4A: + m_sQueueSample.m_nSampleIndex = SFX_PICKUP_ERROR_LEFT; + processedPickup = true; + stereo = true; + break; + case SOUND_PICKUP_BONUS: + case SOUND_PICKUP_MONEY: + case SOUND_PICKUP_HIDDEN_PACKAGE: + case SOUND_PICKUP_PACMAN_PILL: + case SOUND_PICKUP_PACMAN_PACKAGE: + case SOUND_PICKUP_FLOAT_PACKAGE: + m_sQueueSample.m_nSampleIndex = SFX_PICKUP_3_LEFT; + processedPickup = true; + stereo = true; + break; + case SOUND_PAGER: + m_sQueueSample.m_nSampleIndex = SFX_PAGER; + break; + case SOUND_RACE_START_3: + case SOUND_RACE_START_2: + case SOUND_RACE_START_1: + case SOUND_CLOCK_TICK: + m_sQueueSample.m_nSampleIndex = SFX_TIMER_BEEP; + break; + case SOUND_RACE_START_GO: + m_sQueueSample.m_nSampleIndex = SFX_PART_MISSION_COMPLETE; + break; + case SOUND_PART_MISSION_COMPLETE: + m_sQueueSample.m_nSampleIndex = SFX_PART_MISSION_COMPLETE; + processedMission = true; + break; + case SOUND_FRONTEND_MENU_STARTING: + m_sQueueSample.m_nSampleIndex = SFX_START_BUTTON_LEFT; + stereo = true; + break; + case SOUND_FRONTEND_MENU_COMPLETED: + m_sQueueSample.m_nSampleIndex = SFX_PAGE_CHANGE_AND_BACK_LEFT; + stereo = true; + break; + case SOUND_FRONTEND_MENU_DENIED: + m_sQueueSample.m_nSampleIndex = SFX_HIGHLIGHT_LEFT; + stereo = true; + break; + case SOUND_FRONTEND_MENU_SUCCESS: + m_sQueueSample.m_nSampleIndex = SFX_SELECT_LEFT; + stereo = true; + break; + case SOUND_FRONTEND_EXIT: + m_sQueueSample.m_nSampleIndex = SFX_SUB_MENU_BACK_LEFT; + stereo = true; + break; + case SOUND_9A: + m_sQueueSample.m_nSampleIndex = SFX_STEREO_LEFT; + stereo = true; + break; + case SOUND_9B: + m_sQueueSample.m_nSampleIndex = SFX_MONO; + break; + case SOUND_FRONTEND_AUDIO_TEST: + m_sQueueSample.m_nSampleIndex = m_anRandomTable[0] % 3 + SFX_NOISE_BURST_1; + break; + case SOUND_FRONTEND_FAIL: + m_sQueueSample.m_nSampleIndex = SFX_ERROR_LEFT; + stereo = true; + break; + case SOUND_FRONTEND_NO_RADIO: + case SOUND_FRONTEND_RADIO_CHANGE: + m_sQueueSample.m_nSampleIndex = SFX_RADIO_CLICK; + break; + case SOUND_A0: + m_sQueueSample.m_nSampleIndex = SFX_INFO; + break; + default: + continue; + } + + if (processedPickup) { + if (m_FrameCounter <= cPickupNextFrame) + continue; + cPickupNextFrame = m_FrameCounter + 5; + } else if (processedMission) { + if (m_FrameCounter <= cPartMisComNextFrame) + continue; + cPartMisComNextFrame = m_FrameCounter + 5; + } + + sample = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]; + if (sample == SFX_RAIN) { + m_sQueueSample.m_nFrequency = 28509; + } else if (sample == SFX_PICKUP_1_LEFT) { + if (1.f == m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]) + m_sQueueSample.m_nFrequency = 32000; + else + m_sQueueSample.m_nFrequency = 48000; + } else { + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + } + m_sQueueSample.m_nVolume = 110; + m_sQueueSample.m_nCounter = counter++; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nReleasingVolumeModificator = 0; + m_sQueueSample.m_bIs2D = true; + m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + if (stereo) + m_sQueueSample.m_nOffset = m_anRandomTable[0] & 31; + else + m_sQueueSample.m_nOffset = 63; + m_sQueueSample.m_bReverbFlag = false; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + if (stereo) { + ++m_sQueueSample.m_nSampleIndex; + m_sQueueSample.m_nCounter = counter++; + m_sQueueSample.m_nOffset = maxVolume - m_sQueueSample.m_nOffset; + AddSampleToRequestedQueue(); + } + } +} + +void +cAudioManager::ProcessCrane() +{ + CCrane *crane = (CCrane *)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity; + float distSquared; + bool distCalculated = false; + static const int intensity = 80; + + if (crane) { + if (crane->m_nCraneStatus == CCrane::ACTIVATED) { + if (crane->m_nCraneState != CCrane::IDLE) { + m_sQueueSample.m_vecPos = crane->m_pCraneEntity->GetPosition(); + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < SQR(intensity)) { + CalculateDistance(distCalculated, distSquared); + m_sQueueSample.m_nVolume = ComputeVolume(100, 80.f, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 0; + m_sQueueSample.m_nSampleIndex = SFX_CRANE_MAGNET; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 2; + m_sQueueSample.m_nFrequency = 6000; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = 100; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_fSoundIntensity = intensity; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents) { + m_sQueueSample.m_nCounter = 1; + m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_2; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COL_CAR_2); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = true; + AddSampleToRequestedQueue(); + } + } + } + } + } +} + +void +cAudioManager::ProcessProjectiles() +{ + const int rocketLauncherIntensity = 90; + const int molotovIntensity = 30; + const int molotovVolume = 50; + uint8 emittingVol; + + for (int32 i = 0; i < NUM_PROJECTILES; i++) { + if (CProjectileInfo::GetProjectileInfo(i)->m_bInUse) { + switch (CProjectileInfo::GetProjectileInfo(i)->m_eWeaponType) { + case WEAPONTYPE_ROCKETLAUNCHER: + emittingVol = maxVolume; + m_sQueueSample.m_fSoundIntensity = rocketLauncherIntensity; + m_sQueueSample.m_nSampleIndex = SFX_ROCKET_FLY; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ROCKET_FLY); + m_sQueueSample.m_nReleasingVolumeModificator = 3; + break; + case WEAPONTYPE_MOLOTOV: + emittingVol = molotovVolume; + m_sQueueSample.m_fSoundIntensity = molotovIntensity; + m_sQueueSample.m_nSampleIndex = SFX_PED_ON_FIRE; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nFrequency = 32 * SampleManager.GetSampleBaseFrequency(SFX_PED_ON_FIRE) / 25; + m_sQueueSample.m_nReleasingVolumeModificator = 7; + break; + default: + return; + } + m_sQueueSample.m_fSpeedMultiplier = 4.0f; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_vecPos = CProjectileInfo::ms_apProjectile[i]->GetPosition(); + float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + m_sQueueSample.m_fDistance = Sqrt(distSquared); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = i; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = emittingVol; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + } + } +} + +void +cAudioManager::ProcessGarages() +{ + CEntity *entity; + eGarageState state; + uint32 sampleIndex; + uint8 j; + float distSquared; + bool distCalculated; + + static uint8 iSound = 32; + +#define LOOP_HELPER \ + for (j = 0; j < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; ++j) { \ + switch (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[j]) { \ + case SOUND_GARAGE_DOOR_CLOSED: \ + case SOUND_GARAGE_DOOR_OPENED: \ + if (distSquared < 6400.f) { \ + CalculateDistance(distCalculated, distSquared); \ + m_sQueueSample.m_nVolume = ComputeVolume(60, 80.f, m_sQueueSample.m_fDistance); \ + if (m_sQueueSample.m_nVolume) { \ + if (CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) { \ + m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2; \ + m_sQueueSample.m_nFrequency = 6735; \ + } else if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[j] == 69) { \ + m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2; \ + m_sQueueSample.m_nFrequency = 22000; \ + } else { \ + m_sQueueSample.m_nSampleIndex = SFX_COL_GARAGE_DOOR_1; \ + m_sQueueSample.m_nFrequency = 18000; \ + } \ + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; \ + m_sQueueSample.m_nReleasingVolumeModificator = 4; \ + m_sQueueSample.m_nEmittingVolume = 60; \ + m_sQueueSample.m_fSpeedMultiplier = 0.0f; \ + m_sQueueSample.m_fSoundIntensity = 80.0f; \ + /*m_sQueueSample.m_nReleasingVolumeModificator = 4;*/ \ + m_sQueueSample.m_bReverbFlag = true; \ + /*m_sQueueSample.m_bReverbFlag = true;*/ \ + m_sQueueSample.m_bIs2D = false; \ + m_sQueueSample.m_bReleasingSoundFlag = true; \ + m_sQueueSample.m_nLoopCount = 1; \ + m_sQueueSample.m_nLoopStart = 0; \ + m_sQueueSample.m_nLoopEnd = -1; \ + m_sQueueSample.m_nCounter = iSound++; \ + if (iSound < 32) \ + iSound = 32; \ + m_sQueueSample.m_bRequireReflection = true; \ + AddSampleToRequestedQueue(); \ + } \ + } \ + break; \ + default: \ + continue; \ + } \ + } + + for (uint32 i = 0; i < CGarages::NumGarages; ++i) { + if (CGarages::aGarages[i].m_eGarageType == GARAGE_NONE) + continue; + entity = CGarages::aGarages[i].m_pDoor1; + if (!entity) + continue; + m_sQueueSample.m_vecPos = entity->GetPosition(); + distCalculated = false; + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < 6400.f) { + state = CGarages::aGarages[i].m_eGarageState; + if (state == GS_OPENING || state == GS_CLOSING || state == GS_AFTERDROPOFF) { + CalculateDistance(distCalculated, distSquared); + m_sQueueSample.m_nVolume = ComputeVolume(90, 80.f, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + if (CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) { + if (CGarages::aGarages[i].m_eGarageState == GS_AFTERDROPOFF) { + if (!(m_FrameCounter & 1)) { + LOOP_HELPER + continue; + } + if (m_anRandomTable[1] & 1) { + sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_CAR_1; + } else { + sampleIndex = m_anRandomTable[2] % 6 + SFX_COL_CAR_PANEL_1; + } + m_sQueueSample.m_nSampleIndex = sampleIndex; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) / 2; + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_nCounter = iSound++; + if (iSound < 32) + iSound = 32; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nEmittingVolume = 90; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + LOOP_HELPER + continue; + } + m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; + m_sQueueSample.m_nFrequency = 6543; + } else { + m_sQueueSample.m_nSampleIndex = SFX_GARAGE_DOOR_LOOP; + m_sQueueSample.m_nFrequency = 13961; + } + m_sQueueSample.m_nCounter = i; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + m_sQueueSample.m_nEmittingVolume = 90; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } + LOOP_HELPER + } + } +#undef LOOP_HELPER +} + +void +cAudioManager::ProcessFireHydrant() +{ + float distSquared; + bool distCalculated = false; + static const int intensity = 35; + + m_sQueueSample.m_vecPos = ((CEntity *)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)->GetPosition(); + distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (distSquared < SQR(intensity)) { + CalculateDistance(distCalculated, distSquared); + m_sQueueSample.m_nVolume = ComputeVolume(40, 35.f, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 0; + m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 4; + m_sQueueSample.m_nFrequency = 15591; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = 40; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_fSoundIntensity = intensity; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } +} + +#pragma region BRIDGE +const int bridgeIntensity = 400; + +void +cAudioManager::ProcessBridge() +{ + float dist; + bool distCalculated = false; + + if (CBridge::pLiftRoad) { + m_sQueueSample.m_vecPos = CBridge::pLiftRoad->GetPosition(); + dist = GetDistanceSquared(m_sQueueSample.m_vecPos); + if (dist < 202500.0f) { + CalculateDistance(distCalculated, dist); + switch (CBridge::State) { + case STATE_BRIDGE_LOCKED: + case STATE_LIFT_PART_IS_UP: + case STATE_LIFT_PART_ABOUT_TO_MOVE_UP: + ProcessBridgeWarning(); + break; + case STATE_LIFT_PART_MOVING_DOWN: + case STATE_LIFT_PART_MOVING_UP: + ProcessBridgeWarning(); + ProcessBridgeMotor(); + break; + default: + break; + } + ProcessBridgeOneShots(); + } + } +} + +void +cAudioManager::ProcessBridgeWarning() +{ + if (CStats::CommercialPassed && m_sQueueSample.m_fDistance < 450.f) { + m_sQueueSample.m_nVolume = ComputeVolume(100, 450.f, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 0; + m_sQueueSample.m_nSampleIndex = SFX_BRIDGE_OPEN_WARNING; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 1; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BRIDGE_OPEN_WARNING); + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = 100; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_fSoundIntensity = 450.0f; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 8; + m_sQueueSample.m_bReverbFlag = false; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } +} + +void +cAudioManager::ProcessBridgeMotor() +{ + if (m_sQueueSample.m_fDistance < bridgeIntensity) { + m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, bridgeIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 1; + m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; // todo check sfx name + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 1; + m_sQueueSample.m_nFrequency = 5500; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nEmittingVolume = maxVolume; + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_fSoundIntensity = bridgeIntensity; + m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_bReverbFlag = false; + AddSampleToRequestedQueue(); + } + } +} + +void +cAudioManager::ProcessBridgeOneShots() +{ + if (CBridge::State == STATE_LIFT_PART_IS_UP && CBridge::OldState == STATE_LIFT_PART_MOVING_UP) { + m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; + } else { + if (CBridge::State == STATE_LIFT_PART_IS_DOWN && CBridge::OldState == STATE_LIFT_PART_MOVING_DOWN) { + m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; + } else { + if (CBridge::State == STATE_LIFT_PART_MOVING_UP && CBridge::OldState == STATE_LIFT_PART_ABOUT_TO_MOVE_UP) { + m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; + } else { + if (CBridge::State == STATE_LIFT_PART_MOVING_DOWN && CBridge::OldState == STATE_LIFT_PART_IS_UP) { + m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; + } else + return; + } + } + } + if (m_sQueueSample.m_fDistance < bridgeIntensity) { + m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, bridgeIntensity, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nCounter = 2; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_nReleasingVolumeModificator = 1; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nEmittingVolume = maxVolume; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_fSpeedMultiplier = 2.0f; + m_sQueueSample.m_fSoundIntensity = bridgeIntensity; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bReverbFlag = false; + m_sQueueSample.m_bRequireReflection = false; + AddSampleToRequestedQueue(); + } + } +} +#pragma endregion + +#pragma region MISSION_AUDIO +bool g_bMissionAudioLoadFailed; + +struct MissionAudioData { + const char *m_pName; + int32 m_nId; +}; + +const MissionAudioData MissionAudioNameSfxAssoc[] = { + {"lib_a1", STREAMED_SOUND_MISSION_LIB_A1}, {"lib_a2", STREAMED_SOUND_MISSION_LIB_A2}, {"lib_a", STREAMED_SOUND_MISSION_LIB_A}, + {"lib_b", STREAMED_SOUND_MISSION_LIB_B}, {"lib_c", STREAMED_SOUND_MISSION_LIB_C}, {"lib_d", STREAMED_SOUND_MISSION_LIB_D}, + {"l2_a", STREAMED_SOUND_MISSION_L2_A}, {"j4t_1", STREAMED_SOUND_MISSION_J4T_1}, {"j4t_2", STREAMED_SOUND_MISSION_J4T_2}, + {"j4t_3", STREAMED_SOUND_MISSION_J4T_3}, {"j4t_4", STREAMED_SOUND_MISSION_J4T_4}, {"j4_a", STREAMED_SOUND_MISSION_J4_A}, + {"j4_b", STREAMED_SOUND_MISSION_J4_B}, {"j4_c", STREAMED_SOUND_MISSION_J4_C}, {"j4_d", STREAMED_SOUND_MISSION_J4_D}, + {"j4_e", STREAMED_SOUND_MISSION_J4_E}, {"j4_f", STREAMED_SOUND_MISSION_J4_F}, {"j6_1", STREAMED_SOUND_MISSION_J6_1}, + {"j6_a", STREAMED_SOUND_MISSION_J6_A}, {"j6_b", STREAMED_SOUND_MISSION_J6_B}, {"j6_c", STREAMED_SOUND_MISSION_J6_C}, + {"j6_d", STREAMED_SOUND_MISSION_J6_D}, {"t4_a", STREAMED_SOUND_MISSION_T4_A}, {"s1_a", STREAMED_SOUND_MISSION_S1_A}, + {"s1_a1", STREAMED_SOUND_MISSION_S1_A1}, {"s1_b", STREAMED_SOUND_MISSION_S1_B}, {"s1_c", STREAMED_SOUND_MISSION_S1_C}, + {"s1_c1", STREAMED_SOUND_MISSION_S1_C1}, {"s1_d", STREAMED_SOUND_MISSION_S1_D}, {"s1_e", STREAMED_SOUND_MISSION_S1_E}, + {"s1_f", STREAMED_SOUND_MISSION_S1_F}, {"s1_g", STREAMED_SOUND_MISSION_S1_G}, {"s1_h", STREAMED_SOUND_MISSION_S1_H}, + {"s1_i", STREAMED_SOUND_MISSION_S1_I}, {"s1_j", STREAMED_SOUND_MISSION_S1_J}, {"s1_k", STREAMED_SOUND_MISSION_S1_K}, + {"s1_l", STREAMED_SOUND_MISSION_S1_L}, {"s3_a", STREAMED_SOUND_MISSION_S3_A}, {"s3_b", STREAMED_SOUND_MISSION_S3_B}, + {"el3_a", STREAMED_SOUND_MISSION_EL3_A}, {"mf1_a", STREAMED_SOUND_MISSION_MF1_A}, {"mf2_a", STREAMED_SOUND_MISSION_MF2_A}, + {"mf3_a", STREAMED_SOUND_MISSION_MF3_A}, {"mf3_b", STREAMED_SOUND_MISSION_MF3_B}, {"mf3_b1", STREAMED_SOUND_MISSION_MF3_B1}, + {"mf3_c", STREAMED_SOUND_MISSION_MF3_C}, {"mf4_a", STREAMED_SOUND_MISSION_MF4_A}, {"mf4_b", STREAMED_SOUND_MISSION_MF4_B}, + {"mf4_c", STREAMED_SOUND_MISSION_MF4_C}, {"a1_a", STREAMED_SOUND_MISSION_A1_A}, {"a3_a", STREAMED_SOUND_MISSION_A3_A}, + {"a5_a", STREAMED_SOUND_MISSION_A5_A}, {"a4_a", STREAMED_SOUND_MISSION_A4_A}, {"a4_b", STREAMED_SOUND_MISSION_A4_B}, + {"a4_c", STREAMED_SOUND_MISSION_A4_C}, {"a4_d", STREAMED_SOUND_MISSION_A4_D}, {"k1_a", STREAMED_SOUND_MISSION_K1_A}, + {"k3_a", STREAMED_SOUND_MISSION_K3_A}, {"r1_a", STREAMED_SOUND_MISSION_R1_A}, {"r2_a", STREAMED_SOUND_MISSION_R2_A}, + {"r2_b", STREAMED_SOUND_MISSION_R2_B}, {"r2_c", STREAMED_SOUND_MISSION_R2_C}, {"r2_d", STREAMED_SOUND_MISSION_R2_D}, + {"r2_e", STREAMED_SOUND_MISSION_R2_E}, {"r2_f", STREAMED_SOUND_MISSION_R2_F}, {"r2_g", STREAMED_SOUND_MISSION_R2_G}, + {"r2_h", STREAMED_SOUND_MISSION_R2_H}, {"r5_a", STREAMED_SOUND_MISSION_R5_A}, {"r6_a", STREAMED_SOUND_MISSION_R6_A}, + {"r6_a1", STREAMED_SOUND_MISSION_R6_A1}, {"r6_b", STREAMED_SOUND_MISSION_R6_B}, {"lo2_a", STREAMED_SOUND_MISSION_LO2_A}, + {"lo6_a", STREAMED_SOUND_MISSION_LO6_A}, {"yd2_a", STREAMED_SOUND_MISSION_YD2_A}, {"yd2_b", STREAMED_SOUND_MISSION_YD2_B}, + {"yd2_c", STREAMED_SOUND_MISSION_YD2_C}, {"yd2_c1", STREAMED_SOUND_MISSION_YD2_C1}, {"yd2_d", STREAMED_SOUND_MISSION_YD2_D}, + {"yd2_e", STREAMED_SOUND_MISSION_YD2_E}, {"yd2_f", STREAMED_SOUND_MISSION_YD2_F}, {"yd2_g", STREAMED_SOUND_MISSION_YD2_G}, + {"yd2_h", STREAMED_SOUND_MISSION_YD2_H}, {"yd2_ass", STREAMED_SOUND_MISSION_YD2_ASS}, {"yd2_ok", STREAMED_SOUND_MISSION_YD2_OK}, + {"h5_a", STREAMED_SOUND_MISSION_H5_A}, {"h5_b", STREAMED_SOUND_MISSION_H5_B}, {"h5_c", STREAMED_SOUND_MISSION_H5_C}, + {"ammu_a", STREAMED_SOUND_MISSION_AMMU_A}, {"ammu_b", STREAMED_SOUND_MISSION_AMMU_B}, {"ammu_c", STREAMED_SOUND_MISSION_AMMU_C}, + {"door_1", STREAMED_SOUND_MISSION_DOOR_1}, {"door_2", STREAMED_SOUND_MISSION_DOOR_2}, {"door_3", STREAMED_SOUND_MISSION_DOOR_3}, + {"door_4", STREAMED_SOUND_MISSION_DOOR_4}, {"door_5", STREAMED_SOUND_MISSION_DOOR_5}, {"door_6", STREAMED_SOUND_MISSION_DOOR_6}, + {"t3_a", STREAMED_SOUND_MISSION_T3_A}, {"t3_b", STREAMED_SOUND_MISSION_T3_B}, {"t3_c", STREAMED_SOUND_MISSION_T3_C}, + {"k1_b", STREAMED_SOUND_MISSION_K1_B}, {"c_1", STREAMED_SOUND_MISSION_CAT1}}; + +int32 +FindMissionAudioSfx(const char *name) +{ + for (uint32 i = 0; i < ARRAY_SIZE(MissionAudioNameSfxAssoc); ++i) { + if (!CGeneral::faststricmp(MissionAudioNameSfxAssoc[i].m_pName, name)) + return MissionAudioNameSfxAssoc[i].m_nId; + } + debug("Can't find mission audio %s", name); + return NO_SAMPLE; +} + +bool +cAudioManager::MissionScriptAudioUsesPoliceChannel(int32 soundMission) const +{ + switch (soundMission) { + case STREAMED_SOUND_MISSION_J6_D: + case STREAMED_SOUND_MISSION_T4_A: + case STREAMED_SOUND_MISSION_S1_H: + case STREAMED_SOUND_MISSION_S3_B: + case STREAMED_SOUND_MISSION_EL3_A: + case STREAMED_SOUND_MISSION_A3_A: + case STREAMED_SOUND_MISSION_A5_A: + case STREAMED_SOUND_MISSION_K1_A: + case STREAMED_SOUND_MISSION_R1_A: + case STREAMED_SOUND_MISSION_R5_A: + case STREAMED_SOUND_MISSION_LO2_A: + case STREAMED_SOUND_MISSION_LO6_A: + return true; + default: + return false; + } +} + +void +cAudioManager::PreloadMissionAudio(const char *name) +{ + if (m_bIsInitialised) { + int32 missionAudioSfx = FindMissionAudioSfx(name); + if (missionAudioSfx != NO_SAMPLE) { + m_sMissionAudio.m_nSampleIndex = missionAudioSfx; + m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_NOT_LOADED; + m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_STOPPED; + m_sMissionAudio.field_22 = 0; + m_sMissionAudio.m_nMissionAudioCounter = m_nTimeSpent * SampleManager.GetStreamedFileLength(missionAudioSfx) / 1000; + m_sMissionAudio.m_nMissionAudioCounter *= 4; + m_sMissionAudio.m_bIsPlayed = false; + m_sMissionAudio.m_bPredefinedProperties = 1; + g_bMissionAudioLoadFailed = false; + } + } +} + +bool +cAudioManager::GetMissionAudioLoadingStatus() const +{ + if (m_bIsInitialised) + return m_sMissionAudio.m_nLoadingStatus; + + return true; +} + +void +cAudioManager::SetMissionAudioLocation(float x, float y, float z) +{ + if (m_bIsInitialised) { + m_sMissionAudio.m_bPredefinedProperties = false; + m_sMissionAudio.m_vecPos = CVector(x, y, z); + } +} + +void +cAudioManager::PlayLoadedMissionAudio() +{ + if (m_bIsInitialised && m_sMissionAudio.m_nSampleIndex != NO_SAMPLE && m_sMissionAudio.m_nLoadingStatus == LOADING_STATUS_LOADED && + !m_sMissionAudio.m_nPlayStatus) { + m_sMissionAudio.m_bIsPlayed = true; + } +} + +bool +cAudioManager::IsMissionAudioSampleFinished() +{ + if (m_bIsInitialised) + return m_sMissionAudio.m_nPlayStatus == PLAY_STATUS_FINISHED; + + static int32 cPretendFrame = 1; + + return (cPretendFrame++ & 63) == 0; +} + +void +cAudioManager::ClearMissionAudio() +{ + if (m_bIsInitialised) { + m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; + m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_NOT_LOADED; + m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_STOPPED; + m_sMissionAudio.field_22 = 0; + m_sMissionAudio.m_bIsPlayed = false; + m_sMissionAudio.m_bPredefinedProperties = 1; + m_sMissionAudio.m_nMissionAudioCounter = 0; + } +} + +void +cAudioManager::ProcessMissionAudio() +{ + float dist; + uint8 emittingVol; + uint8 pan; + float distSquared; + CVector vec; + + static uint8 nCheckPlayingDelay = 0; + static uint8 nFramesUntilFailedLoad = 0; + static uint8 nFramesForPretendPlaying = 0; + + if (m_bIsInitialised) { + if (m_sMissionAudio.m_nSampleIndex != NO_SAMPLE) { + switch (m_sMissionAudio.m_nLoadingStatus) { + case LOADING_STATUS_NOT_LOADED: + SampleManager.PreloadStreamedFile(m_sMissionAudio.m_nSampleIndex, 1); + m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_LOADED; + nFramesUntilFailedLoad = 0; + return; + case LOADING_STATUS_LOADED: + if (!m_sMissionAudio.m_bIsPlayed) + return; + if (g_bMissionAudioLoadFailed) { + if (m_bTimerJustReset) { + ClearMissionAudio(); + SampleManager.StopStreamedFile(1); + nFramesForPretendPlaying = 0; + nCheckPlayingDelay = 0; + nFramesUntilFailedLoad = 0; + } else if (!m_nUserPause) { + if (++nFramesForPretendPlaying < 120) { + m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_PLAYING; + } else { + m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED; + m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; + } + } + } else { + if (m_sMissionAudio.m_nPlayStatus) { + if (m_sMissionAudio.m_nPlayStatus != PLAY_STATUS_PLAYING) + return; + if (m_bTimerJustReset) { + ClearMissionAudio(); + SampleManager.StopStreamedFile(1); + return; + } + if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex)) { + if (!m_nUserPause) { + if (nCheckPlayingDelay) { + --nCheckPlayingDelay; + } else if (GetMissionScriptPoliceAudioPlayingStatus() == PLAY_STATUS_FINISHED || + m_sMissionAudio.m_nMissionAudioCounter-- == 0) { + m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED; + m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; + SampleManager.StopStreamedFile(1); + m_sMissionAudio.m_nMissionAudioCounter = 0; + } + } + } else if (m_sMissionAudio.field_22) { + if (SampleManager.IsStreamPlaying(1) || m_nUserPause || m_nPreviousUserPause) { + if (m_nUserPause) + SampleManager.PauseStream(1, 1); + else + SampleManager.PauseStream(0, 1); + } else { + m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED; + m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; + SampleManager.StopStreamedFile(1); + m_sMissionAudio.m_nMissionAudioCounter = 0; + } + } else { + if (m_nUserPause) + return; + if (nCheckPlayingDelay--) { + if (!SampleManager.IsStreamPlaying(1)) + return; + nCheckPlayingDelay = 0; + } + m_sMissionAudio.field_22 = 1; + } + } else { + if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex)) { + SetMissionScriptPoliceAudio(m_sMissionAudio.m_nSampleIndex); + } else { + if (m_nUserPause) + SampleManager.PauseStream(1, 1); + if (m_sMissionAudio.m_bPredefinedProperties) { + SampleManager.SetStreamedVolumeAndPan(80, 63, 1, 1); + } else { + distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos); + if (distSquared >= 2500.f) { + emittingVol = 0; + pan = 63; + } else { + dist = Sqrt(distSquared); + emittingVol = ComputeVolume(80, 50.0f, dist); + TranslateEntity(&m_sMissionAudio.m_vecPos, &vec); + pan = ComputePan(50.f, &vec); + } + SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, 1); + } + SampleManager.StartPreloadedStreamedFile(1); + } + m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_PLAYING; + nCheckPlayingDelay = 30; + } + } + break; + case 2: + if (++nFramesUntilFailedLoad >= 90) { + nFramesForPretendPlaying = 0; + g_bMissionAudioLoadFailed = true; + nFramesUntilFailedLoad = 0; + m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_LOADED; + } + return; + default: + return; + } + } + } +} +#pragma endregion All the mission audio stuff \ No newline at end of file diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index ec46aa53..eecc8e7d 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -3,301 +3,21 @@ #include "AudioManager.h" #include "audio_enums.h" -#include "Automobile.h" -#include "Boat.h" -#include "Bridge.h" -#include "Camera.h" -#include "Cranes.h" -#include "DMAudio.h" -#include "Entity.h" -#include "Explosion.h" -#include "Fire.h" -#include "Garages.h" -#include "General.h" -#include "HandlingMgr.h" -#include "Heli.h" -#include "ModelIndices.h" +#include "AudioScriptObject.h" #include "MusicManager.h" -#include "Pad.h" -#include "Ped.h" -#include "Physical.h" -#include "Placeable.h" -#include "Plane.h" -#include "PlayerPed.h" -#include "Pools.h" -#include "Projectile.h" -#include "ProjectileInfo.h" -#include "Replay.h" -#include "Stats.h" -#include "SurfaceTable.h" -#include "Train.h" -#include "Transmission.h" -#include "Vehicle.h" -#include "WaterCannon.h" -#include "Weather.h" -#include "ZoneCull.h" +#include "Timer.h" +#include "DMAudio.h" #include "sampman.h" +#include "Camera.h" +#include "World.h" cAudioManager AudioManager; -uint32 gPornNextTime; -uint32 gSawMillNextTime; -uint32 gShopNextTime; -uint32 gAirportNextTime; -uint32 gCinemaNextTime; -uint32 gDocksNextTime; -uint32 gHomeNextTime; -uint32 gCellNextTime; -uint32 gNextCryTime; -uint8 gJumboVolOffsetPercentage; -bool bPlayerJustEnteredCar; -bool g_bMissionAudioLoadFailed; const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); const int policeChannel = channels + 1; const int allChannels = channels + 2; const int maxVolume = 127; -const int scriptObjectIntensityS = 30; -const int scriptObjectIntensityL = 80; -const int bridgeIntensity = 400; -const int rocketLauncherIntensity = 90; -const int molotovIntensity = 30; -const int molotovVolume = 50; - -const int rainOnVehicleIntensity = 22; -const int reverseGearIntensity = 30; -const int engineDamageIntensity = 40; - -const bool hornPatternsArray[8][44] = { - {false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, - false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false}, - {false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, - true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false}, - {false, false, true, true, true, true, true, true, true, true, true, true, false, false, false, false, true, true, true, true, true, false, - false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false}, - {false, false, true, true, true, true, true, false, false, true, true, true, true, true, false, false, false, true, true, true, true, true, - true, true, true, true, true, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, false}, - {false, false, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false}, - {false, false, true, true, true, false, false, false, true, true, true, false, false, false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false}, - {false, false, true, true, true, true, false, false, false, false, true, true, true, false, false, true, true, true, false, false, true, true, - true, true, true, true, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, false, false}, - {false, false, true, true, true, true, false, false, true, true, true, true, true, false, false, false, true, true, true, true, true, true, - false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false}, -}; - -const int totalAudioEntitiesSlots = 200; - -const uint8 panTable[64]{0, 3, 8, 12, 16, 19, 22, 24, 26, 28, 30, 31, 33, 34, 36, 37, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 53, - 54, 55, 55, 56, 56, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63}; - -// TODO: where is this used? Is this the right file? -enum eVehicleModel { - LANDSTAL, - IDAHO, - STINGER, - LINERUN, - PEREN, - SENTINEL, - PATRIOT, - FIRETRUK, - TRASH, - STRETCH, - MANANA, - INFERNUS, - BLISTA, - PONY, - MULE, - CHEETAH, - AMBULAN, - FBICAR, - MOONBEAM, - ESPERANT, - TAXI, - KURUMA, - BOBCAT, - MRWHOOP, - BFINJECT, - CORPSE, - POLICE, - ENFORCER, - SECURICA, - BANSHEE, - PREDATOR, - BUS, - RHINO, - BARRACKS, - TRAIN, - CHOPPER, - DODO, - COACH, - CABBIE, - STALLION, - RUMPO, - RCBANDIT, - BELLYUP, - MRWONGS, - MAFIA, - YARDIE, - YAKUZA, - DIABLOS, - COLUMB, - HOODS, - AIRTRAIN, - DEADDODO, - SPEEDER, - REEFER, - PANLANT, - FLATBED, - YANKEE, - ESCAPE, - BORGNINE, - TOYZ, - GHOST, - CAR151, - CAR152, - CAR153, - CAR154, - CAR155, - CAR156, - CAR157, - CAR158, - CAR159, -}; - -enum PLAY_STATUS : uint8 { PLAY_STATUS_STOPPED = 0, PLAY_STATUS_PLAYING = 1, PLAY_STATUS_FINISHED = 2 }; - -enum LOADING_STATUS : uint8 { LOADING_STATUS_NOT_LOADED = 0, LOADING_STATUS_LOADED = 1 }; - -cPedComments::cPedComments() -{ - for (int i = 0; i < NUM_PED_COMMENTS_SLOTS; i++) - for (int j = 0; j < NUM_PED_COMMENTS_BANKS; j++) { - m_asPedComments[j][i].m_nProcess = -1; - m_nIndexMap[j][i] = NUM_PED_COMMENTS_SLOTS; - } - - for (int i = 0; i < NUM_PED_COMMENTS_BANKS; i++) - m_nCommentsInBank[i] = 0; - m_nActiveBank = 0; -} - -void -cPedComments::Add(tPedComment *com) -{ - uint8 index; - - if (m_nCommentsInBank[m_nActiveBank] >= NUM_PED_COMMENTS_SLOTS) { - index = m_nIndexMap[m_nActiveBank][NUM_PED_COMMENTS_SLOTS - 1]; - if (m_asPedComments[m_nActiveBank][index].m_bVolume > com->m_bVolume) - return; - } else { - index = m_nCommentsInBank[m_nActiveBank]++; - } - - m_asPedComments[m_nActiveBank][index].m_nSampleIndex = com->m_nSampleIndex; - m_asPedComments[m_nActiveBank][index].m_nEntityIndex = com->m_nEntityIndex; - m_asPedComments[m_nActiveBank][index].m_vecPos = com->m_vecPos; - m_asPedComments[m_nActiveBank][index].m_fDistance = com->m_fDistance; - m_asPedComments[m_nActiveBank][index].m_bVolume = com->m_bVolume; - - uint32 i = 0; - if (index != 0) { - for (i = 0; i < index; i++) { - if (m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][i]].m_bVolume < m_asPedComments[m_nActiveBank][index].m_bVolume) { - break; - } - } - - if (i < index) - memmove(&m_nIndexMap[m_nActiveBank][i + 1], &m_nIndexMap[m_nActiveBank][i], NUM_PED_COMMENTS_SLOTS - 1 - i); - } - - m_nIndexMap[m_nActiveBank][i] = index; -} - -void -cPedComments::Process() -{ - int sampleIndex; - uint8 actualUsedBank; - tPedComment *comment; - - static const int defaultIntensity = 50; - static const int policeHeliIntensity = 400; - - if (!AudioManager.m_nUserPause) { - if (m_nCommentsInBank[m_nActiveBank]) { - sampleIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nSampleIndex; - if (!SampleManager.IsPedCommentLoaded(sampleIndex)) - SampleManager.LoadPedComment(sampleIndex); - - AudioManager.m_sQueueSample.m_nEntityIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nEntityIndex; - AudioManager.m_sQueueSample.m_nCounter = 0; - AudioManager.m_sQueueSample.m_nSampleIndex = sampleIndex; - AudioManager.m_sQueueSample.m_nBankIndex = SAMPLEBANK_PED; - AudioManager.m_sQueueSample.m_nReleasingVolumeModificator = 3; - AudioManager.m_sQueueSample.m_nVolume = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_bVolume; - AudioManager.m_sQueueSample.m_fDistance = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_fDistance; - AudioManager.m_sQueueSample.m_nLoopCount = 1; - AudioManager.m_sQueueSample.m_nLoopStart = 0; - AudioManager.m_sQueueSample.m_nLoopEnd = -1; - AudioManager.m_sQueueSample.m_nEmittingVolume = maxVolume; - AudioManager.m_sQueueSample.m_fSpeedMultiplier = 3.0f; - switch (sampleIndex) { - case SFX_POLICE_HELI_1: - case SFX_POLICE_HELI_2: - case SFX_POLICE_HELI_3: - AudioManager.m_sQueueSample.m_fSoundIntensity = policeHeliIntensity; - break; - default: - AudioManager.m_sQueueSample.m_fSoundIntensity = defaultIntensity; - break; - } - AudioManager.m_sQueueSample.m_bReleasingSoundFlag = true; - AudioManager.m_sQueueSample.m_vecPos = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_vecPos; - - if (sampleIndex >= SFX_AMMU_D && sampleIndex <= SFX_AMMU_F) { - AudioManager.m_sQueueSample.m_bReverbFlag = false; - AudioManager.m_sQueueSample.m_bRequireReflection = false; - } else { - AudioManager.m_sQueueSample.m_bReverbFlag = true; - AudioManager.m_sQueueSample.m_bRequireReflection = true; - } - - AudioManager.m_sQueueSample.m_bIs2D = false; - AudioManager.m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AudioManager.m_sQueueSample.m_nSampleIndex) + AudioManager.RandomDisplacement(750); - if (CTimer::GetIsSlowMotionActive()) - AudioManager.m_sQueueSample.m_nFrequency /= 2; - m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nProcess = -1; - AudioManager.AddSampleToRequestedQueue(); - } - - // Switch bank - if (m_nActiveBank) { - actualUsedBank = SAMPLEBANK_PED; - m_nActiveBank = SAMPLEBANK_MAIN; - } else { - actualUsedBank = SAMPLEBANK_MAIN; - m_nActiveBank = SAMPLEBANK_PED; - } - comment = m_asPedComments[actualUsedBank]; - for (uint32 i = 0; i < m_nCommentsInBank[actualUsedBank]; i++) { - if (m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess > 0) { - --m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess; - Add(&comment[m_nIndexMap[actualUsedBank][i]]); - } - } - - for (uint32 i = 0; i < NUM_PED_COMMENTS_SLOTS; i++) { - m_nIndexMap[actualUsedBank][i] = NUM_PED_COMMENTS_SLOTS; - } - m_nCommentsInBank[actualUsedBank] = 0; - } -} - cAudioManager::cAudioManager() { m_bIsInitialised = false; @@ -331,6 +51,536 @@ cAudioManager::~cAudioManager() Terminate(); } +void +cAudioManager::Initialise() +{ + if (!m_bIsInitialised) { + PreInitialiseGameSpecificSetup(); + m_bIsInitialised = SampleManager.Initialise(); + if (m_bIsInitialised) { + m_nActiveSamples = SampleManager.GetMaximumSupportedChannels(); + if (m_nActiveSamples <= 1) { + Terminate(); + } else { + --m_nActiveSamples; + PostInitialiseGameSpecificSetup(); + InitialisePoliceRadioZones(); + InitialisePoliceRadio(); + MusicManager.Initialise(); + } + } + } +} + +void +cAudioManager::Terminate() +{ + if (m_bIsInitialised) { + MusicManager.Terminate(); + + for (uint32 i = 0; i < NUM_AUDIOENTITIES; i++) { + m_asAudioEntities[i].m_bIsUsed = false; + m_anAudioEntityIndices[i] = ARRAY_SIZE(m_anAudioEntityIndices); + } + + m_nAudioEntitiesTotal = 0; + m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0; + PreTerminateGameSpecificShutdown(); + + for (uint32 i = 0; i < MAX_SAMPLEBANKS; i++) { + if (SampleManager.IsSampleBankLoaded(i)) + SampleManager.UnloadSampleBank(i); + } + + SampleManager.Terminate(); + + m_bIsInitialised = false; + PostTerminateGameSpecificShutdown(); + } +} + +void +cAudioManager::Service() +{ + GenerateIntegerRandomNumberTable(); + if (m_bTimerJustReset) { + ResetAudioLogicTimers(m_nTimer); + MusicManager.ResetTimers(m_nTimer); + m_bTimerJustReset = false; + } + if (m_bIsInitialised) { + m_nPreviousUserPause = m_nUserPause; + m_nUserPause = CTimer::GetIsUserPaused(); + UpdateReflections(); + ServiceSoundEffects(); + MusicManager.Service(); + } +} + +int32 +cAudioManager::CreateEntity(eAudioType type, void *entity) +{ + if (!m_bIsInitialised) + return AEHANDLE_ERROR_NOAUDIOSYS; + if (!entity) + return AEHANDLE_ERROR_NOENTITY; + if (type >= TOTAL_AUDIO_TYPES) + return AEHANDLE_ERROR_BADAUDIOTYPE; + for (uint32 i = 0; i < ARRAY_SIZE(m_asAudioEntities); i++) { + if (!m_asAudioEntities[i].m_bIsUsed) { + m_asAudioEntities[i].m_bIsUsed = true; + m_asAudioEntities[i].m_nStatus = 0; + m_asAudioEntities[i].m_nType = type; + m_asAudioEntities[i].m_pEntity = entity; + m_asAudioEntities[i].m_awAudioEvent[0] = SOUND_NO_SOUND; + m_asAudioEntities[i].m_awAudioEvent[1] = SOUND_NO_SOUND; + m_asAudioEntities[i].m_awAudioEvent[2] = SOUND_NO_SOUND; + m_asAudioEntities[i].m_awAudioEvent[3] = SOUND_NO_SOUND; + m_asAudioEntities[i].m_AudioEvents = 0; + m_anAudioEntityIndices[m_nAudioEntitiesTotal++] = i; + return i; + } + } + return AEHANDLE_ERROR_NOFREESLOT; +} + +void +cAudioManager::DestroyEntity(int32 id) +{ + if (m_bIsInitialised && id >= 0 && id < NUM_AUDIOENTITIES && m_asAudioEntities[id].m_bIsUsed) { + m_asAudioEntities[id].m_bIsUsed = false; + for (int32 i = 0; i < m_nAudioEntitiesTotal; ++i) { + if (id == m_anAudioEntityIndices[i]) { + if (i < NUM_AUDIOENTITIES - 1) + memmove(&m_anAudioEntityIndices[i], &m_anAudioEntityIndices[i + 1], NUM_AUDIOENTITY_EVENTS * (m_nAudioEntitiesTotal - (i + 1))); + m_anAudioEntityIndices[--m_nAudioEntitiesTotal] = NUM_AUDIOENTITIES; + return; + } + } + } +} + +void +cAudioManager::SetEntityStatus(int32 id, uint8 status) +{ + if (m_bIsInitialised && id >= 0 && id < NUM_AUDIOENTITIES && m_asAudioEntities[id].m_bIsUsed) + m_asAudioEntities[id].m_nStatus = status; +} + +void +cAudioManager::PlayOneShot(int32 index, int16 sound, float vol) +{ + static const uint8 OneShotPriority[] = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 3, 5, 2, 2, 1, 1, 3, 1, 3, 3, 1, 1, 1, 4, 4, 3, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 3, 2, 2, 2, 2, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 3, 1, 1, 1, 9, + 2, 2, 0, 0, 0, 0, 3, 3, 5, 1, 1, 1, 1, 3, 4, 7, 6, 6, 6, 6, 1, 3, 4, 3, 4, 2, 1, 3, 5, 4, 6, 6, 1, 3, + 1, 1, 1, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + + if (m_bIsInitialised) { + if (index >= 0 && index < NUM_AUDIOENTITIES) { + tAudioEntity &entity = m_asAudioEntities[index]; + if (entity.m_bIsUsed) { + if (sound < SOUND_TOTAL_SOUNDS) { + if (entity.m_nType == AUDIOTYPE_SCRIPTOBJECT) { + if (m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal < ARRAY_SIZE(m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices)) { + entity.m_awAudioEvent[0] = sound; + entity.m_AudioEvents = 1; + m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal++] = index; + } + } else { + int32 i = 0; + while (true) { + if (i >= entity.m_AudioEvents) { + if (entity.m_AudioEvents < ARRAY_SIZE(entity.m_awAudioEvent)) { + entity.m_awAudioEvent[i] = sound; + entity.m_afVolume[i] = vol; + ++entity.m_AudioEvents; + } + return; + } + if (OneShotPriority[entity.m_awAudioEvent[i]] > OneShotPriority[sound]) + break; + ++i; + } + if (i < NUM_AUDIOENTITY_EVENTS - 1) { + memmove(&entity.m_awAudioEvent[i + 1], &entity.m_awAudioEvent[i], (NUM_AUDIOENTITY_EVENTS - 1 - i) * NUM_AUDIOENTITY_EVENTS / 2); + memmove(&entity.m_afVolume[i + 1], &entity.m_afVolume[i], (NUM_AUDIOENTITY_EVENTS - 1 - i) * NUM_AUDIOENTITY_EVENTS); + } + entity.m_awAudioEvent[i] = sound; + entity.m_afVolume[i] = vol; + if (entity.m_AudioEvents < ARRAY_SIZE(entity.m_awAudioEvent)) + ++entity.m_AudioEvents; + } + } + } + } + } +} + +void +cAudioManager::SetEffectsMasterVolume(uint8 volume) const +{ + SampleManager.SetEffectsMasterVolume(volume); +} + +void +cAudioManager::SetMusicMasterVolume(uint8 volume) const +{ + SampleManager.SetMusicMasterVolume(volume); +} + +void +cAudioManager::SetEffectsFadeVol(uint8 volume) const +{ + SampleManager.SetEffectsFadeVolume(volume); +} + +void +cAudioManager::SetMusicFadeVol(uint8 volume) const +{ + SampleManager.SetMusicFadeVolume(volume); +} + +void +cAudioManager::ResetTimers(uint32 time) +{ + if (m_bIsInitialised) { + m_bTimerJustReset = true; + m_nTimer = time; + ClearRequestedQueue(); + if (m_nActiveSampleQueue) { + m_nActiveSampleQueue = 0; + ClearRequestedQueue(); + m_nActiveSampleQueue = 1; + } else { + m_nActiveSampleQueue = 1; + ClearRequestedQueue(); + m_nActiveSampleQueue = 0; + } + ClearActiveSamples(); + ClearMissionAudio(); + SampleManager.StopChannel(policeChannel); + SampleManager.SetEffectsFadeVolume(0); + SampleManager.SetMusicFadeVolume(0); + MusicManager.ResetMusicAfterReload(); +#ifdef AUDIO_OAL + SampleManager.Service(); +#endif + } +} + +void +cAudioManager::DestroyAllGameCreatedEntities() +{ + cAudioScriptObject *entity; + + if (m_bIsInitialised) { + for (uint32 i = 0; i < ARRAY_SIZE(m_asAudioEntities); i++) { + if (m_asAudioEntities[i].m_bIsUsed) { + switch (m_asAudioEntities[i].m_nType) { + case AUDIOTYPE_PHYSICAL: + case AUDIOTYPE_EXPLOSION: + case AUDIOTYPE_WEATHER: + case AUDIOTYPE_CRANE: + case AUDIOTYPE_GARAGE: + case AUDIOTYPE_FIREHYDRANT: + DestroyEntity(i); + break; + case AUDIOTYPE_SCRIPTOBJECT: + entity = (cAudioScriptObject *)m_asAudioEntities[i].m_pEntity; + if (entity) { + delete entity; + m_asAudioEntities[i].m_pEntity = nil; + } + DestroyEntity(i); + break; + default: + break; + } + } + } + m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0; + } +} + +uint8 +cAudioManager::GetNum3DProvidersAvailable() const +{ + if (m_bIsInitialised) + return SampleManager.GetNum3DProvidersAvailable(); + return 0; +} + +char * +cAudioManager::Get3DProviderName(uint8 id) const +{ + if (!m_bIsInitialised) + return nil; + if (id >= SampleManager.GetNum3DProvidersAvailable()) + return nil; + return SampleManager.Get3DProviderName(id); +} + +int8 +cAudioManager::GetCurrent3DProviderIndex() const +{ + if (m_bIsInitialised) + return SampleManager.GetCurrent3DProviderIndex(); + + return -1; +} + +int8 +cAudioManager::SetCurrent3DProvider(uint8 which) +{ + if (!m_bIsInitialised) + return -1; + for (uint8 i = 0; i < m_nActiveSamples + 1; ++i) + SampleManager.StopChannel(i); + ClearRequestedQueue(); + if (m_nActiveSampleQueue == 0) + m_nActiveSampleQueue = 1; + else + m_nActiveSampleQueue = 0; + ClearRequestedQueue(); + ClearActiveSamples(); + int8 current = SampleManager.SetCurrent3DProvider(which); + if (current > 0) { + m_nActiveSamples = SampleManager.GetMaximumSupportedChannels(); + if (m_nActiveSamples > 1) + --m_nActiveSamples; + } + return current; +} + +void +cAudioManager::SetSpeakerConfig(int32 conf) const +{ + SampleManager.SetSpeakerConfig(conf); +} + +bool +cAudioManager::IsMP3RadioChannelAvailable() const +{ + if (m_bIsInitialised) + return SampleManager.IsMP3RadioChannelAvailable(); + + return false; +} + +void +cAudioManager::ReleaseDigitalHandle() const +{ + if (m_bIsInitialised) { + SampleManager.ReleaseDigitalHandle(); + } +} + +void +cAudioManager::ReacquireDigitalHandle() const +{ + if (m_bIsInitialised) { + SampleManager.ReacquireDigitalHandle(); + } +} + +void +cAudioManager::SetDynamicAcousticModelingStatus(bool status) +{ + m_bDynamicAcousticModelingStatus = status; +} + +bool +cAudioManager::CheckForAnAudioFileOnCD() const +{ + return SampleManager.CheckForAnAudioFileOnCD(); +} + +uint8 +cAudioManager::GetCDAudioDriveLetter() const +{ + if (m_bIsInitialised) + return SampleManager.GetCDAudioDriveLetter(); + + return 0; +} + +bool +cAudioManager::IsAudioInitialised() const +{ + return m_bIsInitialised; +} + +void +cAudioManager::ServiceSoundEffects() +{ + m_bFifthFrameFlag = (m_FrameCounter++ % 5) == 0; + if (m_nUserPause && !m_nPreviousUserPause) { + for (int32 i = 0; i < allChannels; i++) + SampleManager.StopChannel(i); + + ClearRequestedQueue(); + if (m_nActiveSampleQueue) { + m_nActiveSampleQueue = 0; + ClearRequestedQueue(); + m_nActiveSampleQueue = 1; + } else { + m_nActiveSampleQueue = 1; + ClearRequestedQueue(); + m_nActiveSampleQueue = 0; + } + ClearActiveSamples(); + } + m_nActiveSampleQueue = m_nActiveSampleQueue != 1; + ProcessReverb(); + ProcessSpecial(); + ClearRequestedQueue(); + InterrogateAudioEntities(); + m_sPedComments.Process(); + ServicePoliceRadio(); + ServiceCollisions(); + AddReleasingSounds(); + ProcessMissionAudio(); +#ifdef GTA_PC + AdjustSamplesVolume(); +#endif + ProcessActiveQueues(); +#ifdef AUDIO_OAL + SampleManager.Service(); +#endif + for (int32 i = 0; i < m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal; ++i) { + cAudioScriptObject *object = (cAudioScriptObject *)m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]].m_pEntity; + delete object; + m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]].m_pEntity = nil; + DestroyEntity(m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]); + } + m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0; +} + +uint8 +cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const +{ + float newSoundIntensity; + if (soundIntensity <= 0.0f) + return 0; + newSoundIntensity = soundIntensity / 5.0f; + if (newSoundIntensity <= distance) + emittingVolume = sq((soundIntensity - newSoundIntensity - (distance - newSoundIntensity)) / (soundIntensity - newSoundIntensity)) * emittingVolume; + return emittingVolume; +} + +void +cAudioManager::TranslateEntity(Const CVector *in, CVector *out) const +{ + *out = MultiplyInverse(TheCamera.GetMatrix(), *in); +} + +int32 +cAudioManager::ComputePan(float dist, CVector *vec) +{ + const uint8 PanTable[64] = {0, 3, 8, 12, 16, 19, 22, 24, 26, 28, 30, 31, 33, 34, 36, 37, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 53, + 54, 55, 55, 56, 56, 57, 57, 58, 58, 58, 59, 59, 59, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63}; + + int32 index = Min(63, Abs(vec->x / (dist / 64.f))); + + if (vec->x > 0.f) + return Max(20, 63 - PanTable[index]); + return Min(107, PanTable[index] + 63); +} + +int32 +cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier) const +{ + uint32 newFreq = oldFreq; + if (!TheCamera.Get_Just_Switched_Status() && speedMultiplier != 0.0f) { + float dist = position2 - position1; + if (dist != 0.0f) { + float speedOfSource = (dist / m_nTimeSpent) * speedMultiplier; + if (m_fSpeedOfSound > Abs(speedOfSource)) { + if (speedOfSource < 0.0f) { + speedOfSource = Max(speedOfSource, -1.5f); + } else { + speedOfSource = Min(speedOfSource, 1.5f); + } + newFreq = (oldFreq * m_fSpeedOfSound) / (speedOfSource + m_fSpeedOfSound); + } + } + } + return newFreq; +} + +int32 +cAudioManager::RandomDisplacement(uint32 seed) const +{ + int32 value; + + static bool bIsEven = true; + static uint32 base = 0; + + if (!seed) + return 0; + + value = m_anRandomTable[(base + seed) % 5] % seed; + base += value; + + if (value % 2) { + bIsEven = !bIsEven; + } + if (!bIsEven) + value = -value; + return value; +} + +void +cAudioManager::InterrogateAudioEntities() +{ + for (int32 i = 0; i < m_nAudioEntitiesTotal; i++) { + ProcessEntity(m_anAudioEntityIndices[i]); + m_asAudioEntities[m_anAudioEntityIndices[i]].m_AudioEvents = 0; + } +} + +void +cAudioManager::AddSampleToRequestedQueue() +{ + int32 calculatedVolume; + uint8 sampleIndex; + bool bReflections; + + if (m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) { + calculatedVolume = m_sQueueSample.m_nReleasingVolumeModificator * (maxVolume - m_sQueueSample.m_nVolume); + sampleIndex = m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; + if (sampleIndex >= m_nActiveSamples) { + sampleIndex = m_abSampleQueueIndexTable[m_nActiveSampleQueue][m_nActiveSamples - 1]; + if (m_asSamples[m_nActiveSampleQueue][sampleIndex].m_nCalculatedVolume <= calculatedVolume) + return; + } else { + ++m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; + } + m_sQueueSample.m_nCalculatedVolume = calculatedVolume; + m_sQueueSample.m_bLoopEnded = false; + if (m_sQueueSample.m_bIs2D) { + m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_nLoopsRemaining = 0; + } + if (m_bDynamicAcousticModelingStatus && m_sQueueSample.m_nLoopCount) { + bReflections = m_sQueueSample.m_bRequireReflection; + } else { + bReflections = false; + m_sQueueSample.m_nLoopsRemaining = 0; + } + m_sQueueSample.m_bRequireReflection = false; + + if (!m_bDynamicAcousticModelingStatus) + m_sQueueSample.m_bReverbFlag = false; + + m_asSamples[m_nActiveSampleQueue][sampleIndex] = m_sQueueSample; + + AddDetailsToRequestedOrderList(sampleIndex); + if (bReflections) + AddReflectionsToRequestedQueue(); + } +} void cAudioManager::AddDetailsToRequestedOrderList(uint8 sample) { @@ -348,35 +598,6 @@ cAudioManager::AddDetailsToRequestedOrderList(uint8 sample) m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample; } -void -cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1, uint8 counter, bool notLooping) -{ - m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, 50.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = counter; - m_sQueueSample.m_nSampleIndex = sample; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 0; - m_sQueueSample.m_nFrequency = freq; - if (notLooping) { - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nReleasingVolumeDivider = 8; - } else { - m_sQueueSample.m_nLoopCount = 1; - } - m_sQueueSample.m_nEmittingVolume = emittingVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 6.0f; - m_sQueueSample.m_fSoundIntensity = 50.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } -} - void cAudioManager::AddReflectionsToRequestedQueue() { @@ -410,6 +631,51 @@ cAudioManager::AddReflectionsToRequestedQueue() } } +void +cAudioManager::UpdateReflections() +{ + const CVector &camPos = TheCamera.GetPosition(); + CColPoint colpoint; + CEntity *ent; + + if (m_FrameCounter % 8 == 0) { + m_avecReflectionsPos[0] = camPos; + m_avecReflectionsPos[0].y += 50.f; + if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[0], colpoint, ent, true, false, false, true, false, true, true)) + m_afReflectionsDistances[0] = Distance(camPos, colpoint.point); + else + m_afReflectionsDistances[0] = 50.0f; + } else if ((m_FrameCounter + 1) % 8 == 0) { + m_avecReflectionsPos[1] = camPos; + m_avecReflectionsPos[1].y -= 50.0f; + if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[1], colpoint, ent, true, false, false, true, false, true, true)) + m_afReflectionsDistances[1] = Distance(camPos, colpoint.point); + else + m_afReflectionsDistances[1] = 50.0f; + } else if ((m_FrameCounter + 2) % 8 == 0) { + m_avecReflectionsPos[2] = camPos; + m_avecReflectionsPos[2].x -= 50.0f; + if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[2], colpoint, ent, true, false, false, true, false, true, true)) + m_afReflectionsDistances[2] = Distance(camPos, colpoint.point); + else + m_afReflectionsDistances[2] = 50.0f; + } else if ((m_FrameCounter + 3) % 8 == 0) { + m_avecReflectionsPos[3] = camPos; + m_avecReflectionsPos[3].x += 50.0f; + if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[3], colpoint, ent, true, false, false, true, false, true, true)) + m_afReflectionsDistances[3] = Distance(camPos, colpoint.point); + else + m_afReflectionsDistances[3] = 50.0f; + } else if ((m_FrameCounter + 4) % 8 == 0) { + m_avecReflectionsPos[4] = camPos; + m_avecReflectionsPos[4].z += 50.0f; + if (CWorld::ProcessVerticalLine(camPos, m_avecReflectionsPos[4].z, colpoint, ent, true, false, false, false, true, false, nil)) + m_afReflectionsDistances[4] = colpoint.point.z - camPos.z; + else + m_afReflectionsDistances[4] = 50.0f; + } +} + void cAudioManager::AddReleasingSounds() { @@ -459,3064 +725,6 @@ cAudioManager::AddReleasingSounds() } } -void -cAudioManager::AddSampleToRequestedQueue() -{ - int32 calculatedVolume; - uint8 sampleIndex; - bool bReflections; - - if (m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) { - calculatedVolume = m_sQueueSample.m_nReleasingVolumeModificator * (maxVolume - m_sQueueSample.m_nVolume); - sampleIndex = m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; - if (sampleIndex >= m_nActiveSamples) { - sampleIndex = m_abSampleQueueIndexTable[m_nActiveSampleQueue][m_nActiveSamples - 1]; - if (m_asSamples[m_nActiveSampleQueue][sampleIndex].m_nCalculatedVolume <= calculatedVolume) - return; - } else { - ++m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; - } - m_sQueueSample.m_nCalculatedVolume = calculatedVolume; - m_sQueueSample.m_bLoopEnded = false; - if (m_sQueueSample.m_bIs2D) { - m_sQueueSample.m_bRequireReflection = false; - m_sQueueSample.m_nLoopsRemaining = 0; - } - if (m_bDynamicAcousticModelingStatus && m_sQueueSample.m_nLoopCount) { - bReflections = m_sQueueSample.m_bRequireReflection; - } else { - bReflections = false; - m_sQueueSample.m_nLoopsRemaining = 0; - } - m_sQueueSample.m_bRequireReflection = false; - - if (!m_bDynamicAcousticModelingStatus) - m_sQueueSample.m_bReverbFlag = false; - - m_asSamples[m_nActiveSampleQueue][sampleIndex] = m_sQueueSample; - - AddDetailsToRequestedOrderList(sampleIndex); - if (bReflections) - AddReflectionsToRequestedQueue(); - } -} - -void -cAudioManager::CalculateDistance(bool &distCalculated, float dist) -{ - if (!distCalculated) { - m_sQueueSample.m_fDistance = Sqrt(dist); - distCalculated = true; - } -} - -bool -cAudioManager::CheckForAnAudioFileOnCD() const -{ - return SampleManager.CheckForAnAudioFileOnCD(); -} - -void -cAudioManager::ClearActiveSamples() -{ - for (int32 i = 0; i < m_nActiveSamples; i++) { - m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE; - m_asActiveSamples[i].m_nCounter = 0; - m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE; - m_asActiveSamples[i].m_nBankIndex = SAMPLEBANK_INVALID; - m_asActiveSamples[i].m_bIs2D = false; - m_asActiveSamples[i].m_nReleasingVolumeModificator = 5; - m_asActiveSamples[i].m_nFrequency = 0; - m_asActiveSamples[i].m_nVolume = 0; - m_asActiveSamples[i].m_nEmittingVolume = 0; - m_asActiveSamples[i].m_fDistance = 0.0f; - m_asActiveSamples[i].m_bIsProcessed = false; - m_asActiveSamples[i].m_bLoopEnded = false; - m_asActiveSamples[i].m_nLoopCount = 1; - m_asActiveSamples[i].m_nLoopStart = 0; - m_asActiveSamples[i].m_nLoopEnd = -1; - m_asActiveSamples[i].m_fSpeedMultiplier = 0.0f; - m_asActiveSamples[i].m_fSoundIntensity = 200.0f; - m_asActiveSamples[i].m_nOffset = 63; - m_asActiveSamples[i].m_bReleasingSoundFlag = false; - m_asActiveSamples[i].m_nCalculatedVolume = 0; - m_asActiveSamples[i].m_nReleasingVolumeDivider = 0; - m_asActiveSamples[i].m_nVolumeChange = -1; - m_asActiveSamples[i].m_vecPos = {0.0f, 0.0f, 0.0f}; - m_asActiveSamples[i].m_bReverbFlag = false; - m_asActiveSamples[i].m_nLoopsRemaining = 0; - m_asActiveSamples[i].m_bRequireReflection = false; - } -} - -void -cAudioManager::ClearMissionAudio() -{ - if (m_bIsInitialised) { - m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; - m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_NOT_LOADED; - m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_STOPPED; - m_sMissionAudio.field_22 = 0; - m_sMissionAudio.m_bIsPlayed = false; - m_sMissionAudio.m_bPredefinedProperties = 1; - m_sMissionAudio.m_nMissionAudioCounter = 0; - } -} - -void -cAudioManager::ClearRequestedQueue() -{ - for (int32 i = 0; i < m_nActiveSamples; i++) { - m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = m_nActiveSamples; - } - m_SampleRequestQueuesStatus[m_nActiveSampleQueue] = 0; -} - -int32 -cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier) const -{ - uint32 newFreq = oldFreq; - if (!TheCamera.Get_Just_Switched_Status() && speedMultiplier != 0.0f) { - float dist = position2 - position1; - if (dist != 0.0f) { - float speedOfSource = (dist / m_nTimeSpent) * speedMultiplier; - if (m_fSpeedOfSound > Abs(speedOfSource)) { - if (speedOfSource < 0.0f) { - speedOfSource = Max(speedOfSource, -1.5f); - } else { - speedOfSource = Min(speedOfSource, 1.5f); - } - newFreq = (oldFreq * m_fSpeedOfSound) / (speedOfSource + m_fSpeedOfSound); - } - } - } - return newFreq; -} - -int32 -cAudioManager::ComputePan(float dist, CVector *vec) -{ - int32 index = Min(63, Abs(vec->x / (dist / 64.f))); - - if (vec->x > 0.f) - return Max(20, 63 - panTable[index]); - return Min(107, panTable[index] + 63); -} - -uint8 -cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const -{ - float newSoundIntensity; - if (soundIntensity <= 0.0f) - return 0; - newSoundIntensity = soundIntensity / 5.0f; - if (newSoundIntensity <= distance) - emittingVolume = sq((soundIntensity - newSoundIntensity - (distance - newSoundIntensity)) / (soundIntensity - newSoundIntensity)) * emittingVolume; - return emittingVolume; -} - -int32 -cAudioManager::CreateEntity(int32 type, void *entity) -{ - if (!m_bIsInitialised) - return AEHANDLE_ERROR_NOAUDIOSYS; - if (!entity) - return AEHANDLE_ERROR_NOENTITY; - if (type >= TOTAL_AUDIO_TYPES) - return AEHANDLE_ERROR_BADAUDIOTYPE; - for (uint32 i = 0; i < ARRAY_SIZE(m_asAudioEntities); i++) { - if (!m_asAudioEntities[i].m_bIsUsed) { - m_asAudioEntities[i].m_bIsUsed = true; - m_asAudioEntities[i].m_nStatus = 0; - m_asAudioEntities[i].m_nType = (eAudioType)type; - m_asAudioEntities[i].m_pEntity = entity; - m_asAudioEntities[i].m_awAudioEvent[0] = SOUND_NO_SOUND; - m_asAudioEntities[i].m_awAudioEvent[1] = SOUND_NO_SOUND; - m_asAudioEntities[i].m_awAudioEvent[2] = SOUND_NO_SOUND; - m_asAudioEntities[i].m_awAudioEvent[3] = SOUND_NO_SOUND; - m_asAudioEntities[i].m_AudioEvents = 0; - m_anAudioEntityIndices[m_nAudioEntitiesTotal++] = i; - return i; - } - } - return AEHANDLE_ERROR_NOFREESLOT; -} - -void -cAudioManager::DestroyAllGameCreatedEntities() -{ - cAudioScriptObject *entity; - - if (m_bIsInitialised) { - for (uint32 i = 0; i < ARRAY_SIZE(m_asAudioEntities); i++) { - if (m_asAudioEntities[i].m_bIsUsed) { - switch (m_asAudioEntities[i].m_nType) { - case AUDIOTYPE_PHYSICAL: - case AUDIOTYPE_EXPLOSION: - case AUDIOTYPE_WEATHER: - case AUDIOTYPE_CRANE: - case AUDIOTYPE_GARAGE: - case AUDIOTYPE_FIREHYDRANT: - DestroyEntity(i); - break; - case AUDIOTYPE_SCRIPTOBJECT: - entity = (cAudioScriptObject *)m_asAudioEntities[i].m_pEntity; - if (entity) { - delete entity; - m_asAudioEntities[i].m_pEntity = nil; - } - DestroyEntity(i); - break; - default: - break; - } - } - } - m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0; - } -} - -void -cAudioManager::DestroyEntity(int32 id) -{ - if (m_bIsInitialised && id >= 0 && id < totalAudioEntitiesSlots && m_asAudioEntities[id].m_bIsUsed) { - m_asAudioEntities[id].m_bIsUsed = false; - for (int32 i = 0; i < m_nAudioEntitiesTotal; ++i) { - if (id == m_anAudioEntityIndices[i]) { - if (i < totalAudioEntitiesSlots - 1) - memmove(&m_anAudioEntityIndices[i], &m_anAudioEntityIndices[i + 1], NUM_AUDIOENTITY_EVENTS * (m_nAudioEntitiesTotal - (i + 1))); - m_anAudioEntityIndices[--m_nAudioEntitiesTotal] = totalAudioEntitiesSlots; - return; - } - } - } -} - -void -cAudioManager::DoJumboVolOffset() const -{ - if (!(m_FrameCounter % (m_anRandomTable[0] % 6 + 3))) - gJumboVolOffsetPercentage = m_anRandomTable[1] % 60; -} - -uint32 -cAudioManager::GetPlayerTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_DAMAGE: - GetPhrase(&sfx, &lastSfx, SFX_CLAUDE_HIGH_DAMAGE_GRUNT_1, 11); - break; - case SOUND_PED_HIT: - GetPhrase(&sfx, &lastSfx, SFX_CLAUDE_LOW_DAMAGE_GRUNT_1, 10); - break; - case SOUND_PED_LAND: - GetPhrase(&sfx, &lastSfx, SFX_CLAUDE_HIT_GROUND_GRUNT_1, 6); - break; - default: - sfx = NO_SAMPLE; - break; - } - return sfx; -} - -uint32 -cAudioManager::GetCopTalkSfx(int16 sound) -{ - uint32 sfx; - PedState pedState; - static uint32 lastSfx = NO_SAMPLE; - - if (sound == SOUND_PED_ARREST_COP) { - GetPhrase(&sfx, &lastSfx, SFX_COP_VOICE_1_ARREST_1, 6); - } else { - if (sound != SOUND_PED_PURSUIT_COP) { - return GetGenericMaleTalkSfx(sound); - } - - pedState = FindPlayerPed()->m_nPedState; - if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) - return NO_SAMPLE; - GetPhrase(&sfx, &lastSfx, SFX_COP_VOICE_1_CHASE_1, 7); - } - - return (SFX_COP_VOICE_2_ARREST_1 - SFX_COP_VOICE_1_ARREST_1) * (m_sQueueSample.m_nEntityIndex % 5) + sfx; -} - -uint32 -cAudioManager::GetSwatTalkSfx(int16 sound) -{ - uint32 sfx; - PedState pedState; - static uint32 lastSfx = NO_SAMPLE; - - if (sound == SOUND_PED_ARREST_SWAT) { - GetPhrase(&sfx, &lastSfx, SFX_SWAT_VOICE_1_CHASE_1, 6); - } else { - if (sound != SOUND_PED_PURSUIT_SWAT) { - return GetGenericMaleTalkSfx(sound); - } - - pedState = FindPlayerPed()->m_nPedState; - if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) - return NO_SAMPLE; - GetPhrase(&sfx, &lastSfx, SFX_SWAT_VOICE_1_CHASE_1, 6); - } - - return (SFX_SWAT_VOICE_2_CHASE_1 - SFX_SWAT_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 4) + sfx; -} - -uint32 -cAudioManager::GetFBITalkSfx(int16 sound) -{ - uint32 sfx; - PedState pedState; - static uint32 lastSfx = NO_SAMPLE; - - if (sound == SOUND_PED_ARREST_FBI) { - GetPhrase(&sfx, &lastSfx, SFX_FBI_VOICE_1_CHASE_1, 6); - } else { - if (sound != SOUND_PED_PURSUIT_FBI) { - return GetGenericMaleTalkSfx(sound); - } - - pedState = FindPlayerPed()->m_nPedState; - if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) - return NO_SAMPLE; - GetPhrase(&sfx, &lastSfx, SFX_FBI_VOICE_1_CHASE_1, 6); - } - - return (SFX_FBI_VOICE_2_CHASE_1 - SFX_FBI_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 3) + sfx; -} - -uint32 -cAudioManager::GetArmyTalkSfx(int16 sound) -{ - uint32 sfx; - PedState pedState; - static uint32 lastSfx = NO_SAMPLE; - - if (sound != SOUND_PED_PURSUIT_ARMY) { - return GetGenericMaleTalkSfx(sound); - } - - pedState = FindPlayerPed()->m_nPedState; - if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) - return NO_SAMPLE; - GetPhrase(&sfx, &lastSfx, SFX_ARMY_VOICE_1_CHASE_1, 15); - - return (SFX_ARMY_VOICE_2_CHASE_1 - SFX_ARMY_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; -} - -uint32 -cAudioManager::GetMedicTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_GUN_PANIC_1, 5); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_CARJACKED_1, 5); - break; - case SOUND_PED_HEALING: - GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_AT_VICTIM_1, 12); - break; - case SOUND_PED_LEAVE_VEHICLE: - GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_GET_OUT_VAN_CHAT_1, 9); - break; - case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, SFX_MEDIC_VOICE_1_RUN_FROM_FIGHT_1, 6); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return (SFX_MEDIC_VOICE_2_GUN_PANIC_1 - SFX_MEDIC_VOICE_1_GUN_PANIC_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; -} - -uint32 -cAudioManager::GetFiremanTalkSfx(int16 sound) -{ - return GetGenericMaleTalkSfx(sound); -} - -uint32 -cAudioManager::GetNormalMaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_GUN_PANIC_1, 7); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_CARJACKED_1, 7); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_DODGE_1, 9); - break; - case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_RUN_FROM_FIGHT_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_DRIVER_ABUSE_1, 12); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_EYING_1, 8); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_SHOCKED_1, 10); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_NORMAL_MALE_CHAT_1, 25); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetTaxiDriverTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - if (sound == SOUND_PED_CAR_JACKED) { - GetPhrase(&sfx, &lastSfx, SFX_ASIAN_TAXI_DRIVER_VOICE_1_CARJACKED_1, 7); - } else { - if (sound != SOUND_PED_CAR_COLLISION) - return GetGenericMaleTalkSfx(sound); - GetPhrase(&sfx, &lastSfx, SFX_ASIAN_TAXI_DRIVER_VOICE_1_DRIVER_ABUSE_1, 6); - } - return (SFX_ASIAN_TAXI_DRIVER_VOICE_2_DRIVER_ABUSE_1 - SFX_ASIAN_TAXI_DRIVER_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; -} - -uint32 -cAudioManager::GetPimpTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, SFX_PIMP_GUN_COOL_1, 7); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_PIMP_CARJACKED_1, 4); - break; - case SOUND_PED_DEFEND: - GetPhrase(&sfx, &lastSfx, SFX_PIMP_FIGHT_1, 9); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_PIMP_DODGE_1, 6); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_PIMP_DRIVER_ABUSE_1, 5); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_PIMP_SHOCKED_1, 2); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_PIMP_CHAT_1, 17); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetMafiaTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_CAR_JACKING: - GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_CARJACKING_1, 2); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_FIGHT_1, 5); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_DODGE_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_DRIVER_ABUSE_1, 6); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_EYING_1, 3); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_MAFIA_MALE_VOICE_1_CHAT_1, 7); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return (SFX_MAFIA_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_MAFIA_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 3) + sfx; -} - -uint32 -cAudioManager::GetTriadTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_GUN_COOL_1, 3); - break; - case SOUND_PED_CAR_JACKING: - GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_CARJACKING_1, 2); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_FIGHT_1, 5); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_DODGE_1, 4); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_DRIVER_ABUSE_1, 7); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_EYING_1, 3); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_TRIAD_MALE_VOICE_1_CHAT_1, 8); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetDiabloTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_GUN_COOL_1, 4); - break; - case SOUND_PED_HANDS_COWER: - sound = SOUND_PED_FLEE_SPRINT; - return GetGenericMaleTalkSfx(sound); - break; - case SOUND_PED_CAR_JACKING: - GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_CARJACKING_1, 2); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_FIGHT_1, 4); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_DODGE_1, 4); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_DRIVER_ABUSE_1, 5); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_EYING_1, 4); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_DIABLO_MALE_VOICE_1_CHAT_1, 5); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return (SFX_DIABLO_MALE_VOICE_2_CHAT_1 - SFX_DIABLO_MALE_VOICE_1_CHAT_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; -} - -uint32 -cAudioManager::GetYakuzaTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_CAR_JACKING: - GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_CARJACKING_1, 2); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_FIGHT_1, 5); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_DODGE_1, 4); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_DRIVER_ABUSE_1, 6); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_YAKUZA_MALE_VOICE_1_CHAT_1, 5); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return (SFX_YAKUZA_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_YAKUZA_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; -} - -uint32 -cAudioManager::GetYardieTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_UP: - sfx = SFX_YARDIE_MALE_VOICE_1_GUN_COOL_1; - break; - case SOUND_PED_CAR_JACKING: - GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_CARJACKING_1, 2); - break; - case SOUND_PED_CAR_JACKED: - sfx = SFX_YARDIE_MALE_VOICE_1_CARJACKED_1; - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_FIGHT_1, 6); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_DODGE_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_DRIVER_ABUSE_1, 6); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_EYING_1, 2); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_YARDIE_MALE_VOICE_1_CHAT_1, 8); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return (SFX_YARDIE_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_YARDIE_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; -} - -uint32 -cAudioManager::GetColumbianTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_CAR_JACKING: - GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_CARJACKING_1, 2); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_FIGHT_1, 5); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_DODGE_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_DRIVER_ABUSE_1, 6); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_EYING_1, 2); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_COLUMBIAN_MALE_VOICE_1_CHAT_1, 5); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return (SFX_COLUMBIAN_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_COLUMBIAN_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; -} - -uint32 -cAudioManager::GetHoodTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_GUN_COOL_1, 5); - break; - case SOUND_PED_CAR_JACKING: - GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_CARJACKING_1, 2); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_FIGHT_1, 6); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_DODGE_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_DRIVER_ABUSE_1, 7); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_EYING_1, 2); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_HOOD_MALE_VOICE_1_CHAT_1, 6); - break; - - default: - return GetGenericMaleTalkSfx(sound); - break; - } - return (SFX_HOOD_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_HOOD_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; -} - -uint32 -cAudioManager::GetBlackCriminalTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_GUN_COOL_1, 4); - break; - case SOUND_PED_CAR_JACKING: - sfx = SFX_BLACK_CRIMINAL_VOICE_1_CARJACKING_1; - break; - case SOUND_PED_MUGGING: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_MUGGING_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_FIGHT_1, 5); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_DODGE_1, 6); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_CRIMINAL_VOICE_1_DRIVER_ABUSE_1, 5); - break; - default: - return GetGenericMaleTalkSfx(sound); - break; - } - return sfx; -} - -uint32 -cAudioManager::GetWhiteCriminalTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_GUN_COOL_1, 3); - break; - case SOUND_PED_CAR_JACKING: - sfx = SFX_WHITE_CRIMINAL_VOICE_1_CARJACKING_1; - break; - case SOUND_PED_MUGGING: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_MUGGING_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_FIGHT_1, 4); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_DODGE_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_CRIMINAL_VOICE_1_DRIVER_ABUSE_1, 4); - break; - default: - return GetGenericMaleTalkSfx(sound); - break; - } - return sfx; -} - -uint32 -cAudioManager::GetMaleNo2TalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_CARJACKED_1, 3); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_MUGGED_1, 4); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_FIGHT_1, 4); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_DODGE_1, 4); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_DRIVER_ABUSE_1, 7); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_EYING_1, 5); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_CASUAL_MALE_OLD_VOICE_1_CHAT_1, 7); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetBlackProjectMaleTalkSfx(int16 sound, int32 model) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_GUN_COOL_1, 3); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_FIGHT_1, 6); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_DODGE_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_DRIVER_ABUSE_1, 7); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_EYING_1, 3); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_MALE_VOICE_1_CHAT_1, 6); - default: - return GetGenericMaleTalkSfx(sound); - } - - if (model == MI_P_MAN2) - sfx += (SFX_BLACK_PROJECT_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_BLACK_PROJECT_MALE_VOICE_1_DRIVER_ABUSE_1); - return sfx; -} - -uint32 -cAudioManager::GetWhiteFatMaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_CARJACKED_1, 3); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_MUGGED_1, 3); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_DODGE_1, 9); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_DRIVER_ABUSE_1, 9); - break; - case SOUND_PED_WAIT_DOUBLEBACK: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_LOST_1, 2); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_MALE_VOICE_1_CHAT_1, 9); - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetBlackFatMaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_CARJACKED_1, 4); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_MUGGED_1, 3); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_DODGE_1, 7); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_DRIVER_ABUSE_1, 6); - break; - case SOUND_PED_WAIT_DOUBLEBACK: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_LOST_1, 3); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_MALE_VOICE_1_CHAT_1, 8); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetBlackCasualFemaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_GUN_PANIC_1, 2); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_MUGGED_1, 3); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_DODGE_1, 6); - break; - case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_RUN_FROM_FIGHT_1, 2); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_DRIVER_ABUSE_1, 7); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_SHOCKED_1, 4); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_FEMALE_1_VOICE_1_CHAT_1, 8); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetWhiteCasualFemaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_GUN_PANIC_1, 2); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ROBBED: - sfx = SFX_WHITE_CASUAL_FEMALE_VOICE_1_MUGGED_1; - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_DODGE_1, 3); - break; - case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_RUN_FROM_FIGHT_1, 2); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_DRIVER_ABUSE_1, 8); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_SHOCKED_1, 2); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_CASUAL_FEMALE_VOICE_1_CHAT_1, 4); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetFemaleNo3TalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_GUN_PANIC_1, 5); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_CARJACKED_1, 3); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_MUGGED_1, 3); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_DODGE_1, 6); - break; - case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_RUN_FROM_FIGHT_1, 4); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_DRIVER_ABUSE_1, 6); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_SHOCKED_1, 4); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_FEMALE_3_VOICE_1_CHAT_1, 5); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetBlackFatFemaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_GUN_PANIC_1, 4); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_DODGE_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_DRIVER_ABUSE_1, 6); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_SHOCKED_1, 5); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_FAT_FEMALE_VOICE_1_CHAT_1, 7); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetWhiteFatFemaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_DODGE_1, 6); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_DRIVER_ABUSE_1, 8); - break; - case SOUND_PED_WAIT_DOUBLEBACK: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_LOST_1, 2); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_SHOCKED_1, 4); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_FAT_FEMALE_VOICE_1_CHAT_1, 8); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetBlackFemaleProstituteTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_GUN_COOL_1, 4); - break; - case SOUND_PED_ROBBED: - sfx = SFX_BLACK_PROSTITUTE_VOICE_1_MUGGED_1; - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_FIGHT_1, 4); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_DODGE_1, 3); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_DRIVER_ABUSE_1, 4); - break; - case SOUND_PED_SOLICIT: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_SOLICIT_1, 8); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROSTITUTE_VOICE_1_CHAT_1, 4); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return (SFX_BLACK_PROSTITUTE_VOICE_2_CHAT_1 - SFX_BLACK_PROSTITUTE_VOICE_1_CHAT_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; -} - -uint32 -cAudioManager::GetWhiteFemaleProstituteTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_FIGHT_1, 4); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_DODGE_1, 3); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_DRIVER_ABUSE_1, 4); - break; - case SOUND_PED_SOLICIT: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_SOLICIT_1, 8); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_PROSTITUTE_VOICE_1_CHAT_1, 4); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return (SFX_WHITE_PROSTITUTE_VOICE_2_CHAT_1 - SFX_WHITE_PROSTITUTE_VOICE_1_CHAT_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; -} - -uint32 -cAudioManager::GetBlackProjectFemaleOldTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_CARJACKED_1, 6); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_DODGE_1, 10); - break; - case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_RUN_FROM_FIGHT_1, 6); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_DRIVER_ABUSE_1, 7); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_SHOCKED_1, 2); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_OLD_VOICE_1_CHAT_1, 10); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetBlackProjectFemaleYoungTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_GUN_PANIC_1, 4); - break; - case SOUND_PED_CAR_JACKED: - sfx = SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_CARJACKED_1; - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_DODGE_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_DRIVER_ABUSE_1, 6); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_SHOCKED_1, 5); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_PROJECT_FEMALE_YOUNG_VOICE_1_CHAT_1, 7); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetChinatownMaleOldTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_GUN_PANIC_1, 3); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_FIGHT_1, 5); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_DODGE_1, 6); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_DRIVER_ABUSE_1, 6); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_EYING_1, 3); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_OLD_VOICE_1_CHAT_1, 7); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetChinatownMaleYoungTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_GUN_PANIC_1, 2); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_FIGHT_1, 6); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_DODGE_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_DRIVER_ABUSE_1, 6); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_EYING_1, 3); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_MALE_YOUNG_VOICE_1_CHAT_1, 6); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetChinatownFemaleOldTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_GUN_PANIC_1, 3); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_DODGE_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5); - break; - case SOUND_PED_CHAT_EVENT: - sfx = SFX_CHINATOWN_OLD_FEMALE_VOICE_1_SHOCKED_1; - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_OLD_FEMALE_VOICE_1_CHAT_1, 6); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetChinatownFemaleYoungTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_DODGE_1, 6); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_DRIVER_ABUSE_1, 7); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_SHOCKED_1, 4); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_CHINATOWN_YOUNG_FEMALE_VOICE_1_CHAT_1, 7); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetLittleItalyMaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_GUN_PANIC_1, 3); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_FIGHT_1, 5); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_DODGE_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_DRIVER_ABUSE_1, 7); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_MALE_VOICE_1_CHAT_1, 6); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return (SFX_LITTLE_ITALY_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_LITTLE_ITALY_MALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; -} - -uint32 -cAudioManager::GetLittleItalyFemaleOldTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_DODGE_1, 6); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_DRIVER_ABUSE_1, 7); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_SHOCKED_1, 4); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_OLD_FEMALE_VOICE_1_CHAT_1, 7); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetLittleItalyFemaleYoungTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_DODGE_1, 7); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_DRIVER_ABUSE_1, 6); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_SHOCKED_1, 4); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_LITTLE_ITALY_YOUNG_FEMALE_VOICE_1_CHAT_1, 6); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetWhiteDockerMaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_GUN_PANIC_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_FIGHT_1, 3); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_DODGE_1, 4); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_DRIVER_ABUSE_1, 4); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_EYING_1, 3); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_DOCKER_MALE_VOICE_1_CHAT_1, 5); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetBlackDockerMaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_GUN_PANIC_1, 3); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_FIGHT_1, 5); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_DODGE_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_DRIVER_ABUSE_1, 6); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_EYING_1, 3); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_DOCKER_VOICE_1_CHAT_1, 5); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetScumMaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_GUN_PANIC_1, 5); - break; - case SOUND_PED_ROBBED: - sfx = SFX_SCUM_MALE_VOICE_1_MUGGED_1; - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_FIGHT_1, 10); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_DODGE_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_DRIVER_ABUSE_1, 6); - break; - case SOUND_PED_WAIT_DOUBLEBACK: - GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_LOST_1, 3); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_EYING_1, 5); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_SCUM_MALE_VOICE_1_CHAT_1, 9); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetScumFemaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_GUN_PANIC_1, 4); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_FIGHT_1, 4); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_DODGE_1, 8); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_SCUM_FEMALE_VOICE_1_CHAT_1, 13); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetWhiteWorkerMaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_GUN_PANIC_1, 3); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_FIGHT_1, 3); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_DODGE_1, 4); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_DRIVER_ABUSE_1, 6); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_EYING_1, 2); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_WORKER_MALE_VOICE_1_CHAT_1, 6); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetBlackWorkerMaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_GUN_PANIC_1, 4); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_FIGHT_1, 3); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_DODGE_1, 3); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_DRIVER_ABUSE_1, 4); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_EYING_1, 3); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_WORKER_MALE_VOICE_1_CHAT_1, 4); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetBusinessMaleYoungTalkSfx(int16 sound, int32 model) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_GUN_PANIC_1, 3); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_FIGHT_1, 4); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_DODGE_1, 4); - break; - case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_RUN_FROM_FIGHT_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_DRIVER_ABUSE_1, 6); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_YOUNG_VOICE_1_CHAT_1, 6); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - - if (model == MI_B_MAN3) - sfx += (SFX_BUSINESS_MALE_YOUNG_VOICE_2_DRIVER_ABUSE_1 - SFX_BUSINESS_MALE_YOUNG_VOICE_1_DRIVER_ABUSE_1); - return sfx; -} - -uint32 -cAudioManager::GetBusinessMaleOldTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_GUN_PANIC_1, 3); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_FIGHT_1, 5); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_DODGE_1, 4); - break; - case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_MRUN_FROM_FIGHT_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_DRIVER_ABUSE_1, 5); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_BUSINESS_MALE_OLD_VOICE_1_CHAT_1, 5); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetWhiteBusinessFemaleTalkSfx(int16 sound, int32 model) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_GUN_PANIC_1, 4); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DODGE_1, 6); - break; - case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_RUN_FROM_FIGHT_1, 4); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_SHOCKED_1, 4); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_BUSINESS_FEMALE_VOICE_1_CHAT_1, 7); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - - if (model == MI_B_WOM2) - sfx += (SFX_WHITE_BUSINESS_FEMALE_VOICE_2_DRIVER_ABUSE_1 - SFX_WHITE_BUSINESS_FEMALE_VOICE_1_DRIVER_ABUSE_1); - return sfx; -} - -uint32 -cAudioManager::GetBlackBusinessFemaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_GUN_PANIC_1, 5); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_CARAJACKED_1, 4); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_MUGGED_1, 3); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_DODGE_1, 6); - break; - case SOUND_PED_FLEE_RUN: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_RUN_FROM_FIGHT_1, 6); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_DRIVER_ABUSE_1, 7); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_SHOCKED_1, 4); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_BUSINESS_FEMALE_VOICE_1_CHAT_1, 7); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetSupermodelMaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_FIGHT_1, 5); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_DODGE_1, 6); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_DRIVER_ABUSE_1, 6); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_EYING_1, 3); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_MODEL_MALE_VOICE_1_CHAT_1, 6); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetSupermodelFemaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_GUN_PANIC_1, 4); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_MUGGED_1, 3); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_DODGE_1, 4); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_DRIVER_ABUSE_1, 7); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_SHOCKED_1, 5); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_MODEL_FEMALE_VOICE_1_CHAT_1, 8); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetStewardMaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_GUN_PANIC_1, 3); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_FIGHT_1, 4); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_DODGE_1, 3); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_DRIVER_ABUSE_1, 5); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_STEWARD_MALE_VOICE_1_CHAT_1, 4); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetStewardFemaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_STEWARD_FEMALE_VOICE_1_GUN_PANIC_1, 3); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_STEWARD_FEMALE_VOICE_1_DODGE_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_STEWARD_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_STEWARD_FEMALE_VOICE_1_CHAT_1, 5); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return (SFX_STEWARD_FEMALE_VOICE_2_DRIVER_ABUSE_1 - SFX_STEWARD_FEMALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; -} - -uint32 -cAudioManager::GetFanMaleTalkSfx(int16 sound, int32 model) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_FIGHT_1, 3); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_DODGE_1, 4); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_DRIVER_ABUSE_1, 5); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_SHOCKED_1, 2); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_MALE_VOICE_1_CHAT_1, 6); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - - if (model == MI_FAN_MAN2) - sfx += (SFX_FOOTBALL_MALE_VOICE_2_DRIVER_ABUSE_1 - SFX_FOOTBALL_MALE_VOICE_1_DRIVER_ABUSE_1); - return sfx; -} - -uint32 -cAudioManager::GetFanFemaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_ROBBED: - sfx = SFX_FOOTBALL_FEMALE_VOICE_1_MUGGED_1; - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_FEMALE_VOICE_1_DODGE_1, 4); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_FEMALE_VOICE_1_DRIVER_ABUSE_1, 5); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_FEMALE_VOICE_1_SHOCKED_1, 2); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_FOOTBALL_FEMALE_VOICE_1_CHAT_1, 6); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return (SFX_FOOTBALL_FEMALE_VOICE_2_DRIVER_ABUSE_1 - SFX_FOOTBALL_FEMALE_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; -} - -uint32 -cAudioManager::GetHospitalMaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_GUN_PANIC_1, 4); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_FIGHT_1, 4); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_DODGE_1, 4); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_DRIVER_ABUSE_1, 5); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_MALE_VOICE_1_CHAT_1, 5); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetHospitalFemaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_FEMALE_VOICE_1_DODGE_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_FEMALE_VOICE_1_DRIVER_ABUSE_1, 6); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_HOSPITAL_FEMALE_VOICE_1_CHAT_1, 6); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetWhiteConstructionWorkerTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_GUN_PANIC_1, 3); - break; - case SOUND_PED_CAR_JACKED: - sfx = SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_CARJACKED_1; - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_FIGHT_1, 5); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_DODGE_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_DRIVER_ABUSE_1, 4); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_EYING_1, 3); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_WHITE_MALE_CONSTRUCTION_VOICE_1_CHAT_1, 7); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetBlackConstructionWorkerTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_GUN_PANIC_1, 3); - break; - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_FIGHT_1, 5); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_DODGE_1, 5); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_DRIVER_ABUSE_1, 5); - break; - case SOUND_PED_CHAT_SEXY: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_EYING_1, 4); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_BLACK_CONSTRUCTION_MALE_VOICE_1_CHAT_1, 4); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetShopperFemaleTalkSfx(int16 sound, int32 model) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_CAR_JACKED: - GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_CARJACKED_1, 2); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_DODGE_1, 6); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_DRIVER_ABUSE_1, 7); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_SHOCKED_1, 4); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_SHOPPER_VOICE_1_CHAT_1, 7); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - - if (model == MI_SHOPPER2) { - sfx += (SFX_SHOPPER_VOICE_2_DRIVER_ABUSE_1 - SFX_SHOPPER_VOICE_1_DRIVER_ABUSE_1); - } else if (model == MI_SHOPPER3) { - sfx += (SFX_SHOPPER_VOICE_3_DRIVER_ABUSE_1 - SFX_SHOPPER_VOICE_1_DRIVER_ABUSE_1); - } - return sfx; -} - -uint32 -cAudioManager::GetStudentMaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_GUN_PANIC_1, 2); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_FIGHT_1, 4); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_DODGE_1, 4); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_DRIVER_ABUSE_1, 4); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_SHOCKED_1, 3); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_STUDENT_MALE_VOICE_1_CHAT_1, 5); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetStudentFemaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_COWER: - GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_GUN_PANIC_1, 4); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_MUGGED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_FIGHT_1, 4); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_DODGE_1, 4); - break; - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_DRIVER_ABUSE_1, 4); - break; - case SOUND_PED_CHAT_EVENT: - GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_SHOCKED_1, 2); - break; - case SOUND_PED_CHAT: - GetPhrase(&sfx, &lastSfx, SFX_STUDENT_FEMALE_VOICE_1_CHAT_1, 4); - break; - default: - return GetGenericFemaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetCasualMaleOldTalkSfx(int16 sound) -{ - return GetGenericMaleTalkSfx(sound); -} - -uint32 -cAudioManager::GetSpecialCharacterTalkSfx(int32 modelIndex, int32 sound) -{ - char *modelName = CModelInfo::GetModelInfo(modelIndex)->GetName(); - if (!CGeneral::faststricmp(modelName, "eight") || !CGeneral::faststricmp(modelName, "eight2")) { - return GetEightTalkSfx(sound); - } - if (!CGeneral::faststricmp(modelName, "frankie")) { - return GetFrankieTalkSfx(sound); - } - if (!CGeneral::faststricmp(modelName, "misty")) { - return GetMistyTalkSfx(sound); - } - if (!CGeneral::faststricmp(modelName, "ojg") || !CGeneral::faststricmp(modelName, "ojg_p")) { - return GetOJGTalkSfx(sound); - } - if (!CGeneral::faststricmp(modelName, "cat")) { - return GetCatatalinaTalkSfx(sound); - } - if (!CGeneral::faststricmp(modelName, "bomber")) { - return GetBomberTalkSfx(sound); - } - if (!CGeneral::faststricmp(modelName, "s_guard")) { - return GetSecurityGuardTalkSfx(sound); - } - if (!CGeneral::faststricmp(modelName, "chunky")) { - return GetChunkyTalkSfx(sound); - } - if (!CGeneral::faststricmp(modelName, "asuka")) { - return GetGenericFemaleTalkSfx(sound); - } - if (!CGeneral::faststricmp(modelName, "maria")) { - return GetGenericFemaleTalkSfx(sound); - } - - return GetGenericMaleTalkSfx(sound); -} -uint32 -cAudioManager::GetEightTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, SFX_8BALL_GUN_COOL_1, 2); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_8BALL_MUGGED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_8BALL_FIGHT_1, 6); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_8BALL_DODGE_1, 7); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetFrankieTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, SFX_SALVATORE_GUN_COOL_1, 4); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_SALVATORE_MUGGED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_SALVATORE_FIGHT_1, 6); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_SALVATORE_DODGE_1, 3); - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetMistyTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, SFX_MISTY_GUN_COOL_1, 5); - break; - case SOUND_PED_ROBBED: - GetPhrase(&sfx, &lastSfx, SFX_MISTY_MUGGED_1, 2); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_MISTY_FIGHT_1, 4); - break; - case SOUND_PED_EVADE: - GetPhrase(&sfx, &lastSfx, SFX_MISTY_DODGE_1, 5); - break; - case SOUND_PED_TAXI_CALL: - GetPhrase(&sfx, &lastSfx, SFX_MISTY_HERE_1, 4); - break; - default: - return GetGenericFemaleTalkSfx(sound); - break; - } - return sfx; -} - -uint32 -cAudioManager::GetOJGTalkSfx(int16 sound) -{ - return GetGenericMaleTalkSfx(sound); -} - -uint32 -cAudioManager::GetCatatalinaTalkSfx(int16 sound) -{ - return GetGenericFemaleTalkSfx(sound); -} - -uint32 -cAudioManager::GetBomberTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - if (sound != SOUND_PED_BOMBER) - return GetGenericMaleTalkSfx(sound); - - GetPhrase(&sfx, &lastSfx, SFX_BOMBERMAN_1, 7); - return sfx; -} - -uint32 -cAudioManager::GetSecurityGuardTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_HANDS_UP: - GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_GUN_COOL_1, 2); - break; - case SOUND_PED_HANDS_COWER: - sfx = SFX_SECURITY_GUARD_VOICE_1_GUN_PANIC_1; - break; - case SOUND_PED_CAR_JACKED: - case SOUND_PED_CAR_COLLISION: - GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_DRIVER_ABUSE_1, 6); - break; - case SOUND_PED_ATTACK: - GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_FIGHT_1, 2); - break; - case SOUND_PED_FLEE_RUN: -#ifdef FIX_BUGS - sfx = SFX_SECURITY_GUARD_VOICE_1_RUN_FROM_FIGHT_1; -#else - GetPhrase(&sfx, &lastSfx, SFX_SECURITY_GUARD_VOICE_1_DRIVER_ABUSE_1, 12); -#endif - break; - default: - return GetGenericMaleTalkSfx(sound); - } - return sfx; -} - -uint32 -cAudioManager::GetChunkyTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - if (sound == SOUND_PED_DEATH) - return SFX_CHUNKY_DEATH; - - if (sound != SOUND_PED_FLEE_RUN) - return GetGenericMaleTalkSfx(sound); - - GetPhrase(&sfx, &lastSfx, SFX_CHUNKY_RUN_1, 5); - return sfx; -} - -uint32 -cAudioManager::GetGenericMaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_DEATH: - GetPhrase(&sfx, &lastSfx, SFX_GENERIC_MALE_DEATH_1, 8); - break; - case SOUND_PED_BULLET_HIT: - case SOUND_PED_DEFEND: - GetPhrase(&sfx, &lastSfx, SFX_GENERIC_MALE_GRUNT_1, 15); - break; - case SOUND_PED_BURNING: - GetPhrase(&sfx, &lastSfx, SFX_GENERIC_MALE_FIRE_1, 8); - break; - case SOUND_PED_FLEE_SPRINT: - GetPhrase(&sfx, &lastSfx, SFX_GENERIC_MALE_PANIC_1, 6); - break; - default: - return NO_SAMPLE; - } - return sfx; -} - -uint32 -cAudioManager::GetGenericFemaleTalkSfx(int16 sound) -{ - uint32 sfx; - static uint32 lastSfx = NO_SAMPLE; - - switch (sound) { - case SOUND_PED_DEATH: - GetPhrase(&sfx, &lastSfx, SFX_GENERIC_FEMALE_DEATH_1, 10); - break; - case SOUND_PED_BULLET_HIT: - case SOUND_PED_DEFEND: - GetPhrase(&sfx, &lastSfx, SFX_GENERIC_FEMALE_GRUNT_1, 11); - break; - case SOUND_PED_BURNING: - GetPhrase(&sfx, &lastSfx, SFX_GENERIC_FEMALE_FIRE_1, 9); - break; - case SOUND_PED_FLEE_SPRINT: - GetPhrase(&sfx, &lastSfx, SFX_GENERIC_FEMALE_PANIC_1, 8); - break; - default: - return NO_SAMPLE; - } - return sfx; -} - -void -cAudioManager::GenerateIntegerRandomNumberTable() -{ - for (int32 i = 0; i < ARRAY_SIZE(m_anRandomTable); i++) { - m_anRandomTable[i] = rand(); - } -} - -char * -cAudioManager::Get3DProviderName(uint8 id) const -{ - if (!m_bIsInitialised) - return nil; - if (id >= SampleManager.GetNum3DProvidersAvailable()) - return nil; - return SampleManager.Get3DProviderName(id); -} - -uint8 -cAudioManager::GetCDAudioDriveLetter() const -{ - if (m_bIsInitialised) - return SampleManager.GetCDAudioDriveLetter(); - - return 0; -} - -int8 -cAudioManager::GetCurrent3DProviderIndex() const -{ - if (m_bIsInitialised) - return SampleManager.GetCurrent3DProviderIndex(); - - return -1; -} - -float -cAudioManager::GetDistanceSquared(const CVector &v) const -{ - const CVector &c = TheCamera.GetPosition(); - return sq(v.x - c.x) + sq(v.y - c.y) + sq((v.z - c.z) * 0.2f); -} - -int32 -cAudioManager::GetJumboTaxiFreq() const -{ - return (60.833f * m_sQueueSample.m_fDistance) + 22050; -} - -bool -cAudioManager::GetMissionAudioLoadingStatus() const -{ - if (m_bIsInitialised) - return m_sMissionAudio.m_nLoadingStatus; - - return true; -} - -uint8 -cAudioManager::GetNum3DProvidersAvailable() const -{ - if (m_bIsInitialised) - return SampleManager.GetNum3DProvidersAvailable(); - return 0; -} - -int32 -cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound) -{ - if (ped->IsPlayer()) - return GetPlayerTalkSfx(sound); - - switch (ped->GetModelIndex()) { - case MI_COP: - return GetCopTalkSfx(sound); - case MI_SWAT: - return GetSwatTalkSfx(sound); - case MI_FBI: - return GetFBITalkSfx(sound); - case MI_ARMY: - return GetArmyTalkSfx(sound); - case MI_MEDIC: - return GetMedicTalkSfx(sound); - case MI_FIREMAN: - return GetFiremanTalkSfx(sound); - case MI_MALE01: - return GetNormalMaleTalkSfx(sound); - case MI_TAXI_D: - return GetTaxiDriverTalkSfx(sound); - case MI_PIMP: - return GetPimpTalkSfx(sound); - case MI_GANG01: - case MI_GANG02: - return GetMafiaTalkSfx(sound); - case MI_GANG03: - case MI_GANG04: - return GetTriadTalkSfx(sound); - case MI_GANG05: - case MI_GANG06: - return GetDiabloTalkSfx(sound); - case MI_GANG07: - case MI_GANG08: - return GetYakuzaTalkSfx(sound); - case MI_GANG09: - case MI_GANG10: - return GetYardieTalkSfx(sound); - case MI_GANG11: - case MI_GANG12: - return GetColumbianTalkSfx(sound); - case MI_GANG13: - case MI_GANG14: - return GetHoodTalkSfx(sound); - case MI_CRIMINAL01: - return GetBlackCriminalTalkSfx(sound); - case MI_CRIMINAL02: - return GetWhiteCriminalTalkSfx(sound); - case MI_SPECIAL01: - case MI_SPECIAL02: - case MI_SPECIAL03: - case MI_SPECIAL04: - return GetSpecialCharacterTalkSfx(ped->GetModelIndex(), sound); - case MI_MALE02: - return GetMaleNo2TalkSfx(sound); - case MI_MALE03: - case MI_P_MAN1: - case MI_P_MAN2: - return GetBlackProjectMaleTalkSfx(sound, ped->GetModelIndex()); - case MI_FATMALE01: - return GetWhiteFatMaleTalkSfx(sound); - case MI_FATMALE02: - return GetBlackFatMaleTalkSfx(sound); - case MI_FEMALE01: - return GetBlackCasualFemaleTalkSfx(sound); - case MI_FEMALE02: - case MI_CAS_WOM: - return GetWhiteCasualFemaleTalkSfx(sound); - case MI_FEMALE03: - return GetFemaleNo3TalkSfx(sound); - case MI_FATFEMALE01: - return GetBlackFatFemaleTalkSfx(sound); - case MI_FATFEMALE02: - return GetWhiteFatFemaleTalkSfx(sound); - case MI_PROSTITUTE: - return GetBlackFemaleProstituteTalkSfx(sound); - case MI_PROSTITUTE2: - return GetWhiteFemaleProstituteTalkSfx(sound); - case MI_P_WOM1: - return GetBlackProjectFemaleOldTalkSfx(sound); - case MI_P_WOM2: - return GetBlackProjectFemaleYoungTalkSfx(sound); - case MI_CT_MAN1: - return GetChinatownMaleOldTalkSfx(sound); - case MI_CT_MAN2: - return GetChinatownMaleYoungTalkSfx(sound); - case MI_CT_WOM1: - return GetChinatownFemaleOldTalkSfx(sound); - case MI_CT_WOM2: - return GetChinatownFemaleYoungTalkSfx(sound); - case MI_LI_MAN1: - case MI_LI_MAN2: - return GetLittleItalyMaleTalkSfx(sound); - case MI_LI_WOM1: - return GetLittleItalyFemaleOldTalkSfx(sound); - case MI_LI_WOM2: - return GetLittleItalyFemaleYoungTalkSfx(sound); - case MI_DOCKER1: - return GetWhiteDockerMaleTalkSfx(sound); - case MI_DOCKER2: - return GetBlackDockerMaleTalkSfx(sound); - case MI_SCUM_MAN: - return GetScumMaleTalkSfx(sound); - case MI_SCUM_WOM: - return GetScumFemaleTalkSfx(sound); - case MI_WORKER1: - return GetWhiteWorkerMaleTalkSfx(sound); - case MI_WORKER2: - return GetBlackWorkerMaleTalkSfx(sound); - case MI_B_MAN1: - case MI_B_MAN3: - return GetBusinessMaleYoungTalkSfx(sound, ped->GetModelIndex()); - case MI_B_MAN2: - return GetBusinessMaleOldTalkSfx(sound); - case MI_B_WOM1: - case MI_B_WOM2: - return GetWhiteBusinessFemaleTalkSfx(sound, ped->GetModelIndex()); - case MI_B_WOM3: - return GetBlackBusinessFemaleTalkSfx(sound); - case MI_MOD_MAN: - return GetSupermodelMaleTalkSfx(sound); - case MI_MOD_WOM: - return GetSupermodelFemaleTalkSfx(sound); - case MI_ST_MAN: - return GetStewardMaleTalkSfx(sound); - case MI_ST_WOM: - return GetStewardFemaleTalkSfx(sound); - case MI_FAN_MAN1: - case MI_FAN_MAN2: - return GetFanMaleTalkSfx(sound, ped->GetModelIndex()); - case MI_FAN_WOM: - return GetFanFemaleTalkSfx(sound); - case MI_HOS_MAN: - return GetHospitalMaleTalkSfx(sound); - case MI_HOS_WOM: - return GetHospitalFemaleTalkSfx(sound); - case MI_CONST1: - return GetWhiteConstructionWorkerTalkSfx(sound); - case MI_CONST2: - return GetBlackConstructionWorkerTalkSfx(sound); - case MI_SHOPPER1: - case MI_SHOPPER2: - case MI_SHOPPER3: - return GetShopperFemaleTalkSfx(sound, ped->GetModelIndex()); - case MI_STUD_MAN: - return GetStudentMaleTalkSfx(sound); - case MI_STUD_WOM: - return GetStudentFemaleTalkSfx(sound); - case MI_CAS_MAN: - return GetCasualMaleOldTalkSfx(sound); - default: - return GetGenericMaleTalkSfx(sound); - } -} - -void -cAudioManager::GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset) const -{ - *phrase = sample + m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % maxOffset; - - // check if the same sfx like last time, if yes, then try use next one, - // if exceeded range, then choose first available sample - if (*phrase == *prevPhrase && ++*phrase >= sample + maxOffset) - *phrase = sample; - *prevPhrase = *phrase; -} - -float -cAudioManager::GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange) -{ - tWheelState wheelState; - float relativeVelChange; - float gasPedalAudio = automobile->m_fGasPedalAudio; - float modificator; - float velChange; - float relativeVel; - - wheelState = automobile->m_aWheelState[wheel]; - if (wheelState == WHEEL_STATE_SPINNING && gasPedalAudio > 0.4f) { - relativeVelChange = (gasPedalAudio - 0.4f) * 1.25f; - - } else if (wheelState == WHEEL_STATE_SKIDDING) { - relativeVelChange = Min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity); - } else if (wheelState == WHEEL_STATE_FIXED) { - modificator = 0.4f; - relativeVelChange = gasPedalAudio; - if (relativeVelChange > 0.4f) { - relativeVelChange = relativeVelChange - 0.4f; - modificator = 5.f / 3.f; - } - velChange = Abs(velocityChange); - if (relativeVelChange > 0.4f) - relativeVelChange = relativeVelChange * modificator; - if (velChange > 0.04f) { - relativeVel = Min(1.0f, velChange / transmission->fMaxVelocity); - } else { - relativeVel = 0.0f; - } - if (relativeVel >= relativeVelChange) - relativeVelChange = relativeVel; - } else { - relativeVelChange = 0.0f; - } - - return Max(relativeVelChange, Min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f)); -} - -float -cAudioManager::GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange) -{ - float relativeVelChange; - - if (automobile->m_aWheelState[wheel] == 2) { - relativeVelChange = Min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity); - } else { - relativeVelChange = 0.0f; - } - - return Max(relativeVelChange, Min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f)); -} - -bool -cAudioManager::HasAirBrakes(int32 model) const -{ - return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS || model == COACH; -} - -void -cAudioManager::Initialise() -{ - if (!m_bIsInitialised) { - PreInitialiseGameSpecificSetup(); - m_bIsInitialised = SampleManager.Initialise(); - if (m_bIsInitialised) { - m_nActiveSamples = SampleManager.GetMaximumSupportedChannels(); - if (m_nActiveSamples <= 1) { - Terminate(); - } else { - --m_nActiveSamples; - PostInitialiseGameSpecificSetup(); - InitialisePoliceRadioZones(); - InitialisePoliceRadio(); - MusicManager.Initialise(); - } - } - } -} - -void -cAudioManager::InterrogateAudioEntities() -{ - for (int32 i = 0; i < m_nAudioEntitiesTotal; i++) { - ProcessEntity(m_anAudioEntityIndices[i]); - m_asAudioEntities[m_anAudioEntityIndices[i]].m_AudioEvents = 0; - } -} - -bool -cAudioManager::IsAudioInitialised() const -{ - return m_bIsInitialised; -} - -bool -cAudioManager::IsMissionAudioSampleFinished() -{ - if (m_bIsInitialised) - return m_sMissionAudio.m_nPlayStatus == PLAY_STATUS_FINISHED; - - static int32 cPretendFrame = 1; - - return (cPretendFrame++ & 63) == 0; -} - -bool -cAudioManager::IsMP3RadioChannelAvailable() const -{ - if (m_bIsInitialised) - return SampleManager.IsMP3RadioChannelAvailable(); - - return false; -} - -bool -cAudioManager::MissionScriptAudioUsesPoliceChannel(int32 soundMission) const -{ - switch (soundMission) { - case STREAMED_SOUND_MISSION_J6_D: - case STREAMED_SOUND_MISSION_T4_A: - case STREAMED_SOUND_MISSION_S1_H: - case STREAMED_SOUND_MISSION_S3_B: - case STREAMED_SOUND_MISSION_EL3_A: - case STREAMED_SOUND_MISSION_A3_A: - case STREAMED_SOUND_MISSION_A5_A: - case STREAMED_SOUND_MISSION_K1_A: - case STREAMED_SOUND_MISSION_R1_A: - case STREAMED_SOUND_MISSION_R5_A: - case STREAMED_SOUND_MISSION_LO2_A: - case STREAMED_SOUND_MISSION_LO6_A: - return true; - default: - return false; - } -} - -void -cAudioManager::PlayLoadedMissionAudio() -{ - if (m_bIsInitialised && m_sMissionAudio.m_nSampleIndex != NO_SAMPLE && m_sMissionAudio.m_nLoadingStatus == LOADING_STATUS_LOADED && - !m_sMissionAudio.m_nPlayStatus) { - m_sMissionAudio.m_bIsPlayed = true; - } -} - -void -cAudioManager::PlayOneShot(int32 index, int16 sound, float vol) -{ - static const uint8 OneShotPriority[] = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 3, 5, 2, 2, 1, 1, 3, 1, 3, 3, 1, 1, 1, 4, 4, 3, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 3, 2, 2, 2, 2, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 3, 1, 1, 1, 9, - 2, 2, 0, 0, 0, 0, 3, 3, 5, 1, 1, 1, 1, 3, 4, 7, 6, 6, 6, 6, 1, 3, 4, 3, 4, 2, 1, 3, 5, 4, 6, 6, 1, 3, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - - if (m_bIsInitialised) { - if (index >= 0 && index < totalAudioEntitiesSlots) { - tAudioEntity &entity = m_asAudioEntities[index]; - if (entity.m_bIsUsed) { - if (sound < SOUND_TOTAL_SOUNDS) { - if (entity.m_nType == AUDIOTYPE_SCRIPTOBJECT) { - if (m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal < ARRAY_SIZE(m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices)) { - entity.m_awAudioEvent[0] = sound; - entity.m_AudioEvents = 1; - m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal++] = index; - } - } else { - int32 i = 0; - while (true) { - if (i >= entity.m_AudioEvents) { - if (entity.m_AudioEvents < ARRAY_SIZE(entity.m_awAudioEvent)) { - entity.m_awAudioEvent[i] = sound; - entity.m_afVolume[i] = vol; - ++entity.m_AudioEvents; - } - return; - } - if (OneShotPriority[entity.m_awAudioEvent[i]] > OneShotPriority[sound]) - break; - ++i; - } - if (i < NUM_AUDIOENTITY_EVENTS - 1) { - memmove(&entity.m_awAudioEvent[i + 1], &entity.m_awAudioEvent[i], (NUM_AUDIOENTITY_EVENTS - 1 - i) * NUM_AUDIOENTITY_EVENTS / 2); - memmove(&entity.m_afVolume[i + 1], &entity.m_afVolume[i], (NUM_AUDIOENTITY_EVENTS - 1 - i) * NUM_AUDIOENTITY_EVENTS); - } - entity.m_awAudioEvent[i] = sound; - entity.m_afVolume[i] = vol; - if (entity.m_AudioEvents < ARRAY_SIZE(entity.m_awAudioEvent)) - ++entity.m_AudioEvents; - } - } - } - } - } -} - -void -cAudioManager::PlayerJustGotInCar() const -{ - if (m_bIsInitialised) { - bPlayerJustEnteredCar = true; - } -} - -void -cAudioManager::PlayerJustLeftCar(void) const -{ - // UNUSED: This is a perfectly empty function. -} - -void -cAudioManager::PostInitialiseGameSpecificSetup() -{ - m_nFireAudioEntity = CreateEntity(AUDIOTYPE_FIRE, &gFireManager); - if (m_nFireAudioEntity >= 0) - SetEntityStatus(m_nFireAudioEntity, 1); - - m_nCollisionEntity = CreateEntity(AUDIOTYPE_COLLISION, (void *)1); - if (m_nCollisionEntity >= 0) - SetEntityStatus(m_nCollisionEntity, 1); - - m_nFrontEndEntity = CreateEntity(AUDIOTYPE_FRONTEND, (void *)1); - if (m_nFrontEndEntity >= 0) - SetEntityStatus(m_nFrontEndEntity, 1); - - m_nProjectileEntity = CreateEntity(AUDIOTYPE_PROJECTILE, (void *)1); - if (m_nProjectileEntity >= 0) - SetEntityStatus(m_nProjectileEntity, 1); - - m_nWaterCannonEntity = CreateEntity(AUDIOTYPE_WATERCANNON, (void *)1); - if (m_nWaterCannonEntity >= 0) - SetEntityStatus(m_nWaterCannonEntity, 1); - - m_nPoliceChannelEntity = CreateEntity(AUDIOTYPE_POLICERADIO, (void *)1); - if (m_nPoliceChannelEntity >= 0) - SetEntityStatus(m_nPoliceChannelEntity, 1); - - m_nBridgeEntity = CreateEntity(AUDIOTYPE_BRIDGE, (void *)1); - if (m_nBridgeEntity >= 0) - SetEntityStatus(m_nBridgeEntity, 1); - - m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; - m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_NOT_LOADED; - m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_STOPPED; - m_sMissionAudio.field_22 = 0; - m_sMissionAudio.m_bIsPlayed = false; - m_sMissionAudio.m_bPredefinedProperties = 1; - m_sMissionAudio.m_nMissionAudioCounter = 0; - ResetAudioLogicTimers(CTimer::GetTimeInMilliseconds()); -} - -void -cAudioManager::PostTerminateGameSpecificShutdown() -{ - ; -} - -void -cAudioManager::PreInitialiseGameSpecificSetup() const -{ - BankStartOffset[SAMPLEBANK_MAIN] = SFX_CAR_HORN_JEEP; - BankStartOffset[SAMPLEBANK_PED] = SFX_COP_VOICE_1_ARREST_1; -} - -struct MissionAudioData { - const char *m_pName; - int32 m_nId; -}; - -const MissionAudioData MissionAudioNameSfxAssoc[] = { - {"lib_a1", STREAMED_SOUND_MISSION_LIB_A1}, {"lib_a2", STREAMED_SOUND_MISSION_LIB_A2}, {"lib_a", STREAMED_SOUND_MISSION_LIB_A}, - {"lib_b", STREAMED_SOUND_MISSION_LIB_B}, {"lib_c", STREAMED_SOUND_MISSION_LIB_C}, {"lib_d", STREAMED_SOUND_MISSION_LIB_D}, - {"l2_a", STREAMED_SOUND_MISSION_L2_A}, {"j4t_1", STREAMED_SOUND_MISSION_J4T_1}, {"j4t_2", STREAMED_SOUND_MISSION_J4T_2}, - {"j4t_3", STREAMED_SOUND_MISSION_J4T_3}, {"j4t_4", STREAMED_SOUND_MISSION_J4T_4}, {"j4_a", STREAMED_SOUND_MISSION_J4_A}, - {"j4_b", STREAMED_SOUND_MISSION_J4_B}, {"j4_c", STREAMED_SOUND_MISSION_J4_C}, {"j4_d", STREAMED_SOUND_MISSION_J4_D}, - {"j4_e", STREAMED_SOUND_MISSION_J4_E}, {"j4_f", STREAMED_SOUND_MISSION_J4_F}, {"j6_1", STREAMED_SOUND_MISSION_J6_1}, - {"j6_a", STREAMED_SOUND_MISSION_J6_A}, {"j6_b", STREAMED_SOUND_MISSION_J6_B}, {"j6_c", STREAMED_SOUND_MISSION_J6_C}, - {"j6_d", STREAMED_SOUND_MISSION_J6_D}, {"t4_a", STREAMED_SOUND_MISSION_T4_A}, {"s1_a", STREAMED_SOUND_MISSION_S1_A}, - {"s1_a1", STREAMED_SOUND_MISSION_S1_A1}, {"s1_b", STREAMED_SOUND_MISSION_S1_B}, {"s1_c", STREAMED_SOUND_MISSION_S1_C}, - {"s1_c1", STREAMED_SOUND_MISSION_S1_C1}, {"s1_d", STREAMED_SOUND_MISSION_S1_D}, {"s1_e", STREAMED_SOUND_MISSION_S1_E}, - {"s1_f", STREAMED_SOUND_MISSION_S1_F}, {"s1_g", STREAMED_SOUND_MISSION_S1_G}, {"s1_h", STREAMED_SOUND_MISSION_S1_H}, - {"s1_i", STREAMED_SOUND_MISSION_S1_I}, {"s1_j", STREAMED_SOUND_MISSION_S1_J}, {"s1_k", STREAMED_SOUND_MISSION_S1_K}, - {"s1_l", STREAMED_SOUND_MISSION_S1_L}, {"s3_a", STREAMED_SOUND_MISSION_S3_A}, {"s3_b", STREAMED_SOUND_MISSION_S3_B}, - {"el3_a", STREAMED_SOUND_MISSION_EL3_A}, {"mf1_a", STREAMED_SOUND_MISSION_MF1_A}, {"mf2_a", STREAMED_SOUND_MISSION_MF2_A}, - {"mf3_a", STREAMED_SOUND_MISSION_MF3_A}, {"mf3_b", STREAMED_SOUND_MISSION_MF3_B}, {"mf3_b1", STREAMED_SOUND_MISSION_MF3_B1}, - {"mf3_c", STREAMED_SOUND_MISSION_MF3_C}, {"mf4_a", STREAMED_SOUND_MISSION_MF4_A}, {"mf4_b", STREAMED_SOUND_MISSION_MF4_B}, - {"mf4_c", STREAMED_SOUND_MISSION_MF4_C}, {"a1_a", STREAMED_SOUND_MISSION_A1_A}, {"a3_a", STREAMED_SOUND_MISSION_A3_A}, - {"a5_a", STREAMED_SOUND_MISSION_A5_A}, {"a4_a", STREAMED_SOUND_MISSION_A4_A}, {"a4_b", STREAMED_SOUND_MISSION_A4_B}, - {"a4_c", STREAMED_SOUND_MISSION_A4_C}, {"a4_d", STREAMED_SOUND_MISSION_A4_D}, {"k1_a", STREAMED_SOUND_MISSION_K1_A}, - {"k3_a", STREAMED_SOUND_MISSION_K3_A}, {"r1_a", STREAMED_SOUND_MISSION_R1_A}, {"r2_a", STREAMED_SOUND_MISSION_R2_A}, - {"r2_b", STREAMED_SOUND_MISSION_R2_B}, {"r2_c", STREAMED_SOUND_MISSION_R2_C}, {"r2_d", STREAMED_SOUND_MISSION_R2_D}, - {"r2_e", STREAMED_SOUND_MISSION_R2_E}, {"r2_f", STREAMED_SOUND_MISSION_R2_F}, {"r2_g", STREAMED_SOUND_MISSION_R2_G}, - {"r2_h", STREAMED_SOUND_MISSION_R2_H}, {"r5_a", STREAMED_SOUND_MISSION_R5_A}, {"r6_a", STREAMED_SOUND_MISSION_R6_A}, - {"r6_a1", STREAMED_SOUND_MISSION_R6_A1}, {"r6_b", STREAMED_SOUND_MISSION_R6_B}, {"lo2_a", STREAMED_SOUND_MISSION_LO2_A}, - {"lo6_a", STREAMED_SOUND_MISSION_LO6_A}, {"yd2_a", STREAMED_SOUND_MISSION_YD2_A}, {"yd2_b", STREAMED_SOUND_MISSION_YD2_B}, - {"yd2_c", STREAMED_SOUND_MISSION_YD2_C}, {"yd2_c1", STREAMED_SOUND_MISSION_YD2_C1}, {"yd2_d", STREAMED_SOUND_MISSION_YD2_D}, - {"yd2_e", STREAMED_SOUND_MISSION_YD2_E}, {"yd2_f", STREAMED_SOUND_MISSION_YD2_F}, {"yd2_g", STREAMED_SOUND_MISSION_YD2_G}, - {"yd2_h", STREAMED_SOUND_MISSION_YD2_H}, {"yd2_ass", STREAMED_SOUND_MISSION_YD2_ASS}, {"yd2_ok", STREAMED_SOUND_MISSION_YD2_OK}, - {"h5_a", STREAMED_SOUND_MISSION_H5_A}, {"h5_b", STREAMED_SOUND_MISSION_H5_B}, {"h5_c", STREAMED_SOUND_MISSION_H5_C}, - {"ammu_a", STREAMED_SOUND_MISSION_AMMU_A}, {"ammu_b", STREAMED_SOUND_MISSION_AMMU_B}, {"ammu_c", STREAMED_SOUND_MISSION_AMMU_C}, - {"door_1", STREAMED_SOUND_MISSION_DOOR_1}, {"door_2", STREAMED_SOUND_MISSION_DOOR_2}, {"door_3", STREAMED_SOUND_MISSION_DOOR_3}, - {"door_4", STREAMED_SOUND_MISSION_DOOR_4}, {"door_5", STREAMED_SOUND_MISSION_DOOR_5}, {"door_6", STREAMED_SOUND_MISSION_DOOR_6}, - {"t3_a", STREAMED_SOUND_MISSION_T3_A}, {"t3_b", STREAMED_SOUND_MISSION_T3_B}, {"t3_c", STREAMED_SOUND_MISSION_T3_C}, - {"k1_b", STREAMED_SOUND_MISSION_K1_B}, {"c_1", STREAMED_SOUND_MISSION_CAT1}}; - -int32 -FindMissionAudioSfx(const char *name) -{ - for (uint32 i = 0; i < ARRAY_SIZE(MissionAudioNameSfxAssoc); ++i) { - if (!CGeneral::faststricmp(MissionAudioNameSfxAssoc[i].m_pName, name)) - return MissionAudioNameSfxAssoc[i].m_nId; - } - debug("Can't find mission audio %s", name); - return NO_SAMPLE; -} - -void -cAudioManager::PreloadMissionAudio(const char *name) -{ - if (m_bIsInitialised) { - int32 missionAudioSfx = FindMissionAudioSfx(name); - if (missionAudioSfx != NO_SAMPLE) { - m_sMissionAudio.m_nSampleIndex = missionAudioSfx; - m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_NOT_LOADED; - m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_STOPPED; - m_sMissionAudio.field_22 = 0; - m_sMissionAudio.m_nMissionAudioCounter = m_nTimeSpent * SampleManager.GetStreamedFileLength(missionAudioSfx) / 1000; - m_sMissionAudio.m_nMissionAudioCounter *= 4; - m_sMissionAudio.m_bIsPlayed = false; - m_sMissionAudio.m_bPredefinedProperties = 1; - g_bMissionAudioLoadFailed = false; - } - } -} -void -cAudioManager::PreTerminateGameSpecificShutdown() -{ - if (m_nBridgeEntity >= 0) { - DestroyEntity(m_nBridgeEntity); - m_nBridgeEntity = AEHANDLE_NONE; - } - if (m_nPoliceChannelEntity >= 0) { - DestroyEntity(m_nPoliceChannelEntity); - m_nPoliceChannelEntity = AEHANDLE_NONE; - } - if (m_nWaterCannonEntity >= 0) { - DestroyEntity(m_nWaterCannonEntity); - m_nWaterCannonEntity = AEHANDLE_NONE; - } - if (m_nFireAudioEntity >= 0) { - DestroyEntity(m_nFireAudioEntity); - m_nFireAudioEntity = AEHANDLE_NONE; - } - if (m_nCollisionEntity >= 0) { - DestroyEntity(m_nCollisionEntity); - m_nCollisionEntity = AEHANDLE_NONE; - } - if (m_nFrontEndEntity >= 0) { - DestroyEntity(m_nFrontEndEntity); - m_nFrontEndEntity = AEHANDLE_NONE; - } - if (m_nProjectileEntity >= 0) { - DestroyEntity(m_nProjectileEntity); - m_nProjectileEntity = AEHANDLE_NONE; - } -} - void cAudioManager::ProcessActiveQueues() { @@ -3688,6088 +896,57 @@ cAudioManager::ProcessActiveQueues() } } -bool -cAudioManager::ProcessAirBrakes(cVehicleParams *params) -{ - CAutomobile *automobile; - uint8 rand; - - if (params->m_fDistance > 900.0f) - return false; - automobile = (CAutomobile *)params->m_pVehicle; - if (!automobile->bEngineOn) - return true; - - if ((automobile->m_fVelocityChangeForAudio < 0.025f || params->m_fVelocityChange >= 0.025f) && - (automobile->m_fVelocityChangeForAudio > -0.025f || params->m_fVelocityChange <= 0.025f)) - return true; - - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - rand = m_anRandomTable[0] % 10 + 70; - m_sQueueSample.m_nVolume = ComputeVolume(rand, 30.0f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 13; - m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AIR_BRAKES); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 10; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nEmittingVolume = rand; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - - return true; -} - -void -cAudioManager::ProcessAirportScriptObject(uint8 sound) -{ - static uint8 counter = 0; - - uint32 time = CTimer::GetTimeInMilliseconds(); - if (time > gAirportNextTime) { - switch (sound) { - case SCRIPT_SOUND_AIRPORT_LOOP_S: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; - break; - case SCRIPT_SOUND_AIRPORT_LOOP_L: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; - break; - default: - return; - } - float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] & 3) + SFX_AIRPORT_ANNOUNCEMENT_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nCounter = counter++; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_nEmittingVolume = 110; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - gAirportNextTime = time + 10000 + m_anRandomTable[3] % 20000; - } - } - } -} - -bool -cAudioManager::ProcessBoatEngine(cVehicleParams *params) -{ - CBoat *boat; - float padRelativeAccerate; - float gasPedal; - int32 padAccelerate; - uint8 emittingVol; - float oneShotVol; - - static uint16 LastAccel = 0; - static uint8 LastVol = 0; - - static const int intensity = 50; - - if (params->m_fDistance < SQR(intensity)) { - boat = (CBoat *)params->m_pVehicle; - if (params->m_nIndex == REEFER) { - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - m_sQueueSample.m_nVolume = ComputeVolume(80, 50.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 39; - m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; - m_sQueueSample.m_nFrequency = 10386; - m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex * 65536) % 1000; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = 80; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = intensity; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 7; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - if (FindPlayerVehicle() == params->m_pVehicle) { - if (Pads[0].GetAccelerate() <= Pads[0].GetBrake()) - padAccelerate = Pads[0].GetBrake(); - else - padAccelerate = Pads[0].GetAccelerate(); - padRelativeAccerate = padAccelerate / 255; - emittingVol = (100.f * padRelativeAccerate) + 15; - m_sQueueSample.m_nFrequency = (3000.f * padRelativeAccerate) + 6000; - if (!boat->m_bIsAnchored) - m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10; - } else { - gasPedal = Abs(boat->m_fGasPedal); - if (gasPedal > 0.0f) { - m_sQueueSample.m_nFrequency = 6000; - emittingVol = 15; - } else { - emittingVol = (100.f * gasPedal) + 15; - m_sQueueSample.m_nFrequency = (3000.f * gasPedal) + 6000; - if (!boat->m_bIsAnchored) - m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10; - } - } - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance); - if (!m_sQueueSample.m_nVolume) - return true; - m_sQueueSample.m_nCounter = 40; - m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL; - m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex * 65536) % 1000; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = intensity; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 7; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - } else { - if (FindPlayerVehicle() == params->m_pVehicle) { - if (Pads[0].GetAccelerate() <= Pads[0].GetBrake()) - padAccelerate = Pads[0].GetBrake(); - else - padAccelerate = Pads[0].GetAccelerate(); - if (padAccelerate <= 20) { - emittingVol = 45 - 45 * padAccelerate / 40; - m_sQueueSample.m_nFrequency = 100 * padAccelerate + 11025; - m_sQueueSample.m_nCounter = 39; - m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_IDLE; - if (LastAccel > 20) { - oneShotVol = LastVol; - PlayOneShot(m_sQueueSample.m_nEntityIndex, SOUND_17, oneShotVol); - } - } else { - emittingVol = 105 * padAccelerate / 255 + 15; - m_sQueueSample.m_nFrequency = 4000 * padAccelerate / 255 + 8000; - if (!boat->m_bIsAnchored) - m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10; - m_sQueueSample.m_nCounter = 40; - m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL; - } - LastVol = emittingVol; - LastAccel = padAccelerate; - } else { - gasPedal = Abs(boat->m_fGasPedal); - if (gasPedal > 0.0f) { - m_sQueueSample.m_nFrequency = 11025; - emittingVol = 45; - m_sQueueSample.m_nCounter = 39; - m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_IDLE; - } else { - emittingVol = (105.f * gasPedal) + 15; - m_sQueueSample.m_nFrequency = (4000.f * gasPedal) + 8000; - if (!boat->m_bIsAnchored) - m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10; - m_sQueueSample.m_nCounter = 40; - m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_ACCEL; - } - } - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance); - if (!m_sQueueSample.m_nVolume) - return true; - m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex * 65536) % 1000; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = intensity; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 7; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - } - AddSampleToRequestedQueue(); - return true; - } - return false; -} - -bool -cAudioManager::ProcessBoatMovingOverWater(cVehicleParams *params) -{ - float velocityChange; - int32 vol; - float multiplier; - - if (params->m_fDistance > 2500.f) - return false; - - velocityChange = Abs(params->m_fVelocityChange); - if (velocityChange <= 0.0005f && params->m_pVehicle->GetPosition().y) - return true; - - velocityChange = Min(0.75f, velocityChange); - multiplier = (velocityChange - 0.0005f) * 1.3342f; - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - vol = (30.f * multiplier); - m_sQueueSample.m_nVolume = ComputeVolume(vol, 50.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 38; - m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nFrequency = (6050.f * multiplier) + 16000; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = vol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = 50.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - - return true; -} - -void -cAudioManager::ProcessBridge() -{ - float dist; - bool distCalculated = false; - - if (CBridge::pLiftRoad) { - m_sQueueSample.m_vecPos = CBridge::pLiftRoad->GetPosition(); - dist = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (dist < 202500.0f) { - CalculateDistance(distCalculated, dist); - switch (CBridge::State) { - case STATE_BRIDGE_LOCKED: - case STATE_LIFT_PART_IS_UP: - case STATE_LIFT_PART_ABOUT_TO_MOVE_UP: - ProcessBridgeWarning(); - break; - case STATE_LIFT_PART_MOVING_DOWN: - case STATE_LIFT_PART_MOVING_UP: - ProcessBridgeWarning(); - ProcessBridgeMotor(); - break; - default: - break; - } - ProcessBridgeOneShots(); - } - } -} - -void -cAudioManager::ProcessBridgeMotor() -{ - if (m_sQueueSample.m_fDistance < bridgeIntensity) { - m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, bridgeIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 1; - m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; // todo check sfx name - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 1; - m_sQueueSample.m_nFrequency = 5500; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = maxVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = bridgeIntensity; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = false; - AddSampleToRequestedQueue(); - } - } -} - -void -cAudioManager::ProcessBridgeOneShots() -{ - if (CBridge::State == STATE_LIFT_PART_IS_UP && CBridge::OldState == STATE_LIFT_PART_MOVING_UP) { - m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; - } else { - if (CBridge::State == STATE_LIFT_PART_IS_DOWN && CBridge::OldState == STATE_LIFT_PART_MOVING_DOWN) { - m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; - } else { - if (CBridge::State == STATE_LIFT_PART_MOVING_UP && CBridge::OldState == STATE_LIFT_PART_ABOUT_TO_MOVE_UP) { - m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; - } else { - if (CBridge::State == STATE_LIFT_PART_MOVING_DOWN && CBridge::OldState == STATE_LIFT_PART_IS_UP) { - m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; - } else - return; - } - } - } - if (m_sQueueSample.m_fDistance < bridgeIntensity) { - m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, bridgeIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 2; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 1; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nEmittingVolume = maxVolume; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = bridgeIntensity; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bReverbFlag = false; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } -} - -void -cAudioManager::ProcessBridgeWarning() -{ - if (CStats::CommercialPassed && m_sQueueSample.m_fDistance < 450.f) { - m_sQueueSample.m_nVolume = ComputeVolume(100, 450.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 0; - m_sQueueSample.m_nSampleIndex = SFX_BRIDGE_OPEN_WARNING; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 1; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BRIDGE_OPEN_WARNING); - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = 100; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = 450.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 8; - m_sQueueSample.m_bReverbFlag = false; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } -} - -bool -cAudioManager::ProcessCarBombTick(cVehicleParams *params) -{ - CAutomobile *automobile; - - if (params->m_fDistance >= SQR(40.f)) - return false; - automobile = (CAutomobile *)params->m_pVehicle; - if (automobile->bEngineOn && automobile->m_bombType == CARBOMB_TIMEDACTIVE) { - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - m_sQueueSample.m_nVolume = ComputeVolume(60, 40.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 35; - m_sQueueSample.m_nSampleIndex = SFX_COUNTDOWN; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 0; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COUNTDOWN); - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = 60; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = 40.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - return true; -} - -void -cAudioManager::ProcessCesna(cVehicleParams *params) -{ - static uint8 nAccel = 0; - - //((CAutomobile *)params->m_pVehicle)->Damage.GetEngineStatus(); - - if (FindPlayerVehicle() == params->m_pVehicle) { - if (params->m_nIndex == DODO) { - if (Pads[0].GetAccelerate() <= 0) { - if (nAccel) - --nAccel; - } else if (nAccel < 60) { - ++nAccel; - } - AddPlayerCarSample(85 * (60 - nAccel) / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_IDLE, 0, 52, 1); - AddPlayerCarSample(85 * nAccel / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_REV, 0, 2, 1); - } - } else if (params->m_nIndex == DODO) { - AddPlayerCarSample(105, 17000, SFX_CESNA_IDLE, 0, 52, 1); - } else if (params->m_fDistance < 40000.f) { - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - m_sQueueSample.m_nVolume = ComputeVolume(80, 200.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 52; - m_sQueueSample.m_nSampleIndex = SFX_CESNA_IDLE; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 0; - m_sQueueSample.m_nFrequency = 12500; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nReleasingVolumeDivider = 8; - m_sQueueSample.m_nEmittingVolume = 80; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 8.0f; - m_sQueueSample.m_fSoundIntensity = 200.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - if (params->m_fDistance < 8100.f) { - m_sQueueSample.m_nVolume = ComputeVolume(80, 90.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 2; - m_sQueueSample.m_nSampleIndex = SFX_CESNA_REV; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 0; - m_sQueueSample.m_nFrequency = 25000; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_nEmittingVolume = 80; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 8.0f; - m_sQueueSample.m_fSoundIntensity = 90.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - } -} - -void -cAudioManager::ProcessCinemaScriptObject(uint8 sound) -{ - uint8 rand; - - static uint8 counter = 0; - - uint32 time = CTimer::GetTimeInMilliseconds(); - if (time > gCinemaNextTime) { - switch (sound) { - case SCRIPT_SOUND_CINEMA_LOOP_S: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; - break; - case SCRIPT_SOUND_CINEMA_LOOP_L: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; - break; - default: - return; - } - float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); - rand = m_anRandomTable[0] % 90 + 30; - m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nSampleIndex = counter % 3 + SFX_CINEMA_BASS_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 4); - m_sQueueSample.m_nCounter = counter++; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_nEmittingVolume = rand; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - gCinemaNextTime = time + 1000 + m_anRandomTable[3] % 4000; - } - } - } -} - -void -cAudioManager::ProcessCrane() -{ - CCrane *crane = (CCrane *)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity; - float distSquared; - bool distCalculated = false; - static const int intensity = 80; - - if (crane) { - if (crane->m_nCraneStatus == CCrane::ACTIVATED) { - if (crane->m_nCraneState != CCrane::IDLE) { - m_sQueueSample.m_vecPos = crane->m_pCraneEntity->GetPosition(); - distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(intensity)) { - CalculateDistance(distCalculated, distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(100, 80.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 0; - m_sQueueSample.m_nSampleIndex = SFX_CRANE_MAGNET; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 2; - m_sQueueSample.m_nFrequency = 6000; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = 100; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = intensity; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents) { - m_sQueueSample.m_nCounter = 1; - m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_2; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COL_CAR_2); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = true; - AddSampleToRequestedQueue(); - } - } - } - } - } -} - -void -cAudioManager::ProcessDocksScriptObject(uint8 sound) -{ - uint32 time; - uint8 rand; - float distSquared; - - static uint32 counter = 0; - - time = CTimer::GetTimeInMilliseconds(); - if (time > gDocksNextTime) { - switch (sound) { - case SCRIPT_SOUND_DOCKS_LOOP_S: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; - break; - case SCRIPT_SOUND_DOCKS_LOOP_L: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; - break; - default: - return; - } - distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); - rand = m_anRandomTable[0] % 60 + 40; - m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nSampleIndex = SFX_DOCKS_FOGHORN; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOCKS_FOGHORN); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8); - m_sQueueSample.m_nCounter = counter++; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_nEmittingVolume = rand; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - gDocksNextTime = time + 10000 + m_anRandomTable[3] % 40000; - } - } - } -} - -bool -cAudioManager::ProcessEngineDamage(cVehicleParams *params) -{ - CAutomobile *veh; - uint8 engineStatus; - uint8 emittingVolume; - - if (params->m_fDistance >= SQR(engineDamageIntensity)) - return false; - veh = (CAutomobile *)params->m_pVehicle; - if (veh->bEngineOn) { - engineStatus = veh->Damage.GetEngineStatus(); - if (engineStatus > 250 || engineStatus < 100) - return true; - if (engineStatus < 225) { - m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; - emittingVolume = 6; - m_sQueueSample.m_nReleasingVolumeModificator = 7; - m_sQueueSample.m_nFrequency = 40000; - } else { - emittingVolume = 60; - m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; - m_sQueueSample.m_nReleasingVolumeModificator = 7; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); - } - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, engineDamageIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 28; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = emittingVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = engineDamageIntensity; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - return true; -} - -void -cAudioManager::ProcessEntity(int32 id) -{ - if (m_asAudioEntities[id].m_nStatus) { - m_sQueueSample.m_nEntityIndex = id; - switch (m_asAudioEntities[id].m_nType) { - case AUDIOTYPE_PHYSICAL: - if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; - ProcessPhysical(id); - } - break; - case AUDIOTYPE_EXPLOSION: - if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; - ProcessExplosions(id); - } - break; - case AUDIOTYPE_FIRE: - if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; - ProcessFires(id); - } - break; - case AUDIOTYPE_WEATHER: - if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; - ProcessWeather(id); - } - break; - case AUDIOTYPE_CRANE: - if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; - ProcessCrane(); - } - break; - case AUDIOTYPE_SCRIPTOBJECT: - if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; - ProcessScriptObject(id); - } - break; - case AUDIOTYPE_BRIDGE: - if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; - ProcessBridge(); - } - break; - case AUDIOTYPE_FRONTEND: - m_sQueueSample.m_bReverbFlag = false; - ProcessFrontEnd(); - break; - case AUDIOTYPE_PROJECTILE: - if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; - ProcessProjectiles(); - } - break; - case AUDIOTYPE_GARAGE: - if (!m_nUserPause) - ProcessGarages(); - break; - case AUDIOTYPE_FIREHYDRANT: - if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; - ProcessFireHydrant(); - } - break; - case AUDIOTYPE_WATERCANNON: - if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; - ProcessWaterCannon(id); - } - break; - default: - return; - } - } -} - -void -cAudioManager::ProcessExplosions(int32 explosion) -{ - uint8 type; - CVector *pos; - float distSquared; - - for (uint8 i = 0; i < ARRAY_SIZE(gaExplosion); i++) { - if (CExplosion::GetExplosionActiveCounter(i) == 1) { - CExplosion::ResetExplosionActiveCounter(i); - type = CExplosion::GetExplosionType(i); - switch (type) { - case EXPLOSION_GRENADE: - case EXPLOSION_ROCKET: - case EXPLOSION_BARREL: - case EXPLOSION_TANK_GRENADE: - m_sQueueSample.m_fSoundIntensity = 400.0f; - m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_2; - m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 38000; - m_sQueueSample.m_nReleasingVolumeModificator = 0; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - break; - case EXPLOSION_MOLOTOV: - m_sQueueSample.m_fSoundIntensity = 200.0f; - m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_3; - m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000; - m_sQueueSample.m_nReleasingVolumeModificator = 0; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - break; - case EXPLOSION_MINE: - case EXPLOSION_HELI_BOMB: - m_sQueueSample.m_fSoundIntensity = 300.0f; - m_sQueueSample.m_nSampleIndex = SFX_ROCKET_LEFT; - m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 12347; - m_sQueueSample.m_nReleasingVolumeModificator = 0; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - break; - default: - m_sQueueSample.m_fSoundIntensity = 400.0f; - m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_1; - m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 38000; - if (type == EXPLOSION_HELI) - m_sQueueSample.m_nFrequency = 8 * m_sQueueSample.m_nFrequency / 10; - m_sQueueSample.m_nReleasingVolumeModificator = 0; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - break; - } - pos = CExplosion::GetExplosionPosition(i); - m_sQueueSample.m_vecPos = *pos; - distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = i; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_nEmittingVolume = maxVolume; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = true; - AddSampleToRequestedQueue(); - } - } - } - } -} - -void -cAudioManager::ProcessFireHydrant() -{ - float distSquared; - bool distCalculated = false; - static const int intensity = 35; - - m_sQueueSample.m_vecPos = ((CEntity *)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)->GetPosition(); - distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(intensity)) { - CalculateDistance(distCalculated, distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(40, 35.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 0; - m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 4; - m_sQueueSample.m_nFrequency = 15591; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = 40; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = intensity; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } -} - -void cAudioManager::ProcessFires(int32) -{ - CEntity *entity; - uint8 emittingVol; - float distSquared; - - for (uint8 i = 0; i < NUM_FIRES; i++) { - if (gFireManager.m_aFires[i].m_bIsOngoing && gFireManager.m_aFires[i].m_bAudioSet) { - entity = gFireManager.m_aFires[i].m_pEntity; - if (entity) { - switch (entity->GetType()) { - case ENTITY_TYPE_BUILDING: - m_sQueueSample.m_fSoundIntensity = 50.0f; - m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; - emittingVol = 100; - m_sQueueSample.m_nFrequency = 8 * SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE) / 10; - m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64); - m_sQueueSample.m_nReleasingVolumeModificator = 6; - break; - case ENTITY_TYPE_PED: - m_sQueueSample.m_fSoundIntensity = 25.0f; - m_sQueueSample.m_nSampleIndex = SFX_PED_ON_FIRE; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PED_ON_FIRE); - emittingVol = 60; - m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64); - m_sQueueSample.m_nReleasingVolumeModificator = 10; - break; - default: - m_sQueueSample.m_fSoundIntensity = 50.0f; - m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); - m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64); - emittingVol = 80; - m_sQueueSample.m_nReleasingVolumeModificator = 8; - } - } else { - m_sQueueSample.m_fSoundIntensity = 50.0f; - m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); - m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64); - emittingVol = 80; - m_sQueueSample.m_nReleasingVolumeModificator = 8; - } - m_sQueueSample.m_vecPos = gFireManager.m_aFires[i].m_vecPos; - distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = i; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_nReleasingVolumeDivider = 10; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - } - } -} - -void -cAudioManager::ProcessFrontEnd() -{ - bool stereo; - bool processedPickup; - bool processedMission; - int16 sample; - - static uint8 counter = 0; - static uint32 cPickupNextFrame = 0; - static uint32 cPartMisComNextFrame = 0; - - for (uint32 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) { - processedPickup = false; - stereo = false; - processedMission = false; - switch (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]) { - case SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM: - m_sQueueSample.m_nSampleIndex = SFX_ERROR_FIRE_RIFLE; - break; - case SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM: - m_sQueueSample.m_nSampleIndex = SFX_ERROR_FIRE_ROCKET_LAUNCHER; - break; - case SOUND_GARAGE_NO_MONEY: - case SOUND_GARAGE_BAD_VEHICLE: - case SOUND_GARAGE_BOMB_ALREADY_SET: - m_sQueueSample.m_nSampleIndex = SFX_PICKUP_ERROR_LEFT; - stereo = true; - break; - case SOUND_GARAGE_OPENING: - case SOUND_GARAGE_BOMB1_SET: - case SOUND_GARAGE_BOMB2_SET: - case SOUND_GARAGE_BOMB3_SET: - case SOUND_41: - case SOUND_GARAGE_VEHICLE_DECLINED: - case SOUND_GARAGE_VEHICLE_ACCEPTED: - case SOUND_PICKUP_HEALTH: - case SOUND_4B: - case SOUND_PICKUP_ADRENALINE: - case SOUND_PICKUP_ARMOUR: - case SOUND_EVIDENCE_PICKUP: - case SOUND_UNLOAD_GOLD: - m_sQueueSample.m_nSampleIndex = SFX_PICKUP_2_LEFT; - processedPickup = true; - stereo = true; - break; - case SOUND_PICKUP_WEAPON_BOUGHT: - case SOUND_PICKUP_WEAPON: - m_sQueueSample.m_nSampleIndex = SFX_PICKUP_1_LEFT; - processedPickup = true; - stereo = true; - break; - case SOUND_4A: - m_sQueueSample.m_nSampleIndex = SFX_PICKUP_ERROR_LEFT; - processedPickup = true; - stereo = true; - break; - case SOUND_PICKUP_BONUS: - case SOUND_PICKUP_MONEY: - case SOUND_PICKUP_HIDDEN_PACKAGE: - case SOUND_PICKUP_PACMAN_PILL: - case SOUND_PICKUP_PACMAN_PACKAGE: - case SOUND_PICKUP_FLOAT_PACKAGE: - m_sQueueSample.m_nSampleIndex = SFX_PICKUP_3_LEFT; - processedPickup = true; - stereo = true; - break; - case SOUND_PAGER: - m_sQueueSample.m_nSampleIndex = SFX_PAGER; - break; - case SOUND_RACE_START_3: - case SOUND_RACE_START_2: - case SOUND_RACE_START_1: - case SOUND_CLOCK_TICK: - m_sQueueSample.m_nSampleIndex = SFX_TIMER_BEEP; - break; - case SOUND_RACE_START_GO: - m_sQueueSample.m_nSampleIndex = SFX_PART_MISSION_COMPLETE; - break; - case SOUND_PART_MISSION_COMPLETE: - m_sQueueSample.m_nSampleIndex = SFX_PART_MISSION_COMPLETE; - processedMission = true; - break; - case SOUND_FRONTEND_MENU_STARTING: - m_sQueueSample.m_nSampleIndex = SFX_START_BUTTON_LEFT; - stereo = true; - break; - case SOUND_FRONTEND_MENU_COMPLETED: - m_sQueueSample.m_nSampleIndex = SFX_PAGE_CHANGE_AND_BACK_LEFT; - stereo = true; - break; - case SOUND_FRONTEND_MENU_DENIED: - m_sQueueSample.m_nSampleIndex = SFX_HIGHLIGHT_LEFT; - stereo = true; - break; - case SOUND_FRONTEND_MENU_SUCCESS: - m_sQueueSample.m_nSampleIndex = SFX_SELECT_LEFT; - stereo = true; - break; - case SOUND_FRONTEND_EXIT: - m_sQueueSample.m_nSampleIndex = SFX_SUB_MENU_BACK_LEFT; - stereo = true; - break; - case SOUND_9A: - m_sQueueSample.m_nSampleIndex = SFX_STEREO_LEFT; - stereo = true; - break; - case SOUND_9B: - m_sQueueSample.m_nSampleIndex = SFX_MONO; - break; - case SOUND_FRONTEND_AUDIO_TEST: - m_sQueueSample.m_nSampleIndex = m_anRandomTable[0] % 3 + SFX_NOISE_BURST_1; - break; - case SOUND_FRONTEND_FAIL: - m_sQueueSample.m_nSampleIndex = SFX_ERROR_LEFT; - stereo = true; - break; - case SOUND_FRONTEND_NO_RADIO: - case SOUND_FRONTEND_RADIO_CHANGE: - m_sQueueSample.m_nSampleIndex = SFX_RADIO_CLICK; - break; - case SOUND_A0: - m_sQueueSample.m_nSampleIndex = SFX_INFO; - break; - default: - continue; - } - - if (processedPickup) { - if (m_FrameCounter <= cPickupNextFrame) - continue; - cPickupNextFrame = m_FrameCounter + 5; - } else if (processedMission) { - if (m_FrameCounter <= cPartMisComNextFrame) - continue; - cPartMisComNextFrame = m_FrameCounter + 5; - } - - sample = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]; - if (sample == SFX_RAIN) { - m_sQueueSample.m_nFrequency = 28509; - } else if (sample == SFX_PICKUP_1_LEFT) { - if (1.f == m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]) - m_sQueueSample.m_nFrequency = 32000; - else - m_sQueueSample.m_nFrequency = 48000; - } else { - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - } - m_sQueueSample.m_nVolume = 110; - m_sQueueSample.m_nCounter = counter++; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nReleasingVolumeModificator = 0; - m_sQueueSample.m_bIs2D = true; - m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - if (stereo) - m_sQueueSample.m_nOffset = m_anRandomTable[0] & 31; - else - m_sQueueSample.m_nOffset = 63; - m_sQueueSample.m_bReverbFlag = false; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - if (stereo) { - ++m_sQueueSample.m_nSampleIndex; - m_sQueueSample.m_nCounter = counter++; - m_sQueueSample.m_nOffset = maxVolume - m_sQueueSample.m_nOffset; - AddSampleToRequestedQueue(); - } - } -} - -void -cAudioManager::ProcessGarages() -{ - CEntity *entity; - eGarageState state; - uint32 sampleIndex; - uint8 j; - float distSquared; - bool distCalculated; - - static uint8 iSound = 32; - -#define LOOP_HELPER \ - for (j = 0; j < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; ++j) { \ - switch (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[j]) { \ - case SOUND_GARAGE_DOOR_CLOSED: \ - case SOUND_GARAGE_DOOR_OPENED: \ - if (distSquared < 6400.f) { \ - CalculateDistance(distCalculated, distSquared); \ - m_sQueueSample.m_nVolume = ComputeVolume(60, 80.f, m_sQueueSample.m_fDistance); \ - if (m_sQueueSample.m_nVolume) { \ - if (CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) { \ - m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2; \ - m_sQueueSample.m_nFrequency = 6735; \ - } else if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[j] == 69) { \ - m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2; \ - m_sQueueSample.m_nFrequency = 22000; \ - } else { \ - m_sQueueSample.m_nSampleIndex = SFX_COL_GARAGE_DOOR_1; \ - m_sQueueSample.m_nFrequency = 18000; \ - } \ - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; \ - m_sQueueSample.m_nReleasingVolumeModificator = 4; \ - m_sQueueSample.m_nEmittingVolume = 60; \ - m_sQueueSample.m_fSpeedMultiplier = 0.0f; \ - m_sQueueSample.m_fSoundIntensity = 80.0f; \ - /*m_sQueueSample.m_nReleasingVolumeModificator = 4;*/ \ - m_sQueueSample.m_bReverbFlag = true; \ - /*m_sQueueSample.m_bReverbFlag = true;*/ \ - m_sQueueSample.m_bIs2D = false; \ - m_sQueueSample.m_bReleasingSoundFlag = true; \ - m_sQueueSample.m_nLoopCount = 1; \ - m_sQueueSample.m_nLoopStart = 0; \ - m_sQueueSample.m_nLoopEnd = -1; \ - m_sQueueSample.m_nCounter = iSound++; \ - if (iSound < 32) \ - iSound = 32; \ - m_sQueueSample.m_bRequireReflection = true; \ - AddSampleToRequestedQueue(); \ - } \ - } \ - break; \ - default: \ - continue; \ - } \ - } - - for (uint32 i = 0; i < CGarages::NumGarages; ++i) { - if (CGarages::aGarages[i].m_eGarageType == GARAGE_NONE) - continue; - entity = CGarages::aGarages[i].m_pDoor1; - if (!entity) - continue; - m_sQueueSample.m_vecPos = entity->GetPosition(); - distCalculated = false; - distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < 6400.f) { - state = CGarages::aGarages[i].m_eGarageState; - if (state == GS_OPENING || state == GS_CLOSING || state == GS_AFTERDROPOFF) { - CalculateDistance(distCalculated, distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(90, 80.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - if (CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) { - if (CGarages::aGarages[i].m_eGarageState == GS_AFTERDROPOFF) { - if (!(m_FrameCounter & 1)) { - LOOP_HELPER - continue; - } - if (m_anRandomTable[1] & 1) { - sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_CAR_1; - } else { - sampleIndex = m_anRandomTable[2] % 6 + SFX_COL_CAR_PANEL_1; - } - m_sQueueSample.m_nSampleIndex = sampleIndex; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) / 2; - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_nCounter = iSound++; - if (iSound < 32) - iSound = 32; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nEmittingVolume = 90; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - LOOP_HELPER - continue; - } - m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; - m_sQueueSample.m_nFrequency = 6543; - } else { - m_sQueueSample.m_nSampleIndex = SFX_GARAGE_DOOR_LOOP; - m_sQueueSample.m_nFrequency = 13961; - } - m_sQueueSample.m_nCounter = i; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nEmittingVolume = 90; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - LOOP_HELPER - } - } -#undef LOOP_HELPER -} - -struct tHelicopterSampleData { - float m_fMaxDistance; - float m_fBaseDistance; - uint8 m_bBaseVolume; -}; - -bool -cAudioManager::ProcessHelicopter(cVehicleParams *params) -{ - CHeli *heli; - float MaxDist; - float dist; - float baseDist; - int32 emittingVol; - static const tHelicopterSampleData gHeliSfxRanges[3] = {{400.f, 380.f, 100}, {100.f, 70.f, maxVolume}, {60.f, 30.f, maxVolume}}; - - if (gHeliSfxRanges[0].m_fMaxDistance * gHeliSfxRanges[0].m_fMaxDistance <= params->m_fDistance) - return false; - - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - heli = (CHeli *)params->m_pVehicle; - for (uint32 i = 0; i < ARRAY_SIZE(gHeliSfxRanges); i++) { - MaxDist = gHeliSfxRanges[i].m_fMaxDistance; - dist = m_sQueueSample.m_fDistance; - if (dist >= MaxDist) - return true; - baseDist = gHeliSfxRanges[i].m_fBaseDistance; - if (dist < baseDist) - emittingVol = (gHeliSfxRanges[i].m_bBaseVolume * ((MaxDist - dist) / (MaxDist - baseDist))); - else - emittingVol = gHeliSfxRanges[i].m_bBaseVolume; - - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, gHeliSfxRanges[i].m_fMaxDistance, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = i + 65; - m_sQueueSample.m_nSampleIndex = i + SFX_HELI_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 0; - m_sQueueSample.m_nFrequency = 1200 * heli->m_nHeliId + SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 6.0f; - m_sQueueSample.m_fSoundIntensity = gHeliSfxRanges[i].m_fMaxDistance; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - return true; -} - -void -cAudioManager::ProcessHomeScriptObject(uint8 sound) -{ - uint32 time; - uint8 rand; - float dist; - - static uint8 counter = 0; - - time = CTimer::GetTimeInMilliseconds(); - if (time > gHomeNextTime) { - switch (sound) { - case SCRIPT_SOUND_HOME_LOOP_S: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; - break; - case SCRIPT_SOUND_HOME_LOOP_L: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; - break; - default: - return; - } - dist = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (dist < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(dist); - rand = m_anRandomTable[0] % 30 + 40; - m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nSampleIndex = m_anRandomTable[0] % 5 + SFX_HOME_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); - m_sQueueSample.m_nCounter = counter++; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_nEmittingVolume = rand; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = true; - AddSampleToRequestedQueue(); - gHomeNextTime = time + 1000 + m_anRandomTable[3] % 4000; - } - } - } -} - -void -cAudioManager::ProcessJumbo(cVehicleParams *params) -{ - CPlane *plane; - float position; - - if (params->m_fDistance < 193600.0f) { - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - plane = (CPlane *)params->m_pVehicle; - DoJumboVolOffset(); - position = PlanePathPosition[plane->m_nPlaneId]; - if (position <= TakeOffPoint) { - if (plane->m_fSpeed <= 0.10334f) { - ProcessJumboTaxi(); - return; - } - - ProcessJumboAccel(plane); - } else if (300.0f + TakeOffPoint >= position) { - ProcessJumboTakeOff(plane); - } else if (LandingPoint - 350.0f >= position) { - ProcessJumboFlying(); - } else { - if (position > LandingPoint) { - if (plane->m_fSpeed > 0.10334f) { - ProcessJumboDecel(plane); - return; - } - ProcessJumboTaxi(); - return; - } - ProcessJumboLanding(plane); - } - } -} - -void -cAudioManager::ProcessJumboAccel(CPlane *plane) -{ - int32 engineFreq; - int32 vol; - float whineSoundFreq; - float modificator; - - if (SetupJumboFlySound(20)) { - modificator = (plane->m_fSpeed - 0.10334f) * 1.676f; - if (modificator > 1.0f) - modificator = 1.0f; - if (SetupJumboRumbleSound(maxVolume * modificator) && SetupJumboTaxiSound((1.0f - modificator) * 75.f)) { - if (modificator < 0.2f) { - whineSoundFreq = modificator * 5.f * 14600.0f + 29500; - vol = modificator * 5.f * maxVolume; - engineFreq = modificator * 5.f * 6050.f + 16000; - } else { - whineSoundFreq = 44100; - engineFreq = 22050; - vol = maxVolume; - } - SetupJumboEngineSound(vol, engineFreq); - SetupJumboWhineSound(18, whineSoundFreq); - } - } -} - -void -cAudioManager::ProcessJumboDecel(CPlane *plane) -{ - if (SetupJumboFlySound(20) && SetupJumboTaxiSound(75)) { - const float modificator = Min(1.f, (plane->m_fSpeed - 0.10334f) * 1.676f); - SetupJumboEngineSound(maxVolume * modificator, 6050.f * modificator + 16000); - SetupJumboWhineSound(18, 29500); - } -} - -void -cAudioManager::ProcessJumboFlying() -{ - if (SetupJumboFlySound(maxVolume)) - SetupJumboEngineSound(63, 22050); -} - -void -cAudioManager::ProcessJumboLanding(CPlane *plane) -{ - const float modificator = (LandingPoint - PlanePathPosition[plane->m_nPlaneId]) / 350.f; - if (SetupJumboFlySound(107.f * modificator + 20)) { - if (SetupJumboTaxiSound(75.f * (1.f - modificator))) { - SetupJumboEngineSound(maxVolume, 22050); - SetupJumboWhineSound(18.f * (1.f - modificator), 14600.f * modificator + 29500); - } - } -} - -void -cAudioManager::ProcessJumboTakeOff(CPlane *plane) -{ - const float modificator = (PlanePathPosition[plane->m_nPlaneId] - TakeOffPoint) / 300.f; - - if (SetupJumboFlySound((107.f * modificator) + 20) && SetupJumboRumbleSound(maxVolume * (1.f - modificator))) { - if (SetupJumboEngineSound(maxVolume, 22050)) - SetupJumboWhineSound(18.f * (1.f - modificator), 44100); - } -} - -void -cAudioManager::ProcessJumboTaxi() -{ - if (SetupJumboFlySound(20)) { - if (SetupJumboTaxiSound(75)) - SetupJumboWhineSound(18, 29500); - } -} - -void -cAudioManager::ProcessLaunderetteScriptObject(uint8 sound) -{ - switch (sound) { - case SCRIPT_SOUND_LAUNDERETTE_LOOP_S: - case SCRIPT_SOUND_LAUNDERETTE_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 30.0f; - break; - default: - return; - } - float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(45, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nSampleIndex = SFX_LAUNDERETTE_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_LAUNDERETTE_LOOP); - m_sQueueSample.m_nCounter = 0; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeModificator = 5; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_nEmittingVolume = 45; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - m_sQueueSample.m_nVolume = ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nSampleIndex = SFX_LAUNDERETTE_SONG_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_LAUNDERETTE_SONG_LOOP); - m_sQueueSample.m_nCounter = 1; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_nEmittingVolume = 110; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } -} - -void -cAudioManager::ProcessLoopingScriptObject(uint8 sound) -{ - uint8 emittingVolume; - float distSquared; - - switch (sound) { - case SCRIPT_SOUND_PARTY_1_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_1_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_2_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_2; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_2); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_2_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_2; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_2); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_3_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_3; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_3); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_3_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_3; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_3); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_4_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_4; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_4); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_4_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_4; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_4); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_5_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_5; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_5); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_5_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_5; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_5); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_6_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_6; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_6); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_6_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_6; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_6); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_7_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_7; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_7); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_7_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_7; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_7); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_8_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_8; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_8); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_8_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_8; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_8); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_9_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_9; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_9); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_9_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_9; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_9); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_10_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_10; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_10); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_10_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_10; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_10); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_11_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_11; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_11); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_11_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_11; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_11); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_12_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_12; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_12); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_12_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_12; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_12); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_13_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_RAGGA; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_RAGGA); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_13_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_RAGGA; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_RAGGA); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_STRIP_CLUB_LOOP_1_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_1); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_STRIP_CLUB_LOOP_1_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_1); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_STRIP_CLUB_LOOP_2_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_2); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_STRIP_CLUB_LOOP_2_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_2); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_WORK_SHOP_LOOP_S: - case SCRIPT_SOUND_WORK_SHOP_LOOP_L: - ProcessWorkShopScriptObject(sound); - return; - case SCRIPT_SOUND_SAWMILL_LOOP_S: - case SCRIPT_SOUND_SAWMILL_LOOP_L: - ProcessSawMillScriptObject(sound); - return; - case SCRIPT_SOUND_38: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_DOG_FOOD_FACTORY; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = 110; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOG_FOOD_FACTORY); - m_sQueueSample.m_nReleasingVolumeModificator = 6; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_39: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_DOG_FOOD_FACTORY; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = 110; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOG_FOOD_FACTORY); - m_sQueueSample.m_nReleasingVolumeModificator = 6; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_LAUNDERETTE_LOOP_S: - case SCRIPT_SOUND_LAUNDERETTE_LOOP_L: - ProcessLaunderetteScriptObject(sound); - return; - case SCRIPT_SOUND_CHINATOWN_RESTAURANT_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_CHINATOWN; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = 110; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_CHINATOWN); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_CHINATOWN_RESTAURANT_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_CHINATOWN; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = 110; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_CHINATOWN); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_CIPRIANI_RESAURANT_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_ITALY; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = 110; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_ITALY); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_CIPRIANI_RESAURANT_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_ITALY; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = 110; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_ITALY); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_46_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = 110; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_1); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_47_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = 110; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_1); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_MARCO_BISTRO_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_2; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = 110; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_2); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_MARCO_BISTRO_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_2; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = 110; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_2); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_AIRPORT_LOOP_S: - case SCRIPT_SOUND_AIRPORT_LOOP_L: - ProcessAirportScriptObject(sound); - return; - case SCRIPT_SOUND_SHOP_LOOP_S: - case SCRIPT_SOUND_SHOP_LOOP_L: - ProcessShopScriptObject(sound); - return; - case SCRIPT_SOUND_CINEMA_LOOP_S: - case SCRIPT_SOUND_CINEMA_LOOP_L: - ProcessCinemaScriptObject(sound); - return; - case SCRIPT_SOUND_DOCKS_LOOP_S: - case SCRIPT_SOUND_DOCKS_LOOP_L: - ProcessDocksScriptObject(sound); - return; - case SCRIPT_SOUND_HOME_LOOP_S: - case SCRIPT_SOUND_HOME_LOOP_L: - ProcessHomeScriptObject(sound); - return; - case SCRIPT_SOUND_FRANKIE_PIANO: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_PIANO_BAR_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PIANO_BAR_1); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PARTY_1_LOOP: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PORN_CINEMA_1_S: - case SCRIPT_SOUND_PORN_CINEMA_1_L: - case SCRIPT_SOUND_PORN_CINEMA_2_S: - case SCRIPT_SOUND_PORN_CINEMA_2_L: - case SCRIPT_SOUND_PORN_CINEMA_3_S: - case SCRIPT_SOUND_PORN_CINEMA_3_L: - case SCRIPT_SOUND_MISTY_SEX_S: - case SCRIPT_SOUND_MISTY_SEX_L: - ProcessPornCinema(sound); - return; - case SCRIPT_SOUND_BANK_ALARM_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_BANK_ALARM_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = 90; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BANK_ALARM_1); - m_sQueueSample.m_nReleasingVolumeModificator = 2; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_BANK_ALARM_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_BANK_ALARM_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = 90; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BANK_ALARM_1); - m_sQueueSample.m_nReleasingVolumeModificator = 2; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_POLICE_BALL_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BALL_1); - m_sQueueSample.m_nReleasingVolumeModificator = 2; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_POLICE_BALL_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BALL_1); - m_sQueueSample.m_nReleasingVolumeModificator = 2; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_INDUSTRIAL); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_INDUSTRIAL); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S: - case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L: - ProcessPoliceCellBeatingScriptObject(sound); - return; - case SCRIPT_SOUND_RAVE_1_LOOP_S: - case SCRIPT_SOUND_RAVE_2_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_RAVE_1_LOOP_L: - case SCRIPT_SOUND_RAVE_2_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_RAVE_3_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_SUBURBAN); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_RAVE_3_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_SUBURBAN); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - case SCRIPT_SOUND_PRETEND_FIRE_LOOP: - m_sQueueSample.m_fSoundIntensity = 50.0f; - m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = 80; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); - m_sQueueSample.m_nReleasingVolumeModificator = 8; - m_sQueueSample.m_nReleasingVolumeDivider = 10; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - break; - default: - return; - } - - distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 0; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_nEmittingVolume = emittingVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } -} - -void -cAudioManager::ProcessMissionAudio() -{ - float dist; - uint8 emittingVol; - uint8 pan; - float distSquared; - CVector vec; - - static uint8 nCheckPlayingDelay = 0; - static uint8 nFramesUntilFailedLoad = 0; - static uint8 nFramesForPretendPlaying = 0; - - if (m_bIsInitialised) { - if (m_sMissionAudio.m_nSampleIndex != NO_SAMPLE) { - switch (m_sMissionAudio.m_nLoadingStatus) { - case LOADING_STATUS_NOT_LOADED: - SampleManager.PreloadStreamedFile(m_sMissionAudio.m_nSampleIndex, 1); - m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_LOADED; - nFramesUntilFailedLoad = 0; - return; - case LOADING_STATUS_LOADED: - if (!m_sMissionAudio.m_bIsPlayed) - return; - if (g_bMissionAudioLoadFailed) { - if (m_bTimerJustReset) { - ClearMissionAudio(); - SampleManager.StopStreamedFile(1); - nFramesForPretendPlaying = 0; - nCheckPlayingDelay = 0; - nFramesUntilFailedLoad = 0; - } else if (!m_nUserPause) { - if (++nFramesForPretendPlaying < 120) { - m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_PLAYING; - } else { - m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED; - m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; - } - } - } else { - if (m_sMissionAudio.m_nPlayStatus) { - if (m_sMissionAudio.m_nPlayStatus != PLAY_STATUS_PLAYING) - return; - if (m_bTimerJustReset) { - ClearMissionAudio(); - SampleManager.StopStreamedFile(1); - return; - } - if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex)) { - if (!m_nUserPause) { - if (nCheckPlayingDelay) { - --nCheckPlayingDelay; - } else if (GetMissionScriptPoliceAudioPlayingStatus() == PLAY_STATUS_FINISHED || - m_sMissionAudio.m_nMissionAudioCounter-- == 0) { - m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED; - m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; - SampleManager.StopStreamedFile(1); - m_sMissionAudio.m_nMissionAudioCounter = 0; - } - } - } else if (m_sMissionAudio.field_22) { - if (SampleManager.IsStreamPlaying(1) || m_nUserPause || m_nPreviousUserPause) { - if (m_nUserPause) - SampleManager.PauseStream(1, 1); - else - SampleManager.PauseStream(0, 1); - } else { - m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED; - m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; - SampleManager.StopStreamedFile(1); - m_sMissionAudio.m_nMissionAudioCounter = 0; - } - } else { - if (m_nUserPause) - return; - if (nCheckPlayingDelay--) { - if (!SampleManager.IsStreamPlaying(1)) - return; - nCheckPlayingDelay = 0; - } - m_sMissionAudio.field_22 = 1; - } - } else { - if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex)) { - SetMissionScriptPoliceAudio(m_sMissionAudio.m_nSampleIndex); - } else { - if (m_nUserPause) - SampleManager.PauseStream(1, 1); - if (m_sMissionAudio.m_bPredefinedProperties) { - SampleManager.SetStreamedVolumeAndPan(80, 63, 1, 1); - } else { - distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos); - if (distSquared >= 2500.f) { - emittingVol = 0; - pan = 63; - } else { - dist = Sqrt(distSquared); - emittingVol = ComputeVolume(80, 50.0f, dist); - TranslateEntity(&m_sMissionAudio.m_vecPos, &vec); - pan = ComputePan(50.f, &vec); - } - SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, 1); - } - SampleManager.StartPreloadedStreamedFile(1); - } - m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_PLAYING; - nCheckPlayingDelay = 30; - } - } - break; - case 2: - if (++nFramesUntilFailedLoad >= 90) { - nFramesForPretendPlaying = 0; - g_bMissionAudioLoadFailed = true; - nFramesUntilFailedLoad = 0; - m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_LOADED; - } - return; - default: - return; - } - } - } -} - -void -cAudioManager::ProcessModelCarEngine(cVehicleParams *params) -{ - CAutomobile *automobile; - float allowedVelocity; - int32 emittingVol; - float velocityChange; - - if (params->m_fDistance < 900.f) { - automobile = (CAutomobile *)params->m_pVehicle; - if (automobile->bEngineOn) { - if (automobile->m_nWheelsOnGround) { - velocityChange = Abs(params->m_fVelocityChange); - } else { - if (automobile->m_nDriveWheelsOnGround) - automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.4f; - velocityChange = automobile->m_fGasPedalAudio * params->m_pTransmission->fMaxVelocity; - } - if (velocityChange > 0.001f) { - allowedVelocity = 0.5f * params->m_pTransmission->fMaxVelocity; - if (velocityChange < allowedVelocity) - emittingVol = (90.f * velocityChange / allowedVelocity); - else - emittingVol = 90; - if (emittingVol) { - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 2; - m_sQueueSample.m_nSampleIndex = SFX_REMOTE_CONTROLLED_CAR; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 1; - m_sQueueSample.m_nFrequency = (11025.f * velocityChange / params->m_pTransmission->fMaxVelocity + 11025.f); - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - } - } - } -} - -void -cAudioManager::ProcessOneShotScriptObject(uint8 sound) -{ - CPlayerPed *playerPed; - uint8 emittingVolume; - float distSquared; - - cPedParams male; - cPedParams female; - - static uint8 iSound = 0; - - switch (sound) { - case SCRIPT_SOUND_INJURED_PED_MALE_OUCH_S: - case SCRIPT_SOUND_INJURED_PED_MALE_OUCH_L: - male.m_pPed = nil; - male.m_bDistanceCalculated = false; - male.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); - SetupPedComments(&male, SOUND_INJURED_PED_MALE_OUCH); - return; - case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S: - case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L: - female.m_pPed = nil; - female.m_bDistanceCalculated = false; - female.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); - SetupPedComments(&female, SOUND_INJURED_PED_FEMALE); - return; - case SCRIPT_SOUND_GATE_START_CLUNK: - case SCRIPT_SOUND_GATE_STOP_CLUNK: - m_sQueueSample.m_fSoundIntensity = 40.0f; - m_sQueueSample.m_nSampleIndex = SFX_COL_GATE; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - if (sound == SCRIPT_SOUND_GATE_START_CLUNK) - m_sQueueSample.m_nFrequency = 10600; - else - m_sQueueSample.m_nFrequency = 9000; - m_sQueueSample.m_nReleasingVolumeModificator = 1; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bRequireReflection = true; - emittingVolume = RandomDisplacement(10) + 50; - break; - case SCRIPT_SOUND_BULLET_HIT_GROUND_1: - case SCRIPT_SOUND_BULLET_HIT_GROUND_2: - case SCRIPT_SOUND_BULLET_HIT_GROUND_3: - m_sQueueSample.m_fSoundIntensity = 50.0f; - m_sQueueSample.m_nSampleIndex = m_anRandomTable[iSound % 5] % 3 + SFX_BULLET_WALL_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); - m_sQueueSample.m_nReleasingVolumeModificator = 9; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - emittingVolume = m_anRandomTable[2] % 20 + 90; - break; - case SCRIPT_SOUND_110: - case SCRIPT_SOUND_111: - if (SampleManager.IsSampleBankLoaded(0) != 1) - return; - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_TRAIN_STATION_ANNOUNCE; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_STATION_ANNOUNCE); - m_sQueueSample.m_nReleasingVolumeModificator = 0; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_bIs2D = false; - break; - case SCRIPT_SOUND_PAYPHONE_RINGING: - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_nSampleIndex = SFX_PHONE_RING; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = 80; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PHONE_RING); - m_sQueueSample.m_nReleasingVolumeModificator = 1; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bRequireReflection = false; - break; - case SCRIPT_SOUND_GLASS_BREAK_L: - m_sQueueSample.m_fSoundIntensity = 60.0f; - m_sQueueSample.m_nSampleIndex = SFX_GLASS_SMASH; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = 70; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_SMASH); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - break; - case SCRIPT_SOUND_GLASS_BREAK_S: - m_sQueueSample.m_fSoundIntensity = 60.0f; - m_sQueueSample.m_nSampleIndex = SFX_GLASS_SMASH; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = 60; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_SMASH); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - break; - case SCRIPT_SOUND_GLASS_CRACK: - m_sQueueSample.m_fSoundIntensity = 60.0f; - m_sQueueSample.m_nSampleIndex = SFX_GLASS_CRACK; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = 70; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_CRACK); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bRequireReflection = true; - break; - case SCRIPT_SOUND_GLASS_LIGHT_BREAK: - m_sQueueSample.m_fSoundIntensity = 55.0f; - m_sQueueSample.m_nSampleIndex = (m_anRandomTable[4] & 3) + SFX_GLASS_SHARD_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 19000; - m_sQueueSample.m_nReleasingVolumeModificator = 9; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - emittingVolume = RandomDisplacement(11) + 25; - break; - case SCRIPT_SOUND_BOX_DESTROYED_1: - m_sQueueSample.m_fSoundIntensity = 60.0f; - m_sQueueSample.m_nSampleIndex = SFX_WOODEN_BOX_SMASH; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = RandomDisplacement(1500) + 18600; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bRequireReflection = true; - emittingVolume = m_anRandomTable[2] % 20 + 80; - break; - case SCRIPT_SOUND_BOX_DESTROYED_2: - m_sQueueSample.m_fSoundIntensity = 60.0f; - m_sQueueSample.m_nSampleIndex = SFX_CARDBOARD_BOX_SMASH; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = RandomDisplacement(1500) + 18600; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bRequireReflection = true; - emittingVolume = m_anRandomTable[2] % 20 + 80; - break; - case SCRIPT_SOUND_METAL_COLLISION: - m_sQueueSample.m_fSoundIntensity = 60.0f; - m_sQueueSample.m_nSampleIndex = m_anRandomTable[3] % 5 + SFX_COL_CAR_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bRequireReflection = true; - emittingVolume = m_anRandomTable[2] % 30 + 70; - break; - case SCRIPT_SOUND_TIRE_COLLISION: - m_sQueueSample.m_fSoundIntensity = 60.0f; - m_sQueueSample.m_nSampleIndex = SFX_TYRE_BUMP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bRequireReflection = true; - emittingVolume = m_anRandomTable[2] % 30 + 60; - break; - case SCRIPT_SOUND_GUNSHELL_DROP: - playerPed = FindPlayerPed(); - if (playerPed) { - switch (playerPed->m_nSurfaceTouched) { - case SURFACE_GRASS: - case SURFACE_DIRT: - case SURFACE_DIRTTRACK: - case SURFACE_SCAFFOLD: - case SURFACE_FLESH: - case SURFACE_SAND: - case SURFACE_TIRE: - case SURFACE_HEDGE: - m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_2; - m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 11000; - m_sQueueSample.m_nReleasingVolumeModificator = 18; - m_sQueueSample.m_fSoundIntensity = 20.0f; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - emittingVolume = m_anRandomTable[2] % 20 + 30; - distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = iSound++; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_nEmittingVolume = emittingVolume; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_bReverbFlag = true; - AddSampleToRequestedQueue(); - } - } - return; - case SURFACE_PUDDLE: - return; - default: - break; - } - } - m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_1; - m_sQueueSample.m_nFrequency = RandomDisplacement(750) + 18000; - m_sQueueSample.m_nReleasingVolumeModificator = 15; - m_sQueueSample.m_fSoundIntensity = 20.0f; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - emittingVolume = m_anRandomTable[2] % 20 + 30; - break; - case SCRIPT_SOUND_GUNSHELL_DROP_SOFT: - m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_2; - m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 11000; - m_sQueueSample.m_nReleasingVolumeModificator = 18; - m_sQueueSample.m_fSoundIntensity = 20.0f; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - emittingVolume = m_anRandomTable[2] % 20 + 30; - break; - default: - return; - } - - distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = iSound++; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_nEmittingVolume = emittingVolume; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_bReverbFlag = true; - AddSampleToRequestedQueue(); - } - } -} - -void -cAudioManager::ProcessPed(CPhysical *ped) -{ - cPedParams params; - - params.m_pPed = nil; - params.m_bDistanceCalculated = false; - params.m_fDistance = 0.0f; - - m_sQueueSample.m_vecPos = ped->GetPosition(); - - // params.m_bDistanceCalculated = false; - params.m_pPed = (CPed *)ped; - params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (ped->GetModelIndex() == MI_FATMALE02) - ProcessPedHeadphones(¶ms); - ProcessPedOneShots(¶ms); -} - -void -cAudioManager::ProcessPedHeadphones(cPedParams *params) -{ - CPed *ped; - CAutomobile *veh; - uint8 emittingVol; - - if (params->m_fDistance < 49.f) { - ped = params->m_pPed; - if (!ped->bIsAimingGun || ped->m_bodyPartBleeding != PED_HEAD) { - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - if (ped->bInVehicle && ped->m_nPedState == PED_DRIVING) { - emittingVol = 10; - veh = (CAutomobile *)ped->m_pMyVehicle; - if (veh && veh->IsCar()) { - for (int32 i = 2; i < ARRAY_SIZE(veh->Doors); i++) { - if (!veh->IsDoorClosed((eDoors)i) || veh->IsDoorMissing((eDoors)i)) { - emittingVol = 42; - break; - } - } - } - } else { - emittingVol = 42; - } - - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 7.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 64; - m_sQueueSample.m_nSampleIndex = SFX_HEADPHONES; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 5; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_HEADPHONES); - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = 7.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - return; - } - } -} - -void -cAudioManager::ProcessPedOneShots(cPedParams *params) -{ - uint8 emittingVol; - int32 sampleIndex; - - CPed *ped = params->m_pPed; - - bool stereo; - int16 sound; - bool noReflection; - CWeapon *weapon; - float maxDist = 0.f; // uninitialized variable - - static uint8 iSound = 21; - - weapon = params->m_pPed->GetWeapon(); - for (uint32 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) { - noReflection = false; - stereo = false; - m_sQueueSample.m_bRequireReflection = false; - sound = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]; - switch (sound) { - case SOUND_STEP_START: - case SOUND_STEP_END: - if (!params->m_pPed->bIsLooking) { - emittingVol = m_anRandomTable[3] % 15 + 45; - if (FindPlayerPed() != m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity) - emittingVol /= 2; - maxDist = 400.f; - switch (params->m_pPed->m_nSurfaceTouched) { - case SURFACE_GRASS: - sampleIndex = m_anRandomTable[1] % 5 + SFX_FOOTSTEP_GRASS_1; - break; - case SURFACE_DIRT: - case SURFACE_DIRTTRACK: - sampleIndex = m_anRandomTable[4] % 5 + SFX_FOOTSTEP_GRAVEL_1; - break; - case SURFACE_METAL6: - case SURFACE_METAL_DOOR: - case SURFACE_BILLBOARD: - case SURFACE_STEEL: - case SURFACE_METAL_POLE: - case SURFACE_STREET_LIGHT: - case SURFACE_METAL14: - case SURFACE_METAL15: - case SURFACE_METAL_FENCE: - case SURFACE_METAL27: - case SURFACE_METAL28: - sampleIndex = m_anRandomTable[0] % 5 + SFX_FOOTSTEP_METAL_1; - break; - case SURFACE_SAND: - sampleIndex = (m_anRandomTable[4] & 3) + SFX_FOOTSTEP_SAND_1; - break; - case SURFACE_PUDDLE: - sampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1; - break; - case SURFACE_WOOD: - case SURFACE_WOOD_BOX: - case SURFACE_WOOD_PLANK: - sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_WOOD_1; - break; - case SURFACE_HEDGE: - sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_VEG_1; - break; - default: - sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_CONCRETE_1; - break; - } - m_sQueueSample.m_nSampleIndex = sampleIndex; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] - 28; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17); - switch (params->m_pPed->m_nMoveState) { - case PEDMOVE_WALK: - emittingVol /= 4; - m_sQueueSample.m_nFrequency = 9 * m_sQueueSample.m_nFrequency / 10; - break; - case PEDMOVE_RUN: - emittingVol /= 2; - m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10; - break; - case PEDMOVE_SPRINT: - m_sQueueSample.m_nFrequency = 12 * m_sQueueSample.m_nFrequency / 10; - break; - default: - break; - } - m_sQueueSample.m_nReleasingVolumeModificator = 5; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 20.0f; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - } - break; - case SOUND_FALL_LAND: - case SOUND_FALL_COLLAPSE: - if (!ped->bIsLooking) { - maxDist = SQR(30); - emittingVol = m_anRandomTable[3] % 20 + 80; - if (ped->m_nSurfaceTouched == SURFACE_PUDDLE) { - m_sQueueSample.m_nSampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1; - } else if (sound == SOUND_FALL_LAND) { - m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND; - } else { - m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND_AND_FALL; - } - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = 1; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17); - m_sQueueSample.m_nReleasingVolumeModificator = 2; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - } - break; - case SOUND_FIGHT_PUNCH_33: - m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1; - m_sQueueSample.m_nFrequency = 18000; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound; - stereo = true; - ++iSound; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = SQR(30); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - emittingVol = m_anRandomTable[3] % 26 + 100; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - break; - case SOUND_FIGHT_KICK_34: - m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1; - m_sQueueSample.m_nFrequency = 16500; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound; - stereo = true; - ++iSound; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = SQR(30); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - emittingVol = m_anRandomTable[3] % 26 + 100; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - break; - case SOUND_FIGHT_HEADBUTT_35: - m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1; - m_sQueueSample.m_nFrequency = 20000; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound; - stereo = true; - ++iSound; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = SQR(30); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - emittingVol = m_anRandomTable[3] % 26 + 100; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - break; - case SOUND_FIGHT_PUNCH_36: - m_sQueueSample.m_nSampleIndex = SFX_FIGHT_2; - m_sQueueSample.m_nFrequency = 18000; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound; - stereo = true; - ++iSound; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = SQR(30); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - emittingVol = m_anRandomTable[3] % 26 + 100; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - break; - case SOUND_FIGHT_PUNCH_37: - m_sQueueSample.m_nSampleIndex = SFX_FIGHT_2; - m_sQueueSample.m_nFrequency = 16500; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound; - stereo = true; - ++iSound; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = SQR(30); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - emittingVol = m_anRandomTable[3] % 26 + 100; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - break; - case SOUND_FIGHT_CLOSE_PUNCH_38: - m_sQueueSample.m_nSampleIndex = SFX_FIGHT_2; - m_sQueueSample.m_nFrequency = 20000; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound; - stereo = true; - ++iSound; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = SQR(30); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - emittingVol = m_anRandomTable[3] % 26 + 100; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - break; - case SOUND_FIGHT_PUNCH_39: - m_sQueueSample.m_nSampleIndex = SFX_FIGHT_4; - m_sQueueSample.m_nFrequency = 18000; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound; - stereo = true; - ++iSound; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = SQR(30); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - emittingVol = m_anRandomTable[3] % 26 + 100; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - break; - case SOUND_FIGHT_PUNCH_OR_KICK_BELOW_40: - m_sQueueSample.m_nSampleIndex = SFX_FIGHT_4; - m_sQueueSample.m_nFrequency = 16500; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound; - stereo = true; - ++iSound; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = SQR(30); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - emittingVol = m_anRandomTable[3] % 26 + 100; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - break; - case SOUND_FIGHT_PUNCH_41: - m_sQueueSample.m_nSampleIndex = SFX_FIGHT_4; - m_sQueueSample.m_nFrequency = 20000; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound; - stereo = true; - ++iSound; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = SQR(30); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - emittingVol = m_anRandomTable[3] % 26 + 100; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - break; - case SOUND_FIGHT_PUNCH_FROM_BEHIND_42: - m_sQueueSample.m_nSampleIndex = SFX_FIGHT_5; - m_sQueueSample.m_nFrequency = 18000; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound; - stereo = true; - ++iSound; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = SQR(30); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - emittingVol = m_anRandomTable[3] % 26 + 100; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - break; - case SOUND_FIGHT_KNEE_OR_KICK_43: - m_sQueueSample.m_nSampleIndex = SFX_FIGHT_5; - m_sQueueSample.m_nFrequency = 16500; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound; - stereo = true; - ++iSound; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = SQR(30); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - emittingVol = m_anRandomTable[3] % 26 + 100; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - break; - case SOUND_FIGHT_KICK_44: - m_sQueueSample.m_nSampleIndex = SFX_FIGHT_5; - m_sQueueSample.m_nFrequency = 20000; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound; - stereo = true; - ++iSound; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = SQR(30); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - emittingVol = m_anRandomTable[3] % 26 + 100; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - break; - case SOUND_WEAPON_BAT_ATTACK: - m_sQueueSample.m_nSampleIndex = SFX_BAT_HIT_LEFT; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound++; - stereo = true; - m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 22000; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = SQR(30); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - emittingVol = m_anRandomTable[2] % 20 + 100; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - if (m_bDynamicAcousticModelingStatus) - m_sQueueSample.m_bRequireReflection = true; - else - noReflection = true; - break; - case SOUND_WEAPON_SHOT_FIRED: - weapon = &ped->m_weapons[ped->m_currentWeapon]; - switch (weapon->m_eWeaponType) { - case WEAPONTYPE_COLT45: - m_sQueueSample.m_nSampleIndex = SFX_COLT45_LEFT; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound++; - stereo = true; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COLT45_LEFT); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 50.0f; - maxDist = SQR(50); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - emittingVol = m_anRandomTable[1] % 10 + 90; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - if (m_bDynamicAcousticModelingStatus) - m_sQueueSample.m_bRequireReflection = true; - else - noReflection = true; - break; - case WEAPONTYPE_UZI: - m_sQueueSample.m_nSampleIndex = SFX_UZI_LEFT; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound++; - stereo = true; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_UZI_LEFT); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 80.0f; - maxDist = SQR(80); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - emittingVol = m_anRandomTable[3] % 15 + 70; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - break; - case WEAPONTYPE_SHOTGUN: - m_sQueueSample.m_nSampleIndex = SFX_SHOTGUN_LEFT; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound++; - stereo = true; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SHOTGUN_LEFT); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 60.0f; - maxDist = 3600.f; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - emittingVol = m_anRandomTable[2] % 10 + 100; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - if (m_bDynamicAcousticModelingStatus) - m_sQueueSample.m_bRequireReflection = true; - else - noReflection = true; - break; - case WEAPONTYPE_AK47: - m_sQueueSample.m_nSampleIndex = SFX_AK47_LEFT; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound++; - stereo = true; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AK47_LEFT); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 80.0f; - maxDist = SQR(80); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - emittingVol = m_anRandomTable[1] % 15 + 70; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - break; - case WEAPONTYPE_M16: - m_sQueueSample.m_nSampleIndex = SFX_M16_LEFT; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound++; - stereo = true; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_M16_LEFT); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 80.0f; - maxDist = SQR(80); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - emittingVol = m_anRandomTable[4] % 15 + 70; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - break; - case WEAPONTYPE_SNIPERRIFLE: - m_sQueueSample.m_nSampleIndex = SFX_SNIPER_LEFT; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound++; - stereo = true; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SNIPER_LEFT); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 60.0f; - maxDist = 3600.f; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - emittingVol = m_anRandomTable[4] % 10 + 110; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - if (m_bDynamicAcousticModelingStatus) - m_sQueueSample.m_bRequireReflection = true; - else - noReflection = true; - break; - case WEAPONTYPE_ROCKETLAUNCHER: - m_sQueueSample.m_nSampleIndex = SFX_ROCKET_LEFT; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound++; - stereo = true; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ROCKET_LEFT); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); - m_sQueueSample.m_nReleasingVolumeModificator = 1; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 90.0f; - maxDist = 8100.f; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - emittingVol = m_anRandomTable[0] % 20 + 80; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - if (m_bDynamicAcousticModelingStatus) - m_sQueueSample.m_bRequireReflection = true; - else - noReflection = true; - break; - case WEAPONTYPE_FLAMETHROWER: - m_sQueueSample.m_nSampleIndex = SFX_FLAMETHROWER_LEFT; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = 9; - emittingVol = 90; - m_sQueueSample.m_nFrequency = (10 * m_sQueueSample.m_nEntityIndex & 2047) + SampleManager.GetSampleBaseFrequency(SFX_FLAMETHROWER_LEFT); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = 60.0f; - maxDist = 3600.f; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nEmittingVolume = 90; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 6; - if (m_bDynamicAcousticModelingStatus) - m_sQueueSample.m_bRequireReflection = true; - else - noReflection = true; - break; - default: - continue; - } - - break; - case SOUND_WEAPON_RELOAD: - weapon = &ped->m_weapons[ped->m_currentWeapon]; - switch (weapon->m_eWeaponType) { - case WEAPONTYPE_COLT45: - m_sQueueSample.m_nSampleIndex = SFX_PISTOL_RELOAD; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PISTOL_RELOAD) + RandomDisplacement(300); - break; - case WEAPONTYPE_UZI: - m_sQueueSample.m_nSampleIndex = SFX_M16_RELOAD; - m_sQueueSample.m_nFrequency = 39243; - break; - case WEAPONTYPE_SHOTGUN: - m_sQueueSample.m_nSampleIndex = SFX_AK47_RELOAD; - m_sQueueSample.m_nFrequency = 30290; - break; - case WEAPONTYPE_AK47: - m_sQueueSample.m_nSampleIndex = SFX_AK47_RELOAD; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AK47_RELOAD); - break; - case WEAPONTYPE_M16: - m_sQueueSample.m_nSampleIndex = SFX_M16_RELOAD; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_M16_RELOAD); - break; - case WEAPONTYPE_SNIPERRIFLE: - m_sQueueSample.m_nSampleIndex = SFX_RIFLE_RELOAD; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RIFLE_RELOAD); - break; - case WEAPONTYPE_ROCKETLAUNCHER: - m_sQueueSample.m_nSampleIndex = SFX_ROCKET_RELOAD; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ROCKET_RELOAD); - break; - default: - continue; - } - emittingVol = 75; - m_sQueueSample.m_nCounter = iSound++; - stereo = true; - m_sQueueSample.m_nFrequency += RandomDisplacement(300); - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nReleasingVolumeModificator = 5; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = SQR(30); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = 75; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - break; - case SOUND_WEAPON_AK47_BULLET_ECHO: - case SOUND_WEAPON_UZI_BULLET_ECHO: - case SOUND_WEAPON_M16_BULLET_ECHO: - m_sQueueSample.m_nSampleIndex = SFX_UZI_END_LEFT; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound++; - stereo = true; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_UZI_END_LEFT); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 80.0f; - maxDist = SQR(80); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - emittingVol = m_anRandomTable[4] % 10 + 40; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - if (m_bDynamicAcousticModelingStatus) - m_sQueueSample.m_bRequireReflection = true; - else - noReflection = true; - break; - case SOUND_WEAPON_FLAMETHROWER_FIRE: - m_sQueueSample.m_nSampleIndex = SFX_FLAMETHROWER_START_LEFT; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound++; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_FLAMETHROWER_START_LEFT); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = 60.0f; - maxDist = 3600.f; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - emittingVol = 70; - m_sQueueSample.m_nEmittingVolume = 70; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - break; - case SOUND_WEAPON_HIT_PED: - m_sQueueSample.m_nSampleIndex = SFX_BULLET_PED; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound++; - stereo = true; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BULLET_PED); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8); - m_sQueueSample.m_nReleasingVolumeModificator = 7; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; - maxDist = SQR(30); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - emittingVol = m_anRandomTable[0] % 20 + 90; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - break; - case SOUND_SPLASH: - m_sQueueSample.m_nSampleIndex = SFX_SPLASH_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iSound++; - stereo = true; - m_sQueueSample.m_nFrequency = RandomDisplacement(1400) + 20000; - m_sQueueSample.m_nReleasingVolumeModificator = 1; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 40.0f; - maxDist = 1600.f; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - emittingVol = m_anRandomTable[2] % 30 + 70; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - break; - default: - SetupPedComments(params, sound); - continue; - } - - if (stereo && iSound > 60) - iSound = 21; - if (params->m_fDistance < maxDist) { - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - if (noReflection) { - if (0.2f * m_sQueueSample.m_fSoundIntensity <= m_sQueueSample.m_fDistance) { - noReflection = 0; - } else { - m_sQueueSample.m_bIs2D = true; - m_sQueueSample.m_nOffset = 0; - } - } - m_sQueueSample.m_bReverbFlag = true; - AddSampleToRequestedQueue(); - if (noReflection) { - m_sQueueSample.m_nOffset = 127; - ++m_sQueueSample.m_nSampleIndex; - if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] != SOUND_WEAPON_SHOT_FIRED || - weapon->m_eWeaponType != WEAPONTYPE_FLAMETHROWER) { - m_sQueueSample.m_nCounter = iSound++; - if (iSound > 60) - iSound = 21; - } else { - ++m_sQueueSample.m_nCounter; - } - AddSampleToRequestedQueue(); - } - } - } - } -} - -void -cAudioManager::ProcessPhysical(int32 id) -{ - CPhysical *entity = (CPhysical *)m_asAudioEntities[id].m_pEntity; - if (entity) { - switch (entity->GetType()) { - case ENTITY_TYPE_VEHICLE: - ProcessVehicle((CVehicle *)m_asAudioEntities[id].m_pEntity); - break; - case ENTITY_TYPE_PED: - ProcessPed((CPhysical *)m_asAudioEntities[id].m_pEntity); - break; - default: - return; - } - } -} - -void -cAudioManager::ProcessPlane(cVehicleParams *params) -{ - switch (params->m_nIndex) { - case AIRTRAIN: - ProcessJumbo(params); - break; - case DEADDODO: - ProcessCesna(params); - break; - default: - debug("Plane Model Id is %d\n, ", params->m_pVehicle->GetModelIndex()); - break; - } -} - -struct tVehicleSampleData { - eSfxSample m_nAccelerationSampleIndex; - uint8 m_bEngineSoundType; - eSfxSample m_nHornSample; - int32 m_nHornFrequency; - uint8 m_nSirenOrAlarmSample; - int32 m_nSirenOrAlarmFrequency; - uint8 m_bDoorType; -}; - -const tVehicleSampleData aVehicleSettings[70] = {{SFX_CAR_REV_2, 2, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 11487, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_8, 8, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_ALARM_1, 10928, 1}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 9935, 2}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 12893, SFX_CAR_ALARM_1, 8941, 0}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 10706, SFX_CAR_ALARM_1, 11922, 1}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 7948, 2}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_POLICE_SIREN_SLOW, 11556, 2}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 31478, SFX_CAR_ALARM_1, 8941, 2}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_BMW328, 9538, SFX_CAR_ALARM_1, 12220, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_3, 3, SFX_CAR_HORN_BMW328, 12017, SFX_CAR_ALARM_1, 9935, 1}, - {SFX_CAR_REV_2, 2, SFX_CAR_HORN_JEEP, 22295, SFX_CAR_ALARM_1, 12200, 1}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_ALARM_1, 13400, 1}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 18286, SFX_CAR_ALARM_1, 9935, 2}, - {SFX_CAR_REV_3, 3, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_ALARM_1, 13600, 1}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 22295, SFX_AMBULANCE_SIREN_SLOW, 8795, 2}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_PORSCHE, 9271, SFX_POLICE_SIREN_SLOW, 16168, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 12170, SFX_CAR_ALARM_1, 8000, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_BUS2, 12345, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_2, 2, SFX_CAR_HORN_BMW328, 10796, SFX_CAR_ALARM_1, 8543, 1}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_PORSCHE, 9271, SFX_CAR_ALARM_1, 9935, 1}, - {SFX_CAR_REV_2, 2, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_ALARM_1, 9935, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_PICKUP, 11025, SFX_ICE_CREAM_TUNE, 11025, 0}, - {SFX_CAR_REV_7, 7, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 10000, 0}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 10706, SFX_POLICE_SIREN_SLOW, 13596, 1}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 17260, SFX_POLICE_SIREN_SLOW, 13000, 2}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_ALARM_1, 9935, 2}, - {SFX_CAR_REV_8, 8, SFX_CAR_HORN_PORSCHE, 10400, SFX_CAR_ALARM_1, 10123, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 26513, SFX_POLICE_SIREN_SLOW, 13596, 0}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_BUS2, 11652, SFX_CAR_ALARM_1, 10554, 3}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 8000, 2}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_ALARM_1, 9935, 2}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 9935, 3}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CESNA_IDLE, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_BUS, 16291, SFX_CAR_ALARM_1, 7500, 3}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10233, SFX_CAR_ALARM_1, 8935, 0}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_ALARM_1, 8935, 0}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_PICKUP, 2000, SFX_CAR_ALARM_1, 17000, 0}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 9003, SFX_CAR_ALARM_1, 9935, 1}, - {SFX_CAR_REV_2, 2, SFX_CAR_HORN_PORSCHE, 12375, SFX_CAR_ALARM_1, 9935, 1}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BUS2, 15554, SFX_CAR_ALARM_1, 9935, 1}, - {SFX_CAR_REV_7, 7, SFX_CAR_HORN_BUS2, 13857, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_7, 7, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 2}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 20143, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9000, 0}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_ALARM_1, 9935, 2}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 18286, SFX_CAR_ALARM_1, 9935, 2}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_ALARM_1, 13400, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}}; - -void -cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *automobile) -{ - static int32 GearFreqAdj[] = {6000, 6000, 3400, 1200, 0, -1000}; - - cTransmission *transmission; - float velocityChange; - float relativeVelocityChange; - float accelerationMultipler; - uint8 wheelInUseCounter; - float time; - int baseFreq; - uint8 vol; - int gearNr; - int32 freq; - - int freqModifier; - int soundOffset; - uint8 engineSoundType; - int32 accelerateState; - bool channelUsed; - char lostTraction; - bool processedAccelSampleStopped; - uint8 currentGear; - float gasPedalAudio; - CVector pos; - - static int16 LastAccel = 0; - static int16 LastBrake = 0; - static uint8 CurrentPretendGear = 1; - static bool bLostTractionLastFrame = false; - static bool bHandbrakeOnLastFrame = 0; - static int32 nCruising = 0; - static bool bAccelSampleStopped = true; - - lostTraction = 0; - processedAccelSampleStopped = 0; - if (bPlayerJustEnteredCar) { - bAccelSampleStopped = true; - bPlayerJustEnteredCar = false; - nCruising = 0; - LastAccel = 0; - bLostTractionLastFrame = false; - LastBrake = 0; - bHandbrakeOnLastFrame = 0; - CurrentPretendGear = 1; - } - if (CReplay::IsPlayingBack()) { - accelerateState = 255.f * Max(0.0f, Min(1.0f, automobile->m_fGasPedal)); - } else { - accelerateState = Pads->GetAccelerate(); - } - channelUsed = SampleManager.GetChannelUsedFlag(m_nActiveSamples); - transmission = params->m_pTransmission; - velocityChange = params->m_fVelocityChange; - relativeVelocityChange = 2.0f * velocityChange / transmission->fMaxVelocity; - - accelerationMultipler = Min(Min(1.f, relativeVelocityChange), 0.f); - gasPedalAudio = accelerationMultipler; - currentGear = params->m_pVehicle->m_nCurrentGear; - - if (transmission->nDriveType == '4') { - wheelInUseCounter = 0; - for (uint8 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) { - if (automobile->m_aWheelState[i]) - ++wheelInUseCounter; - } - if (wheelInUseCounter > 2) - lostTraction = 1; - } else if (transmission->nDriveType == 'F') { - if ((automobile->m_aWheelState[0] || automobile->m_aWheelState[2]) && (automobile->m_aWheelState[1] || automobile->m_aWheelState[3])) { - lostTraction = 1; - } - } else if (transmission->nDriveType == 'R' && (automobile->m_aWheelState[1] || automobile->m_aWheelState[3])) { - lostTraction = 1; - } - if (0.0f != velocityChange) { - time = params->m_pVehicle->m_vecMoveSpeed.z / velocityChange; - if (time <= 0.0f) { - freqModifier = Max(-0.2f, time) * -15000.f; - } else { - freqModifier = -(Min(0.2f, time) * 15000.f); - } - if (params->m_fVelocityChange < -0.001f) - freqModifier = -freqModifier; - } else { - freqModifier = 0; - } - engineSoundType = aVehicleSettings[params->m_nIndex].m_bEngineSoundType; - soundOffset = 3 * (engineSoundType - 1); - if (accelerateState <= 0) { - if (params->m_fVelocityChange < -0.001f) { - if (channelUsed) { - SampleManager.StopChannel(m_nActiveSamples); - bAccelSampleStopped = true; - } - if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction) { - gasPedalAudio = automobile->m_fGasPedalAudio; - } else { - gasPedalAudio = Min(1.0f, params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity); - } - gasPedalAudio = Max(0.0f, gasPedalAudio); - automobile->m_fGasPedalAudio = gasPedalAudio; - } else if (LastAccel > 0) { - if (channelUsed) { - SampleManager.StopChannel(m_nActiveSamples); - bAccelSampleStopped = true; - } - nCruising = 0; - if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction || - params->m_fVelocityChange >= 0.01f && automobile->m_fGasPedalAudio > 0.2f) { - automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.6f; - gasPedalAudio = automobile->m_fGasPedalAudio; - } - if (gasPedalAudio > 0.05f) { - freq = (5000.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 19000; - if (engineSoundType == 6) - freq /= 2; - AddPlayerCarSample((25.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 40, freq, (soundOffset + SFX_CAR_FINGER_OFF_ACCEL_1), engineSoundType, 63, 0); - } - } - freq = (10000.f * gasPedalAudio) + 22050; - if (engineSoundType == 6) - freq /= 2; - AddPlayerCarSample(110 - (40.f * gasPedalAudio), freq, (engineSoundType + SFX_CAR_REV_10), 0, 52, 1); - - CurrentPretendGear = Max(1, currentGear); - LastAccel = accelerateState; - - bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; - bLostTractionLastFrame = lostTraction; - return; - } - if (!nCruising) { - if (accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction || - currentGear < 2 && velocityChange - automobile->m_fVelocityChangeForAudio < 0.01f) { // here could be used abs - if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction) { - if (!automobile->m_nWheelsOnGround && automobile->m_nDriveWheelsOnGround || - (automobile->bIsHandbrakeOn && !bHandbrakeOnLastFrame || lostTraction && !bLostTractionLastFrame) && automobile->m_nWheelsOnGround) { - automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.6f; - } - freqModifier = 0; - baseFreq = (15000.f * automobile->m_fGasPedalAudio) + 14000; - vol = (25.0f * automobile->m_fGasPedalAudio) + 60; - } else { - baseFreq = (8000.f * accelerationMultipler) + 16000; - vol = (25.0f * accelerationMultipler) + 60; - automobile->m_fGasPedalAudio = accelerationMultipler; - } - freq = freqModifier + baseFreq; - if (engineSoundType == 6) - freq /= 2; - if (channelUsed) { - SampleManager.StopChannel(m_nActiveSamples); - bAccelSampleStopped = true; - } - AddPlayerCarSample(vol, freq, (engineSoundType + SFX_PHONE_RING), 0, 2, 1); - LastAccel = accelerateState; - - bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; - bLostTractionLastFrame = lostTraction; - return; - } - TranslateEntity(&m_sQueueSample.m_vecPos, &pos); - if (bAccelSampleStopped) { - if (CurrentPretendGear != 1 || currentGear != 2) { - gearNr = currentGear - 1; - if (gearNr < 1) - gearNr = 1; - CurrentPretendGear = gearNr; - } - processedAccelSampleStopped = 1; - bAccelSampleStopped = false; - } - if (channelUsed) { - SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 85); - SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z); - SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.f, 12.5f); - if (engineSoundType == 6) - freq = (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050) / 2; - else - freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050; - SampleManager.SetChannelFrequency(m_nActiveSamples, freq); - if (!channelUsed) { - SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != 0); - SampleManager.StartChannel(m_nActiveSamples); - } - LastAccel = accelerateState; - - bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; - bLostTractionLastFrame = lostTraction; - return; - } - if (processedAccelSampleStopped) { - if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + SFX_CAR_ACCEL_1, 0)) - return; - SampleManager.SetChannelLoopCount(m_nActiveSamples, 1); - SampleManager.SetChannelLoopPoints(m_nActiveSamples, 0, -1); - SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 85); - SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z); - SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.f, 12.5f); - freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050; - if (engineSoundType == 6) - freq /= 2; - SampleManager.SetChannelFrequency(m_nActiveSamples, freq); - if (!channelUsed) { - SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != 0); - SampleManager.StartChannel(m_nActiveSamples); - } - LastAccel = accelerateState; - - bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; - bLostTractionLastFrame = lostTraction; - return; - } - if (CurrentPretendGear < params->m_pTransmission->nNumberOfGears - 1) { - ++CurrentPretendGear; - if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + SFX_CAR_ACCEL_1, 0)) - return; - SampleManager.SetChannelLoopCount(m_nActiveSamples, 1); - SampleManager.SetChannelLoopPoints(m_nActiveSamples, 0, -1); - SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 85); - SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z); - SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.f, 12.5f); - freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050; - if (engineSoundType == 6) - freq /= 2; - SampleManager.SetChannelFrequency(m_nActiveSamples, freq); - if (!channelUsed) { - SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != 0); - SampleManager.StartChannel(m_nActiveSamples); - } - LastAccel = accelerateState; - - bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; - bLostTractionLastFrame = lostTraction; - return; - } - nCruising = 1; - } - bAccelSampleStopped = true; - if (accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction || - currentGear < params->m_pTransmission->nNumberOfGears - 1) { - nCruising = 0; - } else { - if (accelerateState >= 220 && 0.001f + params->m_fVelocityChange < automobile->m_fVelocityChangeForAudio) { - if (nCruising < 800) - ++nCruising; - } else if (nCruising > 3) { - --nCruising; - } - freq = 27 * nCruising + freqModifier + 22050; - if (engineSoundType == 6) - freq /= 2; - AddPlayerCarSample(85, freq, (soundOffset + SFX_CAR_AFTER_ACCEL_1), engineSoundType, 64, 1); - } - LastAccel = accelerateState; - - bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; - bLostTractionLastFrame = lostTraction; -} - -void -cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound) -{ - uint32 time = CTimer::GetTimeInMilliseconds(); - int32 sampleIndex; - uint8 emittingVol; - float distSquared; - cPedParams params; - - static uint8 counter = 0; - - if (time > gCellNextTime) { - switch (sound) { - case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; - break; - case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; - break; - default: - return; - } - distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); - if (m_FrameCounter & 1) - sampleIndex = (m_anRandomTable[1] & 3) + SFX_FIGHT_1; - else - sampleIndex = (m_anRandomTable[3] & 1) + SFX_BAT_HIT_LEFT; - m_sQueueSample.m_nSampleIndex = sampleIndex; - emittingVol = m_anRandomTable[0] % 50 + 55; - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); - m_sQueueSample.m_nCounter = counter++; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - params.m_bDistanceCalculated = true; - params.m_fDistance = distSquared; - params.m_pPed = nil; - SetupPedComments(¶ms, SOUND_INJURED_PED_MALE_PRISON); - } - gCellNextTime = time + 500 + m_anRandomTable[3] % 1500; - } - } -} - -void -cAudioManager::ProcessPornCinema(uint8 sound) -{ - - eSfxSample sample; - uint32 time; - int32 rand; - float distSquared; - - switch (sound) { - case SCRIPT_SOUND_PORN_CINEMA_1_S: - case SCRIPT_SOUND_MISTY_SEX_S: - m_sQueueSample.m_nSampleIndex = SFX_PORN_1_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - sample = SFX_PORN_1_GROAN_1; - m_sQueueSample.m_fSoundIntensity = 20.0f; - break; - case SCRIPT_SOUND_PORN_CINEMA_1_L: - case SCRIPT_SOUND_MISTY_SEX_L: - m_sQueueSample.m_nSampleIndex = SFX_PORN_1_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - sample = SFX_PORN_1_GROAN_1; - m_sQueueSample.m_fSoundIntensity = 80.0f; - break; - case SCRIPT_SOUND_PORN_CINEMA_2_S: - m_sQueueSample.m_nSampleIndex = SFX_PORN_2_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - sample = SFX_PORN_2_GROAN_1; - m_sQueueSample.m_fSoundIntensity = 20.0f; - break; - case SCRIPT_SOUND_PORN_CINEMA_2_L: - m_sQueueSample.m_nSampleIndex = SFX_PORN_2_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - sample = SFX_PORN_2_GROAN_1; - m_sQueueSample.m_fSoundIntensity = 80.0f; - break; - case SCRIPT_SOUND_PORN_CINEMA_3_S: - m_sQueueSample.m_nSampleIndex = SFX_PORN_3_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_fSoundIntensity = 20.0f; - sample = SFX_PORN_3_GROAN_1; - break; - case SCRIPT_SOUND_PORN_CINEMA_3_L: - m_sQueueSample.m_nSampleIndex = SFX_PORN_3_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_fSoundIntensity = 80.0f; - sample = SFX_PORN_3_GROAN_1; - break; - default: - return; - } - distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); - if (sound != SCRIPT_SOUND_MISTY_SEX_S && sound != SCRIPT_SOUND_MISTY_SEX_L) { - m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nCounter = 0; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_nEmittingVolume = maxVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - - time = CTimer::GetTimeInMilliseconds(); - if (time > gPornNextTime) { - m_sQueueSample.m_nVolume = ComputeVolume(90, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - rand = m_anRandomTable[1] & 1; - m_sQueueSample.m_nSampleIndex = rand + sample; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); - m_sQueueSample.m_nCounter = rand + 1; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_nReleasingVolumeModificator = 6; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - gPornNextTime = time + 2000 + m_anRandomTable[3] % 6000; - } - } - } -} - -void -cAudioManager::ProcessProjectiles() -{ - uint8 emittingVol; - - for (int32 i = 0; i < NUM_PROJECTILES; i++) { - if (CProjectileInfo::GetProjectileInfo(i)->m_bInUse) { - switch (CProjectileInfo::GetProjectileInfo(i)->m_eWeaponType) { - case WEAPONTYPE_ROCKETLAUNCHER: - emittingVol = maxVolume; - m_sQueueSample.m_fSoundIntensity = rocketLauncherIntensity; - m_sQueueSample.m_nSampleIndex = SFX_ROCKET_FLY; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ROCKET_FLY); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - break; - case WEAPONTYPE_MOLOTOV: - emittingVol = molotovVolume; - m_sQueueSample.m_fSoundIntensity = molotovIntensity; - m_sQueueSample.m_nSampleIndex = SFX_PED_ON_FIRE; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = 32 * SampleManager.GetSampleBaseFrequency(SFX_PED_ON_FIRE) / 25; - m_sQueueSample.m_nReleasingVolumeModificator = 7; - break; - default: - return; - } - m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_vecPos = CProjectileInfo::ms_apProjectile[i]->GetPosition(); - float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = i; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - } - } -} - -void -cAudioManager::ProcessRainOnVehicle(cVehicleParams *params) -{ - if (params->m_fDistance < SQR(rainOnVehicleIntensity) && CWeather::Rain > 0.01f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) { - CVehicle *veh = params->m_pVehicle; - ++veh->m_bRainAudioCounter; - if (veh->m_bRainAudioCounter >= 2) { - veh->m_bRainAudioCounter = 0; - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - float emittingVol = 30.f * CWeather::Rain; - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, rainOnVehicleIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = veh->m_bRainSamplesCounter++; - if (veh->m_bRainSamplesCounter > 4) - veh->m_bRainSamplesCounter = 68; - m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] & 3) + SFX_CAR_RAIN_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 9; - m_sQueueSample.m_nFrequency = m_anRandomTable[1] % 4000 + 28000; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nEmittingVolume = (uint8)emittingVol; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = rainOnVehicleIntensity; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bReverbFlag = false; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - } -} - -void -cAudioManager::ProcessReverb() const -{ - if (SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) { - for (uint32 i = 0; i < -#ifdef FIX_BUGS - channels -#else - 28 -#endif - ; - i++) { - if (m_asActiveSamples[i].m_bReverbFlag) - SampleManager.SetChannelReverbFlag(i, 1); - } - } -} - -bool -cAudioManager::ProcessReverseGear(cVehicleParams *params) -{ - CVehicle *veh; - CAutomobile *automobile; - int32 emittingVol; - float modificator; - - if (params->m_fDistance >= SQR(reverseGearIntensity)) - return false; - veh = params->m_pVehicle; - if (veh->bEngineOn && (veh->m_fGasPedal < 0.0f || !veh->m_nCurrentGear)) { - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - automobile = (CAutomobile *)params->m_pVehicle; - if (automobile->m_nWheelsOnGround) { - modificator = params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity; - } else { - if (automobile->m_nDriveWheelsOnGround) - automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.4f; - modificator = automobile->m_fGasPedalAudio; - } - modificator = Abs(modificator); - emittingVol = (24.f * modificator); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, reverseGearIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - if (params->m_pVehicle->m_fGasPedal >= 0.0f) { - m_sQueueSample.m_nCounter = 62; - m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR_2; - } else { - m_sQueueSample.m_nCounter = 61; - m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR; - } - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nFrequency = (6000.f * modificator) + 7000; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = reverseGearIntensity; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - return true; -} - -void -cAudioManager::ProcessSawMillScriptObject(uint8 sound) -{ - uint32 time; - float distSquared; - - switch (sound) { - case SCRIPT_SOUND_SAWMILL_LOOP_S: - case SCRIPT_SOUND_SAWMILL_LOOP_L: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; - break; - default: - return; - } - distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nSampleIndex = SFX_SAWMILL_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SAWMILL_LOOP); - m_sQueueSample.m_nCounter = 0; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeModificator = 5; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_nEmittingVolume = 30; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - time = CTimer::GetTimeInMilliseconds(); - if (time > gSawMillNextTime) { - m_sQueueSample.m_nVolume = ComputeVolume(70, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nSampleIndex = SFX_SAWMILL_CUT_WOOD; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nCounter = 1; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - gSawMillNextTime = time + 2000 + m_anRandomTable[3] % 4000; - } - } - } -} - -void -cAudioManager::ProcessScriptObject(int32 id) -{ - cAudioScriptObject *entity = (cAudioScriptObject *)m_asAudioEntities[id].m_pEntity; - if (entity) { - m_sQueueSample.m_vecPos = entity->Posn; - if (m_asAudioEntities[id].m_AudioEvents == 1) - ProcessOneShotScriptObject(m_asAudioEntities[id].m_awAudioEvent[0]); - else - ProcessLoopingScriptObject(entity->AudioId); - } -} - -void -cAudioManager::ProcessShopScriptObject(uint8 sound) -{ - uint32 time; - int32 rand; - float distSquared; - - switch (sound) { - case SCRIPT_SOUND_SHOP_LOOP_S: - case SCRIPT_SOUND_SHOP_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 30.0f; - break; - default: - return; - } - distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nSampleIndex = SFX_SHOP_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SHOP_LOOP); - m_sQueueSample.m_nCounter = 0; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeModificator = 5; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_nEmittingVolume = 30; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - time = CTimer::GetTimeInMilliseconds(); - if (time > gShopNextTime) { - m_sQueueSample.m_nVolume = ComputeVolume(70, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - rand = m_anRandomTable[1] & 1; - m_sQueueSample.m_nSampleIndex = rand + SFX_SHOP_TILL_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nCounter = rand + 1; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_nEmittingVolume = 70; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - gShopNextTime = time + 3000 + m_anRandomTable[3] % 7000; - } - } - } -} - -void -cAudioManager::ProcessSpecial() -{ - if (m_nUserPause) { - if (!m_nPreviousUserPause) { - MusicManager.ChangeMusicMode(MUSICMODE_FRONTEND); - SampleManager.SetEffectsFadeVolume(maxVolume); - SampleManager.SetMusicFadeVolume(maxVolume); - } - } else { - if (m_nPreviousUserPause) { - MusicManager.StopFrontEndTrack(); - MusicManager.ChangeMusicMode(MUSICMODE_GAME); - } - CPlayerPed *playerPed = FindPlayerPed(); - if (playerPed) { - const PedState &state = playerPed->m_nPedState; - if (state != PED_ENTER_CAR && state != PED_STEAL_CAR && !playerPed->bInVehicle) - SampleManager.StopChannel(m_nActiveSamples); - } - } -} - -bool -cAudioManager::ProcessTrainNoise(cVehicleParams *params) -{ - const float SOUND_INTENSITY = 300.0f; - - CTrain *train; - uint8 emittingVol; - float speedMultipler; - - if (params->m_fDistance >= SQR(SOUND_INTENSITY)) - return false; - - if (params->m_fVelocityChange > 0.0f) { - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - train = (CTrain *)params->m_pVehicle; - speedMultipler = Min(1.0f, train->m_fSpeed * 250.f / 51.f); - emittingVol = (75.f * speedMultipler); - if (train->m_fWagonPosition == 0.0f) { - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { - m_sQueueSample.m_nCounter = 32; - m_sQueueSample.m_nSampleIndex = SFX_TRAIN_FAR; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 2; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_FAR); - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - const float SOUND_INTENSITY = 70.0f; - if (params->m_fDistance < SQR(SOUND_INTENSITY)) { - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { - m_sQueueSample.m_nCounter = 33; - m_sQueueSample.m_nSampleIndex = SFX_TRAIN_NEAR; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 5; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_NEAR) + 100 * m_sQueueSample.m_nEntityIndex % 987; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 6.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - } - return true; -} - -void -cAudioManager::ProcessVehicle(CVehicle *veh) -{ - tHandlingData *handling = veh->pHandling; - float velChange; - cVehicleParams params; - m_sQueueSample.m_vecPos = veh->GetPosition(); - - params.m_bDistanceCalculated = false; - params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); - params.m_pVehicle = veh; - params.m_pTransmission = nil; - params.m_nIndex = 0; - params.m_fVelocityChange = 0.0f; - - if (handling) - params.m_pTransmission = &handling->Transmission; - - params.m_nIndex = veh->GetModelIndex() - MI_FIRST_VEHICLE; - if (params.m_pVehicle->GetStatus() == STATUS_SIMPLE) - velChange = params.m_pVehicle->AutoPilot.m_fMaxTrafficSpeed * 0.02f; - else - velChange = DotProduct(params.m_pVehicle->m_vecMoveSpeed, params.m_pVehicle->GetForward()); - params.m_fVelocityChange = velChange; - switch (params.m_pVehicle->m_vehType) { - case VEHICLE_TYPE_CAR: - UpdateGasPedalAudio((CAutomobile *)veh); - if (params.m_nIndex == RCBANDIT) { - ProcessModelCarEngine(¶ms); - ProcessVehicleOneShots(¶ms); - ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; - ProcessRainOnVehicle(¶ms); - break; - } - if (params.m_nIndex == DODO) { - if (!ProcessVehicleRoadNoise(¶ms)) { - ProcessVehicleOneShots(¶ms); - ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; - ProcessRainOnVehicle(¶ms); - break; - } - if (CWeather::WetRoads > 0.f) - ProcessWetRoadNoise(¶ms); - ProcessVehicleSkidding(¶ms); - } else { - if (!ProcessVehicleRoadNoise(¶ms)) { - ProcessVehicleOneShots(¶ms); - ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; - ProcessRainOnVehicle(¶ms); - break; - } - ProcessReverseGear(¶ms); - if (CWeather::WetRoads > 0.f) - ProcessWetRoadNoise(¶ms); - ProcessVehicleSkidding(¶ms); - ProcessVehicleHorn(¶ms); - ProcessVehicleSirenOrAlarm(¶ms); - if (UsesReverseWarning(params.m_nIndex)) - ProcessVehicleReverseWarning(¶ms); - if (HasAirBrakes(params.m_nIndex)) - ProcessAirBrakes(¶ms); - } - ProcessCarBombTick(¶ms); - ProcessVehicleEngine(¶ms); - ProcessEngineDamage(¶ms); - ProcessVehicleDoors(¶ms); - ProcessVehicleOneShots(¶ms); - ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; - ProcessRainOnVehicle(¶ms); - break; - case VEHICLE_TYPE_BOAT: - ProcessBoatEngine(¶ms); - ProcessBoatMovingOverWater(¶ms); - ProcessVehicleOneShots(¶ms); - ProcessRainOnVehicle(¶ms); - break; - case VEHICLE_TYPE_TRAIN: - ProcessTrainNoise(¶ms); - ProcessVehicleOneShots(¶ms); - ProcessRainOnVehicle(¶ms); - break; - case VEHICLE_TYPE_HELI: - ProcessHelicopter(¶ms); - ProcessVehicleOneShots(¶ms); - ProcessRainOnVehicle(¶ms); - break; - case VEHICLE_TYPE_PLANE: - ProcessPlane(¶ms); - ProcessVehicleOneShots(¶ms); - ProcessRainOnVehicle(¶ms); - break; - default: - ProcessRainOnVehicle(¶ms); - break; - } -} - -bool -cAudioManager::ProcessVehicleDoors(cVehicleParams *params) -{ - const float SOUND_INTENSITY = 40.0f; - - CAutomobile *automobile; - int8 doorState; - int32 emittingVol; - float velocity; - - if (params->m_fDistance >= SQR(SOUND_INTENSITY)) - return false; - - automobile = (CAutomobile *)params->m_pVehicle; - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - for (int32 i = 0; i < ARRAY_SIZE(automobile->Doors); i++) { - if (automobile->Damage.GetDoorStatus(i) == DOOR_STATUS_SWINGING) { - doorState = automobile->Doors[i].m_nDoorState; - if (doorState == DOOR_STATUS_SMASHED || doorState == DOOR_STATUS_SWINGING) { - velocity = Min(0.3f, Abs(automobile->Doors[i].m_fAngVel)); - if (velocity > 0.0035f) { - emittingVol = (100.f * velocity * 10.f / 3.f); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = i + 6; - m_sQueueSample.m_nSampleIndex = m_anRandomTable[1] % 6 + SFX_COL_CAR_PANEL_1; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) + RandomDisplacement(1000); - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 10; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_fSpeedMultiplier = 1.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = true; - AddSampleToRequestedQueue(); - } - } - } - } - } - return true; -} - -void -cAudioManager::ProcessVehicleEngine(cVehicleParams *params) -{ - const float SOUND_INTENSITY = 50.0f; - - CVehicle *playerVeh; - CVehicle *veh; - CAutomobile *automobile; - float relativeGearChange; - float relativeChange; - uint8 volume; - int32 freq = 0; // uinitialized variable - uint8 emittingVol; - cTransmission *transmission; - uint8 currentGear; - float modificator; - float traction = 0.f; - - if (params->m_fDistance < SQR(SOUND_INTENSITY)) { - playerVeh = FindPlayerVehicle(); - veh = params->m_pVehicle; - if (playerVeh == veh && veh->GetStatus() == STATUS_WRECKED) { - SampleManager.StopChannel(m_nActiveSamples); - return; - } - if (veh->bEngineOn) { - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - automobile = (CAutomobile *)params->m_pVehicle; - if (params->m_nIndex == DODO) { - ProcessCesna(params); - return; - } - if (FindPlayerVehicle() == veh) { - ProcessPlayersVehicleEngine(params, automobile); - return; - } - transmission = params->m_pTransmission; - if (transmission) { - currentGear = params->m_pVehicle->m_nCurrentGear; - if (automobile->m_nWheelsOnGround) { - if (automobile->bIsHandbrakeOn) { - if (params->m_fVelocityChange == 0.0f) - traction = 0.9f; - } else if (params->m_pVehicle->GetStatus() == STATUS_SIMPLE) { - traction = 0.0f; - } else { - switch (transmission->nDriveType) { - case '4': - for (int32 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) { - if (automobile->m_aWheelState[i] == WHEEL_STATE_SPINNING) - traction += 0.05f; - } - break; - case 'F': - if (automobile->m_aWheelState[0] == WHEEL_STATE_SPINNING) - traction += 0.1f; - if (automobile->m_aWheelState[2] == WHEEL_STATE_SPINNING) - traction += 0.1f; - break; - case 'R': - if (automobile->m_aWheelState[1] == WHEEL_STATE_SPINNING) - traction += 0.1f; - if (automobile->m_aWheelState[3] == WHEEL_STATE_SPINNING) - traction += 0.1f; - break; - } - } - if (transmission->fMaxVelocity <= 0.f) { - relativeChange = 0.f; - } else if (currentGear) { - relativeGearChange = - Min(1.0f, (params->m_fVelocityChange - transmission->Gears[currentGear].fShiftDownVelocity) / transmission->fMaxVelocity * 2.5f); - if (traction == 0.0f && automobile->GetStatus() != STATUS_SIMPLE && - params->m_fVelocityChange >= transmission->Gears[1].fShiftUpVelocity) { - traction = 0.7f; - } - relativeChange = traction * automobile->m_fGasPedalAudio * 0.95f + (1.0f - traction) * relativeGearChange; - } else - relativeChange = - Min(1.0f, 1.0f - Abs((params->m_fVelocityChange - transmission->Gears[0].fShiftDownVelocity) / transmission->fMaxReverseVelocity)); - } else { - if (automobile->m_nDriveWheelsOnGround) - automobile->m_fGasPedalAudio *= 0.4f; - relativeChange = automobile->m_fGasPedalAudio; - } - modificator = relativeChange; - if (currentGear || !automobile->m_nWheelsOnGround) - freq = 1200 * currentGear + 18000.f * modificator + 14000; - else - freq = 13000.f * modificator + 14000; - if (modificator >= 0.75f) { - emittingVol = 120; - volume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - } else { - emittingVol = modificator * 4.0f / 3.0f * 40.f + 80.f; - volume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - } - } else { - modificator = 0.f; - emittingVol = 80; - volume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - } - m_sQueueSample.m_nVolume = volume; - if (m_sQueueSample.m_nVolume) { - if (automobile->GetStatus() == STATUS_SIMPLE) { - if (modificator < 0.02f) { - m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_bEngineSoundType - 1 + SFX_CAR_IDLE_1; - freq = modificator * 10000 + 22050; - m_sQueueSample.m_nCounter = 52; - } else { - m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nAccelerationSampleIndex; - m_sQueueSample.m_nCounter = 2; - } - } else { - if (automobile->m_fGasPedal < 0.05f) { - m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_bEngineSoundType - 1 + SFX_CAR_IDLE_1; - freq = modificator * 10000 + 22050; - m_sQueueSample.m_nCounter = 52; - } else { - m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nAccelerationSampleIndex; - m_sQueueSample.m_nCounter = 2; - } - } - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nFrequency = freq + 100 * m_sQueueSample.m_nEntityIndex % 1000; - if (m_sQueueSample.m_nSampleIndex == SFX_CAR_IDLE_6 || m_sQueueSample.m_nSampleIndex == SFX_CAR_REV_6) - m_sQueueSample.m_nFrequency /= 2; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 6.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 8; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - } -} - -void -cAudioManager::ProcessVehicleHorn(cVehicleParams *params) -{ - const float SOUND_INTENSITY = 40.0f; - - CAutomobile *automobile; - - if (params->m_fDistance < SQR(SOUND_INTENSITY)) { - automobile = (CAutomobile *)params->m_pVehicle; - if ((!automobile->m_bSirenOrAlarm || !UsesSirenSwitching(params->m_nIndex)) && automobile->GetModelIndex() != MI_MRWHOOP) { - if (automobile->m_nCarHornTimer) { - if (params->m_pVehicle->GetStatus() != STATUS_PLAYER) { - automobile->m_nCarHornTimer = Min(44, automobile->m_nCarHornTimer); - if (automobile->m_nCarHornTimer == 44) - automobile->m_nCarHornPattern = (m_FrameCounter + m_sQueueSample.m_nEntityIndex) & 7; - if (!hornPatternsArray[automobile->m_nCarHornPattern][44 - automobile->m_nCarHornTimer]) - return; - } - - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 4; - m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nHornSample; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 2; - m_sQueueSample.m_nFrequency = aVehicleSettings[params->m_nIndex].m_nHornFrequency; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = 80; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 5.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - } - } -} - -void -cAudioManager::ProcessVehicleOneShots(cVehicleParams *params) -{ - int16 event; - uint8 emittingVol; - float relVol; - float vol; - bool noReflections; - float maxDist; - cPedParams pedParams; - - static uint8 WaveIndex = 41; - static uint8 GunIndex = 53; - static uint8 iWheelIndex = 82; - static uint8 CrunchOffset = 0; - - for (int i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) { - noReflections = 0; - m_sQueueSample.m_bRequireReflection = false; - event = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]; - switch (event) { - case SOUND_CAR_DOOR_CLOSE_BONNET: - case SOUND_CAR_DOOR_CLOSE_BUMPER: - case SOUND_CAR_DOOR_CLOSE_FRONT_LEFT: - case SOUND_CAR_DOOR_CLOSE_FRONT_RIGHT: - case SOUND_CAR_DOOR_CLOSE_BACK_LEFT: - case SOUND_CAR_DOOR_CLOSE_BACK_RIGHT: - { - const float SOUND_INTENSITY = 50.0f; - maxDist = SQR(SOUND_INTENSITY); - emittingVol = m_anRandomTable[2] % 5 + 122; - switch (aVehicleSettings[params->m_nIndex].m_bDoorType) { - case 0: - m_sQueueSample.m_nSampleIndex = SFX_OLD_CAR_DOOR_CLOSE; - break; - case 2: - m_sQueueSample.m_nSampleIndex = SFX_TRUCK_DOOR_CLOSE; - break; - case 3: - m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES; - break; - default: - m_sQueueSample.m_nSampleIndex = SFX_NEW_CAR_DOOR_CLOSE; - break; - } - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] + 22; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = true; - break; - } - case SOUND_CAR_DOOR_OPEN_BONNET: - case SOUND_CAR_DOOR_OPEN_BUMPER: - case SOUND_CAR_DOOR_OPEN_FRONT_LEFT: - case SOUND_CAR_DOOR_OPEN_FRONT_RIGHT: - case SOUND_CAR_DOOR_OPEN_BACK_LEFT: - case SOUND_CAR_DOOR_OPEN_BACK_RIGHT: - { - const float SOUND_INTENSITY = 50.0f; - maxDist = SQR(SOUND_INTENSITY); - emittingVol = m_anRandomTable[1] % 10 + 117; - switch (aVehicleSettings[params->m_nIndex].m_bDoorType) { - case 0: - m_sQueueSample.m_nSampleIndex = SFX_OLD_CAR_DOOR_OPEN; - break; - case 2: - m_sQueueSample.m_nSampleIndex = SFX_TRUCK_DOOR_OPEN; - break; - case 3: - m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES; - break; - default: - m_sQueueSample.m_nSampleIndex = SFX_NEW_CAR_DOOR_OPEN; - break; - } - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] + 10; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = true; - break; - } - case SOUND_CAR_WINDSHIELD_CRACK: - { - const float SOUND_INTENSITY = 30.0f; - maxDist = SQR(SOUND_INTENSITY); - m_sQueueSample.m_nSampleIndex = SFX_GLASS_CRACK; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = 68; - emittingVol = m_anRandomTable[1] % 30 + 60; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_CRACK); - m_sQueueSample.m_nReleasingVolumeModificator = 5; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - } break; - case SOUND_CAR_JUMP: - { - const float SOUND_INTENSITY = 35.0f; - emittingVol = Max(80.f, 2 * (100.f * m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i])); - maxDist = SQR(SOUND_INTENSITY); - m_sQueueSample.m_nSampleIndex = SFX_TYRE_BUMP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = iWheelIndex++; - if (iWheelIndex > 85) - iWheelIndex = 82; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TYRE_BUMP); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); - if (params->m_nIndex == 41) { - m_sQueueSample.m_nFrequency *= 2; - emittingVol /= 2; - } - m_sQueueSample.m_nReleasingVolumeModificator = 6; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - break; - } - case SOUND_CAR_ENGINE_START: - { - const float SOUND_INTENSITY = 40.0f; - emittingVol = 60; - maxDist = SQR(SOUND_INTENSITY); - m_sQueueSample.m_nSampleIndex = SFX_CAR_STARTER; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = 33; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_STARTER); - m_sQueueSample.m_nReleasingVolumeModificator = 1; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = true; - break; - } - case SOUND_CAR_LIGHT_BREAK: - { - const float SOUND_INTENSITY = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_GLASS_SHARD_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = 37; - m_sQueueSample.m_nFrequency = 9 * SampleManager.GetSampleBaseFrequency(SFX_GLASS_SHARD_1) / 10; - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8); - m_sQueueSample.m_nReleasingVolumeModificator = 5; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - maxDist = SQR(SOUND_INTENSITY); - emittingVol = m_anRandomTable[4] % 10 + 30; - break; - } - case SOUND_CAR_HYDRAULIC_1: - case SOUND_CAR_HYDRAULIC_2: - { - const float SOUND_INTENSITY = 35.0f; - if (event == MOONBEAM) // todo check - m_sQueueSample.m_nFrequency = 15600; - else - m_sQueueSample.m_nFrequency = 13118; - m_sQueueSample.m_nSampleIndex = SFX_SUSPENSION_FAST_MOVE; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = 51; - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8); - m_sQueueSample.m_nReleasingVolumeModificator = 5; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - maxDist = SQR(SOUND_INTENSITY); - emittingVol = m_anRandomTable[0] % 15 + 55; - break; - } - case SOUND_CAR_HYDRAULIC_3: - { - const float SOUND_INTENSITY = 35.0f; - m_sQueueSample.m_nSampleIndex = SFX_SUSPENSION_SLOW_MOVE_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = 86; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SUSPENSION_SLOW_MOVE_LOOP); - m_sQueueSample.m_nReleasingVolumeModificator = 5; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_nReleasingVolumeDivider = 7; - noReflections = true; - maxDist = SQR(SOUND_INTENSITY); - emittingVol = m_anRandomTable[0] % 15 + 55; - break; - } - case SOUND_CAR_JERK: - { - const float SOUND_INTENSITY = 35.0f; - m_sQueueSample.m_nSampleIndex = SFX_SHAG_SUSPENSION; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = 87; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SHAG_SUSPENSION); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8); - m_sQueueSample.m_nReleasingVolumeModificator = 5; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - maxDist = SQR(SOUND_INTENSITY); - emittingVol = m_anRandomTable[1] % 15 + 55; - break; - } - case SOUND_CAR_SPLASH: - { - const float SOUND_INTENSITY = 40.0f; - vol = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]; - if (vol <= 300.f) - continue; - if (vol > 1200.f) - m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i] = 1200.0f; - relVol = (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i] - 300.f) / 900.f; - m_sQueueSample.m_nSampleIndex = (m_anRandomTable[0] & 1) + SFX_BOAT_SPLASH_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = WaveIndex++; - if (WaveIndex > 46) - WaveIndex = 41; - m_sQueueSample.m_nFrequency = (7000.f * relVol) + 6000; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - emittingVol = (55.f * relVol); - maxDist = SQR(SOUND_INTENSITY); - break; - } - case SOUND_17: - { - const float SOUND_INTENSITY = 50.0f; - m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_THUMB_OFF; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = 47; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BOAT_THUMB_OFF) + RandomDisplacement(600); - m_sQueueSample.m_nReleasingVolumeModificator = 2; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - emittingVol = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]; - maxDist = SQR(SOUND_INTENSITY); - break; - } - case SOUND_18: - case SOUND_19: - { - const float SOUND_INTENSITY = 35.0f; - m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = 59; - m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 11025; - m_sQueueSample.m_nReleasingVolumeModificator = 5; - m_sQueueSample.m_fSpeedMultiplier = 5.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - maxDist = SQR(SOUND_INTENSITY); - emittingVol = m_anRandomTable[1] % 20 + 70; - break; - } - case SOUND_CAR_TANK_TURRET_ROTATE: - { - const float SOUND_INTENSITY = 40.0f; - vol = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]; - if (vol > 96.0f / 2500.0f) - vol = 96.0f / 2500.0f; - m_sQueueSample.m_nSampleIndex = SFX_TANK_TURRET; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = 79; - m_sQueueSample.m_nFrequency = (3000.f * vol * 2500.0f / 96.0f) + 9000; - m_sQueueSample.m_nReleasingVolumeModificator = 2; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - emittingVol = (37.f * vol * 2500.0f / 96.0f) + 90; - maxDist = SQR(SOUND_INTENSITY); - noReflections = true; - break; - } - case SOUND_CAR_BOMB_TICK: - { - const float SOUND_INTENSITY = 30.0f; - m_sQueueSample.m_nSampleIndex = SFX_BOMB_BEEP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = 80; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BOMB_BEEP); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - maxDist = SQR(SOUND_INTENSITY); - m_sQueueSample.m_bRequireReflection = true; - emittingVol = 60; - break; - } - case SOUND_PLANE_ON_GROUND: - { - const float SOUND_INTENSITY = 180.0f; - m_sQueueSample.m_nSampleIndex = SFX_JUMBO_LAND_WHEELS; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = 81; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_LAND_WHEELS); - m_sQueueSample.m_nReleasingVolumeModificator = 2; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - maxDist = SQR(SOUND_INTENSITY); - emittingVol = m_anRandomTable[4] % 25 + 75; - break; - } - case SOUND_WEAPON_SHOT_FIRED: - { - const float SOUND_INTENSITY = 120.0f; - emittingVol = m_anRandomTable[2]; - maxDist = SQR(SOUND_INTENSITY); - m_sQueueSample.m_nSampleIndex = SFX_UZI_LEFT; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = GunIndex++; - emittingVol = emittingVol % 15 + 65; - if (GunIndex > 58) - GunIndex = 53; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_UZI_LEFT); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - break; - } - case SOUND_WEAPON_HIT_VEHICLE: - { - const float SOUND_INTENSITY = 40.0f; - m_sQueueSample.m_nSampleIndex = m_anRandomTable[m_sQueueSample.m_nEntityIndex % ARRAY_SIZE(m_anRandomTable)] % 6 + SFX_BULLET_CAR_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = 34; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); - m_sQueueSample.m_nReleasingVolumeModificator = 7; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - maxDist = SQR(SOUND_INTENSITY); - emittingVol = m_anRandomTable[3] % 20 + 90; - break; - } - case SOUND_BOMB_TIMED_ACTIVATED: - case SOUND_55: - case SOUND_BOMB_ONIGNITION_ACTIVATED: - case SOUND_BOMB_TICK: - { - const float SOUND_INTENSITY = 50.0f; - m_sQueueSample.m_nSampleIndex = SFX_ARM_BOMB; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = 36; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ARM_BOMB); - m_sQueueSample.m_nReleasingVolumeModificator = 0; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = true; - emittingVol = 50; - maxDist = SQR(SOUND_INTENSITY); - break; - } - case SOUND_PED_HELI_PLAYER_FOUND: - pedParams.m_pPed = nil; - pedParams.m_bDistanceCalculated = false; - pedParams.m_fDistance = 0.0f; - pedParams.m_bDistanceCalculated = params->m_bDistanceCalculated; - pedParams.m_fDistance = params->m_fDistance; - SetupPedComments(&pedParams, SOUND_PED_HELI_PLAYER_FOUND); - continue; - case SOUND_PED_BODYCAST_HIT: - pedParams.m_pPed = nil; - pedParams.m_bDistanceCalculated = false; - pedParams.m_fDistance = 0.0f; - pedParams.m_bDistanceCalculated = params->m_bDistanceCalculated; - pedParams.m_fDistance = params->m_fDistance; - SetupPedComments(&pedParams, SOUND_PED_BODYCAST_HIT); - continue; - case SOUND_WATER_FALL: - { - const float SOUND_INTENSITY = 40.0f; - m_sQueueSample.m_nSampleIndex = SFX_SPLASH_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = 15; - m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 16000; - m_sQueueSample.m_nReleasingVolumeModificator = 1; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - maxDist = SQR(SOUND_INTENSITY); - m_sQueueSample.m_bRequireReflection = true; - emittingVol = m_anRandomTable[4] % 20 + 90; - break; - } - case SOUND_SPLATTER: - { - const float SOUND_INTENSITY = 40.0f; - m_sQueueSample.m_nSampleIndex = CrunchOffset + SFX_PED_CRUNCH_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = 48; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PED_CRUNCH_1) + RandomDisplacement(600); - m_sQueueSample.m_nReleasingVolumeModificator = 1; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 40.0f; - ++CrunchOffset; - maxDist = SQR(SOUND_INTENSITY); - emittingVol = m_anRandomTable[4] % 20 + 55; - CrunchOffset %= 2; - m_sQueueSample.m_bRequireReflection = true; - break; - } - case SOUND_CAR_PED_COLLISION: - { - const float SOUND_INTENSITY = 40.0f; - vol = Min(20.0f, m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]); - emittingVol = (vol / 20.0f * 127.f); - if (!emittingVol) - continue; - - m_sQueueSample.m_nSampleIndex = (m_anRandomTable[2] & 3) + SFX_FIGHT_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nCounter = 50; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) / 2; - m_sQueueSample.m_nReleasingVolumeModificator = 1; - m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - maxDist = SQR(SOUND_INTENSITY); - break; - } - default: - continue; - } - if (params->m_fDistance < maxDist) { - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { - if (noReflections) { - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; - } else { - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - } - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bIs2D = false; - AddSampleToRequestedQueue(); - } - } - } -} - -bool -cAudioManager::ProcessVehicleReverseWarning(cVehicleParams *params) -{ - const float SOUND_INTENSITY = 50.0f; - - CVehicle *veh = params->m_pVehicle; - - if (params->m_fDistance >= SQR(SOUND_INTENSITY)) - return false; - - if (veh->bEngineOn && veh->m_fGasPedal < 0.0f) { - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - m_sQueueSample.m_nVolume = ComputeVolume(60, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 12; - m_sQueueSample.m_nSampleIndex = SFX_REVERSE_WARNING; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 2; - m_sQueueSample.m_nFrequency = (100 * m_sQueueSample.m_nEntityIndex & 1023) + SampleManager.GetSampleBaseFrequency(SFX_REVERSE_WARNING); - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = 60; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - return true; -} - -bool -cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params) -{ - const float SOUND_INTENSITY = 95.0f; - - int32 emittingVol; - uint32 freq; - float modificator; - int sampleFreq; - float velocity; - - if (params->m_fDistance >= SQR(SOUND_INTENSITY)) - return false; - if (params->m_pTransmission) { - if (params->m_pVehicle->m_vecMoveSpeed.z) { - velocity = Abs(params->m_fVelocityChange); - if (velocity > 0.0f) { - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - emittingVol = 30.f * Min(1.f, velocity / (0.5f * params->m_pTransmission->fMaxVelocity)); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 0; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - if (params->m_pVehicle->m_nSurfaceTouched == SURFACE_PUDDLE) { - m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP; - freq = 6050 * emittingVol / 30 + 16000; - } else { - m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE; - modificator = m_sQueueSample.m_fDistance / 190.f; - sampleFreq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE); - freq = (sampleFreq * modificator) + ((3 * sampleFreq) / 4); - } - m_sQueueSample.m_nFrequency = freq; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 6.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - } - } - return true; -} - -void -cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params) -{ - const float SOUND_INTENSITY = 110.0f; - - if (params->m_fDistance < SQR(SOUND_INTENSITY)) { - CVehicle *veh = params->m_pVehicle; - if (veh->m_bSirenOrAlarm == 0 && veh->m_nAlarmState <= 0) - return; - -#ifdef FIX_BUGS - if (params->m_pVehicle->GetStatus() == STATUS_WRECKED) - return; -#endif - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 5; - if (UsesSiren(params->m_nIndex)) { - if (params->m_pVehicle->GetStatus() == STATUS_ABANDONED) - return; - if (veh->m_nCarHornTimer && params->m_nIndex != FIRETRUK) { - m_sQueueSample.m_nSampleIndex = SFX_SIREN_FAST; - if (params->m_nIndex == FBICAR) - m_sQueueSample.m_nFrequency = 16113; - else - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SIREN_FAST); - m_sQueueSample.m_nCounter = 60; - } else { - m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmSample; - m_sQueueSample.m_nFrequency = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmFrequency; - } - } else { - m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmSample; - m_sQueueSample.m_nFrequency = aVehicleSettings[params->m_nIndex].m_nSirenOrAlarmFrequency; - } - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 1; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = 80; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 7.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - return; - } - } -} - -void -cAudioManager::ProcessVehicleSkidding(cVehicleParams *params) -{ - const float SOUND_INTENSITY = 40.0f; - - CAutomobile *automobile; - cTransmission *transmission; - int32 emittingVol; - float newSkidVal = 0.0f; - float skidVal = 0.0f; - - if (params->m_fDistance >= SQR(SOUND_INTENSITY)) - return; - automobile = (CAutomobile *)params->m_pVehicle; - if (!automobile->m_nWheelsOnGround) - return; - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - for (int32 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) { - if (automobile->m_aWheelState[i] == WHEEL_STATE_NORMAL || automobile->Damage.GetWheelStatus(i) == WHEEL_STATUS_MISSING) - continue; - transmission = params->m_pTransmission; - switch (transmission->nDriveType) - { - case '4': - newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); - break; - case 'F': - if (i == CARWHEEL_FRONT_LEFT || i == CARWHEEL_FRONT_RIGHT) - newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); - else - newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); - break; - case 'R': - if (i == CARWHEEL_REAR_LEFT || i == CARWHEEL_REAR_RIGHT) - newSkidVal = GetVehicleDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); - else - newSkidVal = GetVehicleNonDriveWheelSkidValue(i, automobile, transmission, params->m_fVelocityChange); - break; - default: - break; - } - skidVal = Max(skidVal, newSkidVal); - } - - if (skidVal > 0.0f) { - emittingVol = 50.f * skidVal; - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { - m_sQueueSample.m_nCounter = 3; - switch (params->m_pVehicle->m_nSurfaceTouched) { - case SURFACE_GRASS: - case SURFACE_HEDGE: - m_sQueueSample.m_nSampleIndex = SFX_RAIN; - emittingVol /= 4; - m_sQueueSample.m_nFrequency = 13000.f * skidVal + 35000.f; - m_sQueueSample.m_nVolume /= 4; - break; - case SURFACE_DIRT: - case SURFACE_DIRTTRACK: - case SURFACE_SAND: - case SURFACE_PUDDLE: - m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID; - m_sQueueSample.m_nFrequency = 6000.f * skidVal + 10000.f; - break; - - default: - m_sQueueSample.m_nSampleIndex = SFX_SKID; - m_sQueueSample.m_nFrequency = 5000.f * skidVal + 11000.f; - break; - } - - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 8; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } -} - -void cAudioManager::ProcessWaterCannon(int32) -{ - const float SOUND_INTENSITY = 900.0f; - - for (int32 i = 0; i < NUM_WATERCANNONS; i++) { - if (CWaterCannons::aCannons[i].m_nId) { - m_sQueueSample.m_vecPos = CWaterCannons::aCannons[0].m_avecPos[CWaterCannons::aCannons[i].m_nCur]; - float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SOUND_INTENSITY) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(50, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = 15591; - m_sQueueSample.m_nReleasingVolumeModificator = 5; - m_sQueueSample.m_nCounter = i; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_nReleasingVolumeDivider = 8; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nEmittingVolume = 50; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - } - } -} - -void -cAudioManager::ProcessWeather(int32 id) -{ - uint8 vol; - static uint8 counter = 0; - - if (m_asAudioEntities[id].m_AudioEvents && m_asAudioEntities[id].m_awAudioEvent[0] == SOUND_LIGHTNING) { - if (m_asAudioEntities[id].m_afVolume[0] >= 10.f) { - m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 4000; - vol = (m_asAudioEntities[id].m_afVolume[0] - 10.f) + 40; - } else { - m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_2; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 4000; - vol = (m_asAudioEntities[id].m_afVolume[0]) + 35; - } - m_sQueueSample.m_nVolume = vol; - if (TheCamera.SoundDistUp < 20.f) - m_sQueueSample.m_nVolume /= 2; - if (counter == 4) - counter = 0; - m_sQueueSample.m_nCounter = counter++; - m_sQueueSample.m_nReleasingVolumeModificator = 0; - m_sQueueSample.m_nOffset = (m_anRandomTable[2] & 15) + 55; - m_sQueueSample.m_bIs2D = true; - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_bReverbFlag = false; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - if (CWeather::Rain > 0.0f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) { - m_sQueueSample.m_nSampleIndex = SFX_RAIN; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAIN); - m_sQueueSample.m_nVolume = (int32)(25.f * CWeather::Rain); - m_sQueueSample.m_nCounter = 4; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nReleasingVolumeModificator = 0; - m_sQueueSample.m_nOffset = 63; - m_sQueueSample.m_bIs2D = true; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 30; - m_sQueueSample.m_bReverbFlag = false; - m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } -} - -bool -cAudioManager::ProcessWetRoadNoise(cVehicleParams *params) -{ - const float SOUND_INTENSITY = 30.0f; - - float relativeVelocity; - int32 emittingVol; - float modificator; - int freq; - float velChange; - - if (params->m_fDistance >= SQR(SOUND_INTENSITY)) - return false; - if (params->m_pTransmission) { - if (params->m_pVehicle->m_vecMoveSpeed.z) { - velChange = Abs(params->m_fVelocityChange); - if (velChange > 0.f) { - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - relativeVelocity = Min(1.0f, velChange / (0.5f * params->m_pTransmission->fMaxVelocity)); - emittingVol = 23.0f * relativeVelocity * CWeather::WetRoads; - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nCounter = 1; - m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - modificator = m_sQueueSample.m_fDistance / 6.f; - freq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE); - m_sQueueSample.m_nFrequency = freq + freq * modificator; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 6.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } - } - } - return true; -} - -void -cAudioManager::ProcessWorkShopScriptObject(uint8 sound) -{ - float distSquared; - - switch (sound) { - case SCRIPT_SOUND_WORK_SHOP_LOOP_S: - case SCRIPT_SOUND_WORK_SHOP_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 20.0f; - break; - default: - return; - } - distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { - m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nSampleIndex = SFX_WORKSHOP_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_WORKSHOP_1); - m_sQueueSample.m_nCounter = 0; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeModificator = 5; - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_nEmittingVolume = 30; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - } -} - -int32 -cAudioManager::RandomDisplacement(uint32 seed) const -{ - int32 value; - - static bool bIsEven = true; - static uint32 base = 0; - - if (!seed) - return 0; - - value = m_anRandomTable[(base + seed) % 5] % seed; - base += value; - - if (value % 2) { - bIsEven = !bIsEven; - } - if (!bIsEven) - value = -value; - return value; -} - -void -cAudioManager::ReacquireDigitalHandle() const -{ - if (m_bIsInitialised) { - SampleManager.ReacquireDigitalHandle(); - } -} - -void -cAudioManager::ReleaseDigitalHandle() const -{ - if (m_bIsInitialised) { - SampleManager.ReleaseDigitalHandle(); - } -} - -void -cAudioManager::ResetAudioLogicTimers(uint32 timer) -{ - gPornNextTime = timer; - gNextCryTime = timer; - gSawMillNextTime = timer; - gCellNextTime = timer; - gShopNextTime = timer; - gHomeNextTime = timer; - gAirportNextTime = timer; - gDocksNextTime = timer; - gCinemaNextTime = timer; - for (int32 i = 0; i < m_nAudioEntitiesTotal; i++) { - if (m_asAudioEntities[m_anAudioEntityIndices[i]].m_nType == AUDIOTYPE_PHYSICAL) { - CPed *ped = (CPed *)m_asAudioEntities[m_anAudioEntityIndices[i]].m_pEntity; - if (ped->IsPed()) { - ped->m_lastSoundStart = timer; - ped->m_soundStart = timer + m_anRandomTable[0] % 3000; - } - } - } - ClearMissionAudio(); - SampleManager.StopChannel(policeChannel); -} - -void -cAudioManager::ResetTimers(uint32 time) -{ - if (m_bIsInitialised) { - m_bTimerJustReset = true; - m_nTimer = time; - ClearRequestedQueue(); - if (m_nActiveSampleQueue) { - m_nActiveSampleQueue = 0; - ClearRequestedQueue(); - m_nActiveSampleQueue = 1; - } else { - m_nActiveSampleQueue = 1; - ClearRequestedQueue(); - m_nActiveSampleQueue = 0; - } - ClearActiveSamples(); - ClearMissionAudio(); - SampleManager.StopChannel(policeChannel); - SampleManager.SetEffectsFadeVolume(0); - SampleManager.SetMusicFadeVolume(0); - MusicManager.ResetMusicAfterReload(); -#ifdef AUDIO_OAL - SampleManager.Service(); -#endif - } -} - -void -cAudioManager::Service() -{ - GenerateIntegerRandomNumberTable(); - if (m_bTimerJustReset) { - ResetAudioLogicTimers(m_nTimer); - MusicManager.ResetTimers(m_nTimer); - m_bTimerJustReset = false; - } - if (m_bIsInitialised) { - m_nPreviousUserPause = m_nUserPause; - m_nUserPause = CTimer::GetIsUserPaused(); - UpdateReflections(); - ServiceSoundEffects(); - MusicManager.Service(); - } -} - -void -cAudioManager::ServiceSoundEffects() -{ - m_bFifthFrameFlag = (m_FrameCounter++ % 5) == 0; - if (m_nUserPause && !m_nPreviousUserPause) { - for (int32 i = 0; i < allChannels; i++) - SampleManager.StopChannel(i); - - ClearRequestedQueue(); - if (m_nActiveSampleQueue) { - m_nActiveSampleQueue = 0; - ClearRequestedQueue(); - m_nActiveSampleQueue = 1; - } else { - m_nActiveSampleQueue = 1; - ClearRequestedQueue(); - m_nActiveSampleQueue = 0; - } - ClearActiveSamples(); - } - m_nActiveSampleQueue = m_nActiveSampleQueue != 1; - ProcessReverb(); - ProcessSpecial(); - ClearRequestedQueue(); - InterrogateAudioEntities(); - m_sPedComments.Process(); - ServicePoliceRadio(); - ServiceCollisions(); - AddReleasingSounds(); - ProcessMissionAudio(); - AdjustSamplesVolume(); - ProcessActiveQueues(); -#ifdef AUDIO_OAL - SampleManager.Service(); -#endif - for (int32 i = 0; i < m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal; ++i) { - cAudioScriptObject *object = (cAudioScriptObject *)m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]].m_pEntity; - delete object; - m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]].m_pEntity = nil; - DestroyEntity(m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]); - } - m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0; -} - -int8 -cAudioManager::SetCurrent3DProvider(uint8 which) -{ - if (!m_bIsInitialised) - return -1; - for (uint8 i = 0; i < m_nActiveSamples + 1; ++i) - SampleManager.StopChannel(i); - ClearRequestedQueue(); - if (m_nActiveSampleQueue == 0) - m_nActiveSampleQueue = 1; - else - m_nActiveSampleQueue = 0; - ClearRequestedQueue(); - ClearActiveSamples(); - int8 current = SampleManager.SetCurrent3DProvider(which); - if (current > 0) { - m_nActiveSamples = SampleManager.GetMaximumSupportedChannels(); - if (m_nActiveSamples > 1) - --m_nActiveSamples; - } - return current; -} - -void -cAudioManager::SetDynamicAcousticModelingStatus(bool status) -{ - m_bDynamicAcousticModelingStatus = status; -} - -void -cAudioManager::SetEffectsFadeVolume(uint8 volume) const -{ - SampleManager.SetEffectsFadeVolume(volume); -} - -void -cAudioManager::SetEffectsMasterVolume(uint8 volume) const -{ - SampleManager.SetEffectsMasterVolume(volume); -} - -void -cAudioManager::SetEntityStatus(int32 id, uint8 status) -{ - if (m_bIsInitialised && id >= 0 && id < totalAudioEntitiesSlots && m_asAudioEntities[id].m_bIsUsed) - m_asAudioEntities[id].m_nStatus = status; -} - -void -cAudioManager::SetMissionAudioLocation(float x, float y, float z) -{ - if (m_bIsInitialised) { - m_sMissionAudio.m_bPredefinedProperties = false; - m_sMissionAudio.m_vecPos = CVector(x, y, z); - } -} - -void -cAudioManager::SetMusicFadeVolume(uint8 volume) const -{ - SampleManager.SetMusicFadeVolume(volume); -} - -void -cAudioManager::SetMusicMasterVolume(uint8 volume) const -{ - SampleManager.SetMusicMasterVolume(volume); -} - -void -cAudioManager::SetSpeakerConfig(int32 conf) const -{ - SampleManager.SetSpeakerConfig(conf); -} - -bool -cAudioManager::SetupJumboEngineSound(uint8 vol, int32 freq) -{ - const float SOUND_INTENSITY = 180.0f; - if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY) - return false; - - uint8 emittingVol = vol - gJumboVolOffsetPercentage / 100; - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { - m_sQueueSample.m_nCounter = 3; - m_sQueueSample.m_nSampleIndex = SFX_JUMBO_ENGINE; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 1; - m_sQueueSample.m_nFrequency = freq; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - return true; -} - -bool -cAudioManager::SetupJumboFlySound(uint8 emittingVol) -{ - const float SOUND_INTENSITY = 440.0f; - if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY) - return false; - - int32 vol = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - m_sQueueSample.m_nVolume = vol; - if (m_sQueueSample.m_nVolume != 0) { - m_sQueueSample.m_nSampleIndex = SFX_JUMBO_DIST_FLY; - m_sQueueSample.m_nCounter = 0; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 1; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_DIST_FLY); - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - AddSampleToRequestedQueue(); - } - return true; -} - -bool -cAudioManager::SetupJumboRumbleSound(uint8 emittingVol) -{ - const float SOUND_INTENSITY = 240.0f; - if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY) - return false; - - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - - if (m_sQueueSample.m_nVolume != 0) { - m_sQueueSample.m_nCounter = 5; - m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = true; - m_sQueueSample.m_nReleasingVolumeModificator = 1; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_RUMBLE); - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 12; - m_sQueueSample.m_nOffset = 0; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - m_sQueueSample.m_nCounter = 6; - m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE; - m_sQueueSample.m_nFrequency += 200; - m_sQueueSample.m_nOffset = maxVolume; - AddSampleToRequestedQueue(); - } - return true; -} - -bool -cAudioManager::SetupJumboTaxiSound(uint8 vol) -{ - const float SOUND_INTENSITY = 180.0f; - if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY) - return false; - - uint8 emittingVol = (vol / 2) + ((vol / 2) * m_sQueueSample.m_fDistance / SOUND_INTENSITY); - - if (m_sQueueSample.m_fDistance / SOUND_INTENSITY < 0.7f) - emittingVol -= emittingVol * gJumboVolOffsetPercentage / 100; - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - - if (m_sQueueSample.m_nVolume != 0) { - m_sQueueSample.m_nCounter = 1; - m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 1; - m_sQueueSample.m_nFrequency = GetJumboTaxiFreq(); - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - return true; -} - -bool -cAudioManager::SetupJumboWhineSound(uint8 emittingVol, int32 freq) -{ - const float SOUND_INTENSITY = 170.0f; - - if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY) - return false; - - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - - if (m_sQueueSample.m_nVolume != 0) { - m_sQueueSample.m_nCounter = 2; - m_sQueueSample.m_nSampleIndex = SFX_JUMBO_WHINE; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 1; - m_sQueueSample.m_nFrequency = freq; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - } - return true; -} - void -cAudioManager::SetupPedComments(cPedParams *params, uint32 sound) +cAudioManager::ClearRequestedQueue() { - CPed *ped = params->m_pPed; - uint8 emittingVol; - float soundIntensity; - tPedComment pedComment; - - if (ped != nil) { - switch (sound) { - case SOUND_AMMUNATION_WELCOME_1: - pedComment.m_nSampleIndex = SFX_AMMU_D; - break; - case SOUND_AMMUNATION_WELCOME_2: - pedComment.m_nSampleIndex = SFX_AMMU_E; - break; - case SOUND_AMMUNATION_WELCOME_3: - pedComment.m_nSampleIndex = SFX_AMMU_F; - break; - default: - pedComment.m_nSampleIndex = GetPedCommentSfx(ped, sound); - if (pedComment.m_nSampleIndex == NO_SAMPLE) - return; - break; - } - - soundIntensity = 50.0f; - } else { - switch (sound) { - case SOUND_PED_HELI_PLAYER_FOUND: - soundIntensity = 400.0f; - pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_POLICE_HELI_1, SFX_POLICE_HELI_29); - break; - case SOUND_PED_BODYCAST_HIT: - if (CTimer::GetTimeInMilliseconds() <= gNextCryTime) - return; - soundIntensity = 50.0f; - gNextCryTime = CTimer::GetTimeInMilliseconds() + 500; - pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_PLASTER_BLOKE_1, SFX_PLASTER_BLOKE_4); - break; - case SOUND_INJURED_PED_MALE_OUCH: - case SOUND_INJURED_PED_MALE_PRISON: - soundIntensity = 50.0f; - pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_GENERIC_MALE_GRUNT_1, SFX_GENERIC_MALE_GRUNT_15); - break; - case SOUND_INJURED_PED_FEMALE: - soundIntensity = 50.0f; - pedComment.m_nSampleIndex = GetRandomNumberInRange(m_sQueueSample.m_nEntityIndex % 4, SFX_GENERIC_FEMALE_GRUNT_1, SFX_GENERIC_FEMALE_GRUNT_11); - break; - default: - return; - } - } - - if (params->m_fDistance < SQR(soundIntensity)) { - CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); - if (sound != SOUND_PAGER) { - switch (sound) { - case SOUND_AMMUNATION_WELCOME_1: - case SOUND_AMMUNATION_WELCOME_2: - case SOUND_AMMUNATION_WELCOME_3: - emittingVol = maxVolume; - break; - default: - if (CWorld::GetIsLineOfSightClear(TheCamera.GetPosition(), m_sQueueSample.m_vecPos, true, false, false, false, false, false)) - emittingVol = maxVolume; - else - emittingVol = 31; - break; - } - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, soundIntensity, m_sQueueSample.m_fDistance); - pedComment.m_nProcess = 10; - if (m_sQueueSample.m_nVolume != 0) { - pedComment.m_nEntityIndex = m_sQueueSample.m_nEntityIndex; - pedComment.m_vecPos = m_sQueueSample.m_vecPos; - pedComment.m_fDistance = m_sQueueSample.m_fDistance; - pedComment.m_bVolume = m_sQueueSample.m_nVolume; - m_sPedComments.Add(&pedComment); - } - } - } -} - -void -cAudioManager::Terminate() -{ - if (m_bIsInitialised) { - MusicManager.Terminate(); - - for (uint32 i = 0; i < totalAudioEntitiesSlots; i++) { - m_asAudioEntities[i].m_bIsUsed = false; - m_anAudioEntityIndices[i] = ARRAY_SIZE(m_anAudioEntityIndices); - } - - m_nAudioEntitiesTotal = 0; - m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0; - PreTerminateGameSpecificShutdown(); - - for (uint32 i = 0; i < MAX_SAMPLEBANKS; i++) { - if (SampleManager.IsSampleBankLoaded(i)) - SampleManager.UnloadSampleBank(i); - } - - SampleManager.Terminate(); - - m_bIsInitialised = false; - PostTerminateGameSpecificShutdown(); + for (int32 i = 0; i < m_nActiveSamples; i++) { + m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = m_nActiveSamples; } + m_SampleRequestQueuesStatus[m_nActiveSampleQueue] = 0; } void -cAudioManager::TranslateEntity(Const CVector *in, CVector *out) const -{ - *out = MultiplyInverse(TheCamera.GetMatrix(), *in); -} - -void -cAudioManager::UpdateGasPedalAudio(CAutomobile *automobile) +cAudioManager::ClearActiveSamples() { - float newGasPedalAudio; - - float gasPedal = Abs(automobile->m_fGasPedal); - float gasPedalAudio = automobile->m_fGasPedalAudio; - - if (gasPedalAudio < gasPedal) { - newGasPedalAudio = gasPedalAudio + 0.09f; - if (gasPedal <= newGasPedalAudio) - newGasPedalAudio = gasPedal; - } else { - newGasPedalAudio = gasPedalAudio - 0.07f; - if (gasPedal >= newGasPedalAudio) - newGasPedalAudio = gasPedal; + for (int32 i = 0; i < m_nActiveSamples; i++) { + m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE; + m_asActiveSamples[i].m_nCounter = 0; + m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE; + m_asActiveSamples[i].m_nBankIndex = SAMPLEBANK_INVALID; + m_asActiveSamples[i].m_bIs2D = false; + m_asActiveSamples[i].m_nReleasingVolumeModificator = 5; + m_asActiveSamples[i].m_nFrequency = 0; + m_asActiveSamples[i].m_nVolume = 0; + m_asActiveSamples[i].m_nEmittingVolume = 0; + m_asActiveSamples[i].m_fDistance = 0.0f; + m_asActiveSamples[i].m_bIsProcessed = false; + m_asActiveSamples[i].m_bLoopEnded = false; + m_asActiveSamples[i].m_nLoopCount = 1; + m_asActiveSamples[i].m_nLoopStart = 0; + m_asActiveSamples[i].m_nLoopEnd = -1; + m_asActiveSamples[i].m_fSpeedMultiplier = 0.0f; + m_asActiveSamples[i].m_fSoundIntensity = 200.0f; + m_asActiveSamples[i].m_nOffset = 63; + m_asActiveSamples[i].m_bReleasingSoundFlag = false; + m_asActiveSamples[i].m_nCalculatedVolume = 0; + m_asActiveSamples[i].m_nReleasingVolumeDivider = 0; + m_asActiveSamples[i].m_nVolumeChange = -1; + m_asActiveSamples[i].m_vecPos = {0.0f, 0.0f, 0.0f}; + m_asActiveSamples[i].m_bReverbFlag = false; + m_asActiveSamples[i].m_nLoopsRemaining = 0; + m_asActiveSamples[i].m_bRequireReflection = false; } - automobile->m_fGasPedalAudio = newGasPedalAudio; } void -cAudioManager::UpdateReflections() -{ - const CVector &camPos = TheCamera.GetPosition(); - CColPoint colpoint; - CEntity *ent; - - if (m_FrameCounter % 8 == 0) { - m_avecReflectionsPos[0] = camPos; - m_avecReflectionsPos[0].y += 50.f; - if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[0], colpoint, ent, true, false, false, true, false, true, true)) - m_afReflectionsDistances[0] = Distance(camPos, colpoint.point); - else - m_afReflectionsDistances[0] = 50.0f; - } else if ((m_FrameCounter + 1) % 8 == 0) { - m_avecReflectionsPos[1] = camPos; - m_avecReflectionsPos[1].y -= 50.0f; - if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[1], colpoint, ent, true, false, false, true, false, true, true)) - m_afReflectionsDistances[1] = Distance(camPos, colpoint.point); - else - m_afReflectionsDistances[1] = 50.0f; - } else if ((m_FrameCounter + 2) % 8 == 0) { - m_avecReflectionsPos[2] = camPos; - m_avecReflectionsPos[2].x -= 50.0f; - if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[2], colpoint, ent, true, false, false, true, false, true, true)) - m_afReflectionsDistances[2] = Distance(camPos, colpoint.point); - else - m_afReflectionsDistances[2] = 50.0f; - } else if ((m_FrameCounter + 3) % 8 == 0) { - m_avecReflectionsPos[3] = camPos; - m_avecReflectionsPos[3].x += 50.0f; - if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[3], colpoint, ent, true, false, false, true, false, true, true)) - m_afReflectionsDistances[3] = Distance(camPos, colpoint.point); - else - m_afReflectionsDistances[3] = 50.0f; - } else if ((m_FrameCounter + 4) % 8 == 0) { - m_avecReflectionsPos[4] = camPos; - m_avecReflectionsPos[4].z += 50.0f; - if (CWorld::ProcessVerticalLine(camPos, m_avecReflectionsPos[4].z, colpoint, ent, true, false, false, false, true, false, nil)) - m_afReflectionsDistances[4] = colpoint.point.z - camPos.z; - else - m_afReflectionsDistances[4] = 50.0f; - } -} - -bool -cAudioManager::UsesReverseWarning(int32 model) const -{ - return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS || model == COACH; -} - -bool -cAudioManager::UsesSiren(int32 model) const -{ - switch (model) { - case FIRETRUK: - case AMBULAN: - case FBICAR: - case POLICE: - case ENFORCER: - case PREDATOR: - return true; - default: - return false; - } -} - -bool -cAudioManager::UsesSirenSwitching(int32 model) const +cAudioManager::GenerateIntegerRandomNumberTable() { - switch (model) { - case AMBULAN: - case POLICE: - case ENFORCER: - case PREDATOR: - return true; - default: - return false; + for (int32 i = 0; i < ARRAY_SIZE(m_anRandomTable); i++) { + m_anRandomTable[i] = rand(); } } +#ifdef GTA_PC void cAudioManager::AdjustSamplesVolume() { @@ -9790,3 +967,4 @@ cAudioManager::ComputeEmittingVolume(uint8 emittingVolume, float intensity, floa return (quatIntensity - (dist - diffIntensity)) * (float)emittingVolume / quatIntensity; return emittingVolume; } +#endif diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index bbbc84bd..b2b44c07 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -75,7 +75,18 @@ public: uint8 m_nCommentsInBank[NUM_PED_COMMENTS_BANKS]; uint8 m_nActiveBank; - cPedComments(); + cPedComments() + { + for (int i = 0; i < NUM_PED_COMMENTS_SLOTS; i++) + for (int j = 0; j < NUM_PED_COMMENTS_BANKS; j++) { + m_asPedComments[j][i].m_nProcess = -1; + m_nIndexMap[j][i] = NUM_PED_COMMENTS_SLOTS; + } + + for (int i = 0; i < NUM_PED_COMMENTS_BANKS; i++) + m_nCommentsInBank[i] = 0; + m_nActiveBank = 0; + } void Add(tPedComment *com); void Process(); }; @@ -222,11 +233,10 @@ public: float speedMultiplier) const; int32 ComputePan(float, CVector *); uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const; - int32 CreateEntity(int32 type, void *entity); + int32 CreateEntity(eAudioType type, void *entity); void DestroyAllGameCreatedEntities(); void DestroyEntity(int32 id); - void DoJumboVolOffset() const; void DoPoliceRadioCrackle(); // functions returning talk sfx, @@ -434,14 +444,14 @@ public: void ServiceSoundEffects(); int8 SetCurrent3DProvider(uint8 which); void SetDynamicAcousticModelingStatus(bool status); - void SetEffectsFadeVolume(uint8 volume) const; + void SetEffectsFadeVol(uint8 volume) const; void SetEffectsMasterVolume(uint8 volume) const; void SetEntityStatus(int32 id, uint8 status); uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision); void SetMissionAudioLocation(float x, float y, float z); void SetMissionScriptPoliceAudio(int32 sfx) const; void SetMonoMode(uint8); // todo (mobile) - void SetMusicFadeVolume(uint8 volume) const; + void SetMusicFadeVol(uint8 volume) const; void SetMusicMasterVolume(uint8 volume) const; void SetSpeakerConfig(int32 conf) const; void SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter); @@ -464,9 +474,11 @@ public: bool UsesSiren(int32 model) const; bool UsesSirenSwitching(int32 model) const; +#ifdef GTA_PC // only used in pc void AdjustSamplesVolume(); uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist); +#endif }; #ifdef AUDIO_MSS diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp index 888081b7..18d13c9d 100644 --- a/src/audio/DMAudio.cpp +++ b/src/audio/DMAudio.cpp @@ -29,7 +29,7 @@ cDMAudio::Service(void) } int32 -cDMAudio::CreateEntity(int32 type, void *UID) +cDMAudio::CreateEntity(eAudioType type, void *UID) { return AudioManager.CreateEntity(type, (CPhysical *)UID); } @@ -82,7 +82,7 @@ cDMAudio::SetEffectsFadeVol(uint8 volume) uint8 vol = volume; if ( vol > MAX_VOLUME ) vol = MAX_VOLUME; - AudioManager.SetEffectsFadeVolume(vol); + AudioManager.SetEffectsFadeVol(vol); } void @@ -91,7 +91,7 @@ cDMAudio::SetMusicFadeVol(uint8 volume) uint8 vol = volume; if ( vol > MAX_VOLUME ) vol = MAX_VOLUME; - AudioManager.SetMusicFadeVolume(vol); + AudioManager.SetMusicFadeVol(vol); } uint8 diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h index 052fdb81..e1a18830 100644 --- a/src/audio/DMAudio.h +++ b/src/audio/DMAudio.h @@ -20,7 +20,7 @@ public: void Terminate(void); void Service(void); - int32 CreateEntity(int32 type, void *UID); + int32 CreateEntity(eAudioType type, void *UID); void DestroyEntity(int32 audioEntity); void SetEntityStatus(int32 audioEntity, uint8 status); void PlayOneShot(int32 audioEntity, uint16 oneShot, float volume); From 4ff0697b4d29144e6dfad4ca14a98aa1bce5bf5e Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 16 May 2020 21:00:27 +0300 Subject: [PATCH 007/133] More small audio fixes --- src/audio/AudioLogic.cpp | 13 ++++++------- src/audio/AudioManager.cpp | 14 +++++++------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 05483617..2a6581ee 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -1304,7 +1304,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050; SampleManager.SetChannelFrequency(m_nActiveSamples, freq); if (!channelUsed) { - SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != 0); + SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != false); SampleManager.StartChannel(m_nActiveSamples); } LastAccel = accelerateState; @@ -1326,7 +1326,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * freq /= 2; SampleManager.SetChannelFrequency(m_nActiveSamples, freq); if (!channelUsed) { - SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != 0); + SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != false); SampleManager.StartChannel(m_nActiveSamples); } LastAccel = accelerateState; @@ -1349,7 +1349,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * freq /= 2; SampleManager.SetChannelFrequency(m_nActiveSamples, freq); if (!channelUsed) { - SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != 0); + SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != false); SampleManager.StartChannel(m_nActiveSamples); } LastAccel = accelerateState; @@ -1515,11 +1515,10 @@ cAudioManager::GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automo { float relativeVelChange; - if (automobile->m_aWheelState[wheel] == 2) { + if (automobile->m_aWheelState[wheel] == WHEEL_STATE_SKIDDING) relativeVelChange = Min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity); - } else { + else relativeVelChange = 0.0f; - } return Max(relativeVelChange, Min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f)); } @@ -1606,7 +1605,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params) if (params->m_fDistance < SQR(SOUND_INTENSITY)) { CVehicle *veh = params->m_pVehicle; - if (veh->m_bSirenOrAlarm == 0 && veh->m_nAlarmState <= 0) + if (veh->m_bSirenOrAlarm == false && veh->m_nAlarmState <= 0) return; #ifdef FIX_BUGS diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index eecc8e7d..458341b9 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -32,7 +32,7 @@ cAudioManager::cAudioManager() ClearActiveSamples(); GenerateIntegerRandomNumberTable(); field_4 = 0; - m_bDynamicAcousticModelingStatus = 1; + m_bDynamicAcousticModelingStatus = true; for (int i = 0; i < NUM_AUDIOENTITIES; i++) { m_asAudioEntities[i].m_bIsUsed = false; @@ -514,19 +514,19 @@ cAudioManager::RandomDisplacement(uint32 seed) const { int32 value; - static bool bIsEven = true; - static uint32 base = 0; + static bool bPos = true; + static uint32 Adjustment = 0; if (!seed) return 0; - value = m_anRandomTable[(base + seed) % 5] % seed; - base += value; + value = m_anRandomTable[(Adjustment + seed) % 5] % seed; + Adjustment += value; if (value % 2) { - bIsEven = !bIsEven; + bPos = !bPos; } - if (!bIsEven) + if (!bPos) value = -value; return value; } From ad0b99231e31c5374a822a3f2173958f6a0ce517 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 16 May 2020 23:54:44 +0300 Subject: [PATCH 008/133] Remove magic consts from ms_aAnimAssocDefinitions --- src/animation/AnimManager.cpp | 53 ++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/src/animation/AnimManager.cpp b/src/animation/AnimManager.cpp index 8fb1576c..444b6d45 100644 --- a/src/animation/AnimManager.cpp +++ b/src/animation/AnimManager.cpp @@ -530,33 +530,36 @@ char const *aRocketStrafeRightAnimations[] = { "idle_rocket", "walkst_rocket_right", }; + +#define awc(a) ARRAY_SIZE(a), a const AnimAssocDefinition CAnimManager::ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_GROUPS] = { - { "man", "ped", MI_COP, 173, aStdAnimations, aStdAnimDescs }, - { "player", "ped", MI_COP, 5, aPlayerAnimations, aStdAnimDescs }, - { "playerrocket", "ped", MI_COP, 5, aPlayerWithRocketAnimations, aStdAnimDescs }, - { "player1armed", "ped", MI_COP, 5, aPlayer1ArmedAnimations, aStdAnimDescs }, - { "player2armed", "ped", MI_COP, 5, aPlayer2ArmedAnimations, aStdAnimDescs }, - { "playerBBBat", "ped", MI_COP, 5, aPlayerBBBatAnimations, aStdAnimDescs }, - { "shuffle", "ped", MI_COP, 4, aShuffleAnimations, aStdAnimDescs }, - { "oldman", "ped", MI_COP, 4, aOldAnimations, aStdAnimDescs }, - { "gang1", "ped", MI_COP, 4, aGang1Animations, aStdAnimDescs }, - { "gang2", "ped", MI_COP, 4, aGang2Animations, aStdAnimDescs }, - { "fatman", "ped", MI_COP, 4, aFatAnimations, aStdAnimDescs }, - { "oldfatman", "ped", MI_COP, 4, aOldFatAnimations, aStdAnimDescs }, - { "woman", "ped", MI_COP, 4, aStdWomanAnimations, aStdAnimDescs }, - { "shopping", "ped", MI_COP, 4, aWomanShopAnimations, aStdAnimDescs }, - { "busywoman", "ped", MI_COP, 4, aBusyWomanAnimations, aStdAnimDescs }, - { "sexywoman", "ped", MI_COP, 4, aSexyWomanAnimations, aStdAnimDescs }, - { "oldwoman", "ped", MI_COP, 4, aOldWomanAnimations, aStdAnimDescs }, - { "fatwoman", "ped", MI_COP, 4, aFatWomanAnimations, aStdAnimDescs }, - { "panicchunky", "ped", MI_COP, 4, aPanicChunkyAnimations, aStdAnimDescs }, - { "playerback", "ped", MI_COP, 5, aPlayerStrafeBackAnimations, aStdAnimDescs }, - { "playerleft", "ped", MI_COP, 5, aPlayerStrafeLeftAnimations, aStdAnimDescsSide }, - { "playerright", "ped", MI_COP, 5, aPlayerStrafeRightAnimations, aStdAnimDescsSide }, - { "rocketback", "ped", MI_COP, 5, aRocketStrafeBackAnimations, aStdAnimDescs }, - { "rocketleft", "ped", MI_COP, 5, aRocketStrafeLeftAnimations, aStdAnimDescsSide }, - { "rocketright", "ped", MI_COP, 5, aRocketStrafeRightAnimations, aStdAnimDescsSide }, + { "man", "ped", MI_COP, awc(aStdAnimations), aStdAnimDescs }, + { "player", "ped", MI_COP, awc(aPlayerAnimations), aStdAnimDescs }, + { "playerrocket", "ped", MI_COP, awc(aPlayerWithRocketAnimations), aStdAnimDescs }, + { "player1armed", "ped", MI_COP, awc(aPlayer1ArmedAnimations), aStdAnimDescs }, + { "player2armed", "ped", MI_COP, awc(aPlayer2ArmedAnimations), aStdAnimDescs }, + { "playerBBBat", "ped", MI_COP, awc(aPlayerBBBatAnimations), aStdAnimDescs }, + { "shuffle", "ped", MI_COP, awc(aShuffleAnimations), aStdAnimDescs }, + { "oldman", "ped", MI_COP, awc(aOldAnimations), aStdAnimDescs }, + { "gang1", "ped", MI_COP, awc(aGang1Animations), aStdAnimDescs }, + { "gang2", "ped", MI_COP, awc(aGang2Animations), aStdAnimDescs }, + { "fatman", "ped", MI_COP, awc(aFatAnimations), aStdAnimDescs }, + { "oldfatman", "ped", MI_COP, awc(aOldFatAnimations), aStdAnimDescs }, + { "woman", "ped", MI_COP, awc(aStdWomanAnimations), aStdAnimDescs }, + { "shopping", "ped", MI_COP, awc(aWomanShopAnimations), aStdAnimDescs }, + { "busywoman", "ped", MI_COP, awc(aBusyWomanAnimations), aStdAnimDescs }, + { "sexywoman", "ped", MI_COP, awc(aSexyWomanAnimations), aStdAnimDescs }, + { "oldwoman", "ped", MI_COP, awc(aOldWomanAnimations), aStdAnimDescs }, + { "fatwoman", "ped", MI_COP, awc(aFatWomanAnimations), aStdAnimDescs }, + { "panicchunky", "ped", MI_COP, awc(aPanicChunkyAnimations), aStdAnimDescs }, + { "playerback", "ped", MI_COP, awc(aPlayerStrafeBackAnimations), aStdAnimDescs }, + { "playerleft", "ped", MI_COP, awc(aPlayerStrafeLeftAnimations), aStdAnimDescsSide }, + { "playerright", "ped", MI_COP, awc(aPlayerStrafeRightAnimations), aStdAnimDescsSide }, + { "rocketback", "ped", MI_COP, awc(aRocketStrafeBackAnimations), aStdAnimDescs }, + { "rocketleft", "ped", MI_COP, awc(aRocketStrafeLeftAnimations), aStdAnimDescsSide }, + { "rocketright", "ped", MI_COP, awc(aRocketStrafeRightAnimations), aStdAnimDescsSide }, }; +#undef awc void CAnimManager::Initialise(void) From 72ccf9a0db8a1429da7a0da041f97b993cfc3622 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 17 May 2020 14:21:09 +0200 Subject: [PATCH 009/133] revert accidental commit; also update librw --- librw | 2 +- src/control/Script.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/librw b/librw index 661feeab..3971dda0 160000 --- a/librw +++ b/librw @@ -1 +1 @@ -Subproject commit 661feeabf4a4f0a8b0bee23b53ba557a14352d00 +Subproject commit 3971dda001cba9c7dc67e86bc0b54a2c7568578f diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 631ca436..357436c6 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -506,7 +506,7 @@ void CRunningScript::Init() #ifdef USE_DEBUG_SCRIPT_LOADER int open_script() { - static int scriptToLoad = 1; + static int scriptToLoad = 0; #ifdef _WIN32 if (GetAsyncKeyState('G') & 0x8000) From 964acba08382cd0748cd46f4676a7b4e9025957a Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 17 May 2020 15:16:12 +0200 Subject: [PATCH 010/133] fix head/hand atomics --- src/modelinfo/PedModelInfo.cpp | 3 +++ src/modelinfo/PedModelInfo.h | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/modelinfo/PedModelInfo.cpp b/src/modelinfo/PedModelInfo.cpp index 0cb0fc36..473e8b63 100644 --- a/src/modelinfo/PedModelInfo.cpp +++ b/src/modelinfo/PedModelInfo.cpp @@ -21,16 +21,19 @@ CPedModelInfo::DeleteRwObject(void) frame = RpAtomicGetFrame(m_head); RpAtomicDestroy(m_head); RwFrameDestroy(frame); + m_head = nil; } if(m_lhand){ frame = RpAtomicGetFrame(m_lhand); RpAtomicDestroy(m_lhand); RwFrameDestroy(frame); + m_lhand = nil; } if(m_rhand){ frame = RpAtomicGetFrame(m_rhand); RpAtomicDestroy(m_rhand); RwFrameDestroy(frame); + m_rhand = nil; } #endif CClumpModelInfo::DeleteRwObject(); // PC calls this first diff --git a/src/modelinfo/PedModelInfo.h b/src/modelinfo/PedModelInfo.h index 52f75894..d73d3646 100644 --- a/src/modelinfo/PedModelInfo.h +++ b/src/modelinfo/PedModelInfo.h @@ -36,7 +36,14 @@ public: static RwObjectNameIdAssocation m_pPedIds[PED_NODE_MAX]; - CPedModelInfo(void) : CClumpModelInfo(MITYPE_PED) { m_hitColModel = nil; } + CPedModelInfo(void) : CClumpModelInfo(MITYPE_PED) { + m_hitColModel = nil; +#ifdef PED_SKIN + m_head = nil; + m_lhand = nil; + m_rhand = nil; +#endif + } ~CPedModelInfo(void) { delete m_hitColModel; } void DeleteRwObject(void); void SetClump(RpClump *); From 4ab49780b52a78da981136f849862d3bb2b0e577 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 17 May 2020 15:33:44 +0200 Subject: [PATCH 011/133] collect HUD colors at top of file --- src/render/Hud.cpp | 62 ++++++++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 21 deletions(-) diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index c3fcb7bf..8c7904ef 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -21,6 +21,26 @@ #include "User.h" #include "World.h" +// Game has colors inlined in code. +// For easier modification we collect them here: +CRGBA MONEY_COLOR(89, 115, 150, 255); +CRGBA AMMO_COLOR(0, 0, 0, 255); +CRGBA HEALTH_COLOR(186, 101, 50, 255); +CRGBA ARMOUR_COLOR(124, 140, 95, 255); +CRGBA WANTED_COLOR(193, 164, 120, 255); +CRGBA ZONE_COLOR(152, 154, 82, 255); +CRGBA VEHICLE_COLOR(194, 165, 120, 255); +CRGBA CLOCK_COLOR(194, 165, 120, 255); +CRGBA TIMER_COLOR(186, 101, 50, 255); +CRGBA COUNTER_COLOR(0, 106, 164, 255); +CRGBA PAGER_COLOR(32, 162, 66, 205); +CRGBA RADARDISC_COLOR(0, 0, 0, 255); +CRGBA BIGMESSAGE_COLOR(85, 119, 133, 255); +CRGBA WASTEDBUSTED_COLOR(170, 123, 87, 255); +CRGBA ODDJOB_COLOR(89, 115, 150, 255); +CRGBA ODDJOB2_COLOR(156, 91, 40, 255); +CRGBA MISSIONTITLE_COLOR(220, 172, 2, 255); + wchar CHud::m_HelpMessage[256]; wchar CHud::m_LastHelpMessage[256]; uint32 CHud::m_HelpMessageState; @@ -252,7 +272,7 @@ void CHud::Draw() CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f - 2.0f), SCREEN_SCALE_Y(43.0f + 2.0f), sPrint); - CFont::SetColor(CRGBA(89, 115, 150, 255)); + CFont::SetColor(MONEY_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(43.0f), sPrint); /* @@ -312,7 +332,7 @@ void CHud::Draw() CFont::SetFontStyle(FONT_BANK); if (!CDarkel::FrenzyOnGoing() && WeaponType != WEAPONTYPE_UNARMED && WeaponType != WEAPONTYPE_BASEBALLBAT) { - CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::SetColor(AMMO_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(66.0f), SCREEN_SCALE_Y(73.0f), sPrint); } @@ -349,7 +369,7 @@ void CHud::Draw() if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) { CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(164.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrintIcon); } - CFont::SetColor(CRGBA(186, 101, 50, 255)); + CFont::SetColor(HEALTH_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(65.0f), sPrint); @@ -380,7 +400,7 @@ void CHud::Draw() CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(234.0f - 2.0f), SCREEN_SCALE_Y(65.0f + 2.0f), sPrintIcon); } - CFont::SetColor(CRGBA(124, 140, 95, 255)); + CFont::SetColor(ARMOUR_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f), SCREEN_SCALE_Y(65.0f), sPrint); @@ -410,7 +430,7 @@ void CHud::Draw() && (CTimer::GetTimeInMilliseconds() > FindPlayerPed()->m_pWanted->m_nLastWantedLevelChange + 2000 || CTimer::GetFrameCounter() & 4)) { - CFont::SetColor(CRGBA(193, 164, 120, 255)); + CFont::SetColor(WANTED_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(60.0f + 24.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon); } } @@ -504,7 +524,7 @@ void CHud::Draw() CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f) + SCREEN_SCALE_Y(1.0f), m_ZoneToPrint); - CFont::SetColor(CRGBA(152, 154, 82, fZoneAlpha)); + CFont::SetColor(CRGBA(ZONE_COLOR.r, ZONE_COLOR.g, ZONE_COLOR.b, fZoneAlpha)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f), m_ZoneToPrint); } } @@ -598,7 +618,7 @@ void CHud::Draw() CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f) + SCREEN_SCALE_Y(1.0f), m_pVehicleNameToPrint); - CFont::SetColor(CRGBA(194, 165, 120, fVehicleAlpha)); + CFont::SetColor(CRGBA(VEHICLE_COLOR.r, VEHICLE_COLOR.g, VEHICLE_COLOR.b, fVehicleAlpha)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f), m_pVehicleNameToPrint); } } @@ -630,7 +650,7 @@ void CHud::Draw() CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(22.0f) + SCREEN_SCALE_Y(2.0f), sPrint); - CFont::SetColor(CRGBA(194, 165, 120, 255)); + CFont::SetColor(CLOCK_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f), SCREEN_SCALE_Y(22.0f), sPrint); /* @@ -674,7 +694,7 @@ void CHud::Draw() CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(110.0f) + SCREEN_SCALE_Y(2.0f), sTimer); CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); - CFont::SetColor(CRGBA(186, 101, 50, 255)); + CFont::SetColor(TIMER_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET), SCREEN_SCALE_Y(110.0f), sTimer); if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText[0]) { @@ -683,7 +703,7 @@ void CHud::Draw() CFont::SetScale(SCREEN_SCALE_X(0.64f), SCREEN_SCALE_Y(1.35f)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(80.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(110.0f) + SCREEN_SCALE_Y(2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); - CFont::SetColor(CRGBA(186, 101, 50, 255)); + CFont::SetColor(TIMER_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(80.0f), SCREEN_SCALE_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); } } @@ -718,7 +738,7 @@ void CHud::Draw() CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(2.0f), sTimer); - CFont::SetColor(CRGBA(0, 106, 164, 255)); + CFont::SetColor(COUNTER_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET), SCREEN_SCALE_Y(132.0f), sTimer); } else { int counter = atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer); @@ -735,7 +755,7 @@ void CHud::Draw() CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(61.0f) + SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); - CFont::SetColor(CRGBA(0, 106, 164, 255)); + CFont::SetColor(COUNTER_COLOR); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(61.0f), SCREEN_SCALE_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); } } @@ -782,7 +802,7 @@ void CHud::Draw() CFont::SetBackgroundOff(); CFont::SetScale(SCREEN_SCALE_X(0.84f), SCREEN_SCALE_Y(1.0f)); - CFont::SetColor(CRGBA(32, 162, 66, 205)); + CFont::SetColor(PAGER_COLOR); CFont::SetRightJustifyOff(); CFont::SetBackgroundOff(); CFont::SetCentreOff(); @@ -804,7 +824,7 @@ void CHud::Draw() rect.Translate(RADAR_LEFT, SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); #endif rect.Grow(4.0f); - Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255)); + Sprites[HUD_RADARDISC].Draw(rect, RADARDISC_COLOR); CRadar::DrawBlips(); } } @@ -959,7 +979,7 @@ void CHud::Draw() CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[0]); #endif - CFont::SetColor(CRGBA(85, 119, 133, BigMessageAlpha[0])); + CFont::SetColor(CRGBA(BIGMESSAGE_COLOR.r, BIGMESSAGE_COLOR.g, BIGMESSAGE_COLOR.b, BigMessageAlpha[0])); CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(18.0f), m_BigMessage[0]); } else { @@ -994,7 +1014,7 @@ void CHud::Draw() CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[2])); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f - 4.0f), SCREEN_SCALE_FROM_BOTTOM(78.0f), m_BigMessage[2]); - CFont::SetColor(CRGBA(170, 123, 87, BigMessageAlpha[2])); + CFont::SetColor(CRGBA(WASTEDBUSTED_COLOR.r, WASTEDBUSTED_COLOR.g, WASTEDBUSTED_COLOR.b, BigMessageAlpha[2])); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(82.0f), m_BigMessage[2]); } else { @@ -1186,7 +1206,7 @@ void CHud::DrawAfterFade() CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[3]); - CFont::SetColor(CRGBA(89, 115, 150, 255)); + CFont::SetColor(ODDJOB_COLOR); CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f), m_BigMessage[3]); } @@ -1202,7 +1222,7 @@ void CHud::DrawAfterFade() CFont::PrintString((SCREEN_WIDTH / 2) - SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) - SCREEN_SCALE_Y(2.0f), m_BigMessage[4]); - CFont::SetColor(CRGBA(89, 115, 150, 255)); + CFont::SetColor(ODDJOB_COLOR); CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f), m_BigMessage[4]); } @@ -1260,12 +1280,12 @@ void CHud::DrawAfterFade() #ifdef BETA_SLIDING_TEXT CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f) - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]); - CFont::SetColor(CRGBA(156, 91, 40, 255)); + CFont::SetColor(ODDJOB2_COLOR); CFont::PrintString(SCREEN_WIDTH / 2 - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f), m_BigMessage[5]); #else CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]); - CFont::SetColor(CRGBA(156, 91, 40, 255)); + CFont::SetColor(ODDJOB2_COLOR); CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f), m_BigMessage[5]); #endif } @@ -1310,7 +1330,7 @@ void CHud::DrawAfterFade() CFont::SetColor(CRGBA(40, 40, 40, BigMessageAlpha[1])); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[1]); - CFont::SetColor(CRGBA(220, 172, 2, BigMessageAlpha[1])); + CFont::SetColor(CRGBA(MISSIONTITLE_COLOR.r, MISSIONTITLE_COLOR.g, MISSIONTITLE_COLOR.b, BigMessageAlpha[1])); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), m_BigMessage[1]); } else { From d4a429d986908a36618fc58b52db87d5752fde20 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 17 May 2020 22:24:23 +0200 Subject: [PATCH 012/133] little cleanup on radar --- src/core/Radar.h | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/core/Radar.h b/src/core/Radar.h index 7d07671d..ec2bacd0 100644 --- a/src/core/Radar.h +++ b/src/core/Radar.h @@ -26,27 +26,27 @@ enum eRadarSprite RADAR_SPRITE_COORD_BLIP = -1, #endif RADAR_SPRITE_NONE = 0, - RADAR_SPRITE_ASUKA = 1, - RADAR_SPRITE_BOMB = 2, - RADAR_SPRITE_CAT = 3, - RADAR_SPRITE_CENTRE = 4, - RADAR_SPRITE_COPCAR = 5, - RADAR_SPRITE_DON = 6, - RADAR_SPRITE_EIGHT = 7, - RADAR_SPRITE_EL = 8, - RADAR_SPRITE_ICE = 9, - RADAR_SPRITE_JOEY = 10, - RADAR_SPRITE_KENJI = 11, - RADAR_SPRITE_LIZ = 12, - RADAR_SPRITE_LUIGI = 13, - RADAR_SPRITE_NORTH = 14, - RADAR_SPRITE_RAY = 15, - RADAR_SPRITE_SAL = 16, - RADAR_SPRITE_SAVE = 17, - RADAR_SPRITE_SPRAY = 18, - RADAR_SPRITE_TONY = 19, - RADAR_SPRITE_WEAPON = 20, - RADAR_SPRITE_COUNT = 21, + RADAR_SPRITE_ASUKA, + RADAR_SPRITE_BOMB, + RADAR_SPRITE_CAT, + RADAR_SPRITE_CENTRE, + RADAR_SPRITE_COPCAR, + RADAR_SPRITE_DON, + RADAR_SPRITE_EIGHT, + RADAR_SPRITE_EL, + RADAR_SPRITE_ICE, + RADAR_SPRITE_JOEY, + RADAR_SPRITE_KENJI, + RADAR_SPRITE_LIZ, + RADAR_SPRITE_LUIGI, + RADAR_SPRITE_NORTH, + RADAR_SPRITE_RAY, + RADAR_SPRITE_SAL, + RADAR_SPRITE_SAVE, + RADAR_SPRITE_SPRAY, + RADAR_SPRITE_TONY, + RADAR_SPRITE_WEAPON, + RADAR_SPRITE_COUNT }; enum @@ -104,7 +104,7 @@ public: static CSprite2d SpraySprite; static CSprite2d TonySprite; static CSprite2d WeaponSprite; - static CSprite2d *RadarSprites[21]; + static CSprite2d *RadarSprites[RADAR_SPRITE_COUNT]; static float cachedCos; static float cachedSin; #ifdef MENU_MAP From 9b09aa3384213dab45db023d95487096e64ad5c6 Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 18 May 2020 16:40:30 +0200 Subject: [PATCH 013/133] fixes for braking and cloud rotation at high fps --- src/render/Clouds.cpp | 5 +++++ src/vehicles/Vehicle.cpp | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp index 9c0fde0f..60450213 100644 --- a/src/render/Clouds.cpp +++ b/src/render/Clouds.cpp @@ -69,8 +69,13 @@ void CClouds::Update(void) { float s = Sin(TheCamera.Orientation - 0.85f); +#ifdef FIX_BUGS + CloudRotation += CWeather::Wind*s*0.0025f*CTimer::GetTimeStepFix(); + IndividualRotation += (CWeather::Wind*CTimer::GetTimeStep() + 0.3f*CTimer::GetTimeStepFix()) * 60.0f; +#else CloudRotation += CWeather::Wind*s*0.0025f; IndividualRotation += (CWeather::Wind*CTimer::GetTimeStep() + 0.3f) * 60.0f; +#endif } void diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 5dc7bc72..f85f0d50 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -514,6 +514,9 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon brake = 0.2f * mod_HandlingManager.field_4 / m_fMass; else brake = mod_HandlingManager.field_4 / m_fMass; +#ifdef FIX_BUGS + brake *= CTimer::GetTimeStepFix(); +#endif } } From 2588e69849c3a0e4d8c234a3a0e425fceb973d97 Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 18 May 2020 16:55:38 +0200 Subject: [PATCH 014/133] some less certainly fps fixes --- src/vehicles/Automobile.cpp | 6 ++++++ src/vehicles/Vehicle.cpp | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 83fe44d5..2212ddff 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -871,8 +871,14 @@ CAutomobile::ProcessControl(void) CVector wheelFwd = GetForward(); CVector wheelRight = GetRight(); +#ifdef FIX_BUGS + // Not sure if this is needed, but brake usually has timestep as a factor + if(bIsHandbrakeOn) + brake = 20000.0f * CTimer::GetTimeStepFix(); +#else if(bIsHandbrakeOn) brake = 20000.0f; +#endif if(m_aWheelTimer[CARWHEEL_REAR_LEFT] > 0.0f){ if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier)) diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index f85f0d50..6646f7f3 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -487,6 +487,11 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon if(contactSpeedRight != 0.0f){ // exert opposing force right = -contactSpeedRight/wheelsOnGround; +#ifdef FIX_BUGS + // contactSpeedRight is independent of framerate but right has timestep as a factor + // so we probably have to fix this + right *= CTimer::GetTimeStepFix(); +#endif if(wheelStatus == WHEEL_STATUS_BURST){ float fwdspeed = Min(contactSpeedFwd, 0.3f); @@ -507,6 +512,11 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon } }else if(contactSpeedFwd != 0.0f){ fwd = -contactSpeedFwd/wheelsOnGround; +#ifdef FIX_BUGS + // contactSpeedFwd is independent of framerate but fwd has timestep as a factor + // so we probably have to fix this + fwd *= CTimer::GetTimeStepFix(); +#endif if(!bBraking){ if(m_fGasPedal < 0.01f){ From e891cf858f7d2a7c5bbb4ff46400508ffbe3c8b9 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Mon, 18 May 2020 20:17:24 +0300 Subject: [PATCH 015/133] Remove MAX_VOLUME dups --- src/audio/AudioLogic.cpp | 133 ++++++++++++++++++------------------- src/audio/AudioManager.cpp | 5 +- src/audio/MusicManager.cpp | 6 +- src/audio/PoliceRadio.cpp | 3 +- 4 files changed, 71 insertions(+), 76 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 2a6581ee..6f1a3432 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -41,7 +41,6 @@ const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); const int policeChannel = channels + 1; const int allChannels = channels + 2; -const int maxVolume = 127; uint32 gPornNextTime; uint32 gSawMillNextTime; @@ -207,8 +206,8 @@ cAudioManager::ProcessSpecial() if (m_nUserPause) { if (!m_nPreviousUserPause) { MusicManager.ChangeMusicMode(MUSICMODE_FRONTEND); - SampleManager.SetEffectsFadeVolume(maxVolume); - SampleManager.SetMusicFadeVolume(maxVolume); + SampleManager.SetEffectsFadeVolume(MAX_VOLUME); + SampleManager.SetMusicFadeVolume(MAX_VOLUME); } } else { if (m_nPreviousUserPause) { @@ -2566,7 +2565,7 @@ cAudioManager::ProcessHelicopter(cVehicleParams *params) float dist; float baseDist; int32 emittingVol; - static const tHelicopterSampleData gHeliSfxRanges[3] = {{400.f, 380.f, 100}, {100.f, 70.f, maxVolume}, {60.f, 30.f, maxVolume}}; + static const tHelicopterSampleData gHeliSfxRanges[3] = {{400.f, 380.f, 100}, {100.f, 70.f, MAX_VOLUME}, {60.f, 30.f, MAX_VOLUME}}; if (gHeliSfxRanges[0].m_fMaxDistance * gHeliSfxRanges[0].m_fMaxDistance <= params->m_fDistance) return false; @@ -2691,15 +2690,15 @@ cAudioManager::ProcessJumboAccel(CPlane *plane) modificator = (plane->m_fSpeed - 0.10334f) * 1.676f; if (modificator > 1.0f) modificator = 1.0f; - if (SetupJumboRumbleSound(maxVolume * modificator) && SetupJumboTaxiSound((1.0f - modificator) * 75.f)) { + if (SetupJumboRumbleSound(MAX_VOLUME * modificator) && SetupJumboTaxiSound((1.0f - modificator) * 75.f)) { if (modificator < 0.2f) { whineSoundFreq = modificator * 5.f * 14600.0f + 29500; - vol = modificator * 5.f * maxVolume; + vol = modificator * 5.f * MAX_VOLUME; engineFreq = modificator * 5.f * 6050.f + 16000; } else { whineSoundFreq = 44100; engineFreq = 22050; - vol = maxVolume; + vol = MAX_VOLUME; } SetupJumboEngineSound(vol, engineFreq); SetupJumboWhineSound(18, whineSoundFreq); @@ -2712,8 +2711,8 @@ cAudioManager::ProcessJumboTakeOff(CPlane *plane) { const float modificator = (PlanePathPosition[plane->m_nPlaneId] - TakeOffPoint) / 300.f; - if (SetupJumboFlySound((107.f * modificator) + 20) && SetupJumboRumbleSound(maxVolume * (1.f - modificator))) { - if (SetupJumboEngineSound(maxVolume, 22050)) + if (SetupJumboFlySound((107.f * modificator) + 20) && SetupJumboRumbleSound(MAX_VOLUME * (1.f - modificator))) { + if (SetupJumboEngineSound(MAX_VOLUME, 22050)) SetupJumboWhineSound(18.f * (1.f - modificator), 44100); } } @@ -2721,7 +2720,7 @@ cAudioManager::ProcessJumboTakeOff(CPlane *plane) void cAudioManager::ProcessJumboFlying() { - if (SetupJumboFlySound(maxVolume)) + if (SetupJumboFlySound(MAX_VOLUME)) SetupJumboEngineSound(63, 22050); } @@ -2731,7 +2730,7 @@ cAudioManager::ProcessJumboLanding(CPlane *plane) const float modificator = (LandingPoint - PlanePathPosition[plane->m_nPlaneId]) / 350.f; if (SetupJumboFlySound(107.f * modificator + 20)) { if (SetupJumboTaxiSound(75.f * (1.f - modificator))) { - SetupJumboEngineSound(maxVolume, 22050); + SetupJumboEngineSound(MAX_VOLUME, 22050); SetupJumboWhineSound(18.f * (1.f - modificator), 14600.f * modificator + 29500); } } @@ -2742,7 +2741,7 @@ cAudioManager::ProcessJumboDecel(CPlane *plane) { if (SetupJumboFlySound(20) && SetupJumboTaxiSound(75)) { const float modificator = Min(1.f, (plane->m_fSpeed - 0.10334f) * 1.676f); - SetupJumboEngineSound(maxVolume * modificator, 6050.f * modificator + 16000); + SetupJumboEngineSound(MAX_VOLUME * modificator, 6050.f * modificator + 16000); SetupJumboWhineSound(18, 29500); } } @@ -2906,7 +2905,7 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol) m_sQueueSample.m_nCounter = 6; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE; m_sQueueSample.m_nFrequency += 200; - m_sQueueSample.m_nOffset = maxVolume; + m_sQueueSample.m_nOffset = MAX_VOLUME; AddSampleToRequestedQueue(); } return true; @@ -3795,11 +3794,11 @@ cAudioManager::SetupPedComments(cPedParams *params, uint32 sound) case SOUND_AMMUNATION_WELCOME_1: case SOUND_AMMUNATION_WELCOME_2: case SOUND_AMMUNATION_WELCOME_3: - emittingVol = maxVolume; + emittingVol = MAX_VOLUME; break; default: if (CWorld::GetIsLineOfSightClear(TheCamera.GetPosition(), m_sQueueSample.m_vecPos, true, false, false, false, false, false)) - emittingVol = maxVolume; + emittingVol = MAX_VOLUME; else emittingVol = 31; break; @@ -6265,7 +6264,7 @@ cPedComments::Process() AudioManager.m_sQueueSample.m_nLoopCount = 1; AudioManager.m_sQueueSample.m_nLoopStart = 0; AudioManager.m_sQueueSample.m_nLoopEnd = -1; - AudioManager.m_sQueueSample.m_nEmittingVolume = maxVolume; + AudioManager.m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; AudioManager.m_sQueueSample.m_fSpeedMultiplier = 3.0f; switch (sampleIndex) { case SFX_POLICE_HELI_1: @@ -6376,7 +6375,7 @@ cAudioManager::ProcessExplosions(int32 explosion) distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume) { m_sQueueSample.m_nCounter = i; m_sQueueSample.m_fSpeedMultiplier = 2.0f; @@ -6384,7 +6383,7 @@ cAudioManager::ProcessExplosions(int32 explosion) m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = true; m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_nEmittingVolume = maxVolume; + m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_bReverbFlag = true; @@ -6580,7 +6579,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_TRAIN_STATION_ANNOUNCE; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_STATION_ANNOUNCE); m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_fSpeedMultiplier = 2.0f; @@ -6777,7 +6776,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6787,7 +6786,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6797,7 +6796,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_2; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_2); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6807,7 +6806,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_2; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_2); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6817,7 +6816,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_3; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_3); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6827,7 +6826,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_3; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_3); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6837,7 +6836,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_4; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_4); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6847,7 +6846,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_4; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_4); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6857,7 +6856,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_5; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_5); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6867,7 +6866,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_5; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_5); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6877,7 +6876,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_6; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_6); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6887,7 +6886,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_6; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_6); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6897,7 +6896,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_7; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_7); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6907,7 +6906,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_7; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_7); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6917,7 +6916,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_8; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_8); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6927,7 +6926,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_8; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_8); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6937,7 +6936,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_9; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_9); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6947,7 +6946,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_9; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_9); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6957,7 +6956,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_10; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_10); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6967,7 +6966,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_10; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_10); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6977,7 +6976,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_11; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_11); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6987,7 +6986,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_11; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_11); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -6997,7 +6996,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_12; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_12); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7007,7 +7006,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_12; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_12); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7017,7 +7016,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_RAGGA; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_RAGGA); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7027,7 +7026,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_RAGGA; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_RAGGA); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7037,7 +7036,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7047,7 +7046,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7057,7 +7056,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_2); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7067,7 +7066,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_2); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7209,7 +7208,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_PIANO_BAR_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PIANO_BAR_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7219,7 +7218,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7259,7 +7258,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BALL_1); m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7269,7 +7268,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BALL_1); m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7279,7 +7278,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_INDUSTRIAL); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7289,7 +7288,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_INDUSTRIAL); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7304,7 +7303,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7315,7 +7314,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7325,7 +7324,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_SUBURBAN); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7335,7 +7334,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - emittingVolume = maxVolume; + emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_SUBURBAN); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -7429,7 +7428,7 @@ cAudioManager::ProcessPornCinema(uint8 sound) if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); if (sound != SCRIPT_SOUND_MISTY_SEX_S && sound != SCRIPT_SOUND_MISTY_SEX_L) { - m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume) { m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nCounter = 0; @@ -7438,7 +7437,7 @@ cAudioManager::ProcessPornCinema(uint8 sound) m_sQueueSample.m_bReleasingSoundFlag = false; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_nEmittingVolume = maxVolume; + m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_bReverbFlag = true; @@ -8155,7 +8154,7 @@ cAudioManager::ProcessFrontEnd() if (stereo) { ++m_sQueueSample.m_nSampleIndex; m_sQueueSample.m_nCounter = counter++; - m_sQueueSample.m_nOffset = maxVolume - m_sQueueSample.m_nOffset; + m_sQueueSample.m_nOffset = MAX_VOLUME - m_sQueueSample.m_nOffset; AddSampleToRequestedQueue(); } } @@ -8224,7 +8223,7 @@ cAudioManager::ProcessProjectiles() if (CProjectileInfo::GetProjectileInfo(i)->m_bInUse) { switch (CProjectileInfo::GetProjectileInfo(i)->m_eWeaponType) { case WEAPONTYPE_ROCKETLAUNCHER: - emittingVol = maxVolume; + emittingVol = MAX_VOLUME; m_sQueueSample.m_fSoundIntensity = rocketLauncherIntensity; m_sQueueSample.m_nSampleIndex = SFX_ROCKET_FLY; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -8498,7 +8497,7 @@ void cAudioManager::ProcessBridgeMotor() { if (m_sQueueSample.m_fDistance < bridgeIntensity) { - m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, bridgeIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, bridgeIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume) { m_sQueueSample.m_nCounter = 1; m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; // todo check sfx name @@ -8507,7 +8506,7 @@ cAudioManager::ProcessBridgeMotor() m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nFrequency = 5500; m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nEmittingVolume = maxVolume; + m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 2.0f; @@ -8540,7 +8539,7 @@ cAudioManager::ProcessBridgeOneShots() } } if (m_sQueueSample.m_fDistance < bridgeIntensity) { - m_sQueueSample.m_nVolume = ComputeVolume(maxVolume, bridgeIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, bridgeIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume) { m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -8548,7 +8547,7 @@ cAudioManager::ProcessBridgeOneShots() m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nEmittingVolume = maxVolume; + m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_fSpeedMultiplier = 2.0f; diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 458341b9..bd1ac84b 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -16,7 +16,6 @@ cAudioManager AudioManager; const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); const int policeChannel = channels + 1; const int allChannels = channels + 2; -const int maxVolume = 127; cAudioManager::cAudioManager() { @@ -548,7 +547,7 @@ cAudioManager::AddSampleToRequestedQueue() bool bReflections; if (m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) { - calculatedVolume = m_sQueueSample.m_nReleasingVolumeModificator * (maxVolume - m_sQueueSample.m_nVolume); + calculatedVolume = m_sQueueSample.m_nReleasingVolumeModificator * (MAX_VOLUME - m_sQueueSample.m_nVolume); sampleIndex = m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; if (sampleIndex >= m_nActiveSamples) { sampleIndex = m_abSampleQueueIndexTable[m_nActiveSampleQueue][m_nActiveSamples - 1]; @@ -942,7 +941,7 @@ void cAudioManager::GenerateIntegerRandomNumberTable() { for (int32 i = 0; i < ARRAY_SIZE(m_anRandomTable); i++) { - m_anRandomTable[i] = rand(); + m_anRandomTable[i] = myrand(); } } diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index fd02691e..8e8e9c24 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -21,8 +21,6 @@ int32 gNumRetunePresses; int32 gRetuneCounter; bool bHasStarted; -const int maxVolume = 127; - cMusicManager::cMusicManager() { m_bIsInitialised = false; @@ -375,7 +373,7 @@ cMusicManager::Service() if (!m_bIsInitialised || m_bDisabled) return; if (m_nMusicMode == MUSICMODE_CUTSCENE) { - SampleManager.SetStreamedVolumeAndPan(maxVolume, 63, 1, 0); + SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 0); return; } @@ -676,7 +674,7 @@ cMusicManager::PreloadCutSceneMusic(uint8 track) while (SampleManager.IsStreamPlaying(0)) SampleManager.StopStreamedFile(0); SampleManager.PreloadStreamedFile(track, 0); - SampleManager.SetStreamedVolumeAndPan(maxVolume, 63, 1, 0); + SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 0); m_nCurrentStreamedSound = track; } } diff --git a/src/audio/PoliceRadio.cpp b/src/audio/PoliceRadio.cpp index ec02368e..af346479 100644 --- a/src/audio/PoliceRadio.cpp +++ b/src/audio/PoliceRadio.cpp @@ -14,7 +14,6 @@ #include "Zones.h" #include "sampman.h" -const int maxVolume = 127; const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); const int policeChannel = channels + 1; @@ -225,7 +224,7 @@ cAudioManager::ServicePoliceRadioChannel(int32 wantedLevel) } } else if (!SampleManager.GetChannelUsedFlag(policeChannel)) { SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1); - SampleManager.SetStreamedVolumeAndPan(maxVolume, 63, 1, 1); + SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 1); SampleManager.StartPreloadedStreamedFile(1); g_nMissionAudioPlayingStatus = 1; bMissionAudioPhysicalPlayingStatus = 0; From b55ba13586ad297718a4cf84ceec7e2de88a76f5 Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Tue, 12 May 2020 15:42:53 +0200 Subject: [PATCH 016/133] Add basic linux build on travis --- .travis.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..51ef58eb --- /dev/null +++ b/.travis.yml @@ -0,0 +1,15 @@ +language: cpp +os: linux +dist: focal +matrix: + include: + - env: TARGET=release_linux-amd64-librw_gl3_glfw-oal + - env: TARGET=debug_linux-amd64-librw_gl3_glfw-oal +script: + - sudo apt-get update + - sudo apt-get -y install linux-libc-dev libopenal-dev libglew-dev libglfw3-dev libsndfile1-dev libmpg123-dev gcc-8-multilib g++-8-multilib + - mkdir -p "$TRAVIS_BUILD_DIR/build" + - cd "$TRAVIS_BUILD_DIR" + - ./premake5Linux --with-librw gmake2 + - cd build + - CC=gcc-8 CXX=g++-8 make config=$TARGET -j4 verbose=1 From 6bf79120dcd535dc6a63c4d0da858444facb0d8d Mon Sep 17 00:00:00 2001 From: shfil Date: Mon, 18 May 2020 21:08:01 +0200 Subject: [PATCH 017/133] Fix string assignment (aldlist.cpp) --- src/audio/oal/aldlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/oal/aldlist.cpp b/src/audio/oal/aldlist.cpp index 458b7c80..7401e036 100644 --- a/src/audio/oal/aldlist.cpp +++ b/src/audio/oal/aldlist.cpp @@ -73,7 +73,7 @@ ALDeviceList::ALDeviceList() if ((bNewName) && (actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) { memset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO)); ALDeviceInfo.bSelected = true; - ALDeviceInfo.strDeviceName.assign(actualDeviceName, strlen(actualDeviceName)); + ALDeviceInfo.strDeviceName = actualDeviceName; alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion); alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(int), &ALDeviceInfo.iMinorVersion); From 746f2aa47903d6aaeaa8046d8397458617460876 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Mon, 18 May 2020 22:43:06 +0300 Subject: [PATCH 018/133] script FPS fix --- src/control/Script.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 357436c6..844b1858 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -6862,7 +6862,11 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) float heading = LimitAngleOnCircle( RADTODEG(Atan2(-pObject->GetForward().x, pObject->GetForward().y))); float headingTarget = *(float*)&ScriptParams[1]; +#ifdef FIX_BUGS + float rotateBy = *(float*)&ScriptParams[2] * CTimer::GetTimeStepFix(); +#else float rotateBy = *(float*)&ScriptParams[2]; +#endif if (headingTarget == heading) { // using direct comparasion here is fine UpdateCompareFlag(true); return 0; @@ -6911,7 +6915,11 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) assert(pObject); CVector pos = pObject->GetPosition(); CVector posTarget = *(CVector*)&ScriptParams[1]; +#ifdef FIX_BUGS + CVector slideBy = *(CVector*)&ScriptParams[4] * CTimer::GetTimeStepFix(); +#else CVector slideBy = *(CVector*)&ScriptParams[4]; +#endif if (posTarget == pos) { // using direct comparasion here is fine UpdateCompareFlag(true); return 0; From c47292b518724c003a5c4b3f79e24de9fdf56f99 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Tue, 19 May 2020 00:10:45 +0300 Subject: [PATCH 019/133] script fix --- src/control/Script.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 844b1858..864799f8 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -759,6 +759,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) case COMMAND_WAIT: CollectParameters(&m_nIp, 1); m_nWakeTime = CTimer::GetTimeInMilliseconds() + ScriptParams[0]; + m_bSkipWakeTime = false; return 1; case COMMAND_GOTO: CollectParameters(&m_nIp, 1); From 0d0f4da27ad982c5281f5949c22cb62593e2aab9 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 19 May 2020 13:09:20 +0200 Subject: [PATCH 020/133] little cleanup of handlingmgr --- src/core/config.h | 2 -- src/vehicles/HandlingMgr.cpp | 2 +- src/vehicles/HandlingMgr.h | 6 ++++-- src/vehicles/Vehicle.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/config.h b/src/core/config.h index d9f892a6..40882128 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -65,8 +65,6 @@ enum Config { NUMATTRIBZONES = 288, NUMZONEINDICES = 55000, - NUMHANDLINGS = 57, - PATHNODESIZE = 4500, NUMWEATHERS = 4, diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp index 3ac0da38..5beed29e 100644 --- a/src/vehicles/HandlingMgr.cpp +++ b/src/vehicles/HandlingMgr.cpp @@ -78,7 +78,7 @@ cHandlingDataMgr::Initialise(void) { LoadHandlingData(); field_0 = 0.1f; - field_4 = 0.9f; + fWheelFriction = 0.9f; field_8 = 1.0f; field_C = 0.8f; field_10 = 0.98f; diff --git a/src/vehicles/HandlingMgr.h b/src/vehicles/HandlingMgr.h index 398a415f..10e25573 100644 --- a/src/vehicles/HandlingMgr.h +++ b/src/vehicles/HandlingMgr.h @@ -60,7 +60,9 @@ enum eHandlingId HANDLING_PANLANT, HANDLING_FLATBED, HANDLING_YANKEE, - HANDLING_BORGNINE + HANDLING_BORGNINE, + + NUMHANDLINGS }; enum @@ -120,7 +122,7 @@ class cHandlingDataMgr { float field_0; // unused it seems public: - float field_4; // wheel related + float fWheelFriction; // wheel related private: float field_8; // float field_C; // unused it seems diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 6646f7f3..0dd95faf 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -521,9 +521,9 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon if(!bBraking){ if(m_fGasPedal < 0.01f){ if(GetModelIndex() == MI_RCBANDIT) - brake = 0.2f * mod_HandlingManager.field_4 / m_fMass; + brake = 0.2f * mod_HandlingManager.fWheelFriction / m_fMass; else - brake = mod_HandlingManager.field_4 / m_fMass; + brake = mod_HandlingManager.fWheelFriction / m_fMass; #ifdef FIX_BUGS brake *= CTimer::GetTimeStepFix(); #endif From 0b0ba49abc34315f532f9adcdbc277d5275723c7 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 19 May 2020 21:42:55 +0200 Subject: [PATCH 021/133] small fixes --- src/core/World.cpp | 2 +- src/entities/Entity.cpp | 2 +- src/entities/Physical.cpp | 8 +- src/modelinfo/ModelIndices.cpp | 6 +- src/modelinfo/ModelIndices.h | 322 +++++++++++++++++---------------- src/peds/Population.cpp | 20 +- 6 files changed, 173 insertions(+), 187 deletions(-) diff --git a/src/core/World.cpp b/src/core/World.cpp index c15c134d..edcfd865 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -1823,7 +1823,7 @@ void CWorld::RepositionOneObject(CEntity *pEntity) { int16 modelId = pEntity->GetModelIndex(); - if (IsTrafficLight(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER || + if (IsStreetLight(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER || modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 || modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 || modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 || diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp index ec50dd30..683a3571 100644 --- a/src/entities/Entity.cpp +++ b/src/entities/Entity.cpp @@ -683,7 +683,7 @@ CEntity::ProcessLightsForEntity(void) lightOn = true; break; case LIGHT_FLICKER_NIGHT: - if(CClock::GetHours() > 18 || CClock::GetHours() < 7){ + if(CClock::GetHours() > 18 || CClock::GetHours() < 7 || CWeather::WetRoads > 0.5f){){ if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60) lightOn = true; else diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 64358cbf..31f8fcbc 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -1076,13 +1076,13 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists) if(B->IsBuilding()) skipShift = false; - else if(IsTrafficLight(A->GetModelIndex()) && + else if(IsStreetLight(A->GetModelIndex()) && (B->IsVehicle() || B->IsPed()) && A->GetUp().z < 0.66f) skipShift = true; else if((A->IsVehicle() || A->IsPed()) && B->GetUp().z < 0.66f && - IsTrafficLight(B->GetModelIndex())) + IsStreetLight(B->GetModelIndex())) skipShift = true; // TODO: maybe flip some ifs here else if(A->IsObject() && B->IsVehicle()){ @@ -1407,7 +1407,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists) if(B->IsBuilding()) skipCollision = false; - else if(IsTrafficLight(A->GetModelIndex()) && + else if(IsStreetLight(A->GetModelIndex()) && (B->IsVehicle() || B->IsPed()) && A->GetUp().z < 0.66f){ skipCollision = true; @@ -1415,7 +1415,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists) Aobj->m_pCollidingEntity = B; }else if((A->IsVehicle() || A->IsPed()) && B->GetUp().z < 0.66f && - IsTrafficLight(B->GetModelIndex())){ + IsStreetLight(B->GetModelIndex())){ skipCollision = true; A->bSkipLineCol = true; Bobj->m_pCollidingEntity = A; diff --git a/src/modelinfo/ModelIndices.cpp b/src/modelinfo/ModelIndices.cpp index 9a6a74d0..056c3733 100644 --- a/src/modelinfo/ModelIndices.cpp +++ b/src/modelinfo/ModelIndices.cpp @@ -3,14 +3,14 @@ #include "General.h" #include "ModelIndices.h" -#define X(name, var, addr) int16 var; +#define X(name, var) int16 var; MODELINDICES #undef X void InitModelIndices(void) { -#define X(name, var, addr) var = -1; +#define X(name, var) var = -1; MODELINDICES #undef X } @@ -18,7 +18,7 @@ InitModelIndices(void) void MatchModelString(const char *modelname, int16 id) { -#define X(name, var, addr) \ +#define X(name, var) \ if(!CGeneral::faststrcmp(name, modelname)){ \ var = id; \ return; \ diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h index cc6ed25c..c0f01929 100644 --- a/src/modelinfo/ModelIndices.h +++ b/src/modelinfo/ModelIndices.h @@ -1,164 +1,164 @@ #pragma once #define MODELINDICES \ - X("fire_hydrant", MI_FIRE_HYDRANT, 0x5F5A00) \ - X("bagelstnd02", MI_BAGELSTAND2, 0x5F59FC) \ - X("fish01", MI_FISHSTALL01, 0x5F59EC) \ - X("fishstall02", MI_FISHSTALL02, 0x5F59F0) \ - X("fishstall03", MI_FISHSTALL03, 0x5F59F4) \ - X("fishstall04", MI_FISHSTALL04, 0x5F59F8) \ - X("taxisign", MI_TAXISIGN, 0x5F59E8) \ - X("phonesign", MI_PHONESIGN, 0x5F59E4) \ - X("noparkingsign1", MI_NOPARKINGSIGN1, 0x5F59E0) \ - X("bussign1", MI_BUSSIGN1, 0x5F59DC) \ - X("roadworkbarrier1", MI_ROADWORKBARRIER1, 0x5F59D8) \ - X("dump1", MI_DUMP1, 0x5F59D4) \ - X("trafficcone", MI_TRAFFICCONE, 0x5F59D0) \ - X("newsstand1", MI_NEWSSTAND, 0x5F59CC) \ - X("postbox1", MI_POSTBOX1, 0x5F59C8) \ - X("bin1", MI_BIN, 0x5F59C4) \ - X("wastebin", MI_WASTEBIN, 0x5F59C0) \ - X("phonebooth1", MI_PHONEBOOTH1, 0x5F59BC) \ - X("parkingmeter", MI_PARKINGMETER, 0x5F59B8) \ - X("trafficlight1", MI_TRAFFICLIGHTS, 0x5F5958) \ - X("lamppost1", MI_SINGLESTREETLIGHTS1, 0x5F595C) \ - X("lamppost2", MI_SINGLESTREETLIGHTS2, 0x5F5960) \ - X("lamppost3", MI_SINGLESTREETLIGHTS3, 0x5F5964) \ - X("doublestreetlght1", MI_DOUBLESTREETLIGHTS, 0x5F5968) \ - X("rd_Road2A10", MI_ROADSFORROADBLOCKSSTART, 0x5F596C) \ - X("rd_Road1A30", MI_ROADSFORROADBLOCKSEND, 0x5F5970) \ - X("veg_tree1", MI_TREE1, 0x5F5974) \ - X("veg_tree3", MI_TREE2, 0x5F5978) \ - X("veg_treea1", MI_TREE3, 0x5F597C) \ - X("veg_treenew01", MI_TREE4, 0x5F5980) \ - X("veg_treenew05", MI_TREE5, 0x5F5984) \ - X("veg_treeb1", MI_TREE6, 0x5F5988) \ - X("veg_treenew10", MI_TREE7, 0x5F598C) \ - X("veg_treea3", MI_TREE8, 0x5F5990) \ - X("veg_treenew09", MI_TREE9, 0x5F5994) \ - X("veg_treenew08", MI_TREE10, 0x5F5998) \ - X("veg_treenew03", MI_TREE11, 0x5F599C) \ - X("veg_treenew16", MI_TREE12, 0x5F59A0) \ - X("veg_treenew17", MI_TREE13, 0x5F59A4) \ - X("veg_treenew06", MI_TREE14, 0x5F59A8) \ - X("doc_crane_cab", MODELID_CRANE_1, 0x5F59AC) \ - X("cranetopb", MODELID_CRANE_2, 0x5F59B0) \ - X("cranetopa", MODELID_CRANE_3, 0x5F59B4) \ - X("package1", MI_COLLECTABLE1, 0x5F5A04) \ - X("Money", MI_MONEY, 0x5F5A08) \ - X("barrel1", MI_CARMINE, 0x5F5A0C) \ - X("oddjgaragdoor", MI_GARAGEDOOR1, 0x5F5A10) \ - X("bombdoor", MI_GARAGEDOOR2, 0x5F5A14) \ - X("door_bombshop", MI_GARAGEDOOR3, 0x5F5A18) \ - X("vheistlocdoor", MI_GARAGEDOOR4, 0x5F5A1C) \ - X("door2_garage", MI_GARAGEDOOR5, 0x5F5A20) \ - X("ind_slidedoor", MI_GARAGEDOOR6, 0x5F5A24) \ - X("bankjobdoor", MI_GARAGEDOOR7, 0x5F5A28) \ - X("door_jmsgrage", MI_GARAGEDOOR9, 0x5F5A2C) \ - X("jamesgrge_kb", MI_GARAGEDOOR10, 0x5F5A30) \ - X("door_sfehousegrge", MI_GARAGEDOOR11, 0x5F5A34) \ - X("shedgaragedoor", MI_GARAGEDOOR12, 0x5F5A38) \ - X("door4_garage", MI_GARAGEDOOR13, 0x5F5A3C) \ - X("door_col_compnd_01", MI_GARAGEDOOR14, 0x5F5A40) \ - X("door_col_compnd_02", MI_GARAGEDOOR15, 0x5F5A44) \ - X("door_col_compnd_03", MI_GARAGEDOOR16, 0x5F5A48) \ - X("door_col_compnd_04", MI_GARAGEDOOR17, 0x5F5A4C) \ - X("door_col_compnd_05", MI_GARAGEDOOR18, 0x5F5A50) \ - X("impex_door", MI_GARAGEDOOR19, 0x5F5A54) \ - X("SalvGarage", MI_GARAGEDOOR20, 0x5F5A58) \ - X("door3_garage", MI_GARAGEDOOR21, 0x5F5A5C) \ - X("leveldoor2", MI_GARAGEDOOR22, 0x5F5A60) \ - X("double_garage_dr", MI_GARAGEDOOR23, 0x5F5A64) \ - X("amcogaragedoor", MI_GARAGEDOOR24, 0x5F5A68) \ - X("towergaragedoor1", MI_GARAGEDOOR25, 0x5F5A6C) \ - X("towergaragedoor2", MI_GARAGEDOOR26, 0x5F5A70) \ - X("towergaragedoor3", MI_GARAGEDOOR27, 0x5F5A74) \ - X("plysve_gragedoor", MI_GARAGEDOOR28, 0x5F5A78) \ - X("impexpsubgrgdoor", MI_GARAGEDOOR29, 0x5F5A7C) \ - X("Sub_sprayshopdoor", MI_GARAGEDOOR30, 0x5F5A80) \ - X("ind_plyrwoor", MI_GARAGEDOOR31, 0x5F5A84) \ - X("8ballsuburbandoor", MI_GARAGEDOOR32, 0x5F5A88) \ - X("barrel2", MI_NAUTICALMINE, 0x5F5A8C) \ - X("crushercrush", MI_CRUSHERBODY, 0x5F5A90) \ - X("crushertop", MI_CRUSHERLID, 0x5F5A94) \ - X("donkeymag", MI_DONKEYMAG, 0x5F5A98) \ - X("bullion", MI_BULLION, 0x5F5A9C) \ - X("floatpackge1", MI_FLOATPACKAGE1, 0x5F5AA0) \ - X("briefcase", MI_BRIEFCASE, 0x5F5AA4) \ - X("chinabanner1", MI_CHINABANNER1, 0x5F5AA8) \ - X("chinabanner2", MI_CHINABANNER2, 0x5F5AAC) \ - X("chinabanner3", MI_CHINABANNER3, 0x5F5AB0) \ - X("chinabanner4", MI_CHINABANNER4, 0x5F5AB4) \ - X("iten_chinatown5", MI_CHINABANNER5, 0x5F5AB8) \ - X("iten_chinatown7", MI_CHINABANNER6, 0x5F5ABC) \ - X("iten_chinatown3", MI_CHINABANNER7, 0x5F5AC0) \ - X("iten_chinatown2", MI_CHINABANNER8, 0x5F5AC4) \ - X("iten_chinatown4", MI_CHINABANNER9, 0x5F5AC8) \ - X("iten_washline01", MI_CHINABANNER10, 0x5F5ACC) \ - X("iten_washline02", MI_CHINABANNER11, 0x5F5AD0) \ - X("iten_washline03", MI_CHINABANNER12, 0x5F5AD4) \ - X("chinalanterns", MI_CHINALANTERN, 0x5F5AD8) \ - X("glassfx1", MI_GLASS1, 0x5F5ADC) \ - X("glassfx2", MI_GLASS2, 0x5F5AE0) \ - X("glassfx3", MI_GLASS3, 0x5F5AE4) \ - X("glassfx4", MI_GLASS4, 0x5F5AE8) \ - X("glassfx55", MI_GLASS5, 0x5F5AEC) \ - X("glassfxsub1", MI_GLASS6, 0x5F5AF0) \ - X("glassfxsub2", MI_GLASS7, 0x5F5AF4) \ - X("glassfx_composh", MI_GLASS8, 0x5F5AF8) \ - X("bridge_liftsec", MI_BRIDGELIFT, 0x5F5AFC) \ - X("bridge_liftweight", MI_BRIDGEWEIGHT, 0x5F5B00) \ - X("subbridge_lift", MI_BRIDGEROADSEGMENT, 0x5F5B04) \ - X("barrel4", MI_EXPLODINGBARREL, 0x5F5B08) \ - X("flagsitaly", MI_ITALYBANNER1, 0x5F5B0C) \ - X("adrenaline", MI_PICKUP_ADRENALINE, 0x5F5B10) \ - X("bodyarmour", MI_PICKUP_BODYARMOUR, 0x5F5B14) \ - X("info", MI_PICKUP_INFO, 0x5F5B18) \ - X("health", MI_PICKUP_HEALTH, 0x5F5B1C) \ - X("bonus", MI_PICKUP_BONUS, 0x5F5B20) \ - X("bribe", MI_PICKUP_BRIBE, 0x5F5B24) \ - X("killfrenzy", MI_PICKUP_KILLFRENZY, 0x5F5B28) \ - X("camerapickup", MI_PICKUP_CAMERA, 0x5F5B2C) \ - X("bollardlight", MI_BOLLARDLIGHT, 0x5F5B30) \ - X("magnet", MI_MAGNET, 0x5F5B34) \ - X("streetlamp1", MI_STREETLAMP1, 0x5F5B38) \ - X("streetlamp2", MI_STREETLAMP2, 0x5F5B3C) \ - X("railtrax_lo4b", MI_RAILTRACKS, 0x5F5B40) \ - X("bar_barrier10", MI_FENCE, 0x5F5B44) \ - X("bar_barrier12", MI_FENCE2, 0x5F5B48) \ - X("petrolpump", MI_PETROLPUMP, 0x5F5B4C) \ - X("bodycast", MI_BODYCAST, 0x5F5B50) \ - X("backdoor", MI_BACKDOOR, 0x5F5B54) \ - X("coffee", MI_COFFEE, 0x5F5B58) \ - X("bouy", MI_BUOY, 0x5F5B5C) \ - X("parktable1", MI_PARKTABLE, 0x5F5B60) \ - X("sbwy_tunl_start", MI_SUBWAY1, 0x5F5B64) \ - X("sbwy_tunl_bit", MI_SUBWAY2, 0x5F5B68) \ - X("sbwy_tunl_bend", MI_SUBWAY3, 0x5F5B6C) \ - X("sbwy_tunl_cstm6", MI_SUBWAY4, 0x5F5B70) \ - X("sbwy_tunl_cstm7", MI_SUBWAY5, 0x5F5B74) \ - X("sbwy_tunl_cstm8", MI_SUBWAY6, 0x5F5B78) \ - X("sbwy_tunl_cstm10", MI_SUBWAY7, 0x5F5B7C) \ - X("sbwy_tunl_cstm9", MI_SUBWAY8, 0x5F5B80) \ - X("sbwy_tunl_cstm11", MI_SUBWAY9, 0x5F5B84) \ - X("sbwy_tunl_cstm1", MI_SUBWAY10, 0x5F5B88) \ - X("sbwy_tunl_cstm2", MI_SUBWAY11, 0x5F5B8C) \ - X("sbwy_tunl_cstm4", MI_SUBWAY12, 0x5F5B90) \ - X("sbwy_tunl_cstm3", MI_SUBWAY13, 0x5F5B94) \ - X("sbwy_tunl_cstm5", MI_SUBWAY14, 0x5F5B98) \ - X("subplatform_n2", MI_SUBWAY15, 0x5F5B9C) \ - X("suby_tunl_start", MI_SUBWAY16, 0x5F5BA0) \ - X("sbwy_tunl_start2", MI_SUBWAY17, 0x5F5BA4) \ - X("indy_tunl_start", MI_SUBWAY18, 0x5F5BA8) \ - X("indsubway03", MI_SUBPLATFORM_IND, 0x5F5BAC) \ - X("comerside_subway", MI_SUBPLATFORM_COMS, 0x5F5BB0) \ - X("subplatform", MI_SUBPLATFORM_COMS2, 0x5F5BB4) \ - X("subplatform_n", MI_SUBPLATFORM_COMN, 0x5F5BB8) \ - X("Otherside_subway", MI_SUBPLATFORM_SUB, 0x5F5BBC) \ - X("subplatform_sub", MI_SUBPLATFORM_SUB2, 0x5F5BC0) \ - X("files", MI_FILES, 0x5F5BC4) + X("fire_hydrant", MI_FIRE_HYDRANT) \ + X("bagelstnd02", MI_BAGELSTAND2) \ + X("fish01", MI_FISHSTALL01) \ + X("fishstall02", MI_FISHSTALL02) \ + X("fishstall03", MI_FISHSTALL03) \ + X("fishstall04", MI_FISHSTALL04) \ + X("taxisign", MI_TAXISIGN) \ + X("phonesign", MI_PHONESIGN) \ + X("noparkingsign1", MI_NOPARKINGSIGN1) \ + X("bussign1", MI_BUSSIGN1) \ + X("roadworkbarrier1", MI_ROADWORKBARRIER1) \ + X("dump1", MI_DUMP1) \ + X("trafficcone", MI_TRAFFICCONE) \ + X("newsstand1", MI_NEWSSTAND) \ + X("postbox1", MI_POSTBOX1) \ + X("bin1", MI_BIN) \ + X("wastebin", MI_WASTEBIN) \ + X("phonebooth1", MI_PHONEBOOTH1) \ + X("parkingmeter", MI_PARKINGMETER) \ + X("trafficlight1", MI_TRAFFICLIGHTS) \ + X("lamppost1", MI_SINGLESTREETLIGHTS1) \ + X("lamppost2", MI_SINGLESTREETLIGHTS2) \ + X("lamppost3", MI_SINGLESTREETLIGHTS3) \ + X("doublestreetlght1", MI_DOUBLESTREETLIGHTS) \ + X("rd_Road2A10", MI_ROADSFORROADBLOCKSSTART) \ + X("rd_Road1A30", MI_ROADSFORROADBLOCKSEND) \ + X("veg_tree1", MI_TREE1) \ + X("veg_tree3", MI_TREE2) \ + X("veg_treea1", MI_TREE3) \ + X("veg_treenew01", MI_TREE4) \ + X("veg_treenew05", MI_TREE5) \ + X("veg_treeb1", MI_TREE6) \ + X("veg_treenew10", MI_TREE7) \ + X("veg_treea3", MI_TREE8) \ + X("veg_treenew09", MI_TREE9) \ + X("veg_treenew08", MI_TREE10) \ + X("veg_treenew03", MI_TREE11) \ + X("veg_treenew16", MI_TREE12) \ + X("veg_treenew17", MI_TREE13) \ + X("veg_treenew06", MI_TREE14) \ + X("doc_crane_cab", MODELID_CRANE_1) \ + X("cranetopb", MODELID_CRANE_2) \ + X("cranetopa", MODELID_CRANE_3) \ + X("package1", MI_COLLECTABLE1) \ + X("Money", MI_MONEY) \ + X("barrel1", MI_CARMINE) \ + X("oddjgaragdoor", MI_GARAGEDOOR1) \ + X("bombdoor", MI_GARAGEDOOR2) \ + X("door_bombshop", MI_GARAGEDOOR3) \ + X("vheistlocdoor", MI_GARAGEDOOR4) \ + X("door2_garage", MI_GARAGEDOOR5) \ + X("ind_slidedoor", MI_GARAGEDOOR6) \ + X("bankjobdoor", MI_GARAGEDOOR7) \ + X("door_jmsgrage", MI_GARAGEDOOR9) \ + X("jamesgrge_kb", MI_GARAGEDOOR10) \ + X("door_sfehousegrge", MI_GARAGEDOOR11) \ + X("shedgaragedoor", MI_GARAGEDOOR12) \ + X("door4_garage", MI_GARAGEDOOR13) \ + X("door_col_compnd_01", MI_GARAGEDOOR14) \ + X("door_col_compnd_02", MI_GARAGEDOOR15) \ + X("door_col_compnd_03", MI_GARAGEDOOR16) \ + X("door_col_compnd_04", MI_GARAGEDOOR17) \ + X("door_col_compnd_05", MI_GARAGEDOOR18) \ + X("impex_door", MI_GARAGEDOOR19) \ + X("SalvGarage", MI_GARAGEDOOR20) \ + X("door3_garage", MI_GARAGEDOOR21) \ + X("leveldoor2", MI_GARAGEDOOR22) \ + X("double_garage_dr", MI_GARAGEDOOR23) \ + X("amcogaragedoor", MI_GARAGEDOOR24) \ + X("towergaragedoor1", MI_GARAGEDOOR25) \ + X("towergaragedoor2", MI_GARAGEDOOR26) \ + X("towergaragedoor3", MI_GARAGEDOOR27) \ + X("plysve_gragedoor", MI_GARAGEDOOR28) \ + X("impexpsubgrgdoor", MI_GARAGEDOOR29) \ + X("Sub_sprayshopdoor", MI_GARAGEDOOR30) \ + X("ind_plyrwoor", MI_GARAGEDOOR31) \ + X("8ballsuburbandoor", MI_GARAGEDOOR32) \ + X("barrel2", MI_NAUTICALMINE) \ + X("crushercrush", MI_CRUSHERBODY) \ + X("crushertop", MI_CRUSHERLID) \ + X("donkeymag", MI_DONKEYMAG) \ + X("bullion", MI_BULLION) \ + X("floatpackge1", MI_FLOATPACKAGE1) \ + X("briefcase", MI_BRIEFCASE) \ + X("chinabanner1", MI_CHINABANNER1) \ + X("chinabanner2", MI_CHINABANNER2) \ + X("chinabanner3", MI_CHINABANNER3) \ + X("chinabanner4", MI_CHINABANNER4) \ + X("iten_chinatown5", MI_CHINABANNER5) \ + X("iten_chinatown7", MI_CHINABANNER6) \ + X("iten_chinatown3", MI_CHINABANNER7) \ + X("iten_chinatown2", MI_CHINABANNER8) \ + X("iten_chinatown4", MI_CHINABANNER9) \ + X("iten_washline01", MI_CHINABANNER10) \ + X("iten_washline02", MI_CHINABANNER11) \ + X("iten_washline03", MI_CHINABANNER12) \ + X("chinalanterns", MI_CHINALANTERN) \ + X("glassfx1", MI_GLASS1) \ + X("glassfx2", MI_GLASS2) \ + X("glassfx3", MI_GLASS3) \ + X("glassfx4", MI_GLASS4) \ + X("glassfx55", MI_GLASS5) \ + X("glassfxsub1", MI_GLASS6) \ + X("glassfxsub2", MI_GLASS7) \ + X("glassfx_composh", MI_GLASS8) \ + X("bridge_liftsec", MI_BRIDGELIFT) \ + X("bridge_liftweight", MI_BRIDGEWEIGHT) \ + X("subbridge_lift", MI_BRIDGEROADSEGMENT) \ + X("barrel4", MI_EXPLODINGBARREL) \ + X("flagsitaly", MI_ITALYBANNER1) \ + X("adrenaline", MI_PICKUP_ADRENALINE) \ + X("bodyarmour", MI_PICKUP_BODYARMOUR) \ + X("info", MI_PICKUP_INFO) \ + X("health", MI_PICKUP_HEALTH) \ + X("bonus", MI_PICKUP_BONUS) \ + X("bribe", MI_PICKUP_BRIBE) \ + X("killfrenzy", MI_PICKUP_KILLFRENZY) \ + X("camerapickup", MI_PICKUP_CAMERA) \ + X("bollardlight", MI_BOLLARDLIGHT) \ + X("magnet", MI_MAGNET) \ + X("streetlamp1", MI_STREETLAMP1) \ + X("streetlamp2", MI_STREETLAMP2) \ + X("railtrax_lo4b", MI_RAILTRACKS) \ + X("bar_barrier10", MI_FENCE) \ + X("bar_barrier12", MI_FENCE2) \ + X("petrolpump", MI_PETROLPUMP) \ + X("bodycast", MI_BODYCAST) \ + X("backdoor", MI_BACKDOOR) \ + X("coffee", MI_COFFEE) \ + X("bouy", MI_BUOY) \ + X("parktable1", MI_PARKTABLE) \ + X("sbwy_tunl_start", MI_SUBWAY1) \ + X("sbwy_tunl_bit", MI_SUBWAY2) \ + X("sbwy_tunl_bend", MI_SUBWAY3) \ + X("sbwy_tunl_cstm6", MI_SUBWAY4) \ + X("sbwy_tunl_cstm7", MI_SUBWAY5) \ + X("sbwy_tunl_cstm8", MI_SUBWAY6) \ + X("sbwy_tunl_cstm10", MI_SUBWAY7) \ + X("sbwy_tunl_cstm9", MI_SUBWAY8) \ + X("sbwy_tunl_cstm11", MI_SUBWAY9) \ + X("sbwy_tunl_cstm1", MI_SUBWAY10) \ + X("sbwy_tunl_cstm2", MI_SUBWAY11) \ + X("sbwy_tunl_cstm4", MI_SUBWAY12) \ + X("sbwy_tunl_cstm3", MI_SUBWAY13) \ + X("sbwy_tunl_cstm5", MI_SUBWAY14) \ + X("subplatform_n2", MI_SUBWAY15) \ + X("suby_tunl_start", MI_SUBWAY16) \ + X("sbwy_tunl_start2", MI_SUBWAY17) \ + X("indy_tunl_start", MI_SUBWAY18) \ + X("indsubway03", MI_SUBPLATFORM_IND) \ + X("comerside_subway", MI_SUBPLATFORM_COMS) \ + X("subplatform", MI_SUBPLATFORM_COMS2) \ + X("subplatform_n", MI_SUBPLATFORM_COMN) \ + X("Otherside_subway", MI_SUBPLATFORM_SUB) \ + X("subplatform_sub", MI_SUBPLATFORM_SUB2) \ + X("files", MI_FILES) -#define X(name, var, addr) extern int16 var; +#define X(name, var) extern int16 var; MODELINDICES #undef X @@ -255,7 +255,9 @@ enum MI_BUSKER4, // three more peds possible - MI_FIRST_VEHICLE = 90, + MI_LAST_PED = 89, + MI_FIRST_VEHICLE, + MI_LANDSTAL = MI_FIRST_VEHICLE, MI_IDAHO, MI_STINGER, @@ -382,7 +384,7 @@ IsGlass(int16 id) } inline bool -IsTrafficLight(int16 id) +IsStreetLight(int16 id) { return id == MI_TRAFFICLIGHTS || id == MI_SINGLESTREETLIGHTS1 || @@ -410,7 +412,7 @@ IsBoatModel(int16 id) inline bool IsPedModel(int16 id) { - return id >= 0 && id <= 89; + return id >= MI_PLAYER && id <= MI_LAST_PED; } inline bool diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index 1566ba3d..e2257a28 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -966,18 +966,11 @@ CPopulation::ConvertToRealObject(CDummyObject *dummy) if (!obj) return; - bool makeInvisible; CWorld::Remove(dummy); delete dummy; CWorld::Add(obj); - int16 mi = obj->GetModelIndex(); - if (mi == MI_GLASS1 || mi == MI_GLASS2 || mi == MI_GLASS3 || mi == MI_GLASS4 || - mi == MI_GLASS5 || mi == MI_GLASS6 || mi == MI_GLASS7 || mi == MI_GLASS8) - makeInvisible = true; - else - makeInvisible = false; - if (makeInvisible) { + if (IsGlass(obj->GetModelIndex())) { obj->bIsVisible = false; } else if (obj->GetModelIndex() == MI_BUOY) { obj->bIsStatic = false; @@ -996,17 +989,8 @@ CPopulation::ConvertToDummyObject(CObject *obj) dummy->GetMatrix().UpdateRW(); dummy->UpdateRwFrame(); - bool makeInvisible; - int16 mi = obj->GetModelIndex(); - if (mi == MI_GLASS1 || mi == MI_GLASS2 || mi == MI_GLASS3 || mi == MI_GLASS4 || - mi == MI_GLASS5 || mi == MI_GLASS6 || mi == MI_GLASS7 || mi == MI_GLASS8) - makeInvisible = true; - else - makeInvisible = false; - - if (makeInvisible) { + if (IsGlass(obj->GetModelIndex())) dummy->bIsVisible = false; - } CWorld::Remove(obj); delete obj; From 50f0c7a1dcad33ac3d38d6e37faca3d16d222aaa Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 19 May 2020 22:01:28 +0200 Subject: [PATCH 022/133] bla --- src/entities/Entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp index 683a3571..a9b6b2b8 100644 --- a/src/entities/Entity.cpp +++ b/src/entities/Entity.cpp @@ -683,7 +683,7 @@ CEntity::ProcessLightsForEntity(void) lightOn = true; break; case LIGHT_FLICKER_NIGHT: - if(CClock::GetHours() > 18 || CClock::GetHours() < 7 || CWeather::WetRoads > 0.5f){){ + if(CClock::GetHours() > 18 || CClock::GetHours() < 7 || CWeather::WetRoads > 0.5f){ if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60) lightOn = true; else From 1b96e6c378b3e827c27444c38d207350ec0af66c Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Tue, 19 May 2020 23:49:28 +0300 Subject: [PATCH 023/133] fixed script bug --- src/control/Script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 864799f8..e8aa3266 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -2998,9 +2998,9 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) pCarGen->SwitchOff(); }else if (ScriptParams[1] <= 100){ pCarGen->SwitchOn(); + pCarGen->SetUsesRemaining(ScriptParams[1]); }else{ pCarGen->SwitchOn(); - pCarGen->SetUsesRemaining(ScriptParams[1]); } return 0; } From c0c8278c635258fc72636db0bbf59d7c99c4ba61 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Wed, 20 May 2020 20:45:07 +0300 Subject: [PATCH 024/133] fixed ped comment --- src/audio/sampman_miles.cpp | 4 ++++ src/audio/sampman_oal.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp index a2a206a4..ad2c512f 100644 --- a/src/audio/sampman_miles.cpp +++ b/src/audio/sampman_miles.cpp @@ -1469,6 +1469,10 @@ cSampleManager::_GetPedCommentSlot(uint32 nComment) for ( int32 i = 0; i < _TODOCONST(3); i++ ) { slot = nCurrentPedSlot - i - 1; +#ifdef FIX_BUGS + if (slot < 0) + slot += ARRAY_SIZE(nPedSlotSfx); +#endif if ( nComment == nPedSlotSfx[slot] ) return slot; } diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index 30efd7f5..f16afbba 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -800,6 +800,10 @@ cSampleManager::_GetPedCommentSlot(uint32 nComment) for (int32 i = 0; i < _TODOCONST(3); i++) { slot = nCurrentPedSlot - i - 1; +#ifdef FIX_BUGS + if (slot < 0) + slot += ARRAY_SIZE(nPedSlotSfx); +#endif if (nComment == nPedSlotSfx[slot]) return slot; } From b7c1784dd274b88955763c5a3fa2acb4d202e934 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Wed, 20 May 2020 23:25:01 +0300 Subject: [PATCH 025/133] script fix --- src/control/Script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index e8aa3266..8ade2c9b 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -8222,7 +8222,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) car->SetHeading(DEGTORAD(*(float*)&ScriptParams[3])); CTheScripts::ClearSpaceForMissionEntity(pos, car); car->SetStatus(STATUS_ABANDONED); - car->bIsLocked = true; + car->bIsLocked = false; car->bIsCarParkVehicle = true; CCarCtrl::JoinCarWithRoadSystem(car); car->AutoPilot.m_nCarMission = MISSION_NONE; From 3405cfffb76b1e0b7511e2fc394c0121f4aa43a8 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Wed, 20 May 2020 23:52:17 +0300 Subject: [PATCH 026/133] fixed dumb --- src/audio/sampman_miles.cpp | 4 ++-- src/audio/sampman_oal.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp index ad2c512f..d625ac35 100644 --- a/src/audio/sampman_miles.cpp +++ b/src/audio/sampman_miles.cpp @@ -1445,7 +1445,7 @@ cSampleManager::IsSampleBankLoaded(uint8 nBank) bool cSampleManager::IsPedCommentLoaded(uint32 nComment) { - uint8 slot; + int8 slot; for ( int32 i = 0; i < _TODOCONST(3); i++ ) { @@ -1464,7 +1464,7 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment) int32 cSampleManager::_GetPedCommentSlot(uint32 nComment) { - uint8 slot; + int8 slot; for ( int32 i = 0; i < _TODOCONST(3); i++ ) { diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index f16afbba..f6f3a393 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -775,7 +775,7 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment) { ASSERT( nComment < TOTAL_AUDIO_SAMPLES ); - uint8 slot; + int8 slot; for ( int32 i = 0; i < _TODOCONST(3); i++ ) { @@ -795,7 +795,7 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment) int32 cSampleManager::_GetPedCommentSlot(uint32 nComment) { - uint8 slot; + int8 slot; for (int32 i = 0; i < _TODOCONST(3); i++) { From 73ff01e35b2a0d14f06c1ac8121f59f73da7d994 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Thu, 21 May 2020 00:18:13 +0300 Subject: [PATCH 027/133] script fix --- src/control/Script.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 8ade2c9b..68b396f3 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -8696,6 +8696,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CTimer::Resume(); pMissionScript->m_bIsMissionScript = true; pMissionScript->m_bMissionFlag = true; + CTheScripts::bAlreadyRunningAMissionScript = true; return 0; } case COMMAND_SET_OBJECT_DRAW_LAST: From 21071edbfe5794393d1e64322e4689f50ddc1bc3 Mon Sep 17 00:00:00 2001 From: aap Date: Fri, 22 May 2020 14:34:44 +0200 Subject: [PATCH 028/133] fixes for CPhysical and friends --- src/core/Stats.h | 18 +++--- src/core/SurfaceTable.cpp | 128 +++++++++++++++++++------------------- src/core/SurfaceTable.h | 43 +------------ src/core/Timer.h | 2 +- src/entities/Physical.cpp | 97 +++++++++++++++-------------- src/entities/Physical.h | 7 +-- src/objects/Object.h | 9 +-- src/render/Timecycle.h | 2 +- src/vehicles/Boat.cpp | 2 +- 9 files changed, 132 insertions(+), 176 deletions(-) diff --git a/src/core/Stats.h b/src/core/Stats.h index 4445ecf4..ae3c0cb4 100644 --- a/src/core/Stats.h +++ b/src/core/Stats.h @@ -10,7 +10,7 @@ public: TOTAL_HIGHEST_SCORES = 16 }; static int32 DaysPassed; - static int32 HeadsPopped; + static int32 HeadsPopped; static int32 CommercialPassed; static int32 IndustrialPassed; static int32 SuburbanPassed; @@ -52,14 +52,14 @@ public: static int32 LongestFlightInDodo; static int32 TimeTakenDefuseMission; static int32 TotalNumberKillFrenzies; - static int32 TotalNumberMissions; - static int32 RoundsFiredByPlayer; - static int32 KgsOfExplosivesUsed; - static int32 InstantHitsFiredByPlayer; - static int32 InstantHitsHitByPlayer; - static int32 BestTimeBombDefusal; - static int32 mmRain; - static int32 CarsCrushed; + static int32 TotalNumberMissions; + static int32 RoundsFiredByPlayer; + static int32 KgsOfExplosivesUsed; + static int32 InstantHitsFiredByPlayer; + static int32 InstantHitsHitByPlayer; + static int32 BestTimeBombDefusal; + static int32 mmRain; + static int32 CarsCrushed; static int32 FastestTimes[TOTAL_FASTEST_TIMES]; static int32 HighestScores[TOTAL_HIGHEST_SCORES]; diff --git a/src/core/SurfaceTable.cpp b/src/core/SurfaceTable.cpp index 08a84cfd..e4f9c0cd 100644 --- a/src/core/SurfaceTable.cpp +++ b/src/core/SurfaceTable.cpp @@ -56,40 +56,40 @@ int CSurfaceTable::GetAdhesionGroup(uint8 surfaceType) { switch(surfaceType){ - case SURFACE_0: return ADHESIVE_ROAD; - case SURFACE_1: return ADHESIVE_ROAD; - case SURFACE_2: return ADHESIVE_LOOSE; - case SURFACE_3: return ADHESIVE_LOOSE; - case SURFACE_4: return ADHESIVE_HARD; - case SURFACE_5: return ADHESIVE_ROAD; - case SURFACE_6: return ADHESIVE_HARD; - case SURFACE_7: return ADHESIVE_HARD; - case SURFACE_8: return ADHESIVE_HARD; - case SURFACE_9: return ADHESIVE_HARD; - case SURFACE_10: return ADHESIVE_HARD; - case SURFACE_11: return ADHESIVE_HARD; - case SURFACE_12: return ADHESIVE_HARD; - case SURFACE_13: return ADHESIVE_HARD; - case SURFACE_14: return ADHESIVE_HARD; - case SURFACE_15: return ADHESIVE_HARD; - case SURFACE_16: return ADHESIVE_HARD; - case SURFACE_17: return ADHESIVE_RUBBER; - case SURFACE_18: return ADHESIVE_LOOSE; - case SURFACE_19: return ADHESIVE_WET; - case SURFACE_20: return ADHESIVE_ROAD; - case SURFACE_21: return ADHESIVE_ROAD; - case SURFACE_22: return ADHESIVE_ROAD; - case SURFACE_23: return ADHESIVE_RUBBER; - case SURFACE_24: return ADHESIVE_HARD; - case SURFACE_25: return ADHESIVE_LOOSE; - case SURFACE_26: return ADHESIVE_LOOSE; - case SURFACE_27: return ADHESIVE_HARD; - case SURFACE_28: return ADHESIVE_HARD; - case SURFACE_29: return ADHESIVE_RUBBER; - case SURFACE_30: return ADHESIVE_LOOSE; - case SURFACE_31: return ADHESIVE_HARD; - case SURFACE_32: return ADHESIVE_HARD; - default: return ADHESIVE_ROAD; + case SURFACE_DEFAULT: return ADHESIVE_ROAD; + case SURFACE_TARMAC: return ADHESIVE_ROAD; + case SURFACE_GRASS: return ADHESIVE_LOOSE; + case SURFACE_DIRT: return ADHESIVE_LOOSE; + case SURFACE_DIRTTRACK: return ADHESIVE_HARD; + case SURFACE_PAVEMENT: return ADHESIVE_ROAD; + case SURFACE_METAL6: return ADHESIVE_HARD; + case SURFACE_GLASS: return ADHESIVE_HARD; + case SURFACE_SCAFFOLD: return ADHESIVE_HARD; + case SURFACE_METAL_DOOR: return ADHESIVE_HARD; + case SURFACE_BILLBOARD: return ADHESIVE_HARD; + case SURFACE_STEEL: return ADHESIVE_HARD; + case SURFACE_METAL_POLE: return ADHESIVE_HARD; + case SURFACE_STREET_LIGHT: return ADHESIVE_HARD; + case SURFACE_METAL14: return ADHESIVE_HARD; + case SURFACE_METAL15: return ADHESIVE_HARD; + case SURFACE_METAL_FENCE: return ADHESIVE_HARD; + case SURFACE_FLESH: return ADHESIVE_RUBBER; + case SURFACE_SAND: return ADHESIVE_LOOSE; + case SURFACE_PUDDLE: return ADHESIVE_WET; + case SURFACE_WOOD: return ADHESIVE_ROAD; + case SURFACE_WOOD_BOX: return ADHESIVE_ROAD; + case SURFACE_WOOD_PLANK: return ADHESIVE_ROAD; + case SURFACE_TIRE: return ADHESIVE_RUBBER; + case SURFACE_HARD24: return ADHESIVE_HARD; + case SURFACE_HEDGE: return ADHESIVE_LOOSE; + case SURFACE_STONE: return ADHESIVE_LOOSE; + case SURFACE_METAL27: return ADHESIVE_HARD; + case SURFACE_METAL28: return ADHESIVE_HARD; + case SURFACE_RUBBER29: return ADHESIVE_RUBBER; + case SURFACE_LOOSE30: return ADHESIVE_LOOSE; + case SURFACE_BOLLARD: return ADHESIVE_HARD; + case SURFACE_GATE: return ADHESIVE_HARD; + default: return ADHESIVE_ROAD; } } @@ -97,38 +97,38 @@ float CSurfaceTable::GetWetMultiplier(uint8 surfaceType) { switch(surfaceType){ - case SURFACE_0: - case SURFACE_1: - case SURFACE_4: - case SURFACE_5: - case SURFACE_8: - case SURFACE_20: - case SURFACE_21: - case SURFACE_22: - case SURFACE_25: - case SURFACE_30: - case SURFACE_31: + case SURFACE_DEFAULT: + case SURFACE_TARMAC: + case SURFACE_DIRTTRACK: + case SURFACE_PAVEMENT: + case SURFACE_SCAFFOLD: + case SURFACE_WOOD: + case SURFACE_WOOD_BOX: + case SURFACE_WOOD_PLANK: + case SURFACE_HEDGE: + case SURFACE_LOOSE30: + case SURFACE_BOLLARD: return 1.0f - CWeather::WetRoads*0.25f; - case SURFACE_2: - case SURFACE_6: - case SURFACE_7: - case SURFACE_9: - case SURFACE_10: - case SURFACE_11: - case SURFACE_12: - case SURFACE_13: - case SURFACE_14: - case SURFACE_15: - case SURFACE_16: - case SURFACE_17: - case SURFACE_23: - case SURFACE_24: - case SURFACE_26: - case SURFACE_27: - case SURFACE_28: - case SURFACE_29: - case SURFACE_32: + case SURFACE_GRASS: + case SURFACE_METAL6: + case SURFACE_GLASS: + case SURFACE_METAL_DOOR: + case SURFACE_BILLBOARD: + case SURFACE_STEEL: + case SURFACE_METAL_POLE: + case SURFACE_STREET_LIGHT: + case SURFACE_METAL14: + case SURFACE_METAL15: + case SURFACE_METAL_FENCE: + case SURFACE_FLESH: + case SURFACE_TIRE: + case SURFACE_HARD24: + case SURFACE_STONE: + case SURFACE_METAL27: + case SURFACE_METAL28: + case SURFACE_RUBBER29: + case SURFACE_GATE: return 1.0f - CWeather::WetRoads*0.4f; default: diff --git a/src/core/SurfaceTable.h b/src/core/SurfaceTable.h index 12246dce..768521bf 100644 --- a/src/core/SurfaceTable.h +++ b/src/core/SurfaceTable.h @@ -1,47 +1,6 @@ #pragma once - -enum -{ - SURFACE_0, - SURFACE_1, - SURFACE_2, - SURFACE_3, - SURFACE_4, - SURFACE_5, - SURFACE_6, - SURFACE_7, - SURFACE_8, - SURFACE_9, - SURFACE_10, - SURFACE_11, - SURFACE_12, - SURFACE_13, - SURFACE_14, - SURFACE_15, - SURFACE_16, - SURFACE_17, - SURFACE_18, - SURFACE_19, - SURFACE_20, - SURFACE_21, - SURFACE_22, - SURFACE_23, - SURFACE_24, - SURFACE_25, - SURFACE_26, - SURFACE_27, - SURFACE_28, - SURFACE_29, - SURFACE_30, - SURFACE_31, - SURFACE_32, - - NUMSURFACETYPES -}; - -// From nick -// TODO: check and use this +// TODO: check this enum eSurfaceType { SURFACE_DEFAULT, diff --git a/src/core/Timer.h b/src/core/Timer.h index 004cda4d..e7b6fec8 100644 --- a/src/core/Timer.h +++ b/src/core/Timer.h @@ -58,7 +58,7 @@ public: friend bool GenericSave(int file); #ifdef FIX_BUGS - static float GetDefaultTimeStep(void) { return 5.0f / 3.0f; } + static float GetDefaultTimeStep(void) { return 50.0f / 30.0f; } static float GetTimeStepFix(void) { return GetTimeStep() / GetDefaultTimeStep(); } #endif }; diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 31f8fcbc..f9f8ae7e 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -45,9 +45,9 @@ CPhysical::CPhysical(void) bUsesCollision = true; m_audioEntityId = -5; - unk1 = 100.0f; + m_phys_unused1 = 100.0f; m_vecCentreOfMass = CVector(0.0f, 0.0f, 0.0f); - field_EC = 0; + m_phys_unused2 = 0; bIsHeavy = false; bAffectedByGravity = true; @@ -527,26 +527,26 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl bool ispedcontactA = false; bool ispedcontactB = false; - float timestepA; + float massFactorA; if(B->bPedPhysics){ - timestepA = 10.0f; + massFactorA = 10.0f; if(B->IsPed() && ((CPed*)B)->m_pCurrentPhysSurface == A) ispedcontactA = true; }else - timestepA = A->bIsHeavy ? 2.0f : 1.0f; + massFactorA = A->bIsHeavy ? 2.0f : 1.0f; - float timestepB; + float massFactorB; if(A->bPedPhysics){ if(A->IsPed() && ((CPed*)A)->IsPlayer() && B->IsVehicle() && (B->GetStatus() == STATUS_ABANDONED || B->GetStatus() == STATUS_WRECKED || A->bHasHitWall)) - timestepB = 2200.0f / B->m_fMass; + massFactorB = 2200.0f / B->m_fMass; else - timestepB = 10.0f; + massFactorB = 10.0f; if(A->IsPed() && ((CPed*)A)->m_pCurrentPhysSurface == B) ispedcontactB = true; }else - timestepB = B->bIsHeavy ? 2.0f : 1.0f; + massFactorB = B->bIsHeavy ? 2.0f : 1.0f; float speedA, speedB; if(B->IsStatic()){ @@ -646,14 +646,17 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl // positive if B is moving towards A // not interested in how much B moves into A apparently? // only interested in cases where A collided into B - speedB = Max(0.0f, DotProduct(B->m_vecMoveSpeed, colpoint.normal)); + speedB = DotProduct(B->m_vecMoveSpeed, colpoint.normal); + float speedSum = Max(0.0f, DotProduct(B->m_vecMoveSpeed, colpoint.normal)); // A has moved into B - if(speedA < speedB){ - if(!A->bHasHitWall) - speedB -= (speedA - speedB) * (A->m_fElasticity+B->m_fElasticity)/2.0f; - impulseA = (speedB-speedA) * A->m_fMass * timestepA; + if(speedA < speedSum){ + if(A->bHasHitWall) + eA = speedSum; + else + eA = speedSum - (speedA - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f; + impulseA = (eA-speedA) * A->m_fMass * massFactorA; if(!A->bInfiniteMass) - A->ApplyMoveForce(colpoint.normal*(impulseA/timestepA)); + A->ApplyMoveForce(colpoint.normal*(impulseA/massFactorA)); return true; } }else if(A->bPedPhysics){ @@ -661,9 +664,9 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl speedA = DotProduct(A->m_vecMoveSpeed, colpoint.normal); speedB = DotProduct(B->GetSpeed(pointposB), colpoint.normal); - float a = A->m_fMass*timestepA; - float b = B->GetMassTime(pointposB, colpoint.normal, timestepB); - float speedSum = (b*speedB + a*speedA)/(a + b); + float mA = A->m_fMass*massFactorA; + float mB = B->GetMassTweak(pointposB, colpoint.normal, massFactorB); + float speedSum = (mB*speedB + mA*speedA)/(mA + mB); if(speedA < speedSum){ if(A->bHasHitWall) eA = speedSum; @@ -673,10 +676,10 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl eB = speedSum; else eB = speedSum - (speedB - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f; - impulseA = (eA - speedA) * a; - impulseB = -(eB - speedB) * b; - CVector fA = colpoint.normal*(impulseA/timestepA); - CVector fB = colpoint.normal*(-impulseB/timestepB); + impulseA = (eA - speedA) * mA; + impulseB = -(eB - speedB) * mB; + CVector fA = colpoint.normal*(impulseA/massFactorA); + CVector fB = colpoint.normal*(-impulseB/massFactorB); if(!A->bInfiniteMass){ if(fA.z < 0.0f) fA.z = 0.0f; if(ispedcontactB){ @@ -696,9 +699,9 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl speedA = DotProduct(A->GetSpeed(pointposA), colpoint.normal); speedB = DotProduct(B->m_vecMoveSpeed, colpoint.normal); - float a = A->GetMassTime(pointposA, colpoint.normal, timestepA); - float b = B->m_fMass*timestepB; - float speedSum = (b*speedB + a*speedA)/(a + b); + float mA = A->GetMassTweak(pointposA, colpoint.normal, massFactorA); + float mB = B->m_fMass*massFactorB; + float speedSum = (mB*speedB + mA*speedA)/(mA + mB); if(speedA < speedSum){ if(A->bHasHitWall) eA = speedSum; @@ -708,10 +711,10 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl eB = speedSum; else eB = speedSum - (speedB - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f; - impulseA = (eA - speedA) * a; - impulseB = -(eB - speedB) * b; - CVector fA = colpoint.normal*(impulseA/timestepA); - CVector fB = colpoint.normal*(-impulseB/timestepB); + impulseA = (eA - speedA) * mA; + impulseB = -(eB - speedB) * mB; + CVector fA = colpoint.normal*(impulseA/massFactorA); + CVector fB = colpoint.normal*(-impulseB/massFactorB); if(!A->bInfiniteMass && !ispedcontactA){ if(fA.z < 0.0f) fA.z = 0.0f; A->ApplyMoveForce(fA); @@ -736,9 +739,9 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl CVector pointposB = colpoint.point - B->GetPosition(); speedA = DotProduct(A->GetSpeed(pointposA), colpoint.normal); speedB = DotProduct(B->GetSpeed(pointposB), colpoint.normal); - float a = A->GetMassTime(pointposA, colpoint.normal, timestepA); - float b = B->GetMassTime(pointposB, colpoint.normal, timestepB); - float speedSum = (b*speedB + a*speedA)/(a + b); + float mA = A->GetMassTweak(pointposA, colpoint.normal, massFactorA); + float mB = B->GetMassTweak(pointposB, colpoint.normal, massFactorB); + float speedSum = (mB*speedB + mA*speedA)/(mA + mB); if(speedA < speedSum){ if(A->bHasHitWall) eA = speedSum; @@ -748,10 +751,10 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl eB = speedSum; else eB = speedSum - (speedB - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f; - impulseA = (eA - speedA) * a; - impulseB = -(eB - speedB) * b; - CVector fA = colpoint.normal*(impulseA/timestepA); - CVector fB = colpoint.normal*(-impulseB/timestepB); + impulseA = (eA - speedA) * mA; + impulseB = -(eB - speedB) * mB; + CVector fA = colpoint.normal*(impulseA/massFactorA); + CVector fB = colpoint.normal*(-impulseB/massFactorB); if(A->IsVehicle() && !A->bHasHitWall){ fA.x *= 1.4f; fA.y *= 1.4f; @@ -767,7 +770,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl if(B->IsVehicle() && !B->bHasHitWall){ fB.x *= 1.4f; fB.y *= 1.4f; - if(colpoint.normal.z < 0.7f) + if(-colpoint.normal.z < 0.7f) fB.z *= 0.3f; if(B->GetStatus() == STATUS_PLAYER) pointposB *= 0.8f; @@ -813,7 +816,7 @@ CPhysical::ApplyCollisionAlt(CEntity *B, CColPoint &colpoint, float &impulse, CV speed = GetSpeed(pointpos); normalSpeed = DotProduct(speed, colpoint.normal); if(normalSpeed < 0.0f){ - float minspeed = 0.0104f * CTimer::GetTimeStep(); + float minspeed = 1.3f*GRAVITY * CTimer::GetTimeStep(); #ifdef GTA3_1_1_PATCH if ((IsObject() || IsVehicle() && (GetUp().z < -0.3f || ((CVehicle*)this)->IsBike() && (GetStatus() == STATUS_ABANDONED || GetStatus() == STATUS_WRECKED))) && #else @@ -1015,7 +1018,7 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint) ApplyFrictionTurnForce(frictionDir*fImpulse, pointpos); if(fOtherSpeed > 0.1f && - colpoint.surfaceB != SURFACE_2 && colpoint.surfaceB != SURFACE_4 && + colpoint.surfaceB != SURFACE_GRASS && colpoint.surfaceB != SURFACE_DIRTTRACK && CSurfaceTable::GetAdhesionGroup(colpoint.surfaceA) == ADHESIVE_HARD){ CVector v = frictionDir * fOtherSpeed * 0.25f; for(int i = 0; i < 4; i++) @@ -1064,7 +1067,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists) canshift = true; else canshift = A->IsPed() && - B->IsObject() && B->bInfiniteMass && !Bobj->bHasBeenDamaged; + B->IsObject() && B->bIsStatic && !Bobj->bHasBeenDamaged; if(B == A || B->m_scanCode == CWorld::GetCurrentScanCode() || !B->bUsesCollision || @@ -1084,7 +1087,6 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists) B->GetUp().z < 0.66f && IsStreetLight(B->GetModelIndex())) skipShift = true; -// TODO: maybe flip some ifs here else if(A->IsObject() && B->IsVehicle()){ CObject *Aobj = (CObject*)A; if(Aobj->ObjectCreatedBy != TEMP_OBJECT && @@ -1699,16 +1701,16 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists) } if(B->IsPed() && A->IsVehicle() && - (!Bped->IsPlayer() || B->bHasHitWall && A->m_vecMoveSpeed.MagnitudeSqr() > 0.0025f)) + (!Bped->IsPlayer() || B->bHasHitWall && A->m_vecMoveSpeed.MagnitudeSqr() > SQR(0.05f))) Bped->KillPedWithCar((CVehicle*)A, maxImpulseB); else if(B->GetModelIndex() == MI_TRAIN && A->IsPed() && (!Aped->IsPlayer() || A->bHasHitWall)) Aped->KillPedWithCar((CVehicle*)B, maxImpulseA*2.0f); else if(B->IsObject() && B->bUsesCollision && A->IsVehicle()){ + // BUG? not impulseA? if(Bobj->m_nCollisionDamageEffect && maxImpulseB > 20.0f) Bobj->ObjectDamage(maxImpulseB); }else if(A->IsObject() && A->bUsesCollision && B->IsVehicle()){ - // BUG? not impulseA? if(Aobj->m_nCollisionDamageEffect && maxImpulseB > 20.0f) Aobj->ObjectDamage(maxImpulseB); } @@ -1774,7 +1776,7 @@ CPhysical::ProcessShift(void) m_bIsVehicleBeingShifted = true; CEntryInfoNode *node; - bool hasshifted = false; // whatever that means... + bool hasshifted = false; for(node = m_entryInfoList.first; node; node = node->next) hasshifted |= ProcessShiftSectorList(node->sector->m_lists); m_bIsVehicleBeingShifted = false; @@ -1831,7 +1833,7 @@ CPhysical::ProcessCollision(void) int8 n = 1; // The number of steps we divide the time step into float step = 0.0f; // divided time step - float distSq = GetDistanceSq(); + float distSq = m_vecMoveSpeed.MagnitudeSqr() * sq(CTimer::GetTimeStep()); if(IsPed() && (distSq >= sq(0.2f) || ped->IsPlayer())){ if(ped->IsPlayer()) @@ -1920,8 +1922,11 @@ CPhysical::ProcessCollision(void) bSkipLineCol = false; if(!m_vecMoveSpeed.IsZero() || !m_vecTurnSpeed.IsZero() || +#ifdef GTA_TRAIN bHitByTrain || - GetStatus() == STATUS_PLAYER || IsPed() && ped->IsPlayer()){ +#endif + GetStatus() == STATUS_PLAYER || + IsPed() && ped->IsPlayer()){ if(IsVehicle()) ((CVehicle*)this)->bVehicleColProcessed = true; if(CheckCollision()){ diff --git a/src/entities/Physical.h b/src/entities/Physical.h index c84686ed..f8921a5c 100644 --- a/src/entities/Physical.h +++ b/src/entities/Physical.h @@ -18,7 +18,7 @@ public: // The not properly indented fields haven't been checked properly yet int32 m_audioEntityId; - float unk1; + float m_phys_unused1; CTreadable *m_treadable[2]; // car and ped uint32 m_nLastTimeCollided; CVector m_vecMoveSpeed; // velocity @@ -37,7 +37,7 @@ public: CEntryInfoList m_entryInfoList; CPtrNode *m_movingListNode; - char field_EC; + int8 m_phys_unused2; uint8 m_nStaticFrames; uint8 m_nCollisionRecords; bool m_bIsVehicleBeingShifted; @@ -86,7 +86,6 @@ public: void RemoveRefsToEntity(CEntity *ent); static void PlacePhysicalRelativeToOtherPhysical(CPhysical *other, CPhysical *phys, CVector localPos); - float GetDistanceSq(void) { return m_vecMoveSpeed.MagnitudeSqr() * sq(CTimer::GetTimeStep()); } // get speed of point p relative to entity center CVector GetSpeed(const CVector &r); CVector GetSpeed(void) { return GetSpeed(CVector(0.0f, 0.0f, 0.0f)); } @@ -94,7 +93,7 @@ public: return 1.0f / (CrossProduct(pos, dir).MagnitudeSqr()/m_fTurnMass + 1.0f/m_fMass); } - float GetMassTime(const CVector &pos, const CVector &dir, float t) { + float GetMassTweak(const CVector &pos, const CVector &dir, float t) { return 1.0f / (CrossProduct(pos, dir).MagnitudeSqr()/(m_fTurnMass*t) + 1.0f/(m_fMass*t)); } diff --git a/src/objects/Object.h b/src/objects/Object.h index 79589dc9..c9a1bba8 100644 --- a/src/objects/Object.h +++ b/src/objects/Object.h @@ -55,14 +55,7 @@ public: uint8 m_nCollisionDamageEffect; uint8 m_nSpecialCollisionResponseCases; bool m_bCameraToAvoidThisObject; - - // this batch is unused - int8 field_17B; - int8 field_17C; - int8 field_17D; - int8 field_17E; - int8 field_17F; - + uint32 m_obj_unused1; uint32 m_nEndOfLifeTime; int16 m_nRefModelIndex; CEntity *m_pCurSurface; diff --git a/src/render/Timecycle.h b/src/render/Timecycle.h index 28a0b7dd..9af4df49 100644 --- a/src/render/Timecycle.h +++ b/src/render/Timecycle.h @@ -122,7 +122,7 @@ public: static float GetSpriteSize(void) { return m_fCurrentSpriteSize; } static int GetShadowStrength(void) { return m_nCurrentShadowStrength; } static int GetLightShadowStrength(void) { return m_nCurrentLightShadowStrength; } - static int GetLightOnGroundBrightness(void) { return m_fCurrentLightsOnGroundBrightness; } + static float GetLightOnGroundBrightness(void) { return m_fCurrentLightsOnGroundBrightness; } static float GetFarClip(void) { return m_fCurrentFarClip; } static float GetFogStart(void) { return m_fCurrentFogStart; } diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index 72fca542..0ed7876a 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -79,7 +79,7 @@ CBoat::CBoat(int mi, uint8 owner) : CVehicle(owner) bIsInWater = true; - unk1 = 0.0f; + m_phys_unused1 = 0.0f; m_bIsAnchored = true; m_fOrientation = INVALID_ORIENTATION; bTouchingWater = true; From e858314a9f1c0adb0a8c2ec2dd1536e111932650 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 22 May 2020 18:00:18 +0300 Subject: [PATCH 029/133] OpenAL configs --- .appveyor.yml | 2 ++ premake5.lua | 24 +++++++++++++++++++----- src/audio/oal/channel.cpp | 4 ++-- src/audio/oal/channel.h | 1 - src/audio/oal/oal_utils.cpp | 1 + src/audio/oal/oal_utils.h | 1 - src/audio/oal/stream.cpp | 8 ++++---- src/audio/oal/stream.h | 1 - src/core/config.h | 5 ----- 9 files changed, 28 insertions(+), 19 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 20adee80..05604e2c 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -6,6 +6,8 @@ configuration: platform: - win-x86-librw_d3d9-mss - win-x86-librw_gl3_glfw-mss +- win-x86-librw_d3d9-oal +- win-x86-librw_gl3_glfw-oal environment: APPVEYOR_SAVE_CACHE_ON_ERROR: true GLEW_VER: "2.1.0" diff --git a/premake5.lua b/premake5.lua index c8494884..79b8db64 100644 --- a/premake5.lua +++ b/premake5.lua @@ -51,6 +51,9 @@ workspace "re3" "win-x86-RW33_d3d8-mss", "win-x86-librw_d3d9-mss", "win-x86-librw_gl3_glfw-mss", + "win-x86-RW33_d3d8-oal", + "win-x86-librw_d3d9-oal", + "win-x86-librw_gl3_glfw-oal", } filter { "system:linux" } @@ -183,11 +186,23 @@ project "re3" includedirs { "src/extras" } includedirs { "eax" } - includedirs { "milessdk/include" } includedirs { "eax" } - - libdirs { "milessdk/lib" } + filter "platforms:*mss" + defines { "AUIOD_MSS" } + includedirs { "milessdk/include" } + libdirs { "milessdk/lib" } + + filter "platforms:*oal" + defines { "AUIOD_OAL" } + includedirs { "openal-soft/include" } + includedirs { "libsndfile/include" } + includedirs { "mpg123/include" } + libdirs { "openal-soft/libs/Win32" } + libdirs { "libsndfile/lib" } + libdirs { "mpg123/lib" } + + filter {} if(os.getenv("GTA_III_RE_DIR")) then setpaths("$(GTA_III_RE_DIR)/", "%(cfg.buildtarget.name)", "") end @@ -199,8 +214,7 @@ project "re3" characterset ("MBCS") targetextension ".exe" - filter "platforms:linux*" - defines { "OPENAL" } + filter "platforms:linux*oal" links { "openal", "mpg123", "sndfile", "pthread" } filter "platforms:*RW33*" diff --git a/src/audio/oal/channel.cpp b/src/audio/oal/channel.cpp index 6fe1d856..731e3581 100644 --- a/src/audio/oal/channel.cpp +++ b/src/audio/oal/channel.cpp @@ -1,7 +1,7 @@ -#include "channel.h" +#include "common.h" #ifdef AUDIO_OAL -#include "common.h" +#include "channel.h" #include "sampman.h" #ifndef _WIN32 diff --git a/src/audio/oal/channel.h b/src/audio/oal/channel.h index 4dd09ca1..0c86bdc6 100644 --- a/src/audio/oal/channel.h +++ b/src/audio/oal/channel.h @@ -1,5 +1,4 @@ #pragma once -#include "common.h" #ifdef AUDIO_OAL #include "oal/oal_utils.h" diff --git a/src/audio/oal/oal_utils.cpp b/src/audio/oal/oal_utils.cpp index 4119672f..e16de572 100644 --- a/src/audio/oal/oal_utils.cpp +++ b/src/audio/oal/oal_utils.cpp @@ -1,3 +1,4 @@ +#include "common.h" #include "oal_utils.h" #ifdef AUDIO_OAL diff --git a/src/audio/oal/oal_utils.h b/src/audio/oal/oal_utils.h index af45a944..b89ccf36 100644 --- a/src/audio/oal/oal_utils.h +++ b/src/audio/oal/oal_utils.h @@ -1,5 +1,4 @@ #pragma once -#include "common.h" #ifdef AUDIO_OAL #include "eax.h" diff --git a/src/audio/oal/stream.cpp b/src/audio/oal/stream.cpp index 5a9c7d7d..34518f54 100644 --- a/src/audio/oal/stream.cpp +++ b/src/audio/oal/stream.cpp @@ -1,11 +1,9 @@ -#include "stream.h" +#include "common.h" #ifdef AUDIO_OAL -#include "common.h" +#include "stream.h" #include "sampman.h" -#include -#include #ifdef _WIN32 typedef long ssize_t; #pragma comment( lib, "libsndfile-1.lib" ) @@ -13,6 +11,8 @@ typedef long ssize_t; #else #include "crossplatform.h" #endif +#include +#include class CSndFile : public IDecoder { diff --git a/src/audio/oal/stream.h b/src/audio/oal/stream.h index f1e5f458..456c080a 100644 --- a/src/audio/oal/stream.h +++ b/src/audio/oal/stream.h @@ -1,5 +1,4 @@ #pragma once -#include "common.h" #ifdef AUDIO_OAL #include diff --git a/src/core/config.h b/src/core/config.h index 40882128..f43067d7 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -196,11 +196,6 @@ enum Config { #define USE_TXD_CDIMAGE // generate and load textures from txd.img #define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number //#define USE_TEXTURE_POOL -#ifdef _WIN32 -#define AUDIO_MSS -#else -#define AUDIO_OAL -#endif // Particle //#define PC_PARTICLE From 38a09c6e9b4a631aae699a8f3de6c0df33c021e5 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 22 May 2020 21:00:59 +0300 Subject: [PATCH 030/133] Fix linux build --- .appveyor.yml | 2 -- eax/eax.h | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 05604e2c..20adee80 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -6,8 +6,6 @@ configuration: platform: - win-x86-librw_d3d9-mss - win-x86-librw_gl3_glfw-mss -- win-x86-librw_d3d9-oal -- win-x86-librw_gl3_glfw-oal environment: APPVEYOR_SAVE_CACHE_ON_ERROR: true GLEW_VER: "2.1.0" diff --git a/eax/eax.h b/eax/eax.h index 0e2201db..503090d2 100644 --- a/eax/eax.h +++ b/eax/eax.h @@ -12,7 +12,7 @@ extern "C" { #endif // __cplusplus -#ifndef OPENAL +#ifndef AUDIO_OAL #include /* @@ -49,7 +49,7 @@ extern "C" { typedef void (CDECL *LPGETCURRENTVERSION)(LPDWORD major, LPDWORD minor); -#else // OPENAL +#else // AUDIO_OAL #ifndef _WIN32 #include #include From efe52dbbbc504acdf87573f23653d4a8ec295c46 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 22 May 2020 21:14:38 +0300 Subject: [PATCH 031/133] I am an idiot --- eax/eax.h | 4 ---- premake5.lua | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/eax/eax.h b/eax/eax.h index 503090d2..b2210936 100644 --- a/eax/eax.h +++ b/eax/eax.h @@ -50,12 +50,8 @@ extern "C" { #else // AUDIO_OAL -#ifndef _WIN32 #include #include -#else - #include -#endif #ifndef GUID_DEFINED #define GUID_DEFINED diff --git a/premake5.lua b/premake5.lua index 79b8db64..75b1b979 100644 --- a/premake5.lua +++ b/premake5.lua @@ -189,12 +189,12 @@ project "re3" includedirs { "eax" } filter "platforms:*mss" - defines { "AUIOD_MSS" } + defines { "AUDIO_MSS" } includedirs { "milessdk/include" } libdirs { "milessdk/lib" } filter "platforms:*oal" - defines { "AUIOD_OAL" } + defines { "AUDIO_OAL" } includedirs { "openal-soft/include" } includedirs { "libsndfile/include" } includedirs { "mpg123/include" } From a9f332f2d96b6a8b6f83b5da5c1c320d2ff4eab2 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 22 May 2020 21:26:31 +0300 Subject: [PATCH 032/133] Possibly fix travis --- src/audio/oal/stream.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/audio/oal/stream.cpp b/src/audio/oal/stream.cpp index 34518f54..c70cd2c1 100644 --- a/src/audio/oal/stream.cpp +++ b/src/audio/oal/stream.cpp @@ -8,11 +8,12 @@ typedef long ssize_t; #pragma comment( lib, "libsndfile-1.lib" ) #pragma comment( lib, "libmpg123.lib" ) -#else -#include "crossplatform.h" #endif #include #include +#ifndef _WIN32 +#include "crossplatform.h" +#endif class CSndFile : public IDecoder { From c993e99e0086aae50357c8ffa180de54396ede92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Fri, 22 May 2020 22:49:54 +0300 Subject: [PATCH 033/133] Fix linux build --- premake5.lua | 14 ++++++++------ src/audio/oal/stream.cpp | 5 ++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/premake5.lua b/premake5.lua index 75b1b979..fd6da6ac 100644 --- a/premake5.lua +++ b/premake5.lua @@ -195,12 +195,6 @@ project "re3" filter "platforms:*oal" defines { "AUDIO_OAL" } - includedirs { "openal-soft/include" } - includedirs { "libsndfile/include" } - includedirs { "mpg123/include" } - libdirs { "openal-soft/libs/Win32" } - libdirs { "libsndfile/lib" } - libdirs { "mpg123/lib" } filter {} if(os.getenv("GTA_III_RE_DIR")) then @@ -214,6 +208,14 @@ project "re3" characterset ("MBCS") targetextension ".exe" + filter "platforms:win*oal" + includedirs { "openal-soft/include" } + includedirs { "libsndfile/include" } + includedirs { "mpg123/include" } + libdirs { "openal-soft/libs/Win32" } + libdirs { "libsndfile/lib" } + libdirs { "mpg123/lib" } + filter "platforms:linux*oal" links { "openal", "mpg123", "sndfile", "pthread" } diff --git a/src/audio/oal/stream.cpp b/src/audio/oal/stream.cpp index c70cd2c1..34518f54 100644 --- a/src/audio/oal/stream.cpp +++ b/src/audio/oal/stream.cpp @@ -8,12 +8,11 @@ typedef long ssize_t; #pragma comment( lib, "libsndfile-1.lib" ) #pragma comment( lib, "libmpg123.lib" ) +#else +#include "crossplatform.h" #endif #include #include -#ifndef _WIN32 -#include "crossplatform.h" -#endif class CSndFile : public IDecoder { From e18eb0ce012282362203fc93e644914af1eaf51d Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sat, 23 May 2020 00:50:15 +0300 Subject: [PATCH 034/133] script fix --- src/control/Script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 68b396f3..082beda9 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -4333,7 +4333,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) } case COMMAND_SET_CAR_HEAVY: { - CollectParameters(&m_nIp, 1); + CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); assert(pVehicle); pVehicle->bIsHeavy = (ScriptParams[1] != 0); From e2d3ef449c0385acf36ba77ce2c9da62b88ea3a3 Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 23 May 2020 11:34:40 +0200 Subject: [PATCH 035/133] skeleton typos --- src/core/main.cpp | 8 ++++---- src/skel/glfw/glfw.cpp | 8 ++++---- src/skel/platform.h | 2 +- src/skel/skeleton.cpp | 14 +++++++------- src/skel/skeleton.h | 18 +++++++++--------- src/skel/win/win.cpp | 8 ++++---- src/vehicles/Vehicle.h | 3 --- 7 files changed, 29 insertions(+), 32 deletions(-) diff --git a/src/core/main.cpp b/src/core/main.cpp index 1ea8dc7f..acdf6f4e 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -328,7 +328,7 @@ PluginAttach(void) static RwBool Initialise3D(void *param) { - if (RsRwInitialise(param)) + if (RsRwInitialize(param)) { #ifdef DEBUGMENU DebugMenuInit(); @@ -1146,10 +1146,10 @@ AppEventHandler(RsEvent event, void *param) { switch( event ) { - case rsINITIALISE: + case rsINITIALIZE: { CGame::InitialiseOnceBeforeRW(); - return RsInitialise() ? rsEVENTPROCESSED : rsEVENTERROR; + return RsInitialize() ? rsEVENTPROCESSED : rsEVENTERROR; } case rsCAMERASIZE: @@ -1161,7 +1161,7 @@ AppEventHandler(RsEvent event, void *param) return rsEVENTPROCESSED; } - case rsRWINITIALISE: + case rsRWINITIALIZE: { return Initialise3D(param) ? rsEVENTPROCESSED : rsEVENTERROR; } diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index fc23e900..21115585 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -274,7 +274,7 @@ psNativeTextureSupport(void) ***************************************************************************** */ RwBool -psInitialise(void) +psInitialize(void) { PsGlobal.lastMousePos.x = PsGlobal.lastMousePos.y = 0.0f; @@ -789,7 +789,7 @@ RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode) useDefault = TRUE; - if ( RsEventHandler(rsRWINITIALISE, &openParams) == rsEVENTERROR ) + if ( RsEventHandler(rsRWINITIALIZE, &openParams) == rsEVENTERROR ) return FALSE; RwInitialised = TRUE; @@ -1312,7 +1312,7 @@ main(int argc, char *argv[]) * Initialize the platform independent data. * This will in turn initialize the platform specific data... */ - if( RsEventHandler(rsINITIALISE, nil) == rsEVENTERROR ) + if( RsEventHandler(rsINITIALIZE, nil) == rsEVENTERROR ) { return FALSE; } @@ -1355,7 +1355,7 @@ main(int argc, char *argv[]) /* * Initialize the 3D (RenderWare) components of the app... */ - if( rsEVENTERROR == RsEventHandler(rsRWINITIALISE, &openParams) ) + if( rsEVENTERROR == RsEventHandler(rsRWINITIALIZE, &openParams) ) { RsEventHandler(rsTERMINATE, nil); diff --git a/src/skel/platform.h b/src/skel/platform.h index 65e20673..cbb1be28 100644 --- a/src/skel/platform.h +++ b/src/skel/platform.h @@ -15,7 +15,7 @@ extern RwUInt32 psTimer(void); extern double psTimer(void); #endif -extern RwBool psInitialise(void); +extern RwBool psInitialize(void); extern void psTerminate(void); extern void psCameraShowRaster(RwCamera *camera); diff --git a/src/skel/skeleton.cpp b/src/skel/skeleton.cpp index 5191eda7..8191107e 100644 --- a/src/skel/skeleton.cpp +++ b/src/skel/skeleton.cpp @@ -246,8 +246,8 @@ RsEventHandler(RsEvent event, void *param) result = (rsEVENTPROCESSED); break; - case rsRWINITIALISE: - result = (RsRwInitialise(param) ? + case rsRWINITIALIZE: + result = (RsRwInitialize(param) ? rsEVENTPROCESSED : rsEVENTERROR); break; @@ -256,9 +256,9 @@ RsEventHandler(RsEvent event, void *param) result = (rsEVENTPROCESSED); break; - case rsINITIALISE: + case rsINITIALIZE: result = - (RsInitialise()? rsEVENTPROCESSED : rsEVENTERROR); + (RsInitialize()? rsEVENTPROCESSED : rsEVENTERROR); break; default: @@ -294,7 +294,7 @@ RsRwTerminate(void) ***************************************************************************** */ RwBool -RsRwInitialise(void *displayID) +RsRwInitialize(void *displayID) { RwEngineOpenParams openParams; @@ -383,7 +383,7 @@ RsTerminate(void) ***************************************************************************** */ RwBool -RsInitialise(void) +RsInitialize(void) { /* * Initialize Platform independent data... @@ -415,7 +415,7 @@ RsInitialise(void) RsGlobal.pad.inputEventHandler = nil; RsGlobal.pad.used = FALSE; - result = psInitialise(); + result = psInitialize(); return result; } diff --git a/src/skel/skeleton.h b/src/skel/skeleton.h index 8303bd9a..b5ea5abf 100644 --- a/src/skel/skeleton.h +++ b/src/skel/skeleton.h @@ -61,10 +61,10 @@ enum RsEvent _rs_18, _rs_19, _rs_20, - rsRWINITIALISE, + rsRWINITIALIZE, rsRWTERMINATE, rsSELECTDEVICE, - rsINITIALISE, + rsINITIALIZE, rsTERMINATE, rsIDLE, rsFRONTENDIDLE, @@ -241,19 +241,19 @@ extern RsEventStatus RsEventHandler(RsEvent event, void *param); extern RsEventStatus RsKeyboardEventHandler(RsEvent event, void *param); extern RsEventStatus RsPadEventHandler(RsEvent event, void *param); -extern RwBool -RsInitialise(void); +extern RwBool +RsInitialize(void); -extern RwBool +extern RwBool RsRegisterImageLoader(void); -extern RwBool -RsRwInitialise(void *param); +extern RwBool +RsRwInitialize(void *param); -extern RwBool +extern RwBool RsSelectDevice(void); -extern RwBool +extern RwBool RsInputDeviceAttach(RsInputDeviceType inputDevice, RsInputEventHandler inputEventHandler); diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 9a885818..83860f04 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -584,7 +584,7 @@ void _psPrintCpuInfo() ***************************************************************************** */ RwBool -psInitialise(void) +psInitialize(void) { PsGlobal.lastMousePos.x = PsGlobal.lastMousePos.y = 0.0f; @@ -1525,7 +1525,7 @@ RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode) useDefault = TRUE; - if ( RsEventHandler(rsRWINITIALISE, PSGLOBAL(window)) == rsEVENTERROR ) + if ( RsEventHandler(rsRWINITIALIZE, PSGLOBAL(window)) == rsEVENTERROR ) return FALSE; RwInitialised = TRUE; @@ -1896,7 +1896,7 @@ WinMain(HINSTANCE instance, * Initialize the platform independent data. * This will in turn initialize the platform specific data... */ - if( RsEventHandler(rsINITIALISE, nil) == rsEVENTERROR ) + if( RsEventHandler(rsINITIALIZE, nil) == rsEVENTERROR ) { return FALSE; } @@ -1962,7 +1962,7 @@ WinMain(HINSTANCE instance, /* * Initialize the 3D (RenderWare) components of the app... */ - if( rsEVENTERROR == RsEventHandler(rsRWINITIALISE, PSGLOBAL(window)) ) + if( rsEVENTERROR == RsEventHandler(rsRWINITIALIZE, PSGLOBAL(window)) ) { DestroyWindow(PSGLOBAL(window)); diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index f7205c7d..06bdf714 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -109,9 +109,6 @@ enum eFlightModel FLIGHT_MODEL_SEAPLANE }; -// Or Weapon.h? -void FireOneInstantHitRound(CVector *shotSource, CVector *shotTarget, int32 damage); - class CVehicle : public CPhysical { public: From 100e59886d18db04efe5455cc35c056b69c5d1d3 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sat, 23 May 2020 16:14:39 +0300 Subject: [PATCH 036/133] cranes fix --- src/vehicles/Cranes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vehicles/Cranes.cpp b/src/vehicles/Cranes.cpp index 9c8f9fda..936a4510 100644 --- a/src/vehicles/Cranes.cpp +++ b/src/vehicles/Cranes.cpp @@ -184,7 +184,7 @@ bool CCranes::IsThisCarPickedUp(float X, float Y, CVehicle* pVehicle) result = true; } } - return true; + return result; } void CCranes::UpdateCranes(void) From f2790f610b370a3c693e6d957e7f8907d12204e6 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 23 May 2020 22:48:50 +0300 Subject: [PATCH 037/133] More audio cleanup --- src/audio/AudioLogic.cpp | 638 ++++++++++++++++++++------------------- src/audio/AudioManager.h | 2 +- 2 files changed, 322 insertions(+), 318 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 6f1a3432..07f80d72 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -52,8 +52,8 @@ uint32 gHomeNextTime; uint32 gCellNextTime; uint32 gNextCryTime; -enum PLAY_STATUS : uint8 { PLAY_STATUS_STOPPED = 0, PLAY_STATUS_PLAYING = 1, PLAY_STATUS_FINISHED = 2 }; -enum LOADING_STATUS : uint8 { LOADING_STATUS_NOT_LOADED = 0, LOADING_STATUS_LOADED = 1 }; +enum PLAY_STATUS : uint8 { PLAY_STATUS_STOPPED = 0, PLAY_STATUS_PLAYING, PLAY_STATUS_FINISHED }; +enum LOADING_STATUS : uint8 { LOADING_STATUS_NOT_LOADED = 0, LOADING_STATUS_LOADED, LOADING_STATUS_FAILED }; void cAudioManager::PreInitialiseGameSpecificSetup() const @@ -98,7 +98,7 @@ cAudioManager::PostInitialiseGameSpecificSetup() m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_STOPPED; m_sMissionAudio.field_22 = 0; m_sMissionAudio.m_bIsPlayed = false; - m_sMissionAudio.m_bPredefinedProperties = 1; + m_sMissionAudio.m_bPredefinedProperties = true; m_sMissionAudio.m_nMissionAudioCounter = 0; ResetAudioLogicTimers(CTimer::GetTimeInMilliseconds()); } @@ -396,6 +396,14 @@ enum eVehicleModel { MAX_CARS }; +enum +{ + DOOR_TYPE_OLD = 0, + DOOR_TYPE_NEW, + DOOR_TYPE_TRUCK, + DOOR_TYPE_AIRBREAK, +}; + struct tVehicleSampleData { eSfxSample m_nAccelerationSampleIndex; @@ -407,76 +415,76 @@ struct tVehicleSampleData { uint8 m_bDoorType; }; -const tVehicleSampleData aVehicleSettings[MAX_CARS] = {{SFX_CAR_REV_2, 2, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 11487, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_8, 8, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_ALARM_1, 10928, 1}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 9935, 2}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 12893, SFX_CAR_ALARM_1, 8941, 0}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 10706, SFX_CAR_ALARM_1, 11922, 1}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 7948, 2}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_POLICE_SIREN_SLOW, 11556, 2}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 31478, SFX_CAR_ALARM_1, 8941, 2}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_BMW328, 9538, SFX_CAR_ALARM_1, 12220, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_3, 3, SFX_CAR_HORN_BMW328, 12017, SFX_CAR_ALARM_1, 9935, 1}, - {SFX_CAR_REV_2, 2, SFX_CAR_HORN_JEEP, 22295, SFX_CAR_ALARM_1, 12200, 1}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_ALARM_1, 13400, 1}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 18286, SFX_CAR_ALARM_1, 9935, 2}, - {SFX_CAR_REV_3, 3, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_ALARM_1, 13600, 1}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 22295, SFX_AMBULANCE_SIREN_SLOW, 8795, 2}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_PORSCHE, 9271, SFX_POLICE_SIREN_SLOW, 16168, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 12170, SFX_CAR_ALARM_1, 8000, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_BUS2, 12345, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_2, 2, SFX_CAR_HORN_BMW328, 10796, SFX_CAR_ALARM_1, 8543, 1}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_PORSCHE, 9271, SFX_CAR_ALARM_1, 9935, 1}, - {SFX_CAR_REV_2, 2, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_ALARM_1, 9935, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_PICKUP, 11025, SFX_ICE_CREAM_TUNE, 11025, 0}, - {SFX_CAR_REV_7, 7, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 10000, 0}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 10706, SFX_POLICE_SIREN_SLOW, 13596, 1}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 17260, SFX_POLICE_SIREN_SLOW, 13000, 2}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_ALARM_1, 9935, 2}, - {SFX_CAR_REV_8, 8, SFX_CAR_HORN_PORSCHE, 10400, SFX_CAR_ALARM_1, 10123, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 26513, SFX_POLICE_SIREN_SLOW, 13596, 0}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_BUS2, 11652, SFX_CAR_ALARM_1, 10554, 3}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 8000, 2}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_ALARM_1, 9935, 2}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 9935, 3}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CESNA_IDLE, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_BUS, 16291, SFX_CAR_ALARM_1, 7500, 3}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10233, SFX_CAR_ALARM_1, 8935, 0}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_ALARM_1, 8935, 0}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_PICKUP, 2000, SFX_CAR_ALARM_1, 17000, 0}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 9003, SFX_CAR_ALARM_1, 9935, 1}, - {SFX_CAR_REV_2, 2, SFX_CAR_HORN_PORSCHE, 12375, SFX_CAR_ALARM_1, 9935, 1}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BUS2, 15554, SFX_CAR_ALARM_1, 9935, 1}, - {SFX_CAR_REV_7, 7, SFX_CAR_HORN_BUS2, 13857, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_7, 7, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 2}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 20143, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9000, 0}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_ALARM_1, 9935, 2}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 18286, SFX_CAR_ALARM_1, 9935, 2}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_ALARM_1, 13400, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, 0}}; +const tVehicleSampleData aVehicleSettings[MAX_CARS] = {{SFX_CAR_REV_2, 2, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 11487, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_8, 8, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_ALARM_1, 10928, DOOR_TYPE_NEW}, + {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 12893, SFX_CAR_ALARM_1, 8941, DOOR_TYPE_OLD}, + {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 10706, SFX_CAR_ALARM_1, 11922, DOOR_TYPE_NEW}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 7948, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_POLICE_SIREN_SLOW, 11556, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 31478, SFX_CAR_ALARM_1, 8941, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_BMW328, 9538, SFX_CAR_ALARM_1, 12220, DOOR_TYPE_NEW}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_3, 3, SFX_CAR_HORN_BMW328, 12017, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, + {SFX_CAR_REV_2, 2, SFX_CAR_HORN_JEEP, 22295, SFX_CAR_ALARM_1, 12200, DOOR_TYPE_NEW}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_ALARM_1, 13400, DOOR_TYPE_NEW}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 18286, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_3, 3, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_ALARM_1, 13600, DOOR_TYPE_NEW}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 22295, SFX_AMBULANCE_SIREN_SLOW, 8795, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_5, 5, SFX_CAR_HORN_PORSCHE, 9271, SFX_POLICE_SIREN_SLOW, 16168, DOOR_TYPE_NEW}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 12170, SFX_CAR_ALARM_1, 8000, DOOR_TYPE_NEW}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_BUS2, 12345, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_2, 2, SFX_CAR_HORN_BMW328, 10796, SFX_CAR_ALARM_1, 8543, DOOR_TYPE_NEW}, + {SFX_CAR_REV_5, 5, SFX_CAR_HORN_PORSCHE, 9271, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, + {SFX_CAR_REV_2, 2, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_PICKUP, 11025, SFX_ICE_CREAM_TUNE, 11025, DOOR_TYPE_OLD}, + {SFX_CAR_REV_7, 7, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 10000, DOOR_TYPE_OLD}, + {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 10706, SFX_POLICE_SIREN_SLOW, 13596, DOOR_TYPE_NEW}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 17260, SFX_POLICE_SIREN_SLOW, 13000, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_8, 8, SFX_CAR_HORN_PORSCHE, 10400, SFX_CAR_ALARM_1, 10123, DOOR_TYPE_NEW}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 26513, SFX_POLICE_SIREN_SLOW, 13596, DOOR_TYPE_OLD}, + {SFX_CAR_REV_6, 6, SFX_CAR_HORN_BUS2, 11652, SFX_CAR_ALARM_1, 10554, DOOR_TYPE_AIRBREAK}, + {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 8000, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_AIRBREAK}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CESNA_IDLE, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_6, 6, SFX_CAR_HORN_BUS, 16291, SFX_CAR_ALARM_1, 7500, DOOR_TYPE_AIRBREAK}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10233, SFX_CAR_ALARM_1, 8935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_ALARM_1, 8935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_PICKUP, 2000, SFX_CAR_ALARM_1, 17000, DOOR_TYPE_OLD}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 9003, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, + {SFX_CAR_REV_2, 2, SFX_CAR_HORN_PORSCHE, 12375, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, + {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BUS2, 15554, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, + {SFX_CAR_REV_7, 7, SFX_CAR_HORN_BUS2, 13857, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_7, 7, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 20143, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9000, DOOR_TYPE_OLD}, + {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 18286, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_ALARM_1, 13400, DOOR_TYPE_NEW}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}}; bool bPlayerJustEnteredCar; @@ -898,15 +906,15 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params) } break; case 'F': - if (automobile->m_aWheelState[0] == WHEEL_STATE_SPINNING) + if (automobile->m_aWheelState[VEHWHEEL_FRONT_LEFT] == WHEEL_STATE_SPINNING) traction += 0.1f; - if (automobile->m_aWheelState[2] == WHEEL_STATE_SPINNING) + if (automobile->m_aWheelState[VEHWHEEL_REAR_LEFT] == WHEEL_STATE_SPINNING) traction += 0.1f; break; case 'R': - if (automobile->m_aWheelState[1] == WHEEL_STATE_SPINNING) + if (automobile->m_aWheelState[VEHWHEEL_FRONT_RIGHT] == WHEEL_STATE_SPINNING) traction += 0.1f; - if (automobile->m_aWheelState[3] == WHEEL_STATE_SPINNING) + if (automobile->m_aWheelState[VEHWHEEL_REAR_RIGHT] == WHEEL_STATE_SPINNING) traction += 0.1f; break; } @@ -1072,7 +1080,7 @@ cAudioManager::ProcessCesna(cVehicleParams *params) } } else if (params->m_nIndex == DODO) { AddPlayerCarSample(105, 17000, SFX_CESNA_IDLE, 0, 52, 1); - } else if (params->m_fDistance < 40000.f) { + } else if (params->m_fDistance < SQR(200)) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, 200.f, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume) { @@ -1094,7 +1102,7 @@ cAudioManager::ProcessCesna(cVehicleParams *params) m_sQueueSample.m_bRequireReflection = false; AddSampleToRequestedQueue(); } - if (params->m_fDistance < 8100.f) { + if (params->m_fDistance < SQR(90)) { m_sQueueSample.m_nVolume = ComputeVolume(80, 90.f, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume) { m_sQueueSample.m_nCounter = 2; @@ -1140,7 +1148,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * uint8 engineSoundType; int32 accelerateState; bool channelUsed; - char lostTraction; + bool lostTraction; bool processedAccelSampleStopped; uint8 currentGear; float gasPedalAudio; @@ -1154,8 +1162,8 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * static int32 nCruising = 0; static bool bAccelSampleStopped = true; - lostTraction = 0; - processedAccelSampleStopped = 0; + lostTraction = false; + processedAccelSampleStopped = false; if (bPlayerJustEnteredCar) { bAccelSampleStopped = true; bPlayerJustEnteredCar = false; @@ -1187,13 +1195,13 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * ++wheelInUseCounter; } if (wheelInUseCounter > 2) - lostTraction = 1; + lostTraction = true; } else if (transmission->nDriveType == 'F') { if ((automobile->m_aWheelState[0] || automobile->m_aWheelState[2]) && (automobile->m_aWheelState[1] || automobile->m_aWheelState[3])) { - lostTraction = 1; + lostTraction = true; } } else if (transmission->nDriveType == 'R' && (automobile->m_aWheelState[1] || automobile->m_aWheelState[3])) { - lostTraction = 1; + lostTraction = true; } if (0.0f != velocityChange) { time = params->m_pVehicle->m_vecMoveSpeed.z / velocityChange; @@ -1290,7 +1298,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * gearNr = 1; CurrentPretendGear = gearNr; } - processedAccelSampleStopped = 1; + processedAccelSampleStopped = true; bAccelSampleStopped = false; } if (channelUsed) { @@ -1671,7 +1679,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams *params) if (veh->bEngineOn && veh->m_fGasPedal < 0.0f) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(60, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 12; m_sQueueSample.m_nSampleIndex = SFX_REVERSE_WARNING; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -1748,7 +1756,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams *params) CAutomobile *automobile; uint8 rand; - if (params->m_fDistance > 900.0f) + if (params->m_fDistance > SQR(30)) return false; automobile = (CAutomobile *)params->m_pVehicle; if (!automobile->bEngineOn) @@ -1761,7 +1769,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams *params) CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); rand = m_anRandomTable[0] % 10 + 70; m_sQueueSample.m_nVolume = ComputeVolume(rand, 30.0f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 13; m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AIR_BRAKES); @@ -1819,7 +1827,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params) } CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, engineDamageIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 28; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_bIs2D = false; @@ -1904,18 +1912,19 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params) maxDist = SQR(SOUND_INTENSITY); emittingVol = m_anRandomTable[2] % 5 + 122; switch (aVehicleSettings[params->m_nIndex].m_bDoorType) { - case 0: + case DOOR_TYPE_OLD: m_sQueueSample.m_nSampleIndex = SFX_OLD_CAR_DOOR_CLOSE; break; - case 2: - m_sQueueSample.m_nSampleIndex = SFX_TRUCK_DOOR_CLOSE; - break; - case 3: - m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES; - break; + case DOOR_TYPE_NEW: default: m_sQueueSample.m_nSampleIndex = SFX_NEW_CAR_DOOR_CLOSE; break; + case DOOR_TYPE_TRUCK: + m_sQueueSample.m_nSampleIndex = SFX_TRUCK_DOOR_CLOSE; + break; + case DOOR_TYPE_AIRBREAK: + m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES; + break; } m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] + 22; @@ -1937,18 +1946,19 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params) maxDist = SQR(SOUND_INTENSITY); emittingVol = m_anRandomTable[1] % 10 + 117; switch (aVehicleSettings[params->m_nIndex].m_bDoorType) { - case 0: + case DOOR_TYPE_OLD: m_sQueueSample.m_nSampleIndex = SFX_OLD_CAR_DOOR_OPEN; break; - case 2: - m_sQueueSample.m_nSampleIndex = SFX_TRUCK_DOOR_OPEN; - break; - case 3: - m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES; - break; + case DOOR_TYPE_NEW: default: m_sQueueSample.m_nSampleIndex = SFX_NEW_CAR_DOOR_OPEN; break; + case DOOR_TYPE_TRUCK: + m_sQueueSample.m_nSampleIndex = SFX_TRUCK_DOOR_OPEN; + break; + case DOOR_TYPE_AIRBREAK: + m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES; + break; } m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] + 10; @@ -1983,7 +1993,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params) iWheelIndex = 82; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TYRE_BUMP); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); - if (params->m_nIndex == 41) { + if (params->m_nIndex == RCBANDIT) { m_sQueueSample.m_nFrequency *= 2; emittingVol /= 2; } @@ -2516,7 +2526,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams *params) int32 vol; float multiplier; - if (params->m_fDistance > 2500.f) + if (params->m_fDistance > SQR(50)) return false; velocityChange = Abs(params->m_fVelocityChange); @@ -2528,7 +2538,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams *params) CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); vol = (30.f * multiplier); m_sQueueSample.m_nVolume = ComputeVolume(vol, 50.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 38; m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -2567,7 +2577,7 @@ cAudioManager::ProcessHelicopter(cVehicleParams *params) int32 emittingVol; static const tHelicopterSampleData gHeliSfxRanges[3] = {{400.f, 380.f, 100}, {100.f, 70.f, MAX_VOLUME}, {60.f, 30.f, MAX_VOLUME}}; - if (gHeliSfxRanges[0].m_fMaxDistance * gHeliSfxRanges[0].m_fMaxDistance <= params->m_fDistance) + if (SQR(gHeliSfxRanges[0].m_fMaxDistance) <= params->m_fDistance) return false; CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); @@ -2584,7 +2594,7 @@ cAudioManager::ProcessHelicopter(cVehicleParams *params) emittingVol = gHeliSfxRanges[i].m_bBaseVolume; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, gHeliSfxRanges[i].m_fMaxDistance, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = i + 65; m_sQueueSample.m_nSampleIndex = i + SFX_HELI_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -2639,7 +2649,7 @@ cAudioManager::ProcessJumbo(cVehicleParams *params) CPlane *plane; float position; - if (params->m_fDistance < 193600.0f) { + if (params->m_fDistance < SQR(440)) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); plane = (CPlane *)params->m_pVehicle; DoJumboVolOffset(); @@ -2948,7 +2958,7 @@ cAudioManager::ProcessPedHeadphones(cPedParams *params) CAutomobile *veh; uint8 emittingVol; - if (params->m_fDistance < 49.f) { + if (params->m_fDistance < SQR(7)) { ped = params->m_pPed; if (!ped->bIsAimingGun || ped->m_bodyPartBleeding != PED_HEAD) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); @@ -2956,7 +2966,7 @@ cAudioManager::ProcessPedHeadphones(cPedParams *params) emittingVol = 10; veh = (CAutomobile *)ped->m_pMyVehicle; if (veh && veh->IsCar()) { - for (int32 i = 2; i < ARRAY_SIZE(veh->Doors); i++) { + for (int32 i = DOOR_FRONT_LEFT; i < ARRAY_SIZE(veh->Doors); i++) { if (!veh->IsDoorClosed((eDoors)i) || veh->IsDoorMissing((eDoors)i)) { emittingVol = 42; break; @@ -3438,7 +3448,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = 60.0f; - maxDist = 3600.f; + maxDist = SQR(60); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; @@ -3499,7 +3509,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = 60.0f; - maxDist = 3600.f; + maxDist = SQR(60); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; @@ -3522,7 +3532,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = 90.0f; - maxDist = 8100.f; + maxDist = SQR(90); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; @@ -3544,7 +3554,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = 60.0f; - maxDist = 3600.f; + maxDist = SQR(60); m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); @@ -3647,7 +3657,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = 60.0f; - maxDist = 3600.f; + maxDist = SQR(60); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; @@ -3684,7 +3694,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = 40.0f; - maxDist = 1600.f; + maxDist = SQR(40); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; emittingVol = m_anRandomTable[2] % 30 + 70; @@ -3707,7 +3717,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) if (m_sQueueSample.m_nVolume) { if (noReflection) { if (0.2f * m_sQueueSample.m_fSoundIntensity <= m_sQueueSample.m_fDistance) { - noReflection = 0; + noReflection = false; } else { m_sQueueSample.m_bIs2D = true; m_sQueueSample.m_nOffset = 0; @@ -6476,7 +6486,7 @@ cAudioManager::ProcessWaterCannon(int32) if (distSquared < SOUND_INTENSITY) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(50, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -6501,8 +6511,8 @@ cAudioManager::ProcessWaterCannon(int32) } #pragma region SCRIPT_OBJECTS -const int scriptObjectIntensityS = 30; -const int scriptObjectIntensityL = 80; +const int SCRIPT_OBJECT_INTENSITY_S = 30; +const int SCRIPT_OBJECT_INTENSITY_L = 80; void cAudioManager::ProcessScriptObject(int32 id) @@ -6773,7 +6783,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) switch (sound) { case SCRIPT_SOUND_PARTY_1_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6783,7 +6793,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_1_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6793,7 +6803,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_2_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_2; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6803,7 +6813,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_2_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_2; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6813,7 +6823,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_3_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_3; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6823,7 +6833,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_3_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_3; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6833,7 +6843,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_4_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_4; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6843,7 +6853,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_4_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_4; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6853,7 +6863,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_5_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_5; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6863,7 +6873,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_5_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_5; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6873,7 +6883,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_6_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_6; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6883,7 +6893,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_6_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_6; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6893,7 +6903,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_7_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_7; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6903,7 +6913,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_7_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_7; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6913,7 +6923,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_8_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_8; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6923,7 +6933,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_8_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_8; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6933,7 +6943,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_9_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_9; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6943,7 +6953,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_9_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_9; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6953,7 +6963,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_10_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_10; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6963,7 +6973,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_10_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_10; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6973,7 +6983,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_11_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_11; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6983,7 +6993,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_11_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_11; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -6993,7 +7003,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_12_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_12; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -7003,7 +7013,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_12_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_12; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -7013,7 +7023,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_13_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_RAGGA; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -7023,7 +7033,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_13_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_RAGGA; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -7033,7 +7043,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_STRIP_CLUB_LOOP_1_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -7043,7 +7053,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_STRIP_CLUB_LOOP_1_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -7053,7 +7063,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_STRIP_CLUB_LOOP_2_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -7063,7 +7073,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_STRIP_CLUB_LOOP_2_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -7081,7 +7091,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) ProcessSawMillScriptObject(sound); return; case SCRIPT_SOUND_38: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_DOG_FOOD_FACTORY; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = 110; @@ -7091,7 +7101,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_39: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_DOG_FOOD_FACTORY; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = 110; @@ -7105,7 +7115,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) ProcessLaunderetteScriptObject(sound); return; case SCRIPT_SOUND_CHINATOWN_RESTAURANT_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_CHINATOWN; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = 110; @@ -7115,7 +7125,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_CHINATOWN_RESTAURANT_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_CHINATOWN; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = 110; @@ -7125,7 +7135,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_CIPRIANI_RESAURANT_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_ITALY; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = 110; @@ -7135,7 +7145,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_CIPRIANI_RESAURANT_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_ITALY; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = 110; @@ -7145,7 +7155,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_46_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = 110; @@ -7155,7 +7165,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_47_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = 110; @@ -7165,7 +7175,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_MARCO_BISTRO_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_2; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = 110; @@ -7175,7 +7185,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_MARCO_BISTRO_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_2; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = 110; @@ -7205,7 +7215,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) ProcessHomeScriptObject(sound); return; case SCRIPT_SOUND_FRANKIE_PIANO: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_PIANO_BAR_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -7215,7 +7225,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_PARTY_1_LOOP: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -7235,7 +7245,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) ProcessPornCinema(sound); return; case SCRIPT_SOUND_BANK_ALARM_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_BANK_ALARM_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = 90; @@ -7245,7 +7255,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_BANK_ALARM_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_BANK_ALARM_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = 90; @@ -7255,7 +7265,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_POLICE_BALL_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -7265,7 +7275,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_POLICE_BALL_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -7275,7 +7285,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -7285,7 +7295,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -7300,7 +7310,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) return; case SCRIPT_SOUND_RAVE_1_LOOP_S: case SCRIPT_SOUND_RAVE_2_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -7311,7 +7321,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) break; case SCRIPT_SOUND_RAVE_1_LOOP_L: case SCRIPT_SOUND_RAVE_2_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -7321,7 +7331,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_RAVE_3_LOOP_S: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -7331,7 +7341,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_fSpeedMultiplier = 2.0f; break; case SCRIPT_SOUND_RAVE_3_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; emittingVolume = MAX_VOLUME; @@ -7358,7 +7368,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_nLoopCount = 0; @@ -7395,7 +7405,7 @@ cAudioManager::ProcessPornCinema(uint8 sound) m_sQueueSample.m_nSampleIndex = SFX_PORN_1_LOOP; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; sample = SFX_PORN_1_GROAN_1; - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; break; case SCRIPT_SOUND_PORN_CINEMA_2_S: m_sQueueSample.m_nSampleIndex = SFX_PORN_2_LOOP; @@ -7407,7 +7417,7 @@ cAudioManager::ProcessPornCinema(uint8 sound) m_sQueueSample.m_nSampleIndex = SFX_PORN_2_LOOP; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; sample = SFX_PORN_2_GROAN_1; - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; break; case SCRIPT_SOUND_PORN_CINEMA_3_S: m_sQueueSample.m_nSampleIndex = SFX_PORN_3_LOOP; @@ -7418,7 +7428,7 @@ cAudioManager::ProcessPornCinema(uint8 sound) case SCRIPT_SOUND_PORN_CINEMA_3_L: m_sQueueSample.m_nSampleIndex = SFX_PORN_3_LOOP; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; sample = SFX_PORN_3_GROAN_1; break; default: @@ -7518,7 +7528,7 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound) switch (sound) { case SCRIPT_SOUND_SAWMILL_LOOP_S: case SCRIPT_SOUND_SAWMILL_LOOP_L: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; break; default: return; @@ -7574,7 +7584,7 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound) switch (sound) { case SCRIPT_SOUND_LAUNDERETTE_LOOP_S: case SCRIPT_SOUND_LAUNDERETTE_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; break; default: return; @@ -7631,7 +7641,7 @@ cAudioManager::ProcessShopScriptObject(uint8 sound) switch (sound) { case SCRIPT_SOUND_SHOP_LOOP_S: case SCRIPT_SOUND_SHOP_LOOP_L: - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; break; default: return; @@ -7692,10 +7702,10 @@ cAudioManager::ProcessAirportScriptObject(uint8 sound) if (time > gAirportNextTime) { switch (sound) { case SCRIPT_SOUND_AIRPORT_LOOP_S: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; break; case SCRIPT_SOUND_AIRPORT_LOOP_L: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; break; default: return; @@ -7704,7 +7714,7 @@ cAudioManager::ProcessAirportScriptObject(uint8 sound) if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] & 3) + SFX_AIRPORT_ANNOUNCEMENT_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); @@ -7737,10 +7747,10 @@ cAudioManager::ProcessCinemaScriptObject(uint8 sound) if (time > gCinemaNextTime) { switch (sound) { case SCRIPT_SOUND_CINEMA_LOOP_S: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; break; case SCRIPT_SOUND_CINEMA_LOOP_L: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; break; default: return; @@ -7786,10 +7796,10 @@ cAudioManager::ProcessDocksScriptObject(uint8 sound) if (time > gDocksNextTime) { switch (sound) { case SCRIPT_SOUND_DOCKS_LOOP_S: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; break; case SCRIPT_SOUND_DOCKS_LOOP_L: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; break; default: return; @@ -7834,10 +7844,10 @@ cAudioManager::ProcessHomeScriptObject(uint8 sound) if (time > gHomeNextTime) { switch (sound) { case SCRIPT_SOUND_HOME_LOOP_S: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; break; case SCRIPT_SOUND_HOME_LOOP_L: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; break; default: return; @@ -7883,10 +7893,10 @@ cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound) if (time > gCellNextTime) { switch (sound) { case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityS; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; break; case SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L: - m_sQueueSample.m_fSoundIntensity = scriptObjectIntensityL; + m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; break; default: return; @@ -7901,7 +7911,7 @@ cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = sampleIndex; emittingVol = m_anRandomTable[0] % 50 + 55; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); @@ -8411,7 +8421,7 @@ cAudioManager::ProcessFireHydrant() if (distSquared < SQR(intensity)) { CalculateDistance(distCalculated, distSquared); m_sQueueSample.m_nVolume = ComputeVolume(40, 35.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -8445,7 +8455,7 @@ cAudioManager::ProcessBridge() if (CBridge::pLiftRoad) { m_sQueueSample.m_vecPos = CBridge::pLiftRoad->GetPosition(); dist = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (dist < 202500.0f) { + if (dist < SQR(450.0f)) { CalculateDistance(distCalculated, dist); switch (CBridge::State) { case STATE_BRIDGE_LOCKED: @@ -8522,25 +8532,19 @@ cAudioManager::ProcessBridgeMotor() void cAudioManager::ProcessBridgeOneShots() { - if (CBridge::State == STATE_LIFT_PART_IS_UP && CBridge::OldState == STATE_LIFT_PART_MOVING_UP) { + if (CBridge::State == STATE_LIFT_PART_IS_UP && CBridge::OldState == STATE_LIFT_PART_MOVING_UP) m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; - } else { - if (CBridge::State == STATE_LIFT_PART_IS_DOWN && CBridge::OldState == STATE_LIFT_PART_MOVING_DOWN) { - m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; - } else { - if (CBridge::State == STATE_LIFT_PART_MOVING_UP && CBridge::OldState == STATE_LIFT_PART_ABOUT_TO_MOVE_UP) { - m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; - } else { - if (CBridge::State == STATE_LIFT_PART_MOVING_DOWN && CBridge::OldState == STATE_LIFT_PART_IS_UP) { - m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; - } else - return; - } - } - } + else if (CBridge::State == STATE_LIFT_PART_IS_DOWN && CBridge::OldState == STATE_LIFT_PART_MOVING_DOWN) + m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; + else if (CBridge::State == STATE_LIFT_PART_MOVING_UP && CBridge::OldState == STATE_LIFT_PART_ABOUT_TO_MOVE_UP) + m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; + else if (CBridge::State == STATE_LIFT_PART_MOVING_DOWN && CBridge::OldState == STATE_LIFT_PART_IS_UP) + m_sQueueSample.m_nSampleIndex = SFX_COL_CONTAINER_1; + else return; + if (m_sQueueSample.m_fDistance < bridgeIntensity) { m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, bridgeIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_bIs2D = false; @@ -8657,13 +8661,13 @@ cAudioManager::PreloadMissionAudio(const char *name) } } -bool +uint8 cAudioManager::GetMissionAudioLoadingStatus() const { if (m_bIsInitialised) return m_sMissionAudio.m_nLoadingStatus; - return true; + return LOADING_STATUS_LOADED; } void @@ -8679,9 +8683,8 @@ void cAudioManager::PlayLoadedMissionAudio() { if (m_bIsInitialised && m_sMissionAudio.m_nSampleIndex != NO_SAMPLE && m_sMissionAudio.m_nLoadingStatus == LOADING_STATUS_LOADED && - !m_sMissionAudio.m_nPlayStatus) { + m_sMissionAudio.m_nPlayStatus == PLAY_STATUS_STOPPED) m_sMissionAudio.m_bIsPlayed = true; - } } bool @@ -8704,7 +8707,7 @@ cAudioManager::ClearMissionAudio() m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_STOPPED; m_sMissionAudio.field_22 = 0; m_sMissionAudio.m_bIsPlayed = false; - m_sMissionAudio.m_bPredefinedProperties = 1; + m_sMissionAudio.m_bPredefinedProperties = true; m_sMissionAudio.m_nMissionAudioCounter = 0; } } @@ -8722,115 +8725,116 @@ cAudioManager::ProcessMissionAudio() static uint8 nFramesUntilFailedLoad = 0; static uint8 nFramesForPretendPlaying = 0; - if (m_bIsInitialised) { - if (m_sMissionAudio.m_nSampleIndex != NO_SAMPLE) { - switch (m_sMissionAudio.m_nLoadingStatus) { - case LOADING_STATUS_NOT_LOADED: - SampleManager.PreloadStreamedFile(m_sMissionAudio.m_nSampleIndex, 1); - m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_LOADED; + if (!m_bIsInitialised) return; + if (m_sMissionAudio.m_nSampleIndex == NO_SAMPLE) return; + + switch (m_sMissionAudio.m_nLoadingStatus) { + case LOADING_STATUS_NOT_LOADED: + SampleManager.PreloadStreamedFile(m_sMissionAudio.m_nSampleIndex, 1); + m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_LOADED; + nFramesUntilFailedLoad = 0; + break; + case LOADING_STATUS_LOADED: + if (!m_sMissionAudio.m_bIsPlayed) + return; + if (g_bMissionAudioLoadFailed) { + if (m_bTimerJustReset) { + ClearMissionAudio(); + SampleManager.StopStreamedFile(1); + nFramesForPretendPlaying = 0; + nCheckPlayingDelay = 0; nFramesUntilFailedLoad = 0; - return; - case LOADING_STATUS_LOADED: - if (!m_sMissionAudio.m_bIsPlayed) - return; - if (g_bMissionAudioLoadFailed) { - if (m_bTimerJustReset) { - ClearMissionAudio(); - SampleManager.StopStreamedFile(1); - nFramesForPretendPlaying = 0; - nCheckPlayingDelay = 0; - nFramesUntilFailedLoad = 0; - } else if (!m_nUserPause) { - if (++nFramesForPretendPlaying < 120) { - m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_PLAYING; - } else { - m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED; - m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; - } - } + } else if (!m_nUserPause) { + if (++nFramesForPretendPlaying < 120) { + m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_PLAYING; } else { - if (m_sMissionAudio.m_nPlayStatus) { - if (m_sMissionAudio.m_nPlayStatus != PLAY_STATUS_PLAYING) - return; - if (m_bTimerJustReset) { - ClearMissionAudio(); - SampleManager.StopStreamedFile(1); - return; - } - if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex)) { - if (!m_nUserPause) { - if (nCheckPlayingDelay) { - --nCheckPlayingDelay; - } else if (GetMissionScriptPoliceAudioPlayingStatus() == PLAY_STATUS_FINISHED || - m_sMissionAudio.m_nMissionAudioCounter-- == 0) { - m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED; - m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; - SampleManager.StopStreamedFile(1); - m_sMissionAudio.m_nMissionAudioCounter = 0; - } - } - } else if (m_sMissionAudio.field_22) { - if (SampleManager.IsStreamPlaying(1) || m_nUserPause || m_nPreviousUserPause) { - if (m_nUserPause) - SampleManager.PauseStream(1, 1); - else - SampleManager.PauseStream(0, 1); - } else { - m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED; - m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; - SampleManager.StopStreamedFile(1); - m_sMissionAudio.m_nMissionAudioCounter = 0; - } - } else { - if (m_nUserPause) - return; - if (nCheckPlayingDelay--) { - if (!SampleManager.IsStreamPlaying(1)) - return; - nCheckPlayingDelay = 0; - } - m_sMissionAudio.field_22 = 1; - } + m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED; + m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; + } + } + break; + } + switch (m_sMissionAudio.m_nPlayStatus) { + case PLAY_STATUS_STOPPED: + if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex)) { + SetMissionScriptPoliceAudio(m_sMissionAudio.m_nSampleIndex); + } else { + if (m_nUserPause) + SampleManager.PauseStream(1, 1); + if (m_sMissionAudio.m_bPredefinedProperties) { + SampleManager.SetStreamedVolumeAndPan(80, 63, 1, 1); + } else { + distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos); + if (distSquared >= SQR(50.0f)) { + emittingVol = 0; + pan = 63; } else { - if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex)) { - SetMissionScriptPoliceAudio(m_sMissionAudio.m_nSampleIndex); - } else { - if (m_nUserPause) - SampleManager.PauseStream(1, 1); - if (m_sMissionAudio.m_bPredefinedProperties) { - SampleManager.SetStreamedVolumeAndPan(80, 63, 1, 1); - } else { - distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos); - if (distSquared >= 2500.f) { - emittingVol = 0; - pan = 63; - } else { - dist = Sqrt(distSquared); - emittingVol = ComputeVolume(80, 50.0f, dist); - TranslateEntity(&m_sMissionAudio.m_vecPos, &vec); - pan = ComputePan(50.f, &vec); - } - SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, 1); - } - SampleManager.StartPreloadedStreamedFile(1); - } - m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_PLAYING; - nCheckPlayingDelay = 30; + dist = Sqrt(distSquared); + emittingVol = ComputeVolume(80, 50.0f, dist); + TranslateEntity(&m_sMissionAudio.m_vecPos, &vec); + pan = ComputePan(50.f, &vec); + } + SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, 1); + } + SampleManager.StartPreloadedStreamedFile(1); + } + m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_PLAYING; + nCheckPlayingDelay = 30; + break; + case PLAY_STATUS_PLAYING: + if (m_bTimerJustReset) { + ClearMissionAudio(); + SampleManager.StopStreamedFile(1); + break; + } + if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex)) { + if (!m_nUserPause) { + if (nCheckPlayingDelay) { + --nCheckPlayingDelay; + } else if (GetMissionScriptPoliceAudioPlayingStatus() == PLAY_STATUS_FINISHED || m_sMissionAudio.m_nMissionAudioCounter-- == 0) { + m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED; + m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; + SampleManager.StopStreamedFile(1); + m_sMissionAudio.m_nMissionAudioCounter = 0; } } - break; - case 2: - if (++nFramesUntilFailedLoad >= 90) { - nFramesForPretendPlaying = 0; - g_bMissionAudioLoadFailed = true; - nFramesUntilFailedLoad = 0; - m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_LOADED; + } else if (m_sMissionAudio.field_22) { + if (SampleManager.IsStreamPlaying(1) || m_nUserPause || m_nPreviousUserPause) { + if (m_nUserPause) + SampleManager.PauseStream(1, 1); + else + SampleManager.PauseStream(0, 1); + } else { + m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED; + m_sMissionAudio.m_nSampleIndex = NO_SAMPLE; + SampleManager.StopStreamedFile(1); + m_sMissionAudio.m_nMissionAudioCounter = 0; } - return; - default: - return; + } else { + if (m_nUserPause) + break; + if (nCheckPlayingDelay--) { + if (!SampleManager.IsStreamPlaying(1)) + break; + nCheckPlayingDelay = 0; + } + m_sMissionAudio.field_22 = 1; } + break; + default: + break; } + break; + case LOADING_STATUS_FAILED: + if (++nFramesUntilFailedLoad >= 90) { + nFramesForPretendPlaying = 0; + g_bMissionAudioLoadFailed = true; + nFramesUntilFailedLoad = 0; + m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_LOADED; + } + break; + default: + break; } } #pragma endregion All the mission audio stuff \ No newline at end of file diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index b2b44c07..8e1c9590 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -328,7 +328,7 @@ public: float GetCollisionRatio(float a, float b, float c, float d) const; float GetDistanceSquared(const CVector &v) const; int32 GetJumboTaxiFreq() const; - bool GetMissionAudioLoadingStatus() const; + uint8 GetMissionAudioLoadingStatus() const; int8 GetMissionScriptPoliceAudioPlayingStatus() const; uint8 GetNum3DProvidersAvailable() const; int32 GetPedCommentSfx(CPed *ped, int32 sound); From ac208ce02cd23d534e50a453080919d4f491c0fd Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 23 May 2020 23:25:14 +0300 Subject: [PATCH 038/133] Even more small audio cleanup --- src/audio/AudioLogic.cpp | 6 +++--- src/audio/AudioManager.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 07f80d72..6ac0ea4b 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -1158,7 +1158,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * static int16 LastBrake = 0; static uint8 CurrentPretendGear = 1; static bool bLostTractionLastFrame = false; - static bool bHandbrakeOnLastFrame = 0; + static bool bHandbrakeOnLastFrame = false; static int32 nCruising = 0; static bool bAccelSampleStopped = true; @@ -1171,7 +1171,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * LastAccel = 0; bLostTractionLastFrame = false; LastBrake = 0; - bHandbrakeOnLastFrame = 0; + bHandbrakeOnLastFrame = false; CurrentPretendGear = 1; } if (CReplay::IsPlayingBack()) { @@ -1720,7 +1720,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams *params) for (int32 i = 0; i < ARRAY_SIZE(automobile->Doors); i++) { if (automobile->Damage.GetDoorStatus(i) == DOOR_STATUS_SWINGING) { doorState = automobile->Doors[i].m_nDoorState; - if (doorState == DOOR_STATUS_SMASHED || doorState == DOOR_STATUS_SWINGING) { + if (doorState == DOORST_OPEN || doorState == DOORST_CLOSED) { velocity = Min(0.3f, Abs(automobile->Doors[i].m_fAngVel)); if (velocity > 0.0035f) { emittingVol = (100.f * velocity * 10.f / 3.f); diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index bd1ac84b..c34ad90a 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -39,8 +39,8 @@ cAudioManager::cAudioManager() } m_nAudioEntitiesTotal = 0; m_FrameCounter = 0; - m_bFifthFrameFlag = 0; - m_bTimerJustReset = 0; + m_bFifthFrameFlag = false; + m_bTimerJustReset = false; m_nTimer = 0; } From 7d30878418e037bcfda4121f59193e25a89c1824 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 24 May 2020 01:06:19 +0300 Subject: [PATCH 039/133] Fix OAL crash --- premake5.lua | 2 -- src/audio/oal/aldlist.cpp | 3 +-- src/audio/oal/aldlist.h | 11 ++++++++--- src/audio/sampman.h | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/premake5.lua b/premake5.lua index fd6da6ac..2331c0b3 100644 --- a/premake5.lua +++ b/premake5.lua @@ -185,8 +185,6 @@ project "re3" includedirs { "src/weapons" } includedirs { "src/extras" } includedirs { "eax" } - - includedirs { "eax" } filter "platforms:*mss" defines { "AUDIO_MSS" } diff --git a/src/audio/oal/aldlist.cpp b/src/audio/oal/aldlist.cpp index 7401e036..9834ffb4 100644 --- a/src/audio/oal/aldlist.cpp +++ b/src/audio/oal/aldlist.cpp @@ -35,7 +35,6 @@ */ ALDeviceList::ALDeviceList() { - ALDEVICEINFO ALDeviceInfo; char *devices; int index; const char *defaultDeviceName; @@ -71,7 +70,7 @@ ALDeviceList::ALDeviceList() } } if ((bNewName) && (actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) { - memset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO)); + ALDEVICEINFO ALDeviceInfo; ALDeviceInfo.bSelected = true; ALDeviceInfo.strDeviceName = actualDeviceName; alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion); diff --git a/src/audio/oal/aldlist.h b/src/audio/oal/aldlist.h index 694c9d01..3afa6bfe 100644 --- a/src/audio/oal/aldlist.h +++ b/src/audio/oal/aldlist.h @@ -8,15 +8,20 @@ #include #include -typedef struct -{ +struct ALDEVICEINFO { std::string strDeviceName; int iMajorVersion; int iMinorVersion; unsigned int uiSourceCount; std::vector *pvstrExtensions; bool bSelected; -} ALDEVICEINFO, *LPALDEVICEINFO; + + ALDEVICEINFO() : iMajorVersion(0), iMinorVersion(0), uiSourceCount(0), pvstrExtensions(NULL), bSelected(false) + { + } +}; + +typedef ALDEVICEINFO *LPALDEVICEINFO; class ALDeviceList { diff --git a/src/audio/sampman.h b/src/audio/sampman.h index d3c82943..621d4015 100644 --- a/src/audio/sampman.h +++ b/src/audio/sampman.h @@ -3,7 +3,7 @@ #include "AudioSamples.h" #define MAX_VOLUME 127 -#define MAX_FREQ 22050 +#define MAX_FREQ DIGITALRATE struct tSample { int32 nOffset; From f92770f74affa700abcec27f872b2627054f27b6 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 24 May 2020 01:44:10 +0300 Subject: [PATCH 040/133] Optimize ALDeviceList --- src/audio/oal/aldlist.cpp | 108 ++++++++++++++------------------------ src/audio/oal/aldlist.h | 39 +++++++++----- src/audio/sampman_oal.cpp | 8 +-- 3 files changed, 70 insertions(+), 85 deletions(-) diff --git a/src/audio/oal/aldlist.cpp b/src/audio/oal/aldlist.cpp index 9834ffb4..3e86b1d7 100644 --- a/src/audio/oal/aldlist.cpp +++ b/src/audio/oal/aldlist.cpp @@ -41,8 +41,7 @@ ALDeviceList::ALDeviceList() const char *actualDeviceName; // DeviceInfo vector stores, for each enumerated device, it's device name, selection status, spec version #, and extension support - vDeviceInfo.empty(); - vDeviceInfo.reserve(10); + nNumOfDevices = 0; defaultDeviceIndex = 0; @@ -64,7 +63,7 @@ ALDeviceList::ALDeviceList() // if new actual device name isn't already in the list, then add it... actualDeviceName = alcGetString(device, ALC_DEVICE_SPECIFIER); bool bNewName = true; - for (int i = 0; i < GetNumDevices(); i++) { + for (unsigned int i = 0; i < GetNumDevices(); i++) { if (strcmp(GetDeviceName(i), actualDeviceName) == 0) { bNewName = false; } @@ -76,39 +75,37 @@ ALDeviceList::ALDeviceList() alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion); alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(int), &ALDeviceInfo.iMinorVersion); - ALDeviceInfo.pvstrExtensions = new std::vector; - // Check for ALC Extensions if (alcIsExtensionPresent(device, "ALC_EXT_CAPTURE") == AL_TRUE) - ALDeviceInfo.pvstrExtensions->push_back("ALC_EXT_CAPTURE"); + ALDeviceInfo.Extensions |= ADEXT_EXT_CAPTURE; if (alcIsExtensionPresent(device, "ALC_EXT_EFX") == AL_TRUE) - ALDeviceInfo.pvstrExtensions->push_back("ALC_EXT_EFX"); + ALDeviceInfo.Extensions |= ADEXT_EXT_EFX; // Check for AL Extensions if (alIsExtensionPresent("AL_EXT_OFFSET") == AL_TRUE) - ALDeviceInfo.pvstrExtensions->push_back("AL_EXT_OFFSET"); + ALDeviceInfo.Extensions |= ADEXT_EXT_OFFSET; if (alIsExtensionPresent("AL_EXT_LINEAR_DISTANCE") == AL_TRUE) - ALDeviceInfo.pvstrExtensions->push_back("AL_EXT_LINEAR_DISTANCE"); + ALDeviceInfo.Extensions |= ADEXT_EXT_LINEAR_DISTANCE; if (alIsExtensionPresent("AL_EXT_EXPONENT_DISTANCE") == AL_TRUE) - ALDeviceInfo.pvstrExtensions->push_back("AL_EXT_EXPONENT_DISTANCE"); + ALDeviceInfo.Extensions |= ADEXT_EXT_EXPONENT_DISTANCE; if (alIsExtensionPresent("EAX2.0") == AL_TRUE) - ALDeviceInfo.pvstrExtensions->push_back("EAX2.0"); + ALDeviceInfo.Extensions |= ADEXT_EAX2; if (alIsExtensionPresent("EAX3.0") == AL_TRUE) - ALDeviceInfo.pvstrExtensions->push_back("EAX3.0"); + ALDeviceInfo.Extensions |= ADEXT_EAX3; if (alIsExtensionPresent("EAX4.0") == AL_TRUE) - ALDeviceInfo.pvstrExtensions->push_back("EAX4.0"); + ALDeviceInfo.Extensions |= ADEXT_EAX4; if (alIsExtensionPresent("EAX5.0") == AL_TRUE) - ALDeviceInfo.pvstrExtensions->push_back("EAX5.0"); + ALDeviceInfo.Extensions |= ADEXT_EAX5; if (alIsExtensionPresent("EAX-RAM") == AL_TRUE) - ALDeviceInfo.pvstrExtensions->push_back("EAX-RAM"); + ALDeviceInfo.Extensions |= ADEXT_EAX_RAM; // Get Source Count ALDeviceInfo.uiSourceCount = GetMaxNumSources(); - vDeviceInfo.push_back(ALDeviceInfo); + aDeviceInfo[nNumOfDevices++] = ALDeviceInfo; } alcMakeContextCurrent(NULL); alcDestroyContext(context); @@ -128,31 +125,23 @@ ALDeviceList::ALDeviceList() */ ALDeviceList::~ALDeviceList() { - for (unsigned int i = 0; i < vDeviceInfo.size(); i++) { - if (vDeviceInfo[i].pvstrExtensions) { - vDeviceInfo[i].pvstrExtensions->empty(); - delete vDeviceInfo[i].pvstrExtensions; - } - } - - vDeviceInfo.empty(); } /* * Returns the number of devices in the complete device list */ -int ALDeviceList::GetNumDevices() +unsigned int ALDeviceList::GetNumDevices() { - return (int)vDeviceInfo.size(); + return nNumOfDevices; } /* * Returns the device name at an index in the complete device list */ -char * ALDeviceList::GetDeviceName(int index) +const char * ALDeviceList::GetDeviceName(unsigned int index) { if (index < GetNumDevices()) - return (char *)vDeviceInfo[index].strDeviceName.c_str(); + return aDeviceInfo[index].strDeviceName; else return NULL; } @@ -160,13 +149,13 @@ char * ALDeviceList::GetDeviceName(int index) /* * Returns the major and minor version numbers for a device at a specified index in the complete list */ -void ALDeviceList::GetDeviceVersion(int index, int *major, int *minor) +void ALDeviceList::GetDeviceVersion(unsigned int index, int *major, int *minor) { if (index < GetNumDevices()) { if (major) - *major = vDeviceInfo[index].iMajorVersion; + *major = aDeviceInfo[index].iMajorVersion; if (minor) - *minor = vDeviceInfo[index].iMinorVersion; + *minor = aDeviceInfo[index].iMinorVersion; } return; } @@ -174,10 +163,10 @@ void ALDeviceList::GetDeviceVersion(int index, int *major, int *minor) /* * Returns the maximum number of Sources that can be generate on the given device */ -unsigned int ALDeviceList::GetMaxNumSources(int index) +unsigned int ALDeviceList::GetMaxNumSources(unsigned int index) { if (index < GetNumDevices()) - return vDeviceInfo[index].uiSourceCount; + return aDeviceInfo[index].uiSourceCount; else return 0; } @@ -185,20 +174,9 @@ unsigned int ALDeviceList::GetMaxNumSources(int index) /* * Checks if the extension is supported on the given device */ -bool ALDeviceList::IsExtensionSupported(int index, const char *szExtName) +bool ALDeviceList::IsExtensionSupported(int index, unsigned short ext) { - bool bReturn = false; - - if (index < GetNumDevices()) { - for (unsigned int i = 0; i < vDeviceInfo[index].pvstrExtensions->size(); i++) { - if (!_stricmp(vDeviceInfo[index].pvstrExtensions->at(i).c_str(), szExtName)) { - bReturn = true; - break; - } - } - } - - return bReturn; + return !!(aDeviceInfo[index].Extensions & ext); } /* @@ -215,10 +193,10 @@ int ALDeviceList::GetDefaultDevice() void ALDeviceList::FilterDevicesMinVer(int major, int minor) { int dMajor, dMinor; - for (unsigned int i = 0; i < vDeviceInfo.size(); i++) { + for (unsigned int i = 0; i < nNumOfDevices; i++) { GetDeviceVersion(i, &dMajor, &dMinor); if ((dMajor < major) || ((dMajor == major) && (dMinor < minor))) { - vDeviceInfo[i].bSelected = false; + aDeviceInfo[i].bSelected = false; } } } @@ -229,10 +207,10 @@ void ALDeviceList::FilterDevicesMinVer(int major, int minor) void ALDeviceList::FilterDevicesMaxVer(int major, int minor) { int dMajor, dMinor; - for (unsigned int i = 0; i < vDeviceInfo.size(); i++) { + for (unsigned int i = 0; i < nNumOfDevices; i++) { GetDeviceVersion(i, &dMajor, &dMinor); if ((dMajor > major) || ((dMajor == major) && (dMinor > minor))) { - vDeviceInfo[i].bSelected = false; + aDeviceInfo[i].bSelected = false; } } } @@ -240,20 +218,12 @@ void ALDeviceList::FilterDevicesMaxVer(int major, int minor) /* * Deselects device which don't support the given extension name */ -void ALDeviceList::FilterDevicesExtension(char *szExtName) +void +ALDeviceList::FilterDevicesExtension(unsigned short ext) { - bool bFound; - - for (unsigned int i = 0; i < vDeviceInfo.size(); i++) { - bFound = false; - for (unsigned int j = 0; j < vDeviceInfo[i].pvstrExtensions->size(); j++) { - if (!_stricmp(vDeviceInfo[i].pvstrExtensions->at(j).c_str(), szExtName)) { - bFound = true; - break; - } - } - if (!bFound) - vDeviceInfo[i].bSelected = false; + for (unsigned int i = 0; i < nNumOfDevices; i++) { + if (!IsExtensionSupported(i, ext)) + aDeviceInfo[i].bSelected = false; } } @@ -262,8 +232,8 @@ void ALDeviceList::FilterDevicesExtension(char *szExtName) */ void ALDeviceList::ResetFilters() { - for (int i = 0; i < GetNumDevices(); i++) { - vDeviceInfo[i].bSelected = true; + for (unsigned int i = 0; i < GetNumDevices(); i++) { + aDeviceInfo[i].bSelected = true; } filterIndex = 0; } @@ -273,10 +243,10 @@ void ALDeviceList::ResetFilters() */ int ALDeviceList::GetFirstFilteredDevice() { - int i; + unsigned int i; for (i = 0; i < GetNumDevices(); i++) { - if (vDeviceInfo[i].bSelected == true) { + if (aDeviceInfo[i].bSelected == true) { break; } } @@ -289,10 +259,10 @@ int ALDeviceList::GetFirstFilteredDevice() */ int ALDeviceList::GetNextFilteredDevice() { - int i; + unsigned int i; for (i = filterIndex; i < GetNumDevices(); i++) { - if (vDeviceInfo[i].bSelected == true) { + if (aDeviceInfo[i].bSelected == true) { break; } } diff --git a/src/audio/oal/aldlist.h b/src/audio/oal/aldlist.h index 3afa6bfe..417bd314 100644 --- a/src/audio/oal/aldlist.h +++ b/src/audio/oal/aldlist.h @@ -5,19 +5,33 @@ #ifdef AUDIO_OAL #pragma warning(disable: 4786) //disable warning "identifier was truncated to '255' characters in the browser information" -#include -#include + +enum +{ + ADEXT_EXT_CAPTURE = (1 << 0), + ADEXT_EXT_EFX = (1 << 1), + ADEXT_EXT_OFFSET = (1 << 2), + ADEXT_EXT_LINEAR_DISTANCE = (1 << 3), + ADEXT_EXT_EXPONENT_DISTANCE = (1 << 4), + ADEXT_EAX2 = (1 << 5), + ADEXT_EAX3 = (1 << 6), + ADEXT_EAX4 = (1 << 7), + ADEXT_EAX5 = (1 << 8), + ADEXT_EAX_RAM = (1 << 9), +}; struct ALDEVICEINFO { - std::string strDeviceName; + const char *strDeviceName; int iMajorVersion; int iMinorVersion; unsigned int uiSourceCount; - std::vector *pvstrExtensions; + unsigned short Extensions; bool bSelected; - ALDEVICEINFO() : iMajorVersion(0), iMinorVersion(0), uiSourceCount(0), pvstrExtensions(NULL), bSelected(false) + ALDEVICEINFO() : iMajorVersion(0), iMinorVersion(0), uiSourceCount(0), bSelected(false) { + strDeviceName = NULL; + Extensions = 0; } }; @@ -26,22 +40,23 @@ typedef ALDEVICEINFO *LPALDEVICEINFO; class ALDeviceList { private: - std::vector vDeviceInfo; + ALDEVICEINFO aDeviceInfo[64]; + unsigned int nNumOfDevices; int defaultDeviceIndex; int filterIndex; public: ALDeviceList (); ~ALDeviceList (); - int GetNumDevices(); - char *GetDeviceName(int index); - void GetDeviceVersion(int index, int *major, int *minor); - unsigned int GetMaxNumSources(int index); - bool IsExtensionSupported(int index, const char *szExtName); + unsigned int GetNumDevices(); + const char *GetDeviceName(unsigned int index); + void GetDeviceVersion(unsigned int index, int *major, int *minor); + unsigned int GetMaxNumSources(unsigned int index); + bool IsExtensionSupported(int index, unsigned short ext); int GetDefaultDevice(); void FilterDevicesMinVer(int major, int minor); void FilterDevicesMaxVer(int major, int minor); - void FilterDevicesExtension(char *szExtName); + void FilterDevicesExtension(unsigned short ext); void ResetFilters(); int GetFirstFilteredDevice(); int GetNextFilteredDevice(); diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index f6f3a393..1952f370 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -174,10 +174,10 @@ add_providers() } if ( alGetEnumValue("AL_EFFECT_EAXREVERB") != 0 - || pDeviceList->IsExtensionSupported(i, "EAX2.0") - || pDeviceList->IsExtensionSupported(i, "EAX3.0") - || pDeviceList->IsExtensionSupported(i, "EAX4.0") - || pDeviceList->IsExtensionSupported(i, "EAX5.0") ) + || pDeviceList->IsExtensionSupported(i, ADEXT_EAX2) + || pDeviceList->IsExtensionSupported(i, ADEXT_EAX3) + || pDeviceList->IsExtensionSupported(i, ADEXT_EAX4) + || pDeviceList->IsExtensionSupported(i, ADEXT_EAX5) ) { if ( n < MAXPROVIDERS ) { From e95de89c9a748005d4495c0e7bfd0281ef39cd7c Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 24 May 2020 12:01:07 +0300 Subject: [PATCH 041/133] script fix --- src/control/Script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 082beda9..406b11b7 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -6212,7 +6212,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) } CCranes::ActivateCrane(infX, supX, infY, supY, *(float*)&ScriptParams[6], *(float*)&ScriptParams[7], *(float*)&ScriptParams[8], - DEGTORAD(*(float*)&ScriptParams[8]), true, false, + DEGTORAD(*(float*)&ScriptParams[9]), true, false, *(float*)&ScriptParams[0], *(float*)&ScriptParams[1]); return 0; } From 3fdd352ca26c45007c813b7c2c8a5fc5c896cf9d Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 24 May 2020 15:14:56 +0200 Subject: [PATCH 042/133] CVehicle fixes --- src/vehicles/Automobile.cpp | 10 ++-- src/vehicles/Automobile.h | 2 +- src/vehicles/Vehicle.cpp | 94 +++++++++++++++++++------------------ src/vehicles/Vehicle.h | 2 +- 4 files changed, 55 insertions(+), 53 deletions(-) diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 2212ddff..9617c9be 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -175,7 +175,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy) m_nNumPassengers = 0; m_bombType = CARBOMB_NONE; - bHadDriver = false; + bDriverLastFrame = false; m_pBombRigger = nil; if(m_nDoorLock == CARLOCK_UNLOCKED && @@ -276,7 +276,7 @@ CAutomobile::ProcessControl(void) // Process driver if(pDriver){ - if(!bHadDriver && m_bombType == CARBOMB_ONIGNITIONACTIVE){ + if(!bDriverLastFrame && m_bombType == CARBOMB_ONIGNITIONACTIVE){ // If someone enters the car and there is a bomb, detonate m_nBombTimer = 1000; m_pBlowUpEntity = m_pBombRigger; @@ -284,7 +284,7 @@ CAutomobile::ProcessControl(void) m_pBlowUpEntity->RegisterReference((CEntity**)&m_pBlowUpEntity); DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TICK, 1.0f); } - bHadDriver = true; + bDriverLastFrame = true; if(IsUpsideDown() && CanPedEnterCar()){ if(!pDriver->IsPlayer() && @@ -293,7 +293,7 @@ CAutomobile::ProcessControl(void) pDriver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, this); } }else - bHadDriver = false; + bDriverLastFrame = false; // Process passengers if(m_nNumPassengers != 0 && IsUpsideDown() && CanPedEnterCar()){ @@ -3928,7 +3928,7 @@ CAutomobile::SetUpWheelColModel(CColModel *colModel) if(m_aCarNodes[CAR_WHEEL_LM] != nil && m_aCarNodes[CAR_WHEEL_RM] != nil){ mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_LM])); - colModel->spheres[4].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_RF); + colModel->spheres[4].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_LR); mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_RM])); colModel->spheres[5].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_RR); colModel->numSpheres = 6; diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h index a3e8ac17..a2ff2616 100644 --- a/src/vehicles/Automobile.h +++ b/src/vehicles/Automobile.h @@ -86,7 +86,7 @@ public: uint8 field_4D8; uint8 m_bombType : 3; uint8 bTaxiLight : 1; - uint8 bHadDriver : 1; // for bombs + uint8 bDriverLastFrame : 1; // for bombs uint8 bFixedColour : 1; uint8 bBigWheels : 1; uint8 bWaterTight : 1; // no damage for non-player peds diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 0dd95faf..d8c7c4c8 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -50,8 +50,8 @@ CVehicle::CVehicle(uint8 CreatedBy) { int i; - m_nCurrentGear = 0; - m_fChangeGearTime = 0; + m_nCurrentGear = 1; + m_fChangeGearTime = 0.0f; m_fSteerRatio = 0.0f; m_type = ENTITY_TYPE_VEHICLE; VehicleCreatedBy = CreatedBy; @@ -280,8 +280,8 @@ CVehicle::FlyingControl(eFlightModel flightModel) float turnSpeed = m_vecTurnSpeed.MagnitudeSqr(); if(turnSpeed > SQR(0.2f)) m_vecTurnSpeed *= 0.2f/Sqrt(turnSpeed); - } break; + } case FLIGHT_MODEL_RCPLANE: case FLIGHT_MODEL_SEAPLANE: @@ -294,76 +294,77 @@ CVehicle::FlyingControl(eFlightModel flightModel) fThrust += 1.0f; else if (fForwSpeed > 0.0f && fThrust < 0.0f) fThrust = 0.0f; - float fThrustImpulse; + float fThrustAccel; if (flightModel == FLIGHT_MODEL_RCPLANE) - fThrustImpulse = (fThrust - fRCPropFallOff * fForwSpeed) * fRCAeroThrust; + fThrustAccel = (fThrust - fRCPropFallOff * fForwSpeed) * fRCAeroThrust; else - fThrustImpulse = (fThrust - fSeaPropFallOff * fForwSpeed) * fSeaThrust; - ApplyMoveForce(fThrustImpulse * GetForward() * m_fMass * CTimer::GetTimeStep()); + fThrustAccel = (fThrust - fSeaPropFallOff * fForwSpeed) * fSeaThrust; + ApplyMoveForce(fThrustAccel * GetForward() * m_fMass * CTimer::GetTimeStep()); // left/right float fSideSpeed = -DotProduct(GetMoveSpeed(), GetRight()); float fSteerLR = CPad::GetPad(0)->GetSteeringLeftRight() / 128.0f; - float fSideSlipImpulse; + float fSideSlipAccel; if (flightModel == FLIGHT_MODEL_RCPLANE) - fSideSlipImpulse = Abs(fSideSpeed) * fSideSpeed * fRCSideSlipMult; + fSideSlipAccel = Abs(fSideSpeed) * fSideSpeed * fRCSideSlipMult; else - fSideSlipImpulse = Abs(fSideSpeed) * fSideSpeed * fSeaSideSlipMult; - ApplyMoveForce(m_fMass * GetRight() * fSideSlipImpulse * CTimer::GetTimeStep()); + fSideSlipAccel = Abs(fSideSpeed) * fSideSpeed * fSeaSideSlipMult; + ApplyMoveForce(m_fMass * GetRight() * fSideSlipAccel * CTimer::GetTimeStep()); - float fYaw = -DotProduct(CrossProduct(m_vecTurnSpeed + m_vecTurnFriction, vecWidthForward) + m_vecMoveSpeed + m_vecMoveFriction, GetRight()); - float fYawImpulse; + float fYaw = -DotProduct(GetSpeed(vecWidthForward), GetRight()); + float fYawAccel; if (flightModel == FLIGHT_MODEL_RCPLANE) - fYawImpulse = fRCRudderMult * fYaw * Abs(fYaw) + fRCYawMult * fSteerLR * fForwSpeed; + fYawAccel = fRCRudderMult * fYaw * Abs(fYaw) + fRCYawMult * fSteerLR * fForwSpeed; else - fYawImpulse = fSeaRudderMult * fYaw * Abs(fYaw) + fSeaYawMult * fSteerLR * fForwSpeed; - ApplyTurnForce(fYawImpulse * GetRight() * m_fTurnMass * CTimer::GetTimeStep(), vecWidthForward); + fYawAccel = fSeaRudderMult * fYaw * Abs(fYaw) + fSeaYawMult * fSteerLR * fForwSpeed; + ApplyTurnForce(fYawAccel * GetRight() * m_fTurnMass * CTimer::GetTimeStep(), vecWidthForward); - float fRollImpulse; + float fRollAccel; if (flightModel == FLIGHT_MODEL_RCPLANE) { float fDirectionMultiplier = CPad::GetPad(0)->GetLookRight(); if (CPad::GetPad(0)->GetLookLeft()) fDirectionMultiplier = -1; - fRollImpulse = (0.5f * fDirectionMultiplier + fSteerLR) * fRCRollMult; + fRollAccel = (0.5f * fDirectionMultiplier + fSteerLR) * fRCRollMult; } else - fRollImpulse = fSteerLR * fSeaRollMult; - ApplyTurnForce(GetRight() * fRollImpulse * fForwSpeed * m_fTurnMass * CTimer::GetTimeStep(), GetUp()); + fRollAccel = fSteerLR * fSeaRollMult; + ApplyTurnForce(GetRight() * fRollAccel * fForwSpeed * m_fTurnMass * CTimer::GetTimeStep(), GetUp()); CVector vecFRight = CrossProduct(GetForward(), CVector(0.0f, 0.0f, 1.0f)); CVector vecStabilise = (GetUp().z > 0.0f) ? vecFRight : -vecFRight; float fStabiliseDirection = (GetRight().z > 0.0f) ? -1.0f : 1.0f; - float fStabiliseImpulse; + float fStabiliseSpeed; if (flightModel == FLIGHT_MODEL_RCPLANE) - fStabiliseImpulse = fRCRollStabilise * fStabiliseDirection * (1.0f - DotProduct(GetRight(), vecStabilise)) * (1.0f - Abs(GetForward().z)); + fStabiliseSpeed = fRCRollStabilise * fStabiliseDirection * (1.0f - DotProduct(GetRight(), vecStabilise)) * (1.0f - Abs(GetForward().z)); else - fStabiliseImpulse = fSeaRollStabilise * fStabiliseDirection * (1.0f - DotProduct(GetRight(), vecStabilise)) * (1.0f - Abs(GetForward().z)); - ApplyTurnForce(fStabiliseImpulse * m_fTurnMass * GetRight(), GetUp()); // no CTimer::GetTimeStep(), is it right? VC doesn't have it too + fStabiliseSpeed = fSeaRollStabilise * fStabiliseDirection * (1.0f - DotProduct(GetRight(), vecStabilise)) * (1.0f - Abs(GetForward().z)); + ApplyTurnForce(fStabiliseSpeed * m_fTurnMass * GetRight(), GetUp()); // no CTimer::GetTimeStep(), is it right? VC doesn't have it too // up/down - float fTail = -DotProduct(CrossProduct(m_vecTurnSpeed + m_vecTurnFriction, vecWidthForward) + m_vecMoveSpeed + m_vecMoveFriction, GetUp()); + float fTail = -DotProduct(GetSpeed(vecWidthForward), GetUp()); float fSteerUD = -CPad::GetPad(0)->GetSteeringUpDown() / 128.0f; - float fPitchImpulse; + float fPitchAccel; if (flightModel == FLIGHT_MODEL_RCPLANE) - fPitchImpulse = fRCTailMult * fTail * Abs(fTail) + fRCPitchMult * fSteerUD * fForwSpeed; + fPitchAccel = fRCTailMult * fTail * Abs(fTail) + fRCPitchMult * fSteerUD * fForwSpeed; else - fPitchImpulse = fSeaTailMult * fTail * Abs(fTail) + fSeaPitchMult * fSteerUD * fForwSpeed; - ApplyTurnForce(fPitchImpulse * m_fTurnMass * GetUp() * CTimer::GetTimeStep(), vecWidthForward); + fPitchAccel = fSeaTailMult * fTail * Abs(fTail) + fSeaPitchMult * fSteerUD * fForwSpeed; + ApplyTurnForce(fPitchAccel * m_fTurnMass * GetUp() * CTimer::GetTimeStep(), vecWidthForward); float fLift = -DotProduct(GetMoveSpeed(), GetUp()) / Max(0.01f, GetMoveSpeed().Magnitude()); - float fLiftImpluse; + float fLiftAccel; if (flightModel == FLIGHT_MODEL_RCPLANE) - fLiftImpluse = (fRCAttackLiftMult * fLift + fRCFormLiftMult) * fForwSpeed * fForwSpeed; + fLiftAccel = (fRCAttackLiftMult * fLift + fRCFormLiftMult) * fForwSpeed * fForwSpeed; else - fLiftImpluse = (fSeaAttackLiftMult * fLift + fSeaFormLiftMult) * fForwSpeed * fForwSpeed; - float fLiftForce = fLiftImpluse * m_fMass * CTimer::GetTimeStep(); - if (GRAVITY * CTimer::GetTimeStep() * m_fMass < fLiftImpluse) { + fLiftAccel = (fSeaAttackLiftMult * fLift + fSeaFormLiftMult) * fForwSpeed * fForwSpeed; + float fLiftImpulse = fLiftAccel * m_fMass * CTimer::GetTimeStep(); + if (GRAVITY * CTimer::GetTimeStep() * m_fMass < fLiftImpulse) { if (flightModel == FLIGHT_MODEL_RCPLANE && GetPosition().z > 50.0f) - fLiftForce = CTimer::GetTimeStep() * 0.0072 * m_fMass; + fLiftImpulse = CTimer::GetTimeStep() * 0.9f*GRAVITY * m_fMass; else if (flightModel == FLIGHT_MODEL_SEAPLANE && GetPosition().z > 80.0f) - fLiftForce = CTimer::GetTimeStep() * 0.0072 * m_fMass; + fLiftImpulse = CTimer::GetTimeStep() * 0.9f*GRAVITY * m_fMass; } - ApplyMoveForce(fLiftForce * GetUp()); + ApplyMoveForce(fLiftImpulse * GetUp()); + CVector vecResistance; if (flightModel == FLIGHT_MODEL_RCPLANE) vecResistance = vecRCAeroResistance; @@ -425,10 +426,9 @@ CVehicle::FlyingControl(eFlightModel flightModel) } if (CPad::GetPad(0)->GetHorn()) { fYaw = 0.0f; - fPitch = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetUp()), -200.0f, 1.3f); + fPitch = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetForward()), -200.0f, 1.3f); fRoll = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetRight()), -200.0f, 1.3f); } - debug("fPitch: %f\n", fPitch); ApplyTurnForce(fPitch * GetUp() * fPitchVar * m_fTurnMass * CTimer::GetTimeStep(), GetForward()); ApplyTurnForce(fRoll * GetUp() * fRollVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight()); ApplyTurnForce(fYaw * GetForward() * fYawVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight()); @@ -442,11 +442,11 @@ CVehicle::FlyingControl(eFlightModel flightModel) float rY = Pow(vecResistance.y, CTimer::GetTimeStep()); float rZ = Pow(vecResistance.z, CTimer::GetTimeStep()); CVector vecTurnSpeed = Multiply3x3(m_vecTurnSpeed, GetMatrix()); - float fResistanceMultiplier = Pow(1.0f / (fSpinSpeedRes * SQR(vecTurnSpeed.z) + 1.0f), CTimer::GetTimeStep()); + float fResistanceMultiplier = Pow(1.0f / (fSpinSpeedRes * SQR(vecTurnSpeed.z) + 1.0f) * rZ, CTimer::GetTimeStep()); float fResistance = vecTurnSpeed.z * fResistanceMultiplier - vecTurnSpeed.z; vecTurnSpeed.x *= rX; vecTurnSpeed.y *= rY; - vecTurnSpeed.z *= rZ; + vecTurnSpeed.z *= fResistanceMultiplier; m_vecTurnSpeed = Multiply3x3(GetMatrix(), vecTurnSpeed); ApplyTurnForce(-GetRight() * fResistance * m_fTurnMass, GetForward() + Multiply3x3(GetMatrix(), m_vecCentreOfMass)); break; @@ -454,6 +454,9 @@ CVehicle::FlyingControl(eFlightModel flightModel) } } +float fBurstSpeedMax = 0.3f; +float fBurstTyreMod = 0.1f; + void CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelContactSpeed, CVector &wheelContactPoint, int32 wheelsOnGround, float thrust, float brake, float adhesion, int8 wheelId, float *wheelSpeed, tWheelState *wheelState, uint16 wheelStatus) @@ -494,8 +497,8 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon #endif if(wheelStatus == WHEEL_STATUS_BURST){ - float fwdspeed = Min(contactSpeedFwd, 0.3f); - right += fwdspeed * CGeneral::GetRandomNumberInRange(-0.1f, 0.1f); + float fwdspeed = Min(contactSpeedFwd, fBurstSpeedMax); + right += fwdspeed * CGeneral::GetRandomNumberInRange(-fBurstTyreMod, fBurstTyreMod); } } @@ -671,7 +674,7 @@ CVehicle::InflictDamage(CEntity* damagedBy, eWeaponType weaponType, float damage break; } } - if (oldHealth > DAMAGE_HEALTH_TO_CATCH_FIRE && m_fHealth < DAMAGE_HEALTH_TO_CATCH_FIRE) { + if (oldHealth >= DAMAGE_HEALTH_TO_CATCH_FIRE && m_fHealth < DAMAGE_HEALTH_TO_CATCH_FIRE) { if (IsCar()) { CAutomobile* pThisCar = (CAutomobile*)this; pThisCar->Damage.SetEngineStatus(ENGINE_STATUS_ON_FIRE); @@ -990,9 +993,8 @@ CVehicle::CanPedOpenLocks(CPed *ped) bool CVehicle::CanPedEnterCar(void) { - CVector up = GetUp(); // can't enter when car is on side - if(up.z > 0.1f || up.z < -0.1f){ + if(GetUp().z > 0.1f || GetUp().z < -0.1f){ // also when car is moving too fast if(m_vecMoveSpeed.MagnitudeSqr() > sq(0.2f)) return false; diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index 06bdf714..de4d3f88 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -86,8 +86,8 @@ enum CAR_PIECE_WING_LR, CAR_PIECE_WING_RR, CAR_PIECE_WHEEL_LF, - CAR_PIECE_WHEEL_LR, CAR_PIECE_WHEEL_RF, + CAR_PIECE_WHEEL_LR, CAR_PIECE_WHEEL_RR, CAR_PIECE_WINDSCREEN, }; From 14755a4ff4668e2cf2fa580797321141770e3b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sun, 24 May 2020 16:41:29 +0300 Subject: [PATCH 043/133] all my fixes live in exes --- src/core/main.cpp | 10 ++++++++- src/peds/PlayerPed.cpp | 2 +- src/weapons/Weapon.cpp | 48 ++++++++++++++++++++-------------------- src/weapons/Weapon.h | 4 ++-- src/weapons/WeaponInfo.h | 4 ++-- 5 files changed, 38 insertions(+), 30 deletions(-) diff --git a/src/core/main.cpp b/src/core/main.cpp index acdf6f4e..666758c8 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -137,9 +137,13 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha); CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha); +#ifndef ASPECT_RATIO_SCALE + CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, (CMenuManager::m_PrefsUseWideScreen ? 16.f / 9.f : 4.f / 3.f)); +#else CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO); +#endif CVisibilityPlugins::SetRenderWareCamera(Scene.camera); - RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); + RwCameraClear(Scene.camera, &TopColor.rwRGBA, rwCAMERACLEARZ); if(!RsCameraBeginUpdate(Scene.camera)) return false; @@ -155,7 +159,11 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR bool DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha) { +#ifndef ASPECT_RATIO_SCALE + CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, (CMenuManager::m_PrefsUseWideScreen ? 16.f/9.f : 4.f/3.f)); +#else CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO); +#endif CVisibilityPlugins::SetRenderWareCamera(Scene.camera); RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index 3c6fad57..eb4ac09e 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -227,7 +227,7 @@ CPlayerPed::SetInitialState(void) { m_bAdrenalineActive = false; m_nAdrenalineTime = 0; - CTimer::SetTimeStep(1.0f); + CTimer::SetTimeScale(1.0f); m_pSeekTarget = nil; m_vecSeekPos = { 0.0f, 0.0f, 0.0f }; m_fleeFromPosX = 0.0f; diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index 88c4788c..93481105 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -241,51 +241,51 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource) } } - if ( fired ) + if (fired) { bool isPlayer = false; - if ( shooter->IsPed() ) + if (shooter->IsPed()) { - CPed *shooterPed = (CPed*)shooter; + CPed* shooterPed = (CPed*)shooter; shooterPed->bIsShooting = true; - if ( shooterPed->IsPlayer() ) + if (shooterPed->IsPlayer()) isPlayer = true; DMAudio.PlayOneShot(shooterPed->m_audioEntityId, SOUND_WEAPON_SHOT_FIRED, 0.0f); } - if ( m_nAmmoInClip > 0 ) m_nAmmoInClip--; - if ( m_nAmmoTotal > 0 && (m_nAmmoTotal < 25000 || isPlayer) ) m_nAmmoTotal--; + if (m_nAmmoInClip > 0) m_nAmmoInClip--; + if (m_nAmmoTotal > 0 && (m_nAmmoTotal < 25000 || isPlayer)) m_nAmmoTotal--; - if ( m_eWeaponState == WEAPONSTATE_READY && m_eWeaponType == WEAPONTYPE_FLAMETHROWER ) + if (m_eWeaponState == WEAPONSTATE_READY && m_eWeaponType == WEAPONTYPE_FLAMETHROWER) DMAudio.PlayOneShot(((CPhysical*)shooter)->m_audioEntityId, SOUND_WEAPON_FLAMETHROWER_FIRE, 0.0f); m_eWeaponState = WEAPONSTATE_FIRING; - } - if ( m_nAmmoInClip == 0 ) - { - if ( m_nAmmoTotal == 0 ) - return true; - - m_eWeaponState = WEAPONSTATE_RELOADING; - m_nTimer = CTimer::GetTimeInMilliseconds() + GetInfo()->m_nReload; - - if ( shooter == FindPlayerPed() ) + if (m_nAmmoInClip == 0) { - if ( CWorld::Players[CWorld::PlayerInFocus].m_bFastReload ) - m_nTimer = CTimer::GetTimeInMilliseconds() + GetInfo()->m_nReload / 4; + if (m_nAmmoTotal == 0) + return true; + + m_eWeaponState = WEAPONSTATE_RELOADING; + m_nTimer = CTimer::GetTimeInMilliseconds() + GetInfo()->m_nReload; + + if (shooter == FindPlayerPed()) + { + if (CWorld::Players[CWorld::PlayerInFocus].m_bFastReload) + m_nTimer = CTimer::GetTimeInMilliseconds() + GetInfo()->m_nReload / 4; + } + + return true; } - return true; + m_nTimer = CTimer::GetTimeInMilliseconds() + 1000; + if (shooter == FindPlayerPed()) + CStats::RoundsFiredByPlayer++; } - - m_nTimer = CTimer::GetTimeInMilliseconds() + 1000; - if ( shooter == FindPlayerPed() ) - CStats::RoundsFiredByPlayer++; } else { diff --git a/src/weapons/Weapon.h b/src/weapons/Weapon.h index 1b2c0320..c7685e0d 100644 --- a/src/weapons/Weapon.h +++ b/src/weapons/Weapon.h @@ -16,8 +16,8 @@ class CWeapon public: eWeaponType m_eWeaponType; eWeaponState m_eWeaponState; - uint32 m_nAmmoInClip; - uint32 m_nAmmoTotal; + int32 m_nAmmoInClip; + int32 m_nAmmoTotal; uint32 m_nTimer; bool m_bAddRotOffset; diff --git a/src/weapons/WeaponInfo.h b/src/weapons/WeaponInfo.h index b5882082..c89dd482 100644 --- a/src/weapons/WeaponInfo.h +++ b/src/weapons/WeaponInfo.h @@ -5,13 +5,13 @@ class CWeaponInfo { // static CWeaponInfo(&ms_apWeaponInfos)[14]; - static CWeaponInfo ms_apWeaponInfos[14]; + static CWeaponInfo ms_apWeaponInfos[WEAPONTYPE_LAST_WEAPONTYPE]; public: eWeaponFire m_eWeaponFire; float m_fRange; uint32 m_nFiringRate; uint32 m_nReload; - uint32 m_nAmountofAmmunition; + int32 m_nAmountofAmmunition; uint32 m_nDamage; float m_fSpeed; float m_fRadius; From 56683dbed350354865e324f2e0ba28cff9743ead Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 24 May 2020 20:33:30 +0300 Subject: [PATCH 044/133] Clean cAudioManager::ProcessGarages up a bit --- src/audio/AudioLogic.cpp | 168 ++++++++++++++++++--------------------- 1 file changed, 79 insertions(+), 89 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 6ac0ea4b..d418adf4 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -8278,6 +8278,8 @@ cAudioManager::ProcessProjectiles() void cAudioManager::ProcessGarages() { + const float SOUND_INTENSITY = 80.0f; + CEntity *entity; eGarageState state; uint32 sampleIndex; @@ -8287,109 +8289,57 @@ cAudioManager::ProcessGarages() static uint8 iSound = 32; -#define LOOP_HELPER \ - for (j = 0; j < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; ++j) { \ - switch (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[j]) { \ - case SOUND_GARAGE_DOOR_CLOSED: \ - case SOUND_GARAGE_DOOR_OPENED: \ - if (distSquared < 6400.f) { \ - CalculateDistance(distCalculated, distSquared); \ - m_sQueueSample.m_nVolume = ComputeVolume(60, 80.f, m_sQueueSample.m_fDistance); \ - if (m_sQueueSample.m_nVolume) { \ - if (CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) { \ - m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2; \ - m_sQueueSample.m_nFrequency = 6735; \ - } else if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[j] == 69) { \ - m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2; \ - m_sQueueSample.m_nFrequency = 22000; \ - } else { \ - m_sQueueSample.m_nSampleIndex = SFX_COL_GARAGE_DOOR_1; \ - m_sQueueSample.m_nFrequency = 18000; \ - } \ - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; \ - m_sQueueSample.m_nReleasingVolumeModificator = 4; \ - m_sQueueSample.m_nEmittingVolume = 60; \ - m_sQueueSample.m_fSpeedMultiplier = 0.0f; \ - m_sQueueSample.m_fSoundIntensity = 80.0f; \ - /*m_sQueueSample.m_nReleasingVolumeModificator = 4;*/ \ - m_sQueueSample.m_bReverbFlag = true; \ - /*m_sQueueSample.m_bReverbFlag = true;*/ \ - m_sQueueSample.m_bIs2D = false; \ - m_sQueueSample.m_bReleasingSoundFlag = true; \ - m_sQueueSample.m_nLoopCount = 1; \ - m_sQueueSample.m_nLoopStart = 0; \ - m_sQueueSample.m_nLoopEnd = -1; \ - m_sQueueSample.m_nCounter = iSound++; \ - if (iSound < 32) \ - iSound = 32; \ - m_sQueueSample.m_bRequireReflection = true; \ - AddSampleToRequestedQueue(); \ - } \ - } \ - break; \ - default: \ - continue; \ - } \ - } - for (uint32 i = 0; i < CGarages::NumGarages; ++i) { if (CGarages::aGarages[i].m_eGarageType == GARAGE_NONE) continue; entity = CGarages::aGarages[i].m_pDoor1; - if (!entity) + if (entity == nil) continue; m_sQueueSample.m_vecPos = entity->GetPosition(); distCalculated = false; distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < 6400.f) { + if (distSquared < SQR(SOUND_INTENSITY)) { state = CGarages::aGarages[i].m_eGarageState; - if (state == GS_OPENING || state == GS_CLOSING || state == GS_AFTERDROPOFF) { + // while is here just to exit prematurely and avoid goto + while (state == GS_OPENING || state == GS_CLOSING || state == GS_AFTERDROPOFF) { CalculateDistance(distCalculated, distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(90, 80.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + m_sQueueSample.m_nVolume = ComputeVolume(90, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume != 0) { if (CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) { if (CGarages::aGarages[i].m_eGarageState == GS_AFTERDROPOFF) { - if (!(m_FrameCounter & 1)) { - LOOP_HELPER - continue; - } - if (m_anRandomTable[1] & 1) { - sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_CAR_1; - } else { - sampleIndex = m_anRandomTable[2] % 6 + SFX_COL_CAR_PANEL_1; - } - m_sQueueSample.m_nSampleIndex = sampleIndex; - m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) / 2; - m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); - m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_nCounter = iSound++; - if (iSound < 32) - iSound = 32; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - m_sQueueSample.m_nEmittingVolume = 90; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = 80.0f; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; - AddSampleToRequestedQueue(); - LOOP_HELPER - continue; + if (m_FrameCounter & 1) { + if (m_anRandomTable[1] & 1) + sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_CAR_1; + else + sampleIndex = m_anRandomTable[2] % 6 + SFX_COL_CAR_PANEL_1; + m_sQueueSample.m_nSampleIndex = sampleIndex; + m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) / 2; + m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_nCounter = iSound++; + if (iSound < 32) + iSound = 32; + } else break; // premature exit to go straight to the for loop + } else { + m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; + m_sQueueSample.m_nFrequency = 6543; + + m_sQueueSample.m_nCounter = i; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_bReleasingSoundFlag = false; } - m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; - m_sQueueSample.m_nFrequency = 6543; } else { m_sQueueSample.m_nSampleIndex = SFX_GARAGE_DOOR_LOOP; m_sQueueSample.m_nFrequency = 13961; + + m_sQueueSample.m_nCounter = i; + m_sQueueSample.m_nLoopCount = 0; + m_sQueueSample.m_nReleasingVolumeDivider = 3; + m_sQueueSample.m_bReleasingSoundFlag = false; } - m_sQueueSample.m_nCounter = i; - m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -8397,16 +8347,56 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReverbFlag = true; m_sQueueSample.m_bRequireReflection = false; AddSampleToRequestedQueue(); } + break; + } + } + for (j = 0; j < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; ++j) { + switch (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[j]) { + case SOUND_GARAGE_DOOR_CLOSED: + case SOUND_GARAGE_DOOR_OPENED: + if (distSquared < SQR(SOUND_INTENSITY)) { + CalculateDistance(distCalculated, distSquared); + m_sQueueSample.m_nVolume = ComputeVolume(60, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume) { + if (CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) { + m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2; + m_sQueueSample.m_nFrequency = 6735; + } else if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[j] == SOUND_GARAGE_DOOR_OPENED) { + m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2; + m_sQueueSample.m_nFrequency = 22000; + } else { + m_sQueueSample.m_nSampleIndex = SFX_COL_GARAGE_DOOR_1; + m_sQueueSample.m_nFrequency = 18000; + } + m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nReleasingVolumeModificator = 4; + m_sQueueSample.m_nEmittingVolume = 60; + m_sQueueSample.m_fSpeedMultiplier = 0.0f; + m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_nLoopCount = 1; + m_sQueueSample.m_nLoopStart = 0; + m_sQueueSample.m_nLoopEnd = -1; + m_sQueueSample.m_nCounter = iSound++; + if (iSound < 32) + iSound = 32; + m_sQueueSample.m_bRequireReflection = true; + AddSampleToRequestedQueue(); + } + } + break; + default: + break; } - LOOP_HELPER } } -#undef LOOP_HELPER } void From 80c2018b518b2d7028acf1bc33efc2c3334c690b Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Mon, 25 May 2020 03:40:47 +0300 Subject: [PATCH 045/133] cAudioManager::ProcessPlayersVehicleEngine cleanup and fixes --- src/audio/AudioLogic.cpp | 269 +++++++++++++++++---------------------- 1 file changed, 114 insertions(+), 155 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index d418adf4..84db5d3b 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -1146,7 +1146,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * int freqModifier; int soundOffset; uint8 engineSoundType; - int32 accelerateState; + int16 accelerateState; bool channelUsed; bool lostTraction; bool processedAccelSampleStopped; @@ -1174,47 +1174,47 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * bHandbrakeOnLastFrame = false; CurrentPretendGear = 1; } - if (CReplay::IsPlayingBack()) { - accelerateState = 255.f * Max(0.0f, Min(1.0f, automobile->m_fGasPedal)); - } else { - accelerateState = Pads->GetAccelerate(); - } + if (CReplay::IsPlayingBack()) + accelerateState = 255.f * clamp(automobile->m_fGasPedal, 0.0f, 1.0f); + else + accelerateState = Pads[0].GetAccelerate(); + channelUsed = SampleManager.GetChannelUsedFlag(m_nActiveSamples); transmission = params->m_pTransmission; velocityChange = params->m_fVelocityChange; relativeVelocityChange = 2.0f * velocityChange / transmission->fMaxVelocity; - accelerationMultipler = Min(Min(1.f, relativeVelocityChange), 0.f); + accelerationMultipler = clamp(relativeVelocityChange, 0.0f, 1.0f); gasPedalAudio = accelerationMultipler; currentGear = params->m_pVehicle->m_nCurrentGear; if (transmission->nDriveType == '4') { wheelInUseCounter = 0; for (uint8 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) { - if (automobile->m_aWheelState[i]) + if (automobile->m_aWheelState[i] != WHEEL_STATE_NORMAL) ++wheelInUseCounter; } if (wheelInUseCounter > 2) lostTraction = true; - } else if (transmission->nDriveType == 'F') { - if ((automobile->m_aWheelState[0] || automobile->m_aWheelState[2]) && (automobile->m_aWheelState[1] || automobile->m_aWheelState[3])) { + } else if (transmission->nDriveType == 'F') + if ((automobile->m_aWheelState[VEHWHEEL_FRONT_LEFT] != WHEEL_STATE_NORMAL || automobile->m_aWheelState[VEHWHEEL_REAR_LEFT] != WHEEL_STATE_NORMAL) && + (automobile->m_aWheelState[VEHWHEEL_FRONT_RIGHT] != WHEEL_STATE_NORMAL || automobile->m_aWheelState[VEHWHEEL_REAR_RIGHT] != WHEEL_STATE_NORMAL)) lostTraction = true; - } - } else if (transmission->nDriveType == 'R' && (automobile->m_aWheelState[1] || automobile->m_aWheelState[3])) { - lostTraction = true; - } - if (0.0f != velocityChange) { + else if (transmission->nDriveType == 'R' && (automobile->m_aWheelState[VEHWHEEL_FRONT_RIGHT] != WHEEL_STATE_NORMAL || + automobile->m_aWheelState[VEHWHEEL_REAR_RIGHT] != WHEEL_STATE_NORMAL)) + lostTraction = true; + + if (velocityChange != 0.0f) { time = params->m_pVehicle->m_vecMoveSpeed.z / velocityChange; - if (time <= 0.0f) { - freqModifier = Max(-0.2f, time) * -15000.f; - } else { - freqModifier = -(Min(0.2f, time) * 15000.f); - } + if (time > 0.0f) + freqModifier = -(Min(0.2f, time) * 3000.0f * 5.0f); + else + freqModifier = (Max(-0.2f, time) * 3000.0f * -5.0f); if (params->m_fVelocityChange < -0.001f) freqModifier = -freqModifier; - } else { + } else freqModifier = 0; - } + engineSoundType = aVehicleSettings[params->m_nIndex].m_bEngineSoundType; soundOffset = 3 * (engineSoundType - 1); if (accelerateState <= 0) { @@ -1223,11 +1223,11 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * SampleManager.StopChannel(m_nActiveSamples); bAccelSampleStopped = true; } - if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction) { + if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction) gasPedalAudio = automobile->m_fGasPedalAudio; - } else { + else gasPedalAudio = Min(1.0f, params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity); - } + gasPedalAudio = Max(0.0f, gasPedalAudio); automobile->m_fGasPedalAudio = gasPedalAudio; } else if (LastAccel > 0) { @@ -1238,154 +1238,113 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * nCruising = 0; if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction || params->m_fVelocityChange >= 0.01f && automobile->m_fGasPedalAudio > 0.2f) { - automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.6f; + automobile->m_fGasPedalAudio *= 0.6f; gasPedalAudio = automobile->m_fGasPedalAudio; } if (gasPedalAudio > 0.05f) { freq = (5000.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 19000; if (engineSoundType == 6) freq /= 2; - AddPlayerCarSample((25.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 40, freq, (soundOffset + SFX_CAR_FINGER_OFF_ACCEL_1), engineSoundType, 63, 0); + AddPlayerCarSample((25.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 40, freq, (soundOffset + SFX_CAR_FINGER_OFF_ACCEL_1), engineSoundType, 63, + false); } } freq = (10000.f * gasPedalAudio) + 22050; if (engineSoundType == 6) freq /= 2; - AddPlayerCarSample(110 - (40.f * gasPedalAudio), freq, (engineSoundType + SFX_CAR_REV_10), 0, 52, 1); + AddPlayerCarSample(110 - (40.f * gasPedalAudio), freq, (engineSoundType - 1 + SFX_CAR_IDLE_1), 0, 52, true); CurrentPretendGear = Max(1, currentGear); - LastAccel = accelerateState; - - bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; - bLostTractionLastFrame = lostTraction; - return; - } - if (!nCruising) { - if (accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction || - currentGear < 2 && velocityChange - automobile->m_fVelocityChangeForAudio < 0.01f) { // here could be used abs - if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction) { - if (!automobile->m_nWheelsOnGround && automobile->m_nDriveWheelsOnGround || - (automobile->bIsHandbrakeOn && !bHandbrakeOnLastFrame || lostTraction && !bLostTractionLastFrame) && automobile->m_nWheelsOnGround) { - automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.6f; - } - freqModifier = 0; - baseFreq = (15000.f * automobile->m_fGasPedalAudio) + 14000; - vol = (25.0f * automobile->m_fGasPedalAudio) + 60; - } else { - baseFreq = (8000.f * accelerationMultipler) + 16000; - vol = (25.0f * accelerationMultipler) + 60; - automobile->m_fGasPedalAudio = accelerationMultipler; - } - freq = freqModifier + baseFreq; - if (engineSoundType == 6) - freq /= 2; - if (channelUsed) { - SampleManager.StopChannel(m_nActiveSamples); - bAccelSampleStopped = true; - } - AddPlayerCarSample(vol, freq, (engineSoundType + SFX_PHONE_RING), 0, 2, 1); - LastAccel = accelerateState; - - bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; - bLostTractionLastFrame = lostTraction; - return; - } - TranslateEntity(&m_sQueueSample.m_vecPos, &pos); - if (bAccelSampleStopped) { - if (CurrentPretendGear != 1 || currentGear != 2) { - gearNr = currentGear - 1; - if (gearNr < 1) - gearNr = 1; - CurrentPretendGear = gearNr; - } - processedAccelSampleStopped = true; - bAccelSampleStopped = false; - } - if (channelUsed) { - SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 85); - SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z); - SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.f, 12.5f); - if (engineSoundType == 6) - freq = (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050) / 2; - else - freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050; - SampleManager.SetChannelFrequency(m_nActiveSamples, freq); - if (!channelUsed) { - SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != false); - SampleManager.StartChannel(m_nActiveSamples); - } - LastAccel = accelerateState; - - bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; - bLostTractionLastFrame = lostTraction; - return; - } - if (processedAccelSampleStopped) { - if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + SFX_CAR_ACCEL_1, 0)) - return; - SampleManager.SetChannelLoopCount(m_nActiveSamples, 1); - SampleManager.SetChannelLoopPoints(m_nActiveSamples, 0, -1); - SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 85); - SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z); - SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.f, 12.5f); - freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050; - if (engineSoundType == 6) - freq /= 2; - SampleManager.SetChannelFrequency(m_nActiveSamples, freq); - if (!channelUsed) { - SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != false); - SampleManager.StartChannel(m_nActiveSamples); - } - LastAccel = accelerateState; - - bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; - bLostTractionLastFrame = lostTraction; - return; - } - if (CurrentPretendGear < params->m_pTransmission->nNumberOfGears - 1) { - ++CurrentPretendGear; - if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + SFX_CAR_ACCEL_1, 0)) - return; - SampleManager.SetChannelLoopCount(m_nActiveSamples, 1); - SampleManager.SetChannelLoopPoints(m_nActiveSamples, 0, -1); - SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 85); - SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z); - SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.f, 12.5f); - freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050; - if (engineSoundType == 6) - freq /= 2; - SampleManager.SetChannelFrequency(m_nActiveSamples, freq); - if (!channelUsed) { - SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != false); - SampleManager.StartChannel(m_nActiveSamples); - } - LastAccel = accelerateState; - - bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; - bLostTractionLastFrame = lostTraction; - return; - } - nCruising = 1; - } - bAccelSampleStopped = true; - if (accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction || - currentGear < params->m_pTransmission->nNumberOfGears - 1) { - nCruising = 0; } else { - if (accelerateState >= 220 && 0.001f + params->m_fVelocityChange < automobile->m_fVelocityChangeForAudio) { - if (nCruising < 800) - ++nCruising; - } else if (nCruising > 3) { - --nCruising; + while (nCruising == 0) { + if (accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction || + currentGear < 2 && velocityChange - automobile->m_fVelocityChangeForAudio < 0.01f) { // here could be used abs + if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction) { + if (!automobile->m_nWheelsOnGround && automobile->m_nDriveWheelsOnGround || + (automobile->bIsHandbrakeOn && !bHandbrakeOnLastFrame || lostTraction && !bLostTractionLastFrame) && automobile->m_nWheelsOnGround) { + automobile->m_fGasPedalAudio *= 0.6f; + } + freqModifier = 0; + baseFreq = (15000.f * automobile->m_fGasPedalAudio) + 14000; + vol = (25.0f * automobile->m_fGasPedalAudio) + 60; + } else { + baseFreq = (8000.f * accelerationMultipler) + 16000; + vol = (25.0f * accelerationMultipler) + 60; + automobile->m_fGasPedalAudio = accelerationMultipler; + } + freq = freqModifier + baseFreq; + if (engineSoundType == 6) + freq /= 2; + if (channelUsed) { + SampleManager.StopChannel(m_nActiveSamples); + bAccelSampleStopped = true; + } + AddPlayerCarSample(vol, freq, (engineSoundType - 1 + SFX_CAR_REV_1), 0, 2, true); + } else { + TranslateEntity(&m_sQueueSample.m_vecPos, &pos); + if (bAccelSampleStopped) { + if (CurrentPretendGear != 1 || currentGear != 2) { + gearNr = currentGear - 1; + if (gearNr < 1) + gearNr = 1; + CurrentPretendGear = gearNr; + } + processedAccelSampleStopped = true; + bAccelSampleStopped = false; + } + + if (!channelUsed) { + if (!processedAccelSampleStopped) { + if (CurrentPretendGear < params->m_pTransmission->nNumberOfGears - 1) + ++CurrentPretendGear; + else { + nCruising = 1; + break; // while was used just for this fucking place + } + } + + if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + SFX_CAR_ACCEL_1, SAMPLEBANK_MAIN)) + return; + SampleManager.SetChannelLoopCount(m_nActiveSamples, 1); + SampleManager.SetChannelLoopPoints(m_nActiveSamples, 0, -1); + } + + SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 85); + SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z); + SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.f, 12.5f); + freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050; + if (engineSoundType == 6) + freq /= 2; + SampleManager.SetChannelFrequency(m_nActiveSamples, freq); + if (!channelUsed) { + SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != false); + SampleManager.StartChannel(m_nActiveSamples); + } + } + break; + } + if (nCruising != 0) { + bAccelSampleStopped = true; + if (accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction || + currentGear < params->m_pTransmission->nNumberOfGears - 1) { + nCruising = 0; + } else { + if (accelerateState >= 220 && 0.001f + params->m_fVelocityChange < automobile->m_fVelocityChangeForAudio) { + if (nCruising < 800) + ++nCruising; + } else if (nCruising > 3) { + --nCruising; + } + freq = 27 * nCruising + freqModifier + 22050; + if (engineSoundType == 6) + freq /= 2; + AddPlayerCarSample(85, freq, (soundOffset + SFX_CAR_AFTER_ACCEL_1), engineSoundType, 64, true); + } } - freq = 27 * nCruising + freqModifier + 22050; - if (engineSoundType == 6) - freq /= 2; - AddPlayerCarSample(85, freq, (soundOffset + SFX_CAR_AFTER_ACCEL_1), engineSoundType, 64, 1); } LastAccel = accelerateState; - bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn; + bHandbrakeOnLastFrame = !!automobile->bIsHandbrakeOn; bLostTractionLastFrame = lostTraction; } From fd06ab4db8a3c875c53ab7e1bc14068a41fdd46a Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Mon, 25 May 2020 03:56:17 +0300 Subject: [PATCH 046/133] Fix names of static variables --- src/audio/AudioLogic.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 84db5d3b..e223eeb1 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -3353,7 +3353,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) noReflection = true; break; case SOUND_WEAPON_SHOT_FIRED: - weapon = &ped->m_weapons[ped->m_currentWeapon]; + weapon = ped->GetWeapon(); switch (weapon->m_eWeaponType) { case WEAPONTYPE_COLT45: m_sQueueSample.m_nSampleIndex = SFX_COLT45_LEFT; @@ -7655,7 +7655,7 @@ cAudioManager::ProcessShopScriptObject(uint8 sound) void cAudioManager::ProcessAirportScriptObject(uint8 sound) { - static uint8 counter = 0; + static uint8 iSound = 0; uint32 time = CTimer::GetTimeInMilliseconds(); if (time > gAirportNextTime) { @@ -7677,7 +7677,7 @@ cAudioManager::ProcessAirportScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] & 3) + SFX_AIRPORT_ANNOUNCEMENT_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nCounter = counter++; + m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = true; @@ -7700,7 +7700,7 @@ cAudioManager::ProcessCinemaScriptObject(uint8 sound) { uint8 rand; - static uint8 counter = 0; + static uint8 iSound = 0; uint32 time = CTimer::GetTimeInMilliseconds(); if (time > gCinemaNextTime) { @@ -7720,11 +7720,11 @@ cAudioManager::ProcessCinemaScriptObject(uint8 sound) rand = m_anRandomTable[0] % 90 + 30; m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume) { - m_sQueueSample.m_nSampleIndex = counter % 3 + SFX_CINEMA_BASS_1; + m_sQueueSample.m_nSampleIndex = iSound % 3 + SFX_CINEMA_BASS_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 4); - m_sQueueSample.m_nCounter = counter++; + m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = true; @@ -7749,7 +7749,7 @@ cAudioManager::ProcessDocksScriptObject(uint8 sound) uint8 rand; float distSquared; - static uint32 counter = 0; + static uint8 iSound = 0; time = CTimer::GetTimeInMilliseconds(); if (time > gDocksNextTime) { @@ -7773,7 +7773,7 @@ cAudioManager::ProcessDocksScriptObject(uint8 sound) m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOCKS_FOGHORN); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8); - m_sQueueSample.m_nCounter = counter++; + m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = true; @@ -7797,7 +7797,7 @@ cAudioManager::ProcessHomeScriptObject(uint8 sound) uint8 rand; float dist; - static uint8 counter = 0; + static uint8 iSound = 0; time = CTimer::GetTimeInMilliseconds(); if (time > gHomeNextTime) { @@ -7821,7 +7821,7 @@ cAudioManager::ProcessHomeScriptObject(uint8 sound) m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); - m_sQueueSample.m_nCounter = counter++; + m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = true; @@ -7847,7 +7847,7 @@ cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound) float distSquared; cPedParams params; - static uint8 counter = 0; + static uint8 iSound = 0; if (time > gCellNextTime) { switch (sound) { @@ -7874,7 +7874,7 @@ cAudioManager::ProcessPoliceCellBeatingScriptObject(uint8 sound) m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); - m_sQueueSample.m_nCounter = counter++; + m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = true; @@ -7901,7 +7901,7 @@ void cAudioManager::ProcessWeather(int32 id) { uint8 vol; - static uint8 counter = 0; + static uint8 iSound = 0; if (m_asAudioEntities[id].m_AudioEvents && m_asAudioEntities[id].m_awAudioEvent[0] == SOUND_LIGHTNING) { if (m_asAudioEntities[id].m_afVolume[0] >= 10.f) { @@ -7918,9 +7918,9 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.m_nVolume = vol; if (TheCamera.SoundDistUp < 20.f) m_sQueueSample.m_nVolume /= 2; - if (counter == 4) - counter = 0; - m_sQueueSample.m_nCounter = counter++; + if (iSound == 4) + iSound = 0; + m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_nOffset = (m_anRandomTable[2] & 15) + 55; m_sQueueSample.m_bIs2D = true; @@ -7962,7 +7962,7 @@ cAudioManager::ProcessFrontEnd() bool processedMission; int16 sample; - static uint8 counter = 0; + static uint8 iSound = 0; static uint32 cPickupNextFrame = 0; static uint32 cPartMisComNextFrame = 0; @@ -8104,7 +8104,7 @@ cAudioManager::ProcessFrontEnd() m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); } m_sQueueSample.m_nVolume = 110; - m_sQueueSample.m_nCounter = counter++; + m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = true; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -8122,7 +8122,7 @@ cAudioManager::ProcessFrontEnd() AddSampleToRequestedQueue(); if (stereo) { ++m_sQueueSample.m_nSampleIndex; - m_sQueueSample.m_nCounter = counter++; + m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_nOffset = MAX_VOLUME - m_sQueueSample.m_nOffset; AddSampleToRequestedQueue(); } From cebc3bbd488fc67ace2db1c7da6f41833cd82c26 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Mon, 25 May 2020 18:39:16 +0300 Subject: [PATCH 047/133] More audio cleanup and bugfixes --- src/audio/AudioLogic.cpp | 99 ++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 55 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index e223eeb1..b6f883d4 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -524,7 +524,7 @@ cAudioManager::ProcessVehicle(CVehicle *veh) params.m_nIndex = 0; params.m_fVelocityChange = 0.0f; - if (handling) + if (handling != nil) params.m_pTransmission = &handling->Transmission; params.m_nIndex = veh->GetModelIndex() - MI_FIRST_VEHICLE; @@ -540,14 +540,12 @@ cAudioManager::ProcessVehicle(CVehicle *veh) ProcessModelCarEngine(¶ms); ProcessVehicleOneShots(¶ms); ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; - ProcessRainOnVehicle(¶ms); break; } if (params.m_nIndex == DODO) { if (!ProcessVehicleRoadNoise(¶ms)) { ProcessVehicleOneShots(¶ms); ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; - ProcessRainOnVehicle(¶ms); break; } if (CWeather::WetRoads > 0.f) @@ -557,7 +555,6 @@ cAudioManager::ProcessVehicle(CVehicle *veh) if (!ProcessVehicleRoadNoise(¶ms)) { ProcessVehicleOneShots(¶ms); ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; - ProcessRainOnVehicle(¶ms); break; } ProcessReverseGear(¶ms); @@ -575,35 +572,31 @@ cAudioManager::ProcessVehicle(CVehicle *veh) ProcessVehicleEngine(¶ms); ProcessEngineDamage(¶ms); ProcessVehicleDoors(¶ms); + ProcessVehicleOneShots(¶ms); ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; - ProcessRainOnVehicle(¶ms); break; case VEHICLE_TYPE_BOAT: ProcessBoatEngine(¶ms); ProcessBoatMovingOverWater(¶ms); ProcessVehicleOneShots(¶ms); - ProcessRainOnVehicle(¶ms); break; case VEHICLE_TYPE_TRAIN: ProcessTrainNoise(¶ms); ProcessVehicleOneShots(¶ms); - ProcessRainOnVehicle(¶ms); break; case VEHICLE_TYPE_HELI: ProcessHelicopter(¶ms); ProcessVehicleOneShots(¶ms); - ProcessRainOnVehicle(¶ms); break; case VEHICLE_TYPE_PLANE: ProcessPlane(¶ms); ProcessVehicleOneShots(¶ms); - ProcessRainOnVehicle(¶ms); break; default: - ProcessRainOnVehicle(¶ms); break; } + ProcessRainOnVehicle(¶ms); } void @@ -655,14 +648,14 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params) if (params->m_fDistance >= SQR(reverseGearIntensity)) return false; veh = params->m_pVehicle; - if (veh->bEngineOn && (veh->m_fGasPedal < 0.0f || !veh->m_nCurrentGear)) { + if (veh->bEngineOn && (veh->m_fGasPedal < 0.0f || veh->m_nCurrentGear == 0)) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); automobile = (CAutomobile *)params->m_pVehicle; - if (automobile->m_nWheelsOnGround) { + if (automobile->m_nWheelsOnGround != 0) { modificator = params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity; } else { - if (automobile->m_nDriveWheelsOnGround) - automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.4f; + if (automobile->m_nDriveWheelsOnGround != 0) + automobile->m_fGasPedalAudio *= 0.4f; modificator = automobile->m_fGasPedalAudio; } modificator = Abs(modificator); @@ -708,12 +701,12 @@ cAudioManager::ProcessModelCarEngine(cVehicleParams *params) if (params->m_fDistance < SQR(SOUND_INTENSITY)) { automobile = (CAutomobile *)params->m_pVehicle; if (automobile->bEngineOn) { - if (automobile->m_nWheelsOnGround) { - velocityChange = Abs(params->m_fVelocityChange); - } else { - if (automobile->m_nDriveWheelsOnGround) - automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.4f; + if (automobile->m_nWheelsOnGround == 0) { + if (automobile->m_nDriveWheelsOnGround != 0) + automobile->m_fGasPedalAudio *= 0.4f; velocityChange = automobile->m_fGasPedalAudio * params->m_pTransmission->fMaxVelocity; + } else { + velocityChange = Abs(params->m_fVelocityChange); } if (velocityChange > 0.001f) { allowedVelocity = 0.5f * params->m_pTransmission->fMaxVelocity; @@ -764,14 +757,14 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params) if (params->m_fDistance >= SQR(SOUND_INTENSITY)) return false; - if (params->m_pTransmission) { - if (params->m_pVehicle->m_vecMoveSpeed.z) { + if (params->m_pTransmission != nil) { + if (((CAutomobile*)params->m_pVehicle)->m_nDriveWheelsOnGround != 0) { velocity = Abs(params->m_fVelocityChange); if (velocity > 0.0f) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); emittingVol = 30.f * Min(1.f, velocity / (0.5f * params->m_pTransmission->fMaxVelocity)); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_bIs2D = false; @@ -817,8 +810,8 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params) if (params->m_fDistance >= SQR(SOUND_INTENSITY)) return false; - if (params->m_pTransmission) { - if (params->m_pVehicle->m_vecMoveSpeed.z) { + if (params->m_pTransmission != 0) { + if (((CAutomobile *)params->m_pVehicle)->m_nDriveWheelsOnGround != 0) { velChange = Abs(params->m_fVelocityChange); if (velChange > 0.f) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); @@ -863,7 +856,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params) float relativeGearChange; float relativeChange; uint8 volume; - int32 freq = 0; // uinitialized variable + int32 freq = 0; // uninitialized variable uint8 emittingVol; cTransmission *transmission; uint8 currentGear; @@ -889,9 +882,9 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params) return; } transmission = params->m_pTransmission; - if (transmission) { + if (transmission != nil) { currentGear = params->m_pVehicle->m_nCurrentGear; - if (automobile->m_nWheelsOnGround) { + if (automobile->m_nWheelsOnGround != 0) { if (automobile->bIsHandbrakeOn) { if (params->m_fVelocityChange == 0.0f) traction = 0.9f; @@ -921,7 +914,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params) } if (transmission->fMaxVelocity <= 0.f) { relativeChange = 0.f; - } else if (currentGear) { + } else if (currentGear != 0) { relativeGearChange = Min(1.0f, (params->m_fVelocityChange - transmission->Gears[currentGear].fShiftDownVelocity) / transmission->fMaxVelocity * 2.5f); if (traction == 0.0f && automobile->GetStatus() != STATUS_SIMPLE && @@ -933,7 +926,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params) relativeChange = Min(1.0f, 1.0f - Abs((params->m_fVelocityChange - transmission->Gears[0].fShiftDownVelocity) / transmission->fMaxReverseVelocity)); } else { - if (automobile->m_nDriveWheelsOnGround) + if (automobile->m_nDriveWheelsOnGround != 0) automobile->m_fGasPedalAudio *= 0.4f; relativeChange = automobile->m_fGasPedalAudio; } @@ -955,7 +948,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params) volume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); } m_sQueueSample.m_nVolume = volume; - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { if (automobile->GetStatus() == STATUS_SIMPLE) { if (modificator < 0.02f) { m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_bEngineSoundType - 1 + SFX_CAR_IDLE_1; @@ -1000,29 +993,20 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params) void cAudioManager::UpdateGasPedalAudio(CAutomobile *automobile) { - float newGasPedalAudio; - float gasPedal = Abs(automobile->m_fGasPedal); float gasPedalAudio = automobile->m_fGasPedalAudio; - if (gasPedalAudio < gasPedal) { - newGasPedalAudio = gasPedalAudio + 0.09f; - if (gasPedal <= newGasPedalAudio) - newGasPedalAudio = gasPedal; - } else { - newGasPedalAudio = gasPedalAudio - 0.07f; - if (gasPedal >= newGasPedalAudio) - newGasPedalAudio = gasPedal; - } - automobile->m_fGasPedalAudio = newGasPedalAudio; + if (gasPedalAudio < gasPedal) + automobile->m_fGasPedalAudio = Min(gasPedalAudio + 0.09f, gasPedal); + else + automobile->m_fGasPedalAudio = Max(gasPedalAudio - 0.07f, gasPedal); } void cAudioManager::PlayerJustGotInCar() const { - if (m_bIsInitialised) { + if (m_bIsInitialised) bPlayerJustEnteredCar = true; - } } void @@ -1188,7 +1172,9 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * gasPedalAudio = accelerationMultipler; currentGear = params->m_pVehicle->m_nCurrentGear; - if (transmission->nDriveType == '4') { + switch (transmission->nDriveType) + { + case '4': wheelInUseCounter = 0; for (uint8 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) { if (automobile->m_aWheelState[i] != WHEEL_STATE_NORMAL) @@ -1196,20 +1182,24 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * } if (wheelInUseCounter > 2) lostTraction = true; - } else if (transmission->nDriveType == 'F') + break; + case 'F': if ((automobile->m_aWheelState[VEHWHEEL_FRONT_LEFT] != WHEEL_STATE_NORMAL || automobile->m_aWheelState[VEHWHEEL_REAR_LEFT] != WHEEL_STATE_NORMAL) && (automobile->m_aWheelState[VEHWHEEL_FRONT_RIGHT] != WHEEL_STATE_NORMAL || automobile->m_aWheelState[VEHWHEEL_REAR_RIGHT] != WHEEL_STATE_NORMAL)) lostTraction = true; - else if (transmission->nDriveType == 'R' && (automobile->m_aWheelState[VEHWHEEL_FRONT_RIGHT] != WHEEL_STATE_NORMAL || - automobile->m_aWheelState[VEHWHEEL_REAR_RIGHT] != WHEEL_STATE_NORMAL)) + break; + case 'R': + if ((automobile->m_aWheelState[VEHWHEEL_FRONT_RIGHT] != WHEEL_STATE_NORMAL) || (automobile->m_aWheelState[VEHWHEEL_REAR_RIGHT] != WHEEL_STATE_NORMAL)) lostTraction = true; + break; + } if (velocityChange != 0.0f) { time = params->m_pVehicle->m_vecMoveSpeed.z / velocityChange; if (time > 0.0f) freqModifier = -(Min(0.2f, time) * 3000.0f * 5.0f); else - freqModifier = (Max(-0.2f, time) * 3000.0f * -5.0f); + freqModifier = -(Max(-0.2f, time) * 3000.0f * 5.0f); if (params->m_fVelocityChange < -0.001f) freqModifier = -freqModifier; } else @@ -1580,7 +1570,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params) #endif CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 5; if (UsesSiren(params->m_nIndex)) { if (params->m_pVehicle->GetStatus() == STATUS_ABANDONED) @@ -1614,7 +1604,6 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params) m_sQueueSample.m_bReverbFlag = true; m_sQueueSample.m_bRequireReflection = false; AddSampleToRequestedQueue(); - return; } } } @@ -1684,7 +1673,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams *params) if (velocity > 0.0035f) { emittingVol = (100.f * velocity * 10.f / 3.f); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = i + 6; m_sQueueSample.m_nSampleIndex = m_anRandomTable[1] % 6 + SFX_COL_CAR_PANEL_1; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) + RandomDisplacement(1000); @@ -1817,7 +1806,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams *params) if (automobile->bEngineOn && automobile->m_bombType == CARBOMB_TIMEDACTIVE) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(60, 40.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 35; m_sQueueSample.m_nSampleIndex = SFX_COUNTDOWN; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -2351,7 +2340,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params) if (params->m_nIndex == REEFER) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, 50.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 39; m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; m_sQueueSample.m_nFrequency = 10386; @@ -2489,7 +2478,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams *params) return false; velocityChange = Abs(params->m_fVelocityChange); - if (velocityChange <= 0.0005f && params->m_pVehicle->GetPosition().y) + if (velocityChange <= 0.0005f && ((CBoat*)params->m_pVehicle)->bBoatInWater) return true; velocityChange = Min(0.75f, velocityChange); From ad896d5f8191f008642c8e90d2741baa5c0d0d58 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Mon, 25 May 2020 19:10:15 +0300 Subject: [PATCH 048/133] Ped comments cleanup --- src/audio/AudioLogic.cpp | 96 ++++++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 43 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index b6f883d4..86805733 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -3975,17 +3975,18 @@ cAudioManager::GetCopTalkSfx(int16 sound) PedState pedState; static uint32 lastSfx = NO_SAMPLE; - if (sound == SOUND_PED_ARREST_COP) { + switch (sound) { + case SOUND_PED_ARREST_COP: GetPhrase(&sfx, &lastSfx, SFX_COP_VOICE_1_ARREST_1, 6); - } else { - if (sound != SOUND_PED_PURSUIT_COP) { - return GetGenericMaleTalkSfx(sound); - } - + break; + case SOUND_PED_PURSUIT_COP: pedState = FindPlayerPed()->m_nPedState; if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) return NO_SAMPLE; GetPhrase(&sfx, &lastSfx, SFX_COP_VOICE_1_CHASE_1, 7); + break; + default: + return GetGenericMaleTalkSfx(sound); } return (SFX_COP_VOICE_2_ARREST_1 - SFX_COP_VOICE_1_ARREST_1) * (m_sQueueSample.m_nEntityIndex % 5) + sfx; @@ -3998,17 +3999,18 @@ cAudioManager::GetSwatTalkSfx(int16 sound) PedState pedState; static uint32 lastSfx = NO_SAMPLE; - if (sound == SOUND_PED_ARREST_SWAT) { + switch (sound) { + case SOUND_PED_ARREST_SWAT: GetPhrase(&sfx, &lastSfx, SFX_SWAT_VOICE_1_CHASE_1, 6); - } else { - if (sound != SOUND_PED_PURSUIT_SWAT) { - return GetGenericMaleTalkSfx(sound); - } - + break; + case SOUND_PED_PURSUIT_SWAT: pedState = FindPlayerPed()->m_nPedState; if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) return NO_SAMPLE; GetPhrase(&sfx, &lastSfx, SFX_SWAT_VOICE_1_CHASE_1, 6); + break; + default: + return GetGenericMaleTalkSfx(sound); } return (SFX_SWAT_VOICE_2_CHASE_1 - SFX_SWAT_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 4) + sfx; @@ -4021,17 +4023,18 @@ cAudioManager::GetFBITalkSfx(int16 sound) PedState pedState; static uint32 lastSfx = NO_SAMPLE; - if (sound == SOUND_PED_ARREST_FBI) { + switch (sound) { + case SOUND_PED_ARREST_FBI: GetPhrase(&sfx, &lastSfx, SFX_FBI_VOICE_1_CHASE_1, 6); - } else { - if (sound != SOUND_PED_PURSUIT_FBI) { - return GetGenericMaleTalkSfx(sound); - } - + break; + case SOUND_PED_PURSUIT_FBI: pedState = FindPlayerPed()->m_nPedState; if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) return NO_SAMPLE; GetPhrase(&sfx, &lastSfx, SFX_FBI_VOICE_1_CHASE_1, 6); + break; + default: + return GetGenericMaleTalkSfx(sound); } return (SFX_FBI_VOICE_2_CHASE_1 - SFX_FBI_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 3) + sfx; @@ -4044,15 +4047,16 @@ cAudioManager::GetArmyTalkSfx(int16 sound) PedState pedState; static uint32 lastSfx = NO_SAMPLE; - if (sound != SOUND_PED_PURSUIT_ARMY) { + switch (sound) { + case SOUND_PED_PURSUIT_ARMY: + pedState = FindPlayerPed()->m_nPedState; + if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) + return NO_SAMPLE; + GetPhrase(&sfx, &lastSfx, SFX_ARMY_VOICE_1_CHASE_1, 15); + default: return GetGenericMaleTalkSfx(sound); } - pedState = FindPlayerPed()->m_nPedState; - if (pedState == PED_ARRESTED || pedState == PED_DEAD || pedState == PED_DIE) - return NO_SAMPLE; - GetPhrase(&sfx, &lastSfx, SFX_ARMY_VOICE_1_CHASE_1, 15); - return (SFX_ARMY_VOICE_2_CHASE_1 - SFX_ARMY_VOICE_1_CHASE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; } @@ -4133,13 +4137,17 @@ cAudioManager::GetTaxiDriverTalkSfx(int16 sound) uint32 sfx; static uint32 lastSfx = NO_SAMPLE; - if (sound == SOUND_PED_CAR_JACKED) { + switch (sound) { + case SOUND_PED_CAR_JACKED: GetPhrase(&sfx, &lastSfx, SFX_ASIAN_TAXI_DRIVER_VOICE_1_CARJACKED_1, 7); - } else { - if (sound != SOUND_PED_CAR_COLLISION) - return GetGenericMaleTalkSfx(sound); + break; + case SOUND_PED_CAR_COLLISION: GetPhrase(&sfx, &lastSfx, SFX_ASIAN_TAXI_DRIVER_VOICE_1_DRIVER_ABUSE_1, 6); + break; + default: + return GetGenericMaleTalkSfx(sound); } + return (SFX_ASIAN_TAXI_DRIVER_VOICE_2_DRIVER_ABUSE_1 - SFX_ASIAN_TAXI_DRIVER_VOICE_1_DRIVER_ABUSE_1) * (m_sQueueSample.m_nEntityIndex % 2) + sfx; } @@ -6052,10 +6060,14 @@ cAudioManager::GetBomberTalkSfx(int16 sound) uint32 sfx; static uint32 lastSfx = NO_SAMPLE; - if (sound != SOUND_PED_BOMBER) + switch (sound) + { + case SOUND_PED_BOMBER: + GetPhrase(&sfx, &lastSfx, SFX_BOMBERMAN_1, 7); + break; + default: return GetGenericMaleTalkSfx(sound); - - GetPhrase(&sfx, &lastSfx, SFX_BOMBERMAN_1, 7); + } return sfx; } @@ -6098,13 +6110,17 @@ cAudioManager::GetChunkyTalkSfx(int16 sound) uint32 sfx; static uint32 lastSfx = NO_SAMPLE; - if (sound == SOUND_PED_DEATH) + switch (sound) + { + case SOUND_PED_DEATH: return SFX_CHUNKY_DEATH; - - if (sound != SOUND_PED_FLEE_RUN) + case SOUND_PED_FLEE_RUN: + GetPhrase(&sfx, &lastSfx, SFX_CHUNKY_RUN_1, 5); + break; + default: return GetGenericMaleTalkSfx(sound); + } - GetPhrase(&sfx, &lastSfx, SFX_CHUNKY_RUN_1, 5); return sfx; } @@ -6160,8 +6176,6 @@ cAudioManager::GetGenericFemaleTalkSfx(int16 sound) return sfx; } - - void cPedComments::Add(tPedComment *com) { @@ -6175,11 +6189,7 @@ cPedComments::Add(tPedComment *com) index = m_nCommentsInBank[m_nActiveBank]++; } - m_asPedComments[m_nActiveBank][index].m_nSampleIndex = com->m_nSampleIndex; - m_asPedComments[m_nActiveBank][index].m_nEntityIndex = com->m_nEntityIndex; - m_asPedComments[m_nActiveBank][index].m_vecPos = com->m_vecPos; - m_asPedComments[m_nActiveBank][index].m_fDistance = com->m_fDistance; - m_asPedComments[m_nActiveBank][index].m_bVolume = com->m_bVolume; + m_asPedComments[m_nActiveBank][index] = *com; uint32 i = 0; if (index != 0) { @@ -6466,7 +6476,7 @@ void cAudioManager::ProcessScriptObject(int32 id) { cAudioScriptObject *entity = (cAudioScriptObject *)m_asAudioEntities[id].m_pEntity; - if (entity) { + if (entity != 0) { m_sQueueSample.m_vecPos = entity->Posn; if (m_asAudioEntities[id].m_AudioEvents == 1) ProcessOneShotScriptObject(m_asAudioEntities[id].m_awAudioEvent[0]); From 52644192e37bad31a3f88e2bc271619e265c7507 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Mon, 25 May 2020 19:36:09 +0300 Subject: [PATCH 049/133] Even more audio cleanups --- src/audio/AudioLogic.cpp | 209 +++++++++++++++++++-------------------- 1 file changed, 103 insertions(+), 106 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 86805733..f516e43c 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -611,7 +611,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams *params) CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); float emittingVol = 30.f * CWeather::Rain; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, rainOnVehicleIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = veh->m_bRainSamplesCounter++; if (veh->m_bRainSamplesCounter > 4) veh->m_bRainSamplesCounter = 68; @@ -661,7 +661,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams *params) modificator = Abs(modificator); emittingVol = (24.f * modificator); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, reverseGearIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { if (params->m_pVehicle->m_fGasPedal >= 0.0f) { m_sQueueSample.m_nCounter = 62; m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR_2; @@ -717,7 +717,7 @@ cAudioManager::ProcessModelCarEngine(cVehicleParams *params) if (emittingVol) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 30.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nSampleIndex = SFX_REMOTE_CONTROLLED_CAR; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -810,7 +810,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params) if (params->m_fDistance >= SQR(SOUND_INTENSITY)) return false; - if (params->m_pTransmission != 0) { + if (params->m_pTransmission != nil) { if (((CAutomobile *)params->m_pVehicle)->m_nDriveWheelsOnGround != 0) { velChange = Abs(params->m_fVelocityChange); if (velChange > 0.f) { @@ -818,7 +818,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params) relativeVelocity = Min(1.0f, velChange / (0.5f * params->m_pTransmission->fMaxVelocity)); emittingVol = 23.0f * relativeVelocity * CWeather::WetRoads; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 1; m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -1019,7 +1019,7 @@ void cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1, uint8 counter, bool notLooping) { m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, 50.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = counter; m_sQueueSample.m_nSampleIndex = sample; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -1054,20 +1054,20 @@ cAudioManager::ProcessCesna(cVehicleParams *params) if (FindPlayerVehicle() == params->m_pVehicle) { if (params->m_nIndex == DODO) { if (Pads[0].GetAccelerate() <= 0) { - if (nAccel) + if (nAccel != 0) --nAccel; } else if (nAccel < 60) { ++nAccel; } - AddPlayerCarSample(85 * (60 - nAccel) / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_IDLE, 0, 52, 1); - AddPlayerCarSample(85 * nAccel / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_REV, 0, 2, 1); + AddPlayerCarSample(85 * (60 - nAccel) / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_IDLE, 0, 52, true); + AddPlayerCarSample(85 * nAccel / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_REV, 0, 2, true); } } else if (params->m_nIndex == DODO) { - AddPlayerCarSample(105, 17000, SFX_CESNA_IDLE, 0, 52, 1); + AddPlayerCarSample(105, 17000, SFX_CESNA_IDLE, 0, 52, true); } else if (params->m_fDistance < SQR(200)) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, 200.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 52; m_sQueueSample.m_nSampleIndex = SFX_CESNA_IDLE; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -1088,7 +1088,7 @@ cAudioManager::ProcessCesna(cVehicleParams *params) } if (params->m_fDistance < SQR(90)) { m_sQueueSample.m_nVolume = ComputeVolume(80, 90.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nSampleIndex = SFX_CESNA_REV; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -1500,7 +1500,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams *params) CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 4; m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nHornSample; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -1981,7 +1981,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params) case SOUND_CAR_HYDRAULIC_1: case SOUND_CAR_HYDRAULIC_2: { const float SOUND_INTENSITY = 35.0f; - if (event == MOONBEAM) // todo check + if (event == SOUND_CAR_HYDRAULIC_1) m_sQueueSample.m_nFrequency = 15600; else m_sQueueSample.m_nFrequency = 13118; @@ -2926,7 +2926,7 @@ cAudioManager::ProcessPedHeadphones(cPedParams *params) } m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, 7.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 64; m_sQueueSample.m_nSampleIndex = SFX_HEADPHONES; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -3662,13 +3662,13 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) if (params->m_fDistance < maxDist) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { if (noReflection) { - if (0.2f * m_sQueueSample.m_fSoundIntensity <= m_sQueueSample.m_fDistance) { - noReflection = false; - } else { + if (m_sQueueSample.m_fDistance < 0.2f * m_sQueueSample.m_fSoundIntensity) { m_sQueueSample.m_bIs2D = true; m_sQueueSample.m_nOffset = 0; + } else { + noReflection = false; } } m_sQueueSample.m_bReverbFlag = true; @@ -6213,78 +6213,75 @@ cPedComments::Process() uint8 actualUsedBank; tPedComment *comment; - static const int defaultIntensity = 50; - static const int policeHeliIntensity = 400; + if (AudioManager.m_nUserPause != 0) return; - if (!AudioManager.m_nUserPause) { - if (m_nCommentsInBank[m_nActiveBank]) { - sampleIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nSampleIndex; - if (!SampleManager.IsPedCommentLoaded(sampleIndex)) - SampleManager.LoadPedComment(sampleIndex); + if (m_nCommentsInBank[m_nActiveBank]) { + sampleIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nSampleIndex; + if (!SampleManager.IsPedCommentLoaded(sampleIndex)) + SampleManager.LoadPedComment(sampleIndex); - AudioManager.m_sQueueSample.m_nEntityIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nEntityIndex; - AudioManager.m_sQueueSample.m_nCounter = 0; - AudioManager.m_sQueueSample.m_nSampleIndex = sampleIndex; - AudioManager.m_sQueueSample.m_nBankIndex = SAMPLEBANK_PED; - AudioManager.m_sQueueSample.m_nReleasingVolumeModificator = 3; - AudioManager.m_sQueueSample.m_nVolume = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_bVolume; - AudioManager.m_sQueueSample.m_fDistance = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_fDistance; - AudioManager.m_sQueueSample.m_nLoopCount = 1; - AudioManager.m_sQueueSample.m_nLoopStart = 0; - AudioManager.m_sQueueSample.m_nLoopEnd = -1; - AudioManager.m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; - AudioManager.m_sQueueSample.m_fSpeedMultiplier = 3.0f; - switch (sampleIndex) { - case SFX_POLICE_HELI_1: - case SFX_POLICE_HELI_2: - case SFX_POLICE_HELI_3: - AudioManager.m_sQueueSample.m_fSoundIntensity = policeHeliIntensity; - break; - default: - AudioManager.m_sQueueSample.m_fSoundIntensity = defaultIntensity; - break; - } - AudioManager.m_sQueueSample.m_bReleasingSoundFlag = true; - AudioManager.m_sQueueSample.m_vecPos = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_vecPos; - - if (sampleIndex >= SFX_AMMU_D && sampleIndex <= SFX_AMMU_F) { - AudioManager.m_sQueueSample.m_bReverbFlag = false; - AudioManager.m_sQueueSample.m_bRequireReflection = false; - } else { - AudioManager.m_sQueueSample.m_bReverbFlag = true; - AudioManager.m_sQueueSample.m_bRequireReflection = true; - } - - AudioManager.m_sQueueSample.m_bIs2D = false; - AudioManager.m_sQueueSample.m_nFrequency = - SampleManager.GetSampleBaseFrequency(AudioManager.m_sQueueSample.m_nSampleIndex) + AudioManager.RandomDisplacement(750); - if (CTimer::GetIsSlowMotionActive()) - AudioManager.m_sQueueSample.m_nFrequency /= 2; - m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nProcess = -1; - AudioManager.AddSampleToRequestedQueue(); + AudioManager.m_sQueueSample.m_nEntityIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nEntityIndex; + AudioManager.m_sQueueSample.m_nCounter = 0; + AudioManager.m_sQueueSample.m_nSampleIndex = sampleIndex; + AudioManager.m_sQueueSample.m_nBankIndex = SAMPLEBANK_PED; + AudioManager.m_sQueueSample.m_nReleasingVolumeModificator = 3; + AudioManager.m_sQueueSample.m_nVolume = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_bVolume; + AudioManager.m_sQueueSample.m_fDistance = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_fDistance; + AudioManager.m_sQueueSample.m_nLoopCount = 1; + AudioManager.m_sQueueSample.m_nLoopStart = 0; + AudioManager.m_sQueueSample.m_nLoopEnd = -1; + AudioManager.m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; + AudioManager.m_sQueueSample.m_fSpeedMultiplier = 3.0f; + switch (sampleIndex) { + case SFX_POLICE_HELI_1: + case SFX_POLICE_HELI_2: + case SFX_POLICE_HELI_3: + AudioManager.m_sQueueSample.m_fSoundIntensity = 400.0f; + break; + default: + AudioManager.m_sQueueSample.m_fSoundIntensity = 50.0f; + break; } + AudioManager.m_sQueueSample.m_bReleasingSoundFlag = true; + AudioManager.m_sQueueSample.m_vecPos = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_vecPos; - // Switch bank - if (m_nActiveBank) { - actualUsedBank = SAMPLEBANK_PED; - m_nActiveBank = SAMPLEBANK_MAIN; + if (sampleIndex >= SFX_AMMU_D && sampleIndex <= SFX_AMMU_F) { + AudioManager.m_sQueueSample.m_bReverbFlag = false; + AudioManager.m_sQueueSample.m_bRequireReflection = false; } else { - actualUsedBank = SAMPLEBANK_MAIN; - m_nActiveBank = SAMPLEBANK_PED; - } - comment = m_asPedComments[actualUsedBank]; - for (uint32 i = 0; i < m_nCommentsInBank[actualUsedBank]; i++) { - if (m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess > 0) { - --m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess; - Add(&comment[m_nIndexMap[actualUsedBank][i]]); - } + AudioManager.m_sQueueSample.m_bReverbFlag = true; + AudioManager.m_sQueueSample.m_bRequireReflection = true; } - for (uint32 i = 0; i < NUM_PED_COMMENTS_SLOTS; i++) { - m_nIndexMap[actualUsedBank][i] = NUM_PED_COMMENTS_SLOTS; - } - m_nCommentsInBank[actualUsedBank] = 0; + AudioManager.m_sQueueSample.m_bIs2D = false; + AudioManager.m_sQueueSample.m_nFrequency = + SampleManager.GetSampleBaseFrequency(AudioManager.m_sQueueSample.m_nSampleIndex) + AudioManager.RandomDisplacement(750); + if (CTimer::GetIsSlowMotionActive()) + AudioManager.m_sQueueSample.m_nFrequency /= 2; + m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nProcess = -1; + AudioManager.AddSampleToRequestedQueue(); } + + // Switch bank + if (m_nActiveBank) { + actualUsedBank = SAMPLEBANK_PED; + m_nActiveBank = SAMPLEBANK_MAIN; + } else { + actualUsedBank = SAMPLEBANK_MAIN; + m_nActiveBank = SAMPLEBANK_PED; + } + comment = m_asPedComments[actualUsedBank]; + for (uint32 i = 0; i < m_nCommentsInBank[actualUsedBank]; i++) { + if (m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess > 0) { + --m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess; + Add(&comment[m_nIndexMap[actualUsedBank][i]]); + } + } + + for (uint32 i = 0; i < NUM_PED_COMMENTS_SLOTS; i++) { + m_nIndexMap[actualUsedBank][i] = NUM_PED_COMMENTS_SLOTS; + } + m_nCommentsInBank[actualUsedBank] = 0; } #pragma endregion @@ -6344,7 +6341,7 @@ cAudioManager::ProcessExplosions(int32 explosion) if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = i; m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_bIs2D = false; @@ -6412,7 +6409,7 @@ cAudioManager::ProcessFires(int32) if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = i; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_fSpeedMultiplier = 2.0f; @@ -6476,7 +6473,7 @@ void cAudioManager::ProcessScriptObject(int32 id) { cAudioScriptObject *entity = (cAudioScriptObject *)m_asAudioEntities[id].m_pEntity; - if (entity != 0) { + if (entity != nil) { m_sQueueSample.m_vecPos = entity->Posn; if (m_asAudioEntities[id].m_AudioEvents == 1) ProcessOneShotScriptObject(m_asAudioEntities[id].m_awAudioEvent[0]); @@ -6675,7 +6672,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = true; @@ -6720,7 +6717,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = true; @@ -7397,7 +7394,7 @@ cAudioManager::ProcessPornCinema(uint8 sound) m_sQueueSample.m_fDistance = Sqrt(distSquared); if (sound != SCRIPT_SOUND_MISTY_SEX_S && sound != SCRIPT_SOUND_MISTY_SEX_L) { m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_bIs2D = false; @@ -7417,7 +7414,7 @@ cAudioManager::ProcessPornCinema(uint8 sound) time = CTimer::GetTimeInMilliseconds(); if (time > gPornNextTime) { m_sQueueSample.m_nVolume = ComputeVolume(90, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { rand = m_anRandomTable[1] & 1; m_sQueueSample.m_nSampleIndex = rand + sample; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); @@ -7456,7 +7453,7 @@ cAudioManager::ProcessWorkShopScriptObject(uint8 sound) if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = SFX_WORKSHOP_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_WORKSHOP_1); @@ -7495,7 +7492,7 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound) if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = SFX_SAWMILL_LOOP; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SAWMILL_LOOP); @@ -7515,7 +7512,7 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound) time = CTimer::GetTimeInMilliseconds(); if (time > gSawMillNextTime) { m_sQueueSample.m_nVolume = ComputeVolume(70, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = SFX_SAWMILL_CUT_WOOD; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); @@ -7551,7 +7548,7 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound) if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(45, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = SFX_LAUNDERETTE_LOOP; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_LAUNDERETTE_LOOP); @@ -7569,7 +7566,7 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound) AddSampleToRequestedQueue(); } m_sQueueSample.m_nVolume = ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = SFX_LAUNDERETTE_SONG_LOOP; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_LAUNDERETTE_SONG_LOOP); @@ -7608,7 +7605,7 @@ cAudioManager::ProcessShopScriptObject(uint8 sound) if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = SFX_SHOP_LOOP; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SHOP_LOOP); @@ -7628,7 +7625,7 @@ cAudioManager::ProcessShopScriptObject(uint8 sound) time = CTimer::GetTimeInMilliseconds(); if (time > gShopNextTime) { m_sQueueSample.m_nVolume = ComputeVolume(70, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { rand = m_anRandomTable[1] & 1; m_sQueueSample.m_nSampleIndex = rand + SFX_SHOP_TILL_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -7718,7 +7715,7 @@ cAudioManager::ProcessCinemaScriptObject(uint8 sound) m_sQueueSample.m_fDistance = Sqrt(distSquared); rand = m_anRandomTable[0] % 90 + 30; m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = iSound % 3 + SFX_CINEMA_BASS_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); @@ -7767,7 +7764,7 @@ cAudioManager::ProcessDocksScriptObject(uint8 sound) m_sQueueSample.m_fDistance = Sqrt(distSquared); rand = m_anRandomTable[0] % 60 + 40; m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = SFX_DOCKS_FOGHORN; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOCKS_FOGHORN); @@ -7815,7 +7812,7 @@ cAudioManager::ProcessHomeScriptObject(uint8 sound) m_sQueueSample.m_fDistance = Sqrt(dist); rand = m_anRandomTable[0] % 30 + 40; m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = m_anRandomTable[0] % 5 + SFX_HOME_1; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); @@ -8095,7 +8092,7 @@ cAudioManager::ProcessFrontEnd() if (sample == SFX_RAIN) { m_sQueueSample.m_nFrequency = 28509; } else if (sample == SFX_PICKUP_1_LEFT) { - if (1.f == m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]) + if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i] == 1.0f) m_sQueueSample.m_nFrequency = 32000; else m_sQueueSample.m_nFrequency = 48000; @@ -8144,7 +8141,7 @@ cAudioManager::ProcessCrane() if (distSquared < SQR(intensity)) { CalculateDistance(distCalculated, distSquared); m_sQueueSample.m_nVolume = ComputeVolume(100, 80.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nSampleIndex = SFX_CRANE_MAGNET; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -8216,7 +8213,7 @@ cAudioManager::ProcessProjectiles() if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = i; m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_nLoopCount = 0; @@ -8320,7 +8317,7 @@ cAudioManager::ProcessGarages() if (distSquared < SQR(SOUND_INTENSITY)) { CalculateDistance(distCalculated, distSquared); m_sQueueSample.m_nVolume = ComputeVolume(60, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { if (CGarages::aGarages[i].m_eGarageType == GARAGE_CRUSHER) { m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2; m_sQueueSample.m_nFrequency = 6735; @@ -8429,7 +8426,7 @@ cAudioManager::ProcessBridgeWarning() { if (CStats::CommercialPassed && m_sQueueSample.m_fDistance < 450.f) { m_sQueueSample.m_nVolume = ComputeVolume(100, 450.f, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nSampleIndex = SFX_BRIDGE_OPEN_WARNING; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -8456,7 +8453,7 @@ cAudioManager::ProcessBridgeMotor() { if (m_sQueueSample.m_fDistance < bridgeIntensity) { m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, bridgeIntensity, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume) { + if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 1; m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; // todo check sfx name m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; From 3c3b1aadc0bfd3b8d58cc9dcc269d83f6a003235 Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 25 May 2020 20:36:18 +0200 Subject: [PATCH 050/133] small fixes --- src/core/World.cpp | 26 +++++++++++++------------- src/peds/Ped.cpp | 2 +- src/render/Coronas.cpp | 6 +++--- src/render/Shadows.cpp | 8 ++++---- src/render/Timecycle.cpp | 2 +- src/render/Timecycle.h | 2 +- src/vehicles/Automobile.cpp | 4 ++-- src/vehicles/Heli.cpp | 2 +- src/vehicles/Vehicle.cpp | 9 +++++++-- 9 files changed, 33 insertions(+), 28 deletions(-) diff --git a/src/core/World.cpp b/src/core/World.cpp index edcfd865..39681428 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -33,22 +33,22 @@ CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS]; -CPtrList CWorld::ms_bigBuildingsList[4];// = (CPtrList*)0x6FAB60; -CPtrList CWorld::ms_listMovingEntityPtrs;// = *(CPtrList*)0x8F433C; -CSector CWorld::ms_aSectors[NUMSECTORS_Y][NUMSECTORS_X];// = (CSector (*)[NUMSECTORS_Y])0x665608; -uint16 CWorld::ms_nCurrentScanCode;// = *(uint16*)0x95CC64; +CPtrList CWorld::ms_bigBuildingsList[4]; +CPtrList CWorld::ms_listMovingEntityPtrs; +CSector CWorld::ms_aSectors[NUMSECTORS_Y][NUMSECTORS_X]; +uint16 CWorld::ms_nCurrentScanCode; -uint8 CWorld::PlayerInFocus;// = *(uint8 *)0x95CD61; +uint8 CWorld::PlayerInFocus; CPlayerInfo CWorld::Players[NUMPLAYERS]; -bool CWorld::bNoMoreCollisionTorque;// = *(bool*)0x95CDCC; -CEntity *CWorld::pIgnoreEntity;// = *(CEntity**)0x8F6494; -bool CWorld::bIncludeDeadPeds;// = *(bool*)0x95CD8F; -bool CWorld::bSecondShift;// = *(bool*)0x95CD54; -bool CWorld::bForceProcessControl;// = *(bool*)0x95CD6C; -bool CWorld::bProcessCutsceneOnly;// = *(bool*)0x95CD8B; +bool CWorld::bNoMoreCollisionTorque; +CEntity *CWorld::pIgnoreEntity; +bool CWorld::bIncludeDeadPeds; +bool CWorld::bSecondShift; +bool CWorld::bForceProcessControl; +bool CWorld::bProcessCutsceneOnly; -bool CWorld::bDoingCarCollisions;// = *(bool*)0x95CD8C; -bool CWorld::bIncludeCarTyres;// = *(bool*)0x95CDAA; +bool CWorld::bDoingCarCollisions; +bool CWorld::bIncludeCarTyres; void CWorld::Initialise() diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index d48a6a2f..e3fa2104 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -63,7 +63,7 @@ CPed *gapTempPedList[50]; uint16 gnNumTempPedList; -CColPoint aTempPedColPts[MAX_COLLISION_POINTS]; +static CColPoint aTempPedColPts[MAX_COLLISION_POINTS]; // Corresponds to ped sounds (from SOUND_PED_DEATH to SOUND_PED_TAXI_CALL) PedAudioData CommentWaitTime[39] = { diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp index de3b5c78..5bf89403 100644 --- a/src/render/Coronas.cpp +++ b/src/render/Coronas.cpp @@ -506,18 +506,18 @@ CCoronas::DoSunAndMoon(void) { // yeah, moon is done somewhere else.... - CVector sunCoors = CTimeCycle::GetSunPosition(); + CVector sunCoors = CTimeCycle::GetSunDirection(); sunCoors *= 150.0f; sunCoors += TheCamera.GetPosition(); - if(CTimeCycle::GetSunPosition().z > -0.2f){ + if(CTimeCycle::GetSunDirection().z > -0.2f){ float size = ((CGeneral::GetRandomNumber()&0xFF) * 0.005f + 10.0f) * CTimeCycle::GetSunSize(); RegisterCorona(SUN_CORE, CTimeCycle::GetSunCoreRed(), CTimeCycle::GetSunCoreGreen(), CTimeCycle::GetSunCoreBlue(), 255, sunCoors, size, 999999.88f, TYPE_STAR, FLARE_NONE, REFLECTION_OFF, LOSCHECK_OFF, STREAK_OFF, 0.0f); - if(CTimeCycle::GetSunPosition().z > 0.0f) + if(CTimeCycle::GetSunDirection().z > 0.0f) RegisterCorona(SUN_CORONA, CTimeCycle::GetSunCoronaRed(), CTimeCycle::GetSunCoronaGreen(), CTimeCycle::GetSunCoronaBlue(), 255, sunCoors, 25.0f * CTimeCycle::GetSunSize(), diff --git a/src/render/Shadows.cpp b/src/render/Shadows.cpp index 69f9dce0..d07c302a 100644 --- a/src/render/Shadows.cpp +++ b/src/render/Shadows.cpp @@ -642,12 +642,12 @@ CShadows::StoreShadowForPole(CEntity *pPole, float fOffsetX, float fOffsetY, flo PolePos.y += fOffsetX * pPole->GetRight().y + fOffsetY * pPole->GetForward().y; PolePos.z += fOffsetZ; - PolePos.x += -CTimeCycle::GetSunPosition().x * (fPoleHeight / 2); - PolePos.y += -CTimeCycle::GetSunPosition().y * (fPoleHeight / 2); + PolePos.x += -CTimeCycle::GetSunDirection().x * (fPoleHeight / 2); + PolePos.y += -CTimeCycle::GetSunDirection().y * (fPoleHeight / 2); StoreStaticShadow((uintptr)pPole + nID + _TODOCONST(51), SHADOWTYPE_DARK, gpPostShadowTex, &PolePos, - -CTimeCycle::GetSunPosition().x * (fPoleHeight / 2), - -CTimeCycle::GetSunPosition().y * (fPoleHeight / 2), + -CTimeCycle::GetSunDirection().x * (fPoleHeight / 2), + -CTimeCycle::GetSunDirection().y * (fPoleHeight / 2), CTimeCycle::GetShadowSideX() * fPoleWidth, CTimeCycle::GetShadowSideY() * fPoleWidth, 2 * (int32)((pPole->GetUp().z - 0.5f) * CTimeCycle::GetShadowStrength() * 2.0f) / 3, diff --git a/src/render/Timecycle.cpp b/src/render/Timecycle.cpp index cf3426d7..1989db5c 100644 --- a/src/render/Timecycle.cpp +++ b/src/render/Timecycle.cpp @@ -298,7 +298,7 @@ CTimeCycle::Update(void) m_CurrentStoredValue = (m_CurrentStoredValue+1)&0xF; float sunAngle = 2*PI*(CClock::GetMinutes() + CClock::GetHours()*60)/(24*60); - CVector &sunPos = GetSunPosition(); + CVector &sunPos = GetSunDirection(); sunPos.x = Sin(sunAngle); sunPos.y = 1.0f; sunPos.z = 0.2f - Cos(sunAngle); diff --git a/src/render/Timecycle.h b/src/render/Timecycle.h index 9af4df49..0cb02b67 100644 --- a/src/render/Timecycle.h +++ b/src/render/Timecycle.h @@ -142,7 +142,7 @@ public: static void Initialise(void); static void Update(void); - static CVector &GetSunPosition(void) { return m_VectorToSun[m_CurrentStoredValue]; } + static CVector &GetSunDirection(void) { return m_VectorToSun[m_CurrentStoredValue]; } static float GetShadowFrontX(void) { return m_fShadowFrontX[m_CurrentStoredValue]; } static float GetShadowFrontY(void) { return m_fShadowFrontY[m_CurrentStoredValue]; } static float GetShadowSideX(void) { return m_fShadowSideX[m_CurrentStoredValue]; } diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 9617c9be..c968a147 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -4314,7 +4314,7 @@ GetCurrentAtomicObjectCB(RwObject *object, void *data) return object; } -CColPoint spherepoints[MAX_COLLISION_POINTS]; +static CColPoint aTempPedColPts[MAX_COLLISION_POINTS]; CObject* CAutomobile::SpawnFlyingComponent(int32 component, uint32 type) @@ -4434,7 +4434,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type) if(CCollision::ProcessColModels(obj->GetMatrix(), *obj->GetColModel(), this->GetMatrix(), *this->GetColModel(), - spherepoints, nil, nil) > 0) + aTempPedColPts, nil, nil) > 0) obj->m_pCollidingEntity = this; if(bRenderScorched) diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp index 7b62b461..bb266a80 100644 --- a/src/vehicles/Heli.cpp +++ b/src/vehicles/Heli.cpp @@ -570,7 +570,7 @@ CHeli::PreRender(void) i = 0; for(angle = 0.0f; angle < TWOPI; angle += TWOPI/32){ CVector pos(radius*Cos(angle), radius*Sin(angle), 0.0f); - CVector dir = pos*0.01f; + CVector dir = CVector(pos.x, pos.y, 1.0f)*0.01f; pos += GetPosition(); if(CWorld::ProcessVerticalLine(pos, testLowZ, point, entity, true, false, false, false, true, false, nil)) diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index d8c7c4c8..e264d7ed 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -466,6 +466,10 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon static bool bBraking; static bool bDriving; +#ifdef FIX_BUGS + bAlreadySkidding = false; +#endif + // how much force we want to apply in these axes float fwd = 0.0f; float right = 0.0f; @@ -547,7 +551,8 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon } } - if(sq(adhesion) < sq(right) + sq(fwd)){ + float speedSq = sq(right) + sq(fwd); + if(sq(adhesion) < speedSq){ if(*wheelState != WHEEL_STATE_FIXED){ if(bDriving && contactSpeedFwd < 0.2f) *wheelState = WHEEL_STATE_SPINNING; @@ -555,7 +560,7 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon *wheelState = WHEEL_STATE_SKIDDING; } - float l = Sqrt(sq(right) + sq(fwd)); + float l = Sqrt(speedSq); float tractionLoss = bAlreadySkidding ? 1.0f : pHandling->fTractionLoss; right *= adhesion * tractionLoss / l; fwd *= adhesion * tractionLoss / l; From 15a99da50e330f2116bbda57695064fa9cf5772b Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Mon, 25 May 2020 23:34:47 +0300 Subject: [PATCH 051/133] cranes fix --- src/vehicles/Cranes.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/vehicles/Cranes.cpp b/src/vehicles/Cranes.cpp index 936a4510..757974a6 100644 --- a/src/vehicles/Cranes.cpp +++ b/src/vehicles/Cranes.cpp @@ -243,8 +243,11 @@ void CCrane::Update(void) Abs(m_pVehiclePickedUp->GetMoveSpeed().x) > CAR_MOVING_SPEED_THRESHOLD || Abs(m_pVehiclePickedUp->GetMoveSpeed().y) > CAR_MOVING_SPEED_THRESHOLD || Abs(m_pVehiclePickedUp->GetMoveSpeed().z) > CAR_MOVING_SPEED_THRESHOLD || - FindPlayerPed()->GetPedState() == PED_ENTER_CAR && // TODO: fix carjack bug - FindPlayerPed()->m_pSeekTarget == m_pVehiclePickedUp) { + (FindPlayerPed()->GetPedState() == PED_ENTER_CAR +#ifdef FIX_BUGS + || FindPlayerPed()->GetPedState() == PED_CARJACK +#endif + ) && FindPlayerPed()->m_pSeekTarget == m_pVehiclePickedUp) { m_pVehiclePickedUp = nil; m_nCraneState = IDLE; } @@ -395,7 +398,7 @@ bool CCrane::RotateCarriedCarProperly() float fDeltaThisFrame = CAR_ROTATION_SPEED * CTimer::GetTimeStep(); if (Abs(fAngleDelta) <= fDeltaThisFrame) // no rotation is actually applied? return true; - m_pVehiclePickedUp->GetMatrix().RotateZ(Abs(fDeltaThisFrame)); + m_pVehiclePickedUp->GetMatrix().RotateZ(fAngleDelta < 0 ? -fDeltaThisFrame : fDeltaThisFrame); return false; } From ad8e8f434117894f052ced019d8b96a7144d0583 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Mon, 25 May 2020 23:59:55 +0300 Subject: [PATCH 052/133] switch collision with debug menu --- src/core/re3.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 9bc6400c..883caec5 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -160,6 +160,13 @@ TeleportToWaypoint(void) } #endif +static void +SwitchCarCollision(void) +{ + if (FindPlayerVehicle() && FindPlayerVehicle()->IsCar()) + FindPlayerVehicle()->bUsesCollision = !FindPlayerVehicle()->bUsesCollision; +} + static int engineStatus; static void SetEngineStatus(void) @@ -362,6 +369,7 @@ DebugMenuPopulate(void) #ifdef MENU_MAP DebugMenuAddCmd("Debug", "Teleport to map waypoint", TeleportToWaypoint); #endif + DebugMenuAddCmd("Debug", "Switch car collision", SwitchCarCollision); DebugMenuAddVar("Debug", "Engine Status", &engineStatus, nil, 1, 0, 226, nil); DebugMenuAddCmd("Debug", "Set Engine Status", SetEngineStatus); DebugMenuAddCmd("Debug", "Fix Car", FixCar); From 38d28542269b34450f1c893e43943c70e9d55086 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Tue, 26 May 2020 00:18:04 +0300 Subject: [PATCH 053/133] fixed FIX_BUGS --- src/control/CarCtrl.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index cd86ce4c..e8b3bfd9 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -463,10 +463,6 @@ CCarCtrl::GenerateOneRandomCar() directionNextLinkY = pNextLink->GetDirY() * pVehicle->AutoPilot.m_nNextDirection; } #else - float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo].GetDirX(); - float currentPathLinkForwardY = pVehicle->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo].GetDirY(); - float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo].GetDirX(); - float nextPathLinkForwardY = pVehicle->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo].GetDirY(); CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo]; CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo]; @@ -1647,12 +1643,18 @@ void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle) if (pVehicle->AutoPilot.m_bStayInFastLane) pVehicle->AutoPilot.m_nNextLane = 0; CVector positionOnCurrentLinkIncludingLane( - pCurLink->GetX() + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY, - pCurLink->GetY() - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX, + pCurLink->GetX() + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) +#ifdef FIX_BUGS + * currentPathLinkForwardY +#endif + ,pCurLink->GetY() - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX, 0.0f); CVector positionOnNextLinkIncludingLane( - pNextLink->GetX() + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY, - pNextLink->GetY() - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX, + pNextLink->GetX() + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) +#ifdef FIX_BUGS + * nextPathLinkForwardY +#endif + ,pNextLink->GetY() - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX, 0.0f); float directionCurrentLinkX = pCurLink->GetDirX() * pVehicle->AutoPilot.m_nCurrentDirection; float directionCurrentLinkY = pCurLink->GetDirY() * pVehicle->AutoPilot.m_nCurrentDirection; From 5ca0d6c6cf8f567299d7698108c9f0e4cc97937f Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Tue, 26 May 2020 00:45:32 +0300 Subject: [PATCH 054/133] fixed NE bug --- src/control/Garages.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 5fc44974..e37df8d4 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -1853,7 +1853,14 @@ CVehicle* CStoredCar::RestoreCar() CStreaming::RequestModel(m_nModelIndex, STREAMFLAGS_DEPENDENCY); if (!CStreaming::HasModelLoaded(m_nModelIndex)) return nil; - CVehicleModelInfo::SetComponentsToUse(m_nVariationA, m_nVariationB); +#ifdef FIX_BUGS + CVehicleModelInfo* pModelInfo = (CVehicleModelInfo*)CModelInfo::GetModelInfo(m_nModelIndex); + assert(pModelInfo); + if (pModelInfo->m_numComps != 0) +#endif + { + CVehicleModelInfo::SetComponentsToUse(m_nVariationA, m_nVariationB); + } #ifdef FIX_BUGS CVehicle* pVehicle; if (CModelInfo::IsBoatModel(m_nModelIndex)) From 7e5dde1f1a6ffbba98572b7fad3a51538104c04b Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 26 May 2020 11:37:46 +0200 Subject: [PATCH 055/133] eSurfaceType --- src/audio/AudioCollision.cpp | 74 ++++++++++++------------ src/audio/AudioLogic.cpp | 56 +++++++++--------- src/core/Cam.cpp | 28 ++++----- src/core/Collision.cpp | 28 ++++----- src/core/SurfaceTable.cpp | 100 ++++++++++++++++----------------- src/core/SurfaceTable.h | 57 +++++++++---------- src/core/TempColModels.cpp | 28 ++++----- src/entities/Physical.cpp | 2 +- src/modelinfo/PedModelInfo.cpp | 4 +- src/peds/Ped.cpp | 14 ++--- src/vehicles/Automobile.cpp | 32 +++++------ src/vehicles/Heli.cpp | 4 +- 12 files changed, 213 insertions(+), 214 deletions(-) diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp index ecd0299c..55d64714 100644 --- a/src/audio/AudioCollision.cpp +++ b/src/audio/AudioCollision.cpp @@ -70,36 +70,36 @@ cAudioManager::GetCollisionOneShotRatio(int32 a, float b) const case SURFACE_DEFAULT: case SURFACE_TARMAC: case SURFACE_PAVEMENT: - case SURFACE_STONE: - case SURFACE_BOLLARD: result = GetCollisionRatio(b, 10.f, 60.f, 50.f); break; + case SURFACE_STEEP_CLIFF: + case SURFACE_TRANSPARENT_STONE: result = GetCollisionRatio(b, 10.f, 60.f, 50.f); break; case SURFACE_GRASS: - case SURFACE_LOOSE30: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break; - case SURFACE_DIRT: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break; - case SURFACE_DIRTTRACK: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break; - case SURFACE_METAL6: result = GetCollisionRatio(b, 6.f, 50.f, 44.f); break; + case SURFACE_CARDBOARDBOX: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break; + case SURFACE_GRAVEL: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break; + case SURFACE_MUD_DRY: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break; + case SURFACE_CAR: result = GetCollisionRatio(b, 6.f, 50.f, 44.f); break; case SURFACE_GLASS: result = GetCollisionRatio(b, 0.1f, 10.f, 9.9f); break; - case SURFACE_SCAFFOLD: - case SURFACE_STEEL: result = GetCollisionRatio(b, 30.f, 130.f, 100.f); break; - case SURFACE_METAL_DOOR: result = GetCollisionRatio(b, 20.f, 100.f, 80.f); break; - case SURFACE_BILLBOARD: result = GetCollisionRatio(b, 0.f, 4.f, 4.f); break; - case SURFACE_METAL_POLE: - case SURFACE_GATE: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break; - case SURFACE_STREET_LIGHT: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break; - case SURFACE_METAL14: result = GetCollisionRatio(b, 1.f, 15.f, 14.f); break; - case SURFACE_METAL15: result = GetCollisionRatio(b, 8.f, 50.f, 42.f); break; - case SURFACE_METAL_FENCE: result = GetCollisionRatio(b, 0.1f, 10.f, 9.9f); break; - case SURFACE_FLESH: result = GetCollisionRatio(b, 0.f, 20.f, 20.f); break; + case SURFACE_TRANSPARENT_CLOTH: + case SURFACE_THICK_METAL_PLATE: result = GetCollisionRatio(b, 30.f, 130.f, 100.f); break; + case SURFACE_GARAGE_DOOR: result = GetCollisionRatio(b, 20.f, 100.f, 80.f); break; + case SURFACE_CAR_PANEL: result = GetCollisionRatio(b, 0.f, 4.f, 4.f); break; + case SURFACE_SCAFFOLD_POLE: + case SURFACE_METAL_GATE: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break; + case SURFACE_LAMP_POST: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break; + case SURFACE_FIRE_HYDRANT: result = GetCollisionRatio(b, 1.f, 15.f, 14.f); break; + case SURFACE_GIRDER: result = GetCollisionRatio(b, 8.f, 50.f, 42.f); break; + case SURFACE_METAL_CHAIN_FENCE: result = GetCollisionRatio(b, 0.1f, 10.f, 9.9f); break; + case SURFACE_PED: result = GetCollisionRatio(b, 0.f, 20.f, 20.f); break; case SURFACE_SAND: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break; - case SURFACE_PUDDLE: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break; - case SURFACE_WOOD: result = GetCollisionRatio(b, 1.f, 4.f, 3.f); break; - case SURFACE_WOOD_BOX: result = GetCollisionRatio(b, 0.1f, 5.f, 4.9f); break; - case SURFACE_WOOD_PLANK: result = GetCollisionRatio(b, 0.1f, 40.f, 39.9f); break; - case SURFACE_TIRE: - case SURFACE_RUBBER29: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break; - case SURFACE_HARD24: result = GetCollisionRatio(b, 0.1f, 4.f, 3.9f); break; + case SURFACE_WATER: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break; + case SURFACE_WOOD_CRATES: result = GetCollisionRatio(b, 1.f, 4.f, 3.f); break; + case SURFACE_WOOD_BENCH: result = GetCollisionRatio(b, 0.1f, 5.f, 4.9f); break; + case SURFACE_WOOD_SOLID: result = GetCollisionRatio(b, 0.1f, 40.f, 39.9f); break; + case SURFACE_RUBBER: + case SURFACE_WHEELBASE: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break; + case SURFACE_PLASTIC: result = GetCollisionRatio(b, 0.1f, 4.f, 3.9f); break; case SURFACE_HEDGE: result = GetCollisionRatio(b, 0.f, 0.5f, 0.5f); break; - case SURFACE_METAL27: result = GetCollisionRatio(b, 4.f, 40.f, 36.f); break; - case SURFACE_METAL28: result = GetCollisionRatio(b, 0.f, 5.f, 5.f); break; + case SURFACE_CONTAINER: result = GetCollisionRatio(b, 4.f, 40.f, 36.f); break; + case SURFACE_NEWS_VENDOR: result = GetCollisionRatio(b, 0.f, 5.f, 5.f); break; default: result = 0.f; break; } @@ -130,18 +130,18 @@ cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollisio m_sQueueSample.m_nSampleIndex = SFX_RAIN; m_sQueueSample.m_nFrequency = 13000.f * ratio + 35000; vol = 50.f * ratio; - } else if(surface1 == SURFACE_PUDDLE || surface2 == SURFACE_PUDDLE) { + } else if(surface1 == SURFACE_WATER || surface2 == SURFACE_WATER) { ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f); m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP; m_sQueueSample.m_nFrequency = 6050.f * ratio + 16000; vol = 30.f * ratio; - } else if(surface1 == SURFACE_DIRT || surface2 == SURFACE_DIRT || surface1 == SURFACE_DIRTTRACK || - surface2 == SURFACE_DIRTTRACK || surface1 == SURFACE_SAND || surface2 == SURFACE_SAND) { + } else if(surface1 == SURFACE_GRAVEL || surface2 == SURFACE_GRAVEL || surface1 == SURFACE_MUD_DRY || + surface2 == SURFACE_MUD_DRY || surface1 == SURFACE_SAND || surface2 == SURFACE_SAND) { ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f); m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID; m_sQueueSample.m_nFrequency = 6000.f * ratio + 10000; vol = 50.f * ratio; - } else if(surface1 == SURFACE_FLESH || surface2 == SURFACE_FLESH) { + } else if(surface1 == SURFACE_PED || surface2 == SURFACE_PED) { return 0; } else { ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f); @@ -240,9 +240,9 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col) s2 = col.m_bSurface2; } ratio = GetCollisionOneShotRatio(s1, col.m_fIntensity1); - if(s1 == SURFACE_METAL6 && s2 == SURFACE_FLESH) ratio /= 4.0f; - if(s1 == SURFACE_METAL6 && ratio < 0.6f) { - s1 = SURFACE_BILLBOARD; + if(s1 == SURFACE_CAR && s2 == SURFACE_PED) ratio /= 4.0f; + if(s1 == SURFACE_CAR && ratio < 0.6f) { + s1 = SURFACE_CAR_PANEL; ratio = Min(1.f, 2.f * ratio); } emittingVol = 40.f * ratio; @@ -290,13 +290,13 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col) } switch(s1) { case SURFACE_GLASS: m_sQueueSample.m_nFrequency = 13500; break; - case SURFACE_METAL15: m_sQueueSample.m_nFrequency = 8819; break; - case SURFACE_PUDDLE: + case SURFACE_GIRDER: m_sQueueSample.m_nFrequency = 8819; break; + case SURFACE_WATER: m_sQueueSample.m_nFrequency = 2 * SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); break; - case SURFACE_TIRE: m_sQueueSample.m_nFrequency = 6000; break; - case SURFACE_HARD24: m_sQueueSample.m_nFrequency = 8000; break; + case SURFACE_RUBBER: m_sQueueSample.m_nFrequency = 6000; break; + case SURFACE_PLASTIC: m_sQueueSample.m_nFrequency = 8000; break; default: m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index f516e43c..56e602fd 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -769,7 +769,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params) m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_nReleasingVolumeModificator = 3; - if (params->m_pVehicle->m_nSurfaceTouched == SURFACE_PUDDLE) { + if (params->m_pVehicle->m_nSurfaceTouched == SURFACE_WATER) { m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP; freq = 6050 * emittingVol / 30 + 16000; } else { @@ -1394,10 +1394,10 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams *params) m_sQueueSample.m_nFrequency = 13000.f * skidVal + 35000.f; m_sQueueSample.m_nVolume /= 4; break; - case SURFACE_DIRT: - case SURFACE_DIRTTRACK: + case SURFACE_GRAVEL: + case SURFACE_MUD_DRY: case SURFACE_SAND: - case SURFACE_PUDDLE: + case SURFACE_WATER: m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID; m_sQueueSample.m_nFrequency = 6000.f * skidVal + 10000.f; break; @@ -2984,32 +2984,32 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) case SURFACE_GRASS: sampleIndex = m_anRandomTable[1] % 5 + SFX_FOOTSTEP_GRASS_1; break; - case SURFACE_DIRT: - case SURFACE_DIRTTRACK: + case SURFACE_GRAVEL: + case SURFACE_MUD_DRY: sampleIndex = m_anRandomTable[4] % 5 + SFX_FOOTSTEP_GRAVEL_1; break; - case SURFACE_METAL6: - case SURFACE_METAL_DOOR: - case SURFACE_BILLBOARD: - case SURFACE_STEEL: - case SURFACE_METAL_POLE: - case SURFACE_STREET_LIGHT: - case SURFACE_METAL14: - case SURFACE_METAL15: - case SURFACE_METAL_FENCE: - case SURFACE_METAL27: - case SURFACE_METAL28: + case SURFACE_CAR: + case SURFACE_GARAGE_DOOR: + case SURFACE_CAR_PANEL: + case SURFACE_THICK_METAL_PLATE: + case SURFACE_SCAFFOLD_POLE: + case SURFACE_LAMP_POST: + case SURFACE_FIRE_HYDRANT: + case SURFACE_GIRDER: + case SURFACE_METAL_CHAIN_FENCE: + case SURFACE_CONTAINER: + case SURFACE_NEWS_VENDOR: sampleIndex = m_anRandomTable[0] % 5 + SFX_FOOTSTEP_METAL_1; break; case SURFACE_SAND: sampleIndex = (m_anRandomTable[4] & 3) + SFX_FOOTSTEP_SAND_1; break; - case SURFACE_PUDDLE: + case SURFACE_WATER: sampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1; break; - case SURFACE_WOOD: - case SURFACE_WOOD_BOX: - case SURFACE_WOOD_PLANK: + case SURFACE_WOOD_CRATES: + case SURFACE_WOOD_BENCH: + case SURFACE_WOOD_SOLID: sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_WOOD_1; break; case SURFACE_HEDGE: @@ -3056,7 +3056,7 @@ cAudioManager::ProcessPedOneShots(cPedParams *params) if (!ped->bIsLooking) { maxDist = SQR(30); emittingVol = m_anRandomTable[3] % 20 + 80; - if (ped->m_nSurfaceTouched == SURFACE_PUDDLE) { + if (ped->m_nSurfaceTouched == SURFACE_WATER) { m_sQueueSample.m_nSampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1; } else if (sound == SOUND_FALL_LAND) { m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND; @@ -6653,12 +6653,12 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) if (playerPed) { switch (playerPed->m_nSurfaceTouched) { case SURFACE_GRASS: - case SURFACE_DIRT: - case SURFACE_DIRTTRACK: - case SURFACE_SCAFFOLD: - case SURFACE_FLESH: + case SURFACE_GRAVEL: + case SURFACE_MUD_DRY: + case SURFACE_TRANSPARENT_CLOTH: + case SURFACE_PED: case SURFACE_SAND: - case SURFACE_TIRE: + case SURFACE_RUBBER: case SURFACE_HEDGE: m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_2; m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 11000; @@ -6684,7 +6684,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) } } return; - case SURFACE_PUDDLE: + case SURFACE_WATER: return; default: break; diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 6c79604c..247e77ce 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -504,11 +504,11 @@ CCam::ProcessSpecialHeightRoutines(void) switch(((CPhysical*)CamTargetEntity)->m_nSurfaceTouched) case SURFACE_GRASS: - case SURFACE_DIRT: - case SURFACE_DIRTTRACK: - case SURFACE_STEEL: - case SURFACE_TIRE: - case SURFACE_STONE: + case SURFACE_GRAVEL: + case SURFACE_MUD_DRY: + case SURFACE_THICK_METAL_PLATE: + case SURFACE_RUBBER: + case SURFACE_STEEP_CLIFF: OnRoad = true; if(CCullZones::PlayerNoRain()) @@ -565,9 +565,9 @@ CCam::ProcessSpecialHeightRoutines(void) if(PreviouslyFailedRoadHeightCheck && m_fCloseInPedHeightOffset < 0.0001f){ if(colPoint.surfaceB != SURFACE_TARMAC && colPoint.surfaceB != SURFACE_GRASS && - colPoint.surfaceB != SURFACE_DIRT && - colPoint.surfaceB != SURFACE_DIRTTRACK && - colPoint.surfaceB != SURFACE_STONE){ + colPoint.surfaceB != SURFACE_GRAVEL && + colPoint.surfaceB != SURFACE_MUD_DRY && + colPoint.surfaceB != SURFACE_STEEP_CLIFF){ if(m_fRoadOffSet > 1.4f) m_fRoadOffSet = 1.4f; }else{ @@ -1408,11 +1408,11 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl bool foo = false; switch(((CPhysical*)CamTargetEntity)->m_nSurfaceTouched) case SURFACE_GRASS: - case SURFACE_DIRT: + case SURFACE_GRAVEL: case SURFACE_PAVEMENT: - case SURFACE_STEEL: - case SURFACE_TIRE: - case SURFACE_STONE: + case SURFACE_THICK_METAL_PLATE: + case SURFACE_RUBBER: + case SURFACE_STEEP_CLIFF: foo = true; if(foo) WellBufferMe(TargetHeight, &m_fCamBufferedHeight, &m_fCamBufferedHeightSpeed, 0.4f, 0.05f, false); @@ -1764,8 +1764,8 @@ CCam::WorkOutCamHeightWeeCar(CVector &TargetCoors, float TargetOrientation) else WellBufferMe(TargetZOffSet, &RoadHeightFix, &RoadHeightFixSpeed, 0.27f, 0.1f, false); - if((colpoint.surfaceB == SURFACE_DEFAULT || colpoint.surfaceB >= SURFACE_METAL6) && - colpoint.surfaceB != SURFACE_STEEL && colpoint.surfaceB != SURFACE_STONE && + if((colpoint.surfaceB == SURFACE_DEFAULT || colpoint.surfaceB >= SURFACE_CAR) && + colpoint.surfaceB != SURFACE_THICK_METAL_PLATE && colpoint.surfaceB != SURFACE_STEEP_CLIFF && RoadHeightFix > 1.4f) RoadHeightFix = 1.4f; diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp index 01cc323a..23eaa8dd 100644 --- a/src/core/Collision.cpp +++ b/src/core/Collision.cpp @@ -548,18 +548,18 @@ CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColMod return false; for(i = 0; i < model.numSpheres; i++) - if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_SCAFFOLD) + if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_TRANSPARENT_CLOTH) if(TestLineSphere(newline, model.spheres[i])) return true; for(i = 0; i < model.numBoxes; i++) - if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_SCAFFOLD) + if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_TRANSPARENT_CLOTH) if(TestLineBox(newline, model.boxes[i])) return true; CalculateTrianglePlanes(&model); for(i = 0; i < model.numTriangles; i++) - if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_SCAFFOLD) + if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_TRANSPARENT_CLOTH) if(TestLineTriangle(newline, model.vertices, model.triangles[i], model.trianglePlanes[i])) return true; @@ -1179,16 +1179,16 @@ CCollision::ProcessLineOfSight(const CColLine &line, float coldist = mindist; for(i = 0; i < model.numSpheres; i++) - if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_SCAFFOLD) + if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_TRANSPARENT_CLOTH) ProcessLineSphere(newline, model.spheres[i], point, coldist); for(i = 0; i < model.numBoxes; i++) - if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_SCAFFOLD) + if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_TRANSPARENT_CLOTH) ProcessLineBox(newline, model.boxes[i], point, coldist); CalculateTrianglePlanes(&model); for(i = 0; i < model.numTriangles; i++) - if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_SCAFFOLD) + if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_TRANSPARENT_CLOTH) ProcessLineTriangle(newline, model.vertices, model.triangles[i], model.trianglePlanes[i], point, coldist); if(coldist < mindist){ @@ -1219,17 +1219,17 @@ CCollision::ProcessVerticalLine(const CColLine &line, float coldist = mindist; for(i = 0; i < model.numSpheres; i++) - if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_SCAFFOLD) + if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_TRANSPARENT_CLOTH) ProcessLineSphere(newline, model.spheres[i], point, coldist); for(i = 0; i < model.numBoxes; i++) - if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_SCAFFOLD) + if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_TRANSPARENT_CLOTH) ProcessLineBox(newline, model.boxes[i], point, coldist); CalculateTrianglePlanes(&model); TempStoredPoly.valid = false; for(i = 0; i < model.numTriangles; i++) - if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_SCAFFOLD) + if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_TRANSPARENT_CLOTH) ProcessVerticalLineTriangle(newline, model.vertices, model.triangles[i], model.trianglePlanes[i], point, coldist, &TempStoredPoly); if(coldist < mindist){ @@ -1758,15 +1758,15 @@ CCollision::DrawColModel_Coloured(const CMatrix &mat, const CColModel &colModel, b *= f; } - if(s == SURFACE_SCAFFOLD || s == SURFACE_METAL_FENCE || - s == SURFACE_BOLLARD || s == SURFACE_METAL_POLE) + if(s == SURFACE_TRANSPARENT_CLOTH || s == SURFACE_METAL_CHAIN_FENCE || + s == SURFACE_TRANSPARENT_STONE || s == SURFACE_SCAFFOLD_POLE) if(CTimer::GetFrameCounter() & 1){ r = 0; g = 0; b = 0; } - if(s > SURFACE_GATE){ + if(s > SURFACE_METAL_GATE){ r = CGeneral::GetRandomNumber(); g = CGeneral::GetRandomNumber(); b = CGeneral::GetRandomNumber(); @@ -1839,8 +1839,8 @@ CCollision::DrawColModel_Coloured(const CMatrix &mat, const CColModel &colModel, b *= f; } - if(s == SURFACE_SCAFFOLD || s == SURFACE_METAL_FENCE || - s == SURFACE_BOLLARD || s == SURFACE_METAL_POLE) + if(s == SURFACE_TRANSPARENT_CLOTH || s == SURFACE_METAL_CHAIN_FENCE || + s == SURFACE_TRANSPARENT_STONE || s == SURFACE_SCAFFOLD_POLE) if(CTimer::GetFrameCounter() & 1){ r = 0; g = 0; diff --git a/src/core/SurfaceTable.cpp b/src/core/SurfaceTable.cpp index e4f9c0cd..b1bcceb6 100644 --- a/src/core/SurfaceTable.cpp +++ b/src/core/SurfaceTable.cpp @@ -59,36 +59,36 @@ CSurfaceTable::GetAdhesionGroup(uint8 surfaceType) case SURFACE_DEFAULT: return ADHESIVE_ROAD; case SURFACE_TARMAC: return ADHESIVE_ROAD; case SURFACE_GRASS: return ADHESIVE_LOOSE; - case SURFACE_DIRT: return ADHESIVE_LOOSE; - case SURFACE_DIRTTRACK: return ADHESIVE_HARD; + case SURFACE_GRAVEL: return ADHESIVE_LOOSE; + case SURFACE_MUD_DRY: return ADHESIVE_HARD; case SURFACE_PAVEMENT: return ADHESIVE_ROAD; - case SURFACE_METAL6: return ADHESIVE_HARD; + case SURFACE_CAR: return ADHESIVE_HARD; case SURFACE_GLASS: return ADHESIVE_HARD; - case SURFACE_SCAFFOLD: return ADHESIVE_HARD; - case SURFACE_METAL_DOOR: return ADHESIVE_HARD; - case SURFACE_BILLBOARD: return ADHESIVE_HARD; - case SURFACE_STEEL: return ADHESIVE_HARD; - case SURFACE_METAL_POLE: return ADHESIVE_HARD; - case SURFACE_STREET_LIGHT: return ADHESIVE_HARD; - case SURFACE_METAL14: return ADHESIVE_HARD; - case SURFACE_METAL15: return ADHESIVE_HARD; - case SURFACE_METAL_FENCE: return ADHESIVE_HARD; - case SURFACE_FLESH: return ADHESIVE_RUBBER; + case SURFACE_TRANSPARENT_CLOTH: return ADHESIVE_HARD; + case SURFACE_GARAGE_DOOR: return ADHESIVE_HARD; + case SURFACE_CAR_PANEL: return ADHESIVE_HARD; + case SURFACE_THICK_METAL_PLATE: return ADHESIVE_HARD; + case SURFACE_SCAFFOLD_POLE: return ADHESIVE_HARD; + case SURFACE_LAMP_POST: return ADHESIVE_HARD; + case SURFACE_FIRE_HYDRANT: return ADHESIVE_HARD; + case SURFACE_GIRDER: return ADHESIVE_HARD; + case SURFACE_METAL_CHAIN_FENCE: return ADHESIVE_HARD; + case SURFACE_PED: return ADHESIVE_RUBBER; case SURFACE_SAND: return ADHESIVE_LOOSE; - case SURFACE_PUDDLE: return ADHESIVE_WET; - case SURFACE_WOOD: return ADHESIVE_ROAD; - case SURFACE_WOOD_BOX: return ADHESIVE_ROAD; - case SURFACE_WOOD_PLANK: return ADHESIVE_ROAD; - case SURFACE_TIRE: return ADHESIVE_RUBBER; - case SURFACE_HARD24: return ADHESIVE_HARD; + case SURFACE_WATER: return ADHESIVE_WET; + case SURFACE_WOOD_CRATES: return ADHESIVE_ROAD; + case SURFACE_WOOD_BENCH: return ADHESIVE_ROAD; + case SURFACE_WOOD_SOLID: return ADHESIVE_ROAD; + case SURFACE_RUBBER: return ADHESIVE_RUBBER; + case SURFACE_PLASTIC: return ADHESIVE_HARD; case SURFACE_HEDGE: return ADHESIVE_LOOSE; - case SURFACE_STONE: return ADHESIVE_LOOSE; - case SURFACE_METAL27: return ADHESIVE_HARD; - case SURFACE_METAL28: return ADHESIVE_HARD; - case SURFACE_RUBBER29: return ADHESIVE_RUBBER; - case SURFACE_LOOSE30: return ADHESIVE_LOOSE; - case SURFACE_BOLLARD: return ADHESIVE_HARD; - case SURFACE_GATE: return ADHESIVE_HARD; + case SURFACE_STEEP_CLIFF: return ADHESIVE_LOOSE; + case SURFACE_CONTAINER: return ADHESIVE_HARD; + case SURFACE_NEWS_VENDOR: return ADHESIVE_HARD; + case SURFACE_WHEELBASE: return ADHESIVE_RUBBER; + case SURFACE_CARDBOARDBOX: return ADHESIVE_LOOSE; + case SURFACE_TRANSPARENT_STONE: return ADHESIVE_HARD; + case SURFACE_METAL_GATE: return ADHESIVE_HARD; default: return ADHESIVE_ROAD; } } @@ -99,36 +99,36 @@ CSurfaceTable::GetWetMultiplier(uint8 surfaceType) switch(surfaceType){ case SURFACE_DEFAULT: case SURFACE_TARMAC: - case SURFACE_DIRTTRACK: + case SURFACE_MUD_DRY: case SURFACE_PAVEMENT: - case SURFACE_SCAFFOLD: - case SURFACE_WOOD: - case SURFACE_WOOD_BOX: - case SURFACE_WOOD_PLANK: + case SURFACE_TRANSPARENT_CLOTH: + case SURFACE_WOOD_CRATES: + case SURFACE_WOOD_BENCH: + case SURFACE_WOOD_SOLID: case SURFACE_HEDGE: - case SURFACE_LOOSE30: - case SURFACE_BOLLARD: + case SURFACE_CARDBOARDBOX: + case SURFACE_TRANSPARENT_STONE: return 1.0f - CWeather::WetRoads*0.25f; case SURFACE_GRASS: - case SURFACE_METAL6: + case SURFACE_CAR: case SURFACE_GLASS: - case SURFACE_METAL_DOOR: - case SURFACE_BILLBOARD: - case SURFACE_STEEL: - case SURFACE_METAL_POLE: - case SURFACE_STREET_LIGHT: - case SURFACE_METAL14: - case SURFACE_METAL15: - case SURFACE_METAL_FENCE: - case SURFACE_FLESH: - case SURFACE_TIRE: - case SURFACE_HARD24: - case SURFACE_STONE: - case SURFACE_METAL27: - case SURFACE_METAL28: - case SURFACE_RUBBER29: - case SURFACE_GATE: + case SURFACE_GARAGE_DOOR: + case SURFACE_CAR_PANEL: + case SURFACE_THICK_METAL_PLATE: + case SURFACE_SCAFFOLD_POLE: + case SURFACE_LAMP_POST: + case SURFACE_FIRE_HYDRANT: + case SURFACE_GIRDER: + case SURFACE_METAL_CHAIN_FENCE: + case SURFACE_PED: + case SURFACE_RUBBER: + case SURFACE_PLASTIC: + case SURFACE_STEEP_CLIFF: + case SURFACE_CONTAINER: + case SURFACE_NEWS_VENDOR: + case SURFACE_WHEELBASE: + case SURFACE_METAL_GATE: return 1.0f - CWeather::WetRoads*0.4f; default: diff --git a/src/core/SurfaceTable.h b/src/core/SurfaceTable.h index 768521bf..25b5e57d 100644 --- a/src/core/SurfaceTable.h +++ b/src/core/SurfaceTable.h @@ -1,45 +1,44 @@ #pragma once -// TODO: check this enum eSurfaceType { SURFACE_DEFAULT, SURFACE_TARMAC, SURFACE_GRASS, - SURFACE_DIRT, - SURFACE_DIRTTRACK, + SURFACE_GRAVEL, + SURFACE_MUD_DRY, SURFACE_PAVEMENT, - SURFACE_METAL6, + SURFACE_CAR, SURFACE_GLASS, - SURFACE_SCAFFOLD, - SURFACE_METAL_DOOR, // garage door - SURFACE_BILLBOARD, - SURFACE_STEEL, //? - SURFACE_METAL_POLE, // ? - SURFACE_STREET_LIGHT, - SURFACE_METAL14, - SURFACE_METAL15, - SURFACE_METAL_FENCE, - SURFACE_FLESH, + SURFACE_TRANSPARENT_CLOTH, + SURFACE_GARAGE_DOOR, + SURFACE_CAR_PANEL, + SURFACE_THICK_METAL_PLATE, + SURFACE_SCAFFOLD_POLE, + SURFACE_LAMP_POST, + SURFACE_FIRE_HYDRANT, + SURFACE_GIRDER, + SURFACE_METAL_CHAIN_FENCE, + SURFACE_PED, SURFACE_SAND, - SURFACE_PUDDLE, - SURFACE_WOOD, - SURFACE_WOOD_BOX, - SURFACE_WOOD_PLANK, - SURFACE_TIRE, - SURFACE_HARD24, + SURFACE_WATER, + SURFACE_WOOD_CRATES, + SURFACE_WOOD_BENCH, + SURFACE_WOOD_SOLID, + SURFACE_RUBBER, + SURFACE_PLASTIC, SURFACE_HEDGE, - SURFACE_STONE, - SURFACE_METAL27, - SURFACE_METAL28, - SURFACE_RUBBER29, - SURFACE_LOOSE30, - SURFACE_BOLLARD, - SURFACE_GATE, + SURFACE_STEEP_CLIFF, + SURFACE_CONTAINER, + SURFACE_NEWS_VENDOR, + SURFACE_WHEELBASE, + SURFACE_CARDBOARDBOX, + SURFACE_TRANSPARENT_STONE, + SURFACE_METAL_GATE, // These are illegal - SURFACE_SAND33, - SURFACE_ROAD34, + SURFACE_SAND_BEACH, + SURFACE_CONCRETE_BEACH, }; enum diff --git a/src/core/TempColModels.cpp b/src/core/TempColModels.cpp index 79d6252b..b4d994ec 100644 --- a/src/core/TempColModels.cpp +++ b/src/core/TempColModels.cpp @@ -65,7 +65,7 @@ CTempColModels::Initialise(void) #else for (i = 0; i < ARRAY_SIZE(s_aPedGSpheres); i++) { #endif - s_aPedSpheres[i].surface = SURFACE_FLESH; + s_aPedSpheres[i].surface = SURFACE_PED; s_aPedSpheres[i].piece = 0; } @@ -84,7 +84,7 @@ CTempColModels::Initialise(void) s_aPed2Spheres[2].center = CVector(0.0f, -0.35f, -0.9f); for (i = 0; i < ARRAY_SIZE(s_aPed2Spheres); i++) { - s_aPed2Spheres[i].surface = SURFACE_FLESH; + s_aPed2Spheres[i].surface = SURFACE_PED; s_aPed2Spheres[i].piece = 0; } @@ -105,10 +105,10 @@ CTempColModels::Initialise(void) s_aPedGSpheres[2].center = CVector(0.0f, 0.25f, -0.9f); s_aPedGSpheres[3].center = CVector(0.0f, 0.65f, -0.9f); - s_aPedGSpheres[0].surface = SURFACE_FLESH; - s_aPedGSpheres[1].surface = SURFACE_FLESH; - s_aPedGSpheres[2].surface = SURFACE_FLESH; - s_aPedGSpheres[3].surface = SURFACE_FLESH; + s_aPedGSpheres[0].surface = SURFACE_PED; + s_aPedGSpheres[1].surface = SURFACE_PED; + s_aPedGSpheres[2].surface = SURFACE_PED; + s_aPedGSpheres[3].surface = SURFACE_PED; s_aPedGSpheres[0].piece = 4; s_aPedGSpheres[1].piece = 1; s_aPedGSpheres[2].piece = 0; @@ -130,7 +130,7 @@ CTempColModels::Initialise(void) s_aDoorSpheres[2].center = CVector(0.0f, -0.6f, 0.25f); for (i = 0; i < ARRAY_SIZE(s_aDoorSpheres); i++) { - s_aDoorSpheres[i].surface = SURFACE_BILLBOARD; + s_aDoorSpheres[i].surface = SURFACE_CAR_PANEL; s_aDoorSpheres[i].piece = 0; } @@ -150,7 +150,7 @@ CTempColModels::Initialise(void) s_aBumperSpheres[3].center = CVector(-0.85f, -0.05f, 0.0f); for (i = 0; i < ARRAY_SIZE(s_aBumperSpheres); i++) { - s_aBumperSpheres[i].surface = SURFACE_BILLBOARD; + s_aBumperSpheres[i].surface = SURFACE_CAR_PANEL; s_aBumperSpheres[i].piece = 0; } @@ -170,7 +170,7 @@ CTempColModels::Initialise(void) s_aPanelSpheres[3].center = CVector(-0.15f, 0.45f, 0.0f); for (i = 0; i < ARRAY_SIZE(s_aPanelSpheres); i++) { - s_aPanelSpheres[i].surface = SURFACE_BILLBOARD; + s_aPanelSpheres[i].surface = SURFACE_CAR_PANEL; s_aPanelSpheres[i].piece = 0; } @@ -190,7 +190,7 @@ CTempColModels::Initialise(void) s_aBonnetSpheres[3].center = CVector(0.4f, 0.9f, 0.0f); for (i = 0; i < ARRAY_SIZE(s_aBonnetSpheres); i++) { - s_aBonnetSpheres[i].surface = SURFACE_BILLBOARD; + s_aBonnetSpheres[i].surface = SURFACE_CAR_PANEL; s_aBonnetSpheres[i].piece = 0; } @@ -210,7 +210,7 @@ CTempColModels::Initialise(void) s_aBootSpheres[3].center = CVector(0.4f, -0.6f, 0.0f); for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) { - s_aBootSpheres[i].surface = SURFACE_BILLBOARD; + s_aBootSpheres[i].surface = SURFACE_CAR_PANEL; s_aBootSpheres[i].piece = 0; } @@ -232,7 +232,7 @@ CTempColModels::Initialise(void) #else for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) { #endif - s_aWheelSpheres[i].surface = SURFACE_RUBBER29; + s_aWheelSpheres[i].surface = SURFACE_WHEELBASE; s_aWheelSpheres[i].piece = 0; } @@ -254,7 +254,7 @@ CTempColModels::Initialise(void) #else for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) { #endif - s_aBodyPartSpheres1[i].surface = SURFACE_FLESH; + s_aBodyPartSpheres1[i].surface = SURFACE_PED; s_aBodyPartSpheres1[i].piece = 0; } @@ -276,7 +276,7 @@ CTempColModels::Initialise(void) #else for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) { #endif - s_aBodyPartSpheres2[i].surface = SURFACE_FLESH; + s_aBodyPartSpheres2[i].surface = SURFACE_PED; s_aBodyPartSpheres2[i].piece = 0; } diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index f9f8ae7e..9fc5a853 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -1018,7 +1018,7 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint) ApplyFrictionTurnForce(frictionDir*fImpulse, pointpos); if(fOtherSpeed > 0.1f && - colpoint.surfaceB != SURFACE_GRASS && colpoint.surfaceB != SURFACE_DIRTTRACK && + colpoint.surfaceB != SURFACE_GRASS && colpoint.surfaceB != SURFACE_MUD_DRY && CSurfaceTable::GetAdhesionGroup(colpoint.surfaceA) == ADHESIVE_HARD){ CVector v = frictionDir * fOtherSpeed * 0.25f; for(int i = 0; i < 4; i++) diff --git a/src/modelinfo/PedModelInfo.cpp b/src/modelinfo/PedModelInfo.cpp index 473e8b63..1d8aa4dc 100644 --- a/src/modelinfo/PedModelInfo.cpp +++ b/src/modelinfo/PedModelInfo.cpp @@ -251,7 +251,7 @@ CPedModelInfo::CreateHitColModel(void) center.x = mat->pos.x + m_pColNodeInfos[i].x; center.y = mat->pos.y + 0.0f; center.z = mat->pos.z + m_pColNodeInfos[i].z; - spheres[i].Set(radius, center, SURFACE_FLESH, m_pColNodeInfos[i].pieceType); + spheres[i].Set(radius, center, SURFACE_PED, m_pColNodeInfos[i].pieceType); } } RwMatrixDestroy(mat); @@ -335,7 +335,7 @@ CPedModelInfo::CreateHitColModelSkinned(RpClump *clump) center.x = pos.x + m_pColNodeInfos[i].x; center.y = pos.y + 0.0f; center.z = pos.z + m_pColNodeInfos[i].z; - spheres[i].Set(m_pColNodeInfos[i].radius, center, SURFACE_FLESH, m_pColNodeInfos[i].pieceType); + spheres[i].Set(m_pColNodeInfos[i].radius, center, SURFACE_PED, m_pColNodeInfos[i].pieceType); } RwMatrixDestroy(invmat); RwMatrixDestroy(mat); diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index e3fa2104..6b3b8686 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -2037,7 +2037,7 @@ particleProduceFootDust(CPed *ped, CVector const &pos, float size, int times) switch (ped->m_nSurfaceTouched) { case SURFACE_TARMAC: - case SURFACE_DIRT: + case SURFACE_GRAVEL: case SURFACE_PAVEMENT: case SURFACE_SAND: for (int i = 0; i < times; ++i) { @@ -2190,7 +2190,7 @@ CPed::PlayFootSteps(void) } } - if (m_nSurfaceTouched == SURFACE_PUDDLE) { + if (m_nSurfaceTouched == SURFACE_WATER) { float pedSpeed = CVector2D(m_vecMoveSpeed).Magnitude(); if (pedSpeed > 0.03f && CTimer::GetFrameCounter() % 2 == 0 && pedSpeed > 0.13f) { #ifdef PC_PARTICLE @@ -2588,7 +2588,7 @@ CPed::CanPedDriveOff(void) bool CPed::CanPedJumpThis(CEntity *unused, CVector *damageNormal = nil) { - if (m_nSurfaceTouched == SURFACE_PUDDLE) + if (m_nSurfaceTouched == SURFACE_WATER) return true; CVector pos = GetPosition(); @@ -11055,7 +11055,7 @@ CPed::SetJump(void) #ifdef VC_PED_PORTS m_nPedState != PED_JUMP && !RpAnimBlendClumpGetAssociation(GetClump(), ANIM_JUMP_LAUNCH) && #endif - (m_nSurfaceTouched != SURFACE_STONE || DotProduct(GetForward(), m_vecDamageNormal) >= 0.0f)) { + (m_nSurfaceTouched != SURFACE_STEEP_CLIFF || DotProduct(GetForward(), m_vecDamageNormal) >= 0.0f)) { SetStoredState(); m_nPedState = PED_JUMP; CAnimBlendAssociation *jumpAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_JUMP_LAUNCH, 8.0f); @@ -14781,7 +14781,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints) GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z; #endif m_nSurfaceTouched = intersectionPoint.surfaceB; - if (m_nSurfaceTouched == SURFACE_STONE) { + if (m_nSurfaceTouched == SURFACE_STEEP_CLIFF) { bHitSteepSlope = true; m_vecDamageNormal = intersectionPoint.normal; } @@ -14889,7 +14889,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints) #endif sphereNormal.Normalise(); collidingPoints[sphere].normal = sphereNormal; - if (collidingPoints[sphere].surfaceB == SURFACE_STONE) + if (collidingPoints[sphere].surfaceB == SURFACE_STEEP_CLIFF) bHitSteepSlope = true; } } @@ -16749,7 +16749,7 @@ CPed::UpdatePosition(void) velocityChange = m_moved + velocityOfSurface - m_vecMoveSpeed; m_fRotationCur += curSurface->m_vecTurnSpeed.z * CTimer::GetTimeStep(); m_fRotationDest += curSurface->m_vecTurnSpeed.z * CTimer::GetTimeStep(); - } else if (m_nSurfaceTouched != SURFACE_STONE || m_vecDamageNormal.x == 0.0f && m_vecDamageNormal.y == 0.0f) { + } else if (m_nSurfaceTouched != SURFACE_STEEP_CLIFF || m_vecDamageNormal.x == 0.0f && m_vecDamageNormal.y == 0.0f) { velocityChange = m_moved - m_vecMoveSpeed; } else { // Ped got damaged by steep slope diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index c968a147..e572c123 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -634,7 +634,7 @@ CAutomobile::ProcessControl(void) m_aSuspensionSpringRatio[i], bias); m_aWheelSkidmarkMuddy[i] = m_aWheelColPoints[i].surfaceB == SURFACE_GRASS || - m_aWheelColPoints[i].surfaceB == SURFACE_DIRTTRACK || + m_aWheelColPoints[i].surfaceB == SURFACE_MUD_DRY || m_aWheelColPoints[i].surfaceB == SURFACE_SAND; }else{ contactPoints[i] = Multiply3x3(GetMatrix(), colModel->lines[i].p1); @@ -771,7 +771,7 @@ CAutomobile::ProcessControl(void) else fThrust = acceleration; - m_aWheelColPoints[CARWHEEL_FRONT_LEFT].surfaceA = SURFACE_RUBBER29; + m_aWheelColPoints[CARWHEEL_FRONT_LEFT].surfaceA = SURFACE_WHEELBASE; float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_FRONT_LEFT])*traction; if(GetStatus() == STATUS_PLAYER) adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_FRONT_LEFT].surfaceB); @@ -805,7 +805,7 @@ CAutomobile::ProcessControl(void) else fThrust = acceleration; - m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].surfaceA = SURFACE_RUBBER29; + m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].surfaceA = SURFACE_WHEELBASE; float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_FRONT_RIGHT])*traction; if(GetStatus() == STATUS_PLAYER) adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].surfaceB); @@ -886,7 +886,7 @@ CAutomobile::ProcessControl(void) else fThrust = acceleration; - m_aWheelColPoints[CARWHEEL_REAR_LEFT].surfaceA = SURFACE_RUBBER29; + m_aWheelColPoints[CARWHEEL_REAR_LEFT].surfaceA = SURFACE_WHEELBASE; float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_REAR_LEFT])*traction; if(GetStatus() == STATUS_PLAYER) adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_REAR_LEFT].surfaceB); @@ -920,7 +920,7 @@ CAutomobile::ProcessControl(void) else fThrust = acceleration; - m_aWheelColPoints[CARWHEEL_REAR_RIGHT].surfaceA = SURFACE_RUBBER29; + m_aWheelColPoints[CARWHEEL_REAR_RIGHT].surfaceA = SURFACE_WHEELBASE; float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_REAR_RIGHT])*traction; if(GetStatus() == STATUS_PLAYER) adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_REAR_RIGHT].surfaceB); @@ -1135,10 +1135,10 @@ CAutomobile::ProcessControl(void) } uint8 surf = m_aWheelColPoints[i].surfaceB; - if(surf == SURFACE_DIRT || surf == SURFACE_PUDDLE || surf == SURFACE_HEDGE){ + if(surf == SURFACE_GRAVEL || surf == SURFACE_WATER || surf == SURFACE_HEDGE){ if(surfShake < 0.2f) surfShake = 0.3f; - }else if(surf == SURFACE_DIRTTRACK || surf == SURFACE_SAND){ + }else if(surf == SURFACE_MUD_DRY || surf == SURFACE_SAND){ if(surfShake < 0.1f) surfShake = 0.2f; }else if(surf == SURFACE_GRASS){ @@ -2961,7 +2961,7 @@ CAutomobile::ProcessBuoyancy(void) static RwRGBA smokeCol = {255, 255, 255, 255}; for(i = 0; i < 4; i++){ - if(m_aSuspensionSpringRatio[i] < 1.0f && m_aWheelColPoints[i].surfaceB == SURFACE_PUDDLE){ + if(m_aSuspensionSpringRatio[i] < 1.0f && m_aWheelColPoints[i].surfaceB == SURFACE_WATER){ CVector pos = m_aWheelColPoints[i].point + 0.3f*GetUp() - GetPosition(); CVector vSpeed = GetSpeed(pos); vSpeed.z = 0.0f; @@ -3559,7 +3559,7 @@ CAutomobile::AddWheelDirtAndWater(CColPoint *colpoint, uint32 belowEffectSpeed) CGeneral::GetRandomNumberInRange(0.02f, 0.1f), grassCol); } return 0; - case SURFACE_DIRT: + case SURFACE_GRAVEL: dir.x = -0.05f*m_vecMoveSpeed.x; dir.y = -0.05f*m_vecMoveSpeed.y; for(i = 0; i < 4; i++){ @@ -3568,7 +3568,7 @@ CAutomobile::AddWheelDirtAndWater(CColPoint *colpoint, uint32 belowEffectSpeed) CGeneral::GetRandomNumberInRange(0.02f, 0.06f), dirtCol); } return 1; - case SURFACE_DIRTTRACK: + case SURFACE_MUD_DRY: dir.x = -0.05f*m_vecMoveSpeed.x; dir.y = -0.05f*m_vecMoveSpeed.y; for(i = 0; i < 4; i++){ @@ -3918,19 +3918,19 @@ CAutomobile::SetUpWheelColModel(CColModel *colModel) CMatrix mat; mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_LF])); - colModel->spheres[0].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_LF); + colModel->spheres[0].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_RUBBER, CAR_PIECE_WHEEL_LF); mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_LB])); - colModel->spheres[1].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_LR); + colModel->spheres[1].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_RUBBER, CAR_PIECE_WHEEL_LR); mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_RF])); - colModel->spheres[2].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_RF); + colModel->spheres[2].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_RUBBER, CAR_PIECE_WHEEL_RF); mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_RB])); - colModel->spheres[3].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_RR); + colModel->spheres[3].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_RUBBER, CAR_PIECE_WHEEL_RR); if(m_aCarNodes[CAR_WHEEL_LM] != nil && m_aCarNodes[CAR_WHEEL_RM] != nil){ mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_LM])); - colModel->spheres[4].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_LR); + colModel->spheres[4].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_RUBBER, CAR_PIECE_WHEEL_LR); mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_RM])); - colModel->spheres[5].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_RR); + colModel->spheres[5].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_RUBBER, CAR_PIECE_WHEEL_RR); colModel->numSpheres = 6; }else colModel->numSpheres = 4; diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp index bb266a80..4966a228 100644 --- a/src/vehicles/Heli.cpp +++ b/src/vehicles/Heli.cpp @@ -590,12 +590,12 @@ CHeli::PreRender(void) g = 6; b = 3; break; - case SURFACE_DIRT: + case SURFACE_GRAVEL: r = 10; g = 8; b = 7; break; - case SURFACE_DIRTTRACK: + case SURFACE_MUD_DRY: r = 10; g = 6; b = 3; From c83b351887d5c4770912aa1b144df22a616dab01 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 26 May 2020 15:26:54 +0200 Subject: [PATCH 056/133] updated librw --- librw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librw b/librw index 3971dda0..84c582c1 160000 --- a/librw +++ b/librw @@ -1 +1 @@ -Subproject commit 3971dda001cba9c7dc67e86bc0b54a2c7568578f +Subproject commit 84c582c1d7a64a213523b8e4c8211f8b7a4fdcd1 From 0ac3477035e0bf217eeb33f25a265faa391cf1af Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 26 May 2020 18:50:27 +0200 Subject: [PATCH 057/133] fix UB shit --- src/core/Camera.cpp | 2 +- src/render/Sprite.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index 35d230dc..53bee20f 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -3218,7 +3218,7 @@ CCamera::GetLookDirection(void) Cams[ActiveCam].Mode == CCam::MODE_BEHINDBOAT || Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED) return Cams[ActiveCam].DirectionWasLooking; - return LOOKING_FORWARD;; + return LOOKING_FORWARD; } bool diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp index 1dd1aaab..0789769a 100644 --- a/src/render/Sprite.cpp +++ b/src/render/Sprite.cpp @@ -22,8 +22,8 @@ CSprite::CalcHorizonCoors(void) bool CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh, bool farclip) { - CVector viewvec = TheCamera.m_viewMatrix * *(CVector*)∈ - *out = *(RwV3d*)&viewvec; + CVector viewvec = TheCamera.m_viewMatrix * in; + *out = viewvec; if(out->z <= CDraw::GetNearClipZ() + 1.0f) return false; if(out->z >= CDraw::GetFarClipZ() && farclip) return false; float recip = 1.0f/out->z; From 4f1ce8bd4272186bb7a40fd88bf8d4f772f9fbfd Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 26 May 2020 20:44:03 +0200 Subject: [PATCH 058/133] added some unused enums --- src/vehicles/Automobile.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h index a2ff2616..0c02379f 100644 --- a/src/vehicles/Automobile.h +++ b/src/vehicles/Automobile.h @@ -36,7 +36,14 @@ enum eCarPositions CAR_POS_TAILLIGHTS, CAR_POS_FRONTSEAT, CAR_POS_BACKSEAT, - CAR_POS_EXHAUST = 9, + // these are unused so we don't know the actual values + CAR_POS_REVERSELIGHTS, + CAR_POS_BRAKELIGHTS, + CAR_POS_INDICATORS_FRONT, + CAR_POS_INDICATORS_BACK, + CAR_POS_STEERWHEEL, + // + CAR_POS_EXHAUST }; // These are used for all the wheel arrays From ec1d14971c9bb1d751c0256093483d621dd719b8 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Wed, 27 May 2020 00:25:12 +0300 Subject: [PATCH 059/133] mission replay --- src/control/GameLogic.cpp | 26 +++++- src/control/Script.cpp | 147 ++++++++++++++++++++++++++++++++ src/control/Script.h | 19 +++++ src/core/Frontend.cpp | 19 +++++ src/core/Frontend.h | 6 +- src/core/MenuScreens.h | 10 ++- src/core/Pools.cpp | 43 ++++++++++ src/core/config.h | 2 + src/save/GenericGameStorage.cpp | 45 ++++++++++ src/save/GenericGameStorage.h | 8 +- src/save/PCSave.cpp | 5 +- 11 files changed, 325 insertions(+), 5 deletions(-) diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp index abb5c5f3..ae26dd05 100644 --- a/src/control/GameLogic.cpp +++ b/src/control/GameLogic.cpp @@ -83,12 +83,20 @@ CGameLogic::Update() } break; case WBSTATE_WASTED: +#ifdef MISSION_REPLAY + if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > AddExtraDeathDelay() + 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= AddExtraDeathDelay() + 0x800)) { +#else if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800)) { +#endif TheCamera.SetFadeColour(200, 200, 200); TheCamera.Fade(2.0f, FADE_OUT); } +#ifdef MISSION_REPLAY + if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= AddExtraDeathDelay() + 0x1000) { +#else if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= 0x1000) { +#endif pPlayerInfo.m_WBState = WBSTATE_PLAYING; if (pPlayerInfo.m_bGetOutOfHospitalFree) { pPlayerInfo.m_bGetOutOfHospitalFree = false; @@ -131,11 +139,19 @@ CGameLogic::Update() } break; case WBSTATE_BUSTED: +#ifdef MISSION_REPLAY + if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > AddExtraDeathDelay() + 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= AddExtraDeathDelay() + 0x800)) { +#else if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800)) { +#endif TheCamera.SetFadeColour(0, 0, 0); TheCamera.Fade(2.0f, FADE_OUT); } +#ifdef MISSION_REPLAY + if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= AddExtraDeathDelay() + 0x1000) { +#else if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= 0x1000) { +#endif pPlayerInfo.m_WBState = WBSTATE_PLAYING; int takeMoney; @@ -203,11 +219,19 @@ CGameLogic::Update() } break; case WBSTATE_FAILED_CRITICAL_MISSION: - if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800 && CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800) { +#ifdef MISSION_REPLAY + if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > AddExtraDeathDelay() + 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= AddExtraDeathDelay() + 0x800)) { +#else + if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800)) { +#endif TheCamera.SetFadeColour(0, 0, 0); TheCamera.Fade(2.0f, FADE_OUT); } +#ifdef MISSION_REPLAY + if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= AddExtraDeathDelay() + 0x1000) { +#else if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= 0x1000) { +#endif pPlayerInfo.m_WBState = WBSTATE_PLAYING; if (pPlayerInfo.m_pPed->bInVehicle) { CVehicle *pVehicle = pPlayerInfo.m_pPed->m_pMyVehicle; diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 406b11b7..549f53ad 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -28,6 +28,9 @@ #include "Gangs.h" #include "Garages.h" #include "General.h" +#ifdef MISSION_REPLAY +#include "GenericGameStorage.h" +#endif #include "HandlingMgr.h" #include "Heli.h" #include "Hud.h" @@ -128,6 +131,38 @@ uint16 CTheScripts::CommandsExecuted; uint16 CTheScripts::ScriptsUpdated; int32 ScriptParams[32]; +#ifdef MISSION_REPLAY + +static const char* nonMissionScripts[] = { + "copcar", + "ambulan", + "taxi", + "firetru", + "rampage", + "t4x4_1", + "t4x4_2", + "t4x4_3", + "rc1", + "rc2", + "rc3", + "rc4", + "hj", + "usj", + "mayhem" +}; + +int AllowMissionReplay; +uint32 NextMissionDelay; +uint32 MissionStartTime; +uint32 WaitForMissionActivate; +uint32 WaitForSave; +float oldTargetX; +float oldTargetY; +int missionRetryScriptIndex; +bool doingMissionRetry; + +#endif + const uint32 CRunningScript::nSaveStructSize = #ifdef COMPATIBLE_SAVES @@ -666,6 +701,41 @@ void CTheScripts::Process() if (UseTextCommands == 1) UseTextCommands = 0; } + +#ifdef MISSION_REPLAY + static uint32 TimeToWaitTill; + switch (AllowMissionReplay) { + case 2: + AllowMissionReplay = 3; + TimeToWaitTill = CTimer::GetTimeInMilliseconds() + (AddExtraDeathDelay() > 1000 ? 4000 : 2500); + break; + case 3: + if (TimeToWaitTill < CTimer::GetTimeInMilliseconds()) + AllowMissionReplay = 4; + break; + case 4: + AllowMissionReplay = 5; + RetryMission(0, 0); + case 6: + AllowMissionReplay = 7; + TimeToWaitTill = CTimer::GetTimeInMilliseconds() + 500; + case 7: + if (TimeToWaitTill < CTimer::GetTimeInMilliseconds()) { + AllowMissionReplay = 0; + return; + } + break; + } + if (WaitForMissionActivate) { + if (WaitForMissionActivate > CTimer::GetTimeInMilliseconds()) + return; + WaitForMissionActivate = 0; + WaitForSave = CTimer::GetTimeInMilliseconds() + 3000; + } + if (WaitForSave && WaitForSave > CTimer::GetTimeInMilliseconds()) + WaitForSave = 0; +#endif + CRunningScript* script = pActiveScripts; while (script != nil){ CRunningScript* next = script->GetNext(); @@ -1239,6 +1309,17 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) CTheScripts::bAlreadyRunningAMissionScript = false; RemoveScriptFromList(&CTheScripts::pActiveScripts); AddScriptToList(&CTheScripts::pIdleScripts); +#ifdef MISSION_REPLAY + if (m_bMissionFlag) { + CPlayerInfo* pPlayerInfo = &CWorld::Players[CWorld::PlayerInFocus]; + if (pPlayerInfo->m_pPed->GetPedState() != PED_DEAD && pPlayerInfo->m_WBState == WBSTATE_PLAYING && !m_bDeatharrestExecuted) + SaveGameForPause(1); + oldTargetX = oldTargetY = 0.0f; + if (AllowMissionReplay == 1) + AllowMissionReplay = 2; + // I am fairly sure they forgot to set return value here + } +#endif return 1; case COMMAND_START_NEW_SCRIPT: { @@ -2149,7 +2230,14 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) CollectParameters(&m_nIp, 2); CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); assert(car); +#if defined MISSION_REPLAY && defined SIMPLIER_MISSIONS + car->AutoPilot.m_nCruiseSpeed = *(float*)&ScriptParams[1]; + if (missionRetryScriptIndex == 40 && car->GetModelIndex() == MI_CHEETAH) // Turismo + car->AutoPilot.m_nCruiseSpeed = 8 * car->AutoPilot.m_nCruiseSpeed / 10; + car->AutoPilot.m_nCruiseSpeed = Min(car->AutoPilot.m_nCruiseSpeed, 60.0f * car->pHandling->Transmission.fUnkMaxVelocity); +#else car->AutoPilot.m_nCruiseSpeed = Min(*(float*)&ScriptParams[1], 60.0f * car->pHandling->Transmission.fUnkMaxVelocity); +#endif return 0; } case COMMAND_SET_CAR_DRIVING_STYLE: @@ -2219,6 +2307,10 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) case COMMAND_PRINT_BIG: { wchar* key = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); +#ifdef MISSION_REPLAY + if (strcmp((char*)&CTheScripts::ScriptSpace[m_nIp], "M_FAIL") == 0 && CanAllowMissionReplay()) + AllowMissionReplay = 1; +#endif m_nIp += KEY_LENGTH_IN_SCRIPT; CollectParameters(&m_nIp, 2); CMessages::AddBigMessage(key, ScriptParams[0], ScriptParams[1] - 1); @@ -8479,6 +8571,10 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) case COMMAND_MAKE_PLAYER_SAFE_FOR_CUTSCENE: { CollectParameters(&m_nIp, 1); +#ifdef MISSION_REPLAY + AllowMissionReplay = 0; + SaveGameForPause(3); +#endif CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]]; CPad::GetPad(ScriptParams[0])->DisablePlayerControls |= PLAYERCONTROL_DISABLED_80; pPlayerInfo->MakePlayerSafe(true); @@ -8685,6 +8781,11 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) case COMMAND_LOAD_AND_LAUNCH_MISSION_INTERNAL: { CollectParameters(&m_nIp, 1); +#ifdef MISSION_REPLAY + missionRetryScriptIndex = ScriptParams[0]; + if (missionRetryScriptIndex == 19) + CStats::LastMissionPassedName[0] = '\0'; +#endif CTimer::Suspend(); int offset = CTheScripts::MultiScriptArray[ScriptParams[0]]; CFileMgr::ChangeDir("\\"); @@ -11074,6 +11175,12 @@ void CRunningScript::DoDeatharrestCheck() CPlayerInfo* pPlayer = &CWorld::Players[CWorld::PlayerInFocus]; if (!pPlayer->IsRestartingAfterDeath() && !pPlayer->IsRestartingAfterArrest() && !CTheScripts::UpsideDownCars.AreAnyCarsUpsideDown()) return; +#ifdef MISSION_REPLAY + if (AllowMissionReplay != 0) + return; + if (CanAllowMissionReplay()) + AllowMissionReplay = 1; +#endif assert(m_nStackPointer > 0); while (m_nStackPointer > 1) --m_nStackPointer; @@ -11755,3 +11862,43 @@ void CRunningScript::Load(uint8*& buf) prev = p; #endif } + +#ifdef MISSION_REPLAY + +bool CRunningScript::CanAllowMissionReplay() +{ + if (AllowMissionReplay) + return false; + if (CStats::LastMissionPassedName[0] == '\0') + return false; + for (int i = 0; i < ARRAY_SIZE(nonMissionScripts); i++) { + if (strcmp(m_abScriptName, nonMissionScripts[i]) == 0) + return false; + } + return true; +} + +uint32 AddExtraDeathDelay() +{ + if (missionRetryScriptIndex == 63) + return 7000; + if (missionRetryScriptIndex == 64) + return 4000; + return 1000; +} + +void RetryMission(int type, int unk) +{ + if (type == 0) { + doingMissionRetry = true; + FrontEndMenuManager.m_nCurrScreen = MENUPAGE_MISSION_RETRY; + FrontEndMenuManager.RequestFrontEndStartUp(); + } + else if (type == 2) { + doingMissionRetry = false; + AllowMissionReplay = 6; + CTheScripts::MissionCleanup.Process(); + } +} + +#endif diff --git a/src/control/Script.h b/src/control/Script.h index acab66cc..743fad99 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -372,6 +372,9 @@ private: friend class CRunningScript; friend class CHud; friend void CMissionCleanup::Process(); +#ifdef FIX_BUGS + friend void RetryMission(int, int); +#endif }; @@ -479,6 +482,10 @@ private: void CharInAreaCheckCommand(int32, uint32*); void CarInAreaCheckCommand(int32, uint32*); +#ifdef MISSION_REPLAY + bool CanAllowMissionReplay(); +#endif + float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; } bool ThisIsAValidRandomPed(uint32 pedtype) { @@ -502,3 +509,15 @@ private: } } }; + +#ifdef MISSION_REPLAY +extern int AllowMissionReplay; +extern uint32 WaitForMissionActivate; +extern uint32 WaitForSave; +extern uint32 MissionStartTime; +extern int missionRetryScriptIndex; +extern bool doingMissionRetry; + +uint32 AddExtraDeathDelay(); +void RetryMission(int, int); +#endif diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index d58d0576..b291886f 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -3497,6 +3497,13 @@ CMenuManager::Process(void) SaveLoadFileError_SetUpErrorScreen(); } if (m_nCurrScreen == MENUPAGE_LOADING_IN_PROGRESS) { +#ifdef MISSION_REPLAY + if (doingMissionRetry) { + RetryMission(2, 0); + m_nCurrSaveSlot = SLOT_COUNT; + doingMissionRetry = false; + } +#endif if (CheckSlotDataValid(m_nCurrSaveSlot)) { TheCamera.m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDARD; if (m_PrefsVsyncDisp != m_PrefsVsync) @@ -4661,6 +4668,18 @@ CMenuManager::ProcessButtonPresses(void) DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); OutputDebugString("STARTED PLAYING FRONTEND AUDIO TRACK"); break; +#ifdef MISSION_REPLAY + case MENUACTION_REJECT_RETRY: + doingMissionRetry = false; + AllowMissionReplay = 0; + RequestFrontEndShutDown(); + break; + case MENUACTION_UNK114: + doingMissionRetry = false; + RequestFrontEndShutDown(); + RetryMission(2, 0); + return; +#endif } } ProcessOnOffMenuOptions(); diff --git a/src/core/Frontend.h b/src/core/Frontend.h index 89517528..b65a60f1 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -245,7 +245,7 @@ enum eMenuScreen MENUPAGE_SKIN_SELECT = 54, MENUPAGE_KEYBOARD_CONTROLS = 55, MENUPAGE_MOUSE_CONTROLS = 56, - MENUPAGE_57 = 57, // mission failed, wanna restart page in mobile + MENUPAGE_MISSION_RETRY = 57, MENUPAGE_58 = 58, #ifdef MENU_MAP MENUPAGE_MAP = 59, @@ -366,6 +366,10 @@ enum eMenuAction MENUACTION_UNK108, MENUACTION_UNK109, MENUACTION_UNK110, + MENUACTION_UNK111, + MENUACTION_UNK112, + MENUACTION_REJECT_RETRY, + MENUACTION_UNK114, #ifdef MORE_LANGUAGES MENUACTION_LANG_PL, MENUACTION_LANG_RUS, diff --git a/src/core/MenuScreens.h b/src/core/MenuScreens.h index 6c2ebdb8..339ae2ce 100644 --- a/src/core/MenuScreens.h +++ b/src/core/MenuScreens.h @@ -445,11 +445,19 @@ const CMenuScreen aScreens[] = { MENUACTION_MOUSESTEER, "FET_MST", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, + // MENUPAGE_MISSION_RETRY = 57 +#ifdef MISSION_REPLAY - // MENUPAGE_57 = 57 + { "M_FAIL", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, + MENUACTION_LABEL, "FESZ_RM", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_LOADING_IN_PROGRESS, + MENUACTION_REJECT_RETRY, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE + }, +#else { "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0, // mission failed, wanna restart page in mobile }, +#endif // MENUPAGE_58 = 58 { "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0, diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index 17b9e08d..bd0814d0 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -4,6 +4,9 @@ #include "Boat.h" #include "CarCtrl.h" +#ifdef MISSION_REPLAY +#include "GenericGameStorage.h" +#endif #include "Population.h" #include "ProjectileInfo.h" #include "Streaming.h" @@ -206,11 +209,24 @@ INITSAVEBUF if (pVehicle->pPassengers[j]) bHasPassenger = true; } +#ifdef MISSION_REPLAY + bool bForceSaving = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pMyVehicle == pVehicle && IsQuickSave; +#ifdef FIX_BUGS + if ((!pVehicle->pDriver && !bHasPassenger) || bForceSaving) { +#else + if (!pVehicle->pDriver && !bHasPassenger) { +#endif + if (pVehicle->IsCar() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) + ++nNumCars; + if (pVehicle->IsBoat() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) + ++nNumBoats; +#else if (!pVehicle->pDriver && !bHasPassenger) { if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) ++nNumCars; if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) ++nNumBoats; +#endif } } *size = nNumCars * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CAutomobile::nSaveStructSize) + sizeof(int) + @@ -226,23 +242,42 @@ INITSAVEBUF if (pVehicle->pPassengers[j]) bHasPassenger = true; } +#ifdef MISSION_REPLAY + bool bForceSaving = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pMyVehicle == pVehicle && IsQuickSave; +#endif +#if defined FIX_BUGS && defined MISSION_REPLAY + if ((!pVehicle->pDriver && !bHasPassenger) || bForceSaving) { +#else if (!pVehicle->pDriver && !bHasPassenger) { +#endif #ifdef COMPATIBLE_SAVES +#ifdef MISSION_REPLAY + if ((pVehicle->IsCar() || pVehicle->IsBoat()) && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) { +#else if ((pVehicle->IsCar() || pVehicle->IsBoat()) && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) { +#endif WriteSaveBuf(buf, pVehicle->m_vehType); WriteSaveBuf(buf, pVehicle->GetModelIndex()); WriteSaveBuf(buf, GetVehicleRef(pVehicle)); pVehicle->Save(buf); } +#else +#ifdef MISSION_REPLAY + if (pVehicle->IsCar() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) { #else if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) { +#endif WriteSaveBuf(buf, (uint32)pVehicle->m_vehType); WriteSaveBuf(buf, pVehicle->GetModelIndex()); WriteSaveBuf(buf, GetVehicleRef(pVehicle)); memcpy(buf, pVehicle, sizeof(CAutomobile)); SkipSaveBuf(buf, sizeof(CAutomobile)); } +#ifdef MISSION_REPLAY + if (pVehicle->IsBoat() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) { +#else if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) { +#endif WriteSaveBuf(buf, (uint32)pVehicle->m_vehType); WriteSaveBuf(buf, pVehicle->GetModelIndex()); WriteSaveBuf(buf, GetVehicleRef(pVehicle)); @@ -400,7 +435,11 @@ INITSAVEBUF CPed* pPed = GetPedPool()->GetSlot(i); if (!pPed) continue; +#ifdef MISSION_REPLAY + if ((!pPed->bInVehicle || (pPed == CWorld::Players[CWorld::PlayerInFocus].m_pPed && IsQuickSave)) && pPed->m_nPedType == PEDTYPE_PLAYER1) +#else if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1) +#endif nNumPeds++; } *size = sizeof(int) + nNumPeds * (sizeof(uint32) + sizeof(int16) + sizeof(int) + CPlayerPed::nSaveStructSize + @@ -410,7 +449,11 @@ INITSAVEBUF CPed* pPed = GetPedPool()->GetSlot(i); if (!pPed) continue; +#ifdef MISSION_REPLAY + if ((!pPed->bInVehicle || (pPed == CWorld::Players[CWorld::PlayerInFocus].m_pPed && IsQuickSave)) && pPed->m_nPedType == PEDTYPE_PLAYER1) { +#else if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1) { +#endif CopyToBuf(buf, pPed->m_nPedType); CopyToBuf(buf, pPed->m_modelIndex); int32 ref = GetPedRef(pPed); diff --git a/src/core/config.h b/src/core/config.h index f43067d7..5ad12fba 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -227,6 +227,8 @@ enum Config { #define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default #define USE_MEASUREMENTS_IN_METERS // makes game use meters instead of feet in script #define USE_PRECISE_MEASUREMENT_CONVERTION // makes game convert feet to meeters more precisely +#define MISSION_REPLAY // mobile feature +//#define SIMPLIER_MISSIONS // apply simplifications from mobile #define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp index 8aae4011..eff0f2ff 100644 --- a/src/save/GenericGameStorage.cpp +++ b/src/save/GenericGameStorage.cpp @@ -42,6 +42,11 @@ const uint32 SIZE_OF_ONE_GAME_IN_BYTES = 201729; +#ifdef MISSION_REPLAY +int8 IsQuickSave; +const int PAUSE_SAVE_SLOT = SLOT_COUNT; +#endif + char DefaultPCSaveFileName[260]; char ValidSaveName[260]; char LoadFileName[256]; @@ -134,7 +139,12 @@ GenericSave(int file) WriteDataToBufferPointer(buf, saveName); GetLocalTime(&saveTime); WriteDataToBufferPointer(buf, saveTime); +#ifdef MISSION_REPLAY + int32 data = IsQuickSave << 24 | SIZE_OF_ONE_GAME_IN_BYTES; + WriteDataToBufferPointer(buf, data); +#else WriteDataToBufferPointer(buf, SIZE_OF_ONE_GAME_IN_BYTES); +#endif WriteDataToBufferPointer(buf, CGame::currLevel); WriteDataToBufferPointer(buf, TheCamera.GetPosition().x); WriteDataToBufferPointer(buf, TheCamera.GetPosition().y); @@ -240,6 +250,9 @@ GenericLoad() uint8 *buf; int32 file; uint32 size; +#ifdef MISSION_REPLAY + int8 qs; +#endif int32 saveSize; CPad *currPad; @@ -254,6 +267,9 @@ GenericLoad() ReadDataFromFile(file, work_buff, size); buf = (work_buff + 0x40); ReadDataFromBufferPointer(buf, saveSize); +#ifdef MISSION_REPLAY // a hack to keep compatibility but get new data from save + qs = saveSize >> 24; +#endif ReadDataFromBufferPointer(buf, CGame::currLevel); ReadDataFromBufferPointer(buf, TheCamera.GetMatrix().GetPosition().x); ReadDataFromBufferPointer(buf, TheCamera.GetMatrix().GetPosition().y); @@ -296,6 +312,11 @@ GenericLoad() ReadDataFromBufferPointer(buf, TheCamera.PedZoomIndicator); #endif assert(buf - work_buff == SIZE_OF_SIMPLEVARS); +#ifdef MISSION_REPLAY + WaitForSave = 0; + if (FrontEndMenuManager.m_nCurrSaveSlot == PAUSE_SAVE_SLOT && qs == 3) + WaitForMissionActivate = CTimer::GetTimeInMilliseconds() + 2000; +#endif ReadDataFromBlock("Loading Scripts \n", CTheScripts::LoadAllScripts); // Load the rest @@ -563,3 +584,27 @@ align4bytes(int32 size) { return (size + 3) & 0xFFFFFFFC; } + +#ifdef MISSION_REPLAY + +void DisplaySaveResult(int unk, char* name) +{} + +bool SaveGameForPause(int type) +{ + if (AllowMissionReplay != 0 || type != 3 && WaitForSave > CTimer::GetTimeInMilliseconds()) + return false; + WaitForSave = 0; + if (gGameState != GS_PLAYING_GAME || CTheScripts::IsPlayerOnAMission() || CStats::LastMissionPassedName[0] == '\0') { + DisplaySaveResult(3, CStats::LastMissionPassedName); + return false; + } + IsQuickSave = type; + MissionStartTime = 0; + int res = PcSaveHelper.SaveSlot(PAUSE_SAVE_SLOT); + PcSaveHelper.PopulateSlotInfo(); + IsQuickSave = 0; + DisplaySaveResult(res, CStats::LastMissionPassedName); + return true; +} +#endif diff --git a/src/save/GenericGameStorage.h b/src/save/GenericGameStorage.h index b913c305..ee8a52a1 100644 --- a/src/save/GenericGameStorage.h +++ b/src/save/GenericGameStorage.h @@ -40,4 +40,10 @@ extern uint32 TimeToStayFadedBeforeFadeOut; extern char SaveFileNameJustSaved[260]; // 8F2570 -const char TopLineEmptyFile[] = "THIS FILE IS NOT VALID YET"; \ No newline at end of file +const char TopLineEmptyFile[] = "THIS FILE IS NOT VALID YET"; + +#ifdef MISSION_REPLAY +extern int8 IsQuickSave; // originally int + +bool SaveGameForPause(int); +#endif diff --git a/src/save/PCSave.cpp b/src/save/PCSave.cpp index 3dc80f73..3103c7ab 100644 --- a/src/save/PCSave.cpp +++ b/src/save/PCSave.cpp @@ -41,7 +41,10 @@ C_PcSave::SaveSlot(int32 slot) _psGetUserFilesFolder(); int file = CFileMgr::OpenFile(ValidSaveName, "wb"); if (file != 0) { - DoGameSpecificStuffBeforeSave(); +#ifdef MISSION_REPLAY + if (!IsQuickSave) +#endif + DoGameSpecificStuffBeforeSave(); if (GenericSave(file)) { if (!!CFileMgr::CloseFile(file)) nErrorCode = SAVESTATUS_ERR_SAVE_CLOSE; From 7a79b74778b883f21ed202fa15143217f5c2422e Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Wed, 27 May 2020 03:33:27 +0300 Subject: [PATCH 060/133] Restore original logic --- src/audio/AudioLogic.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 56e602fd..ab135877 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -8552,12 +8552,12 @@ const MissionAudioData MissionAudioNameSfxAssoc[] = { {"door_1", STREAMED_SOUND_MISSION_DOOR_1}, {"door_2", STREAMED_SOUND_MISSION_DOOR_2}, {"door_3", STREAMED_SOUND_MISSION_DOOR_3}, {"door_4", STREAMED_SOUND_MISSION_DOOR_4}, {"door_5", STREAMED_SOUND_MISSION_DOOR_5}, {"door_6", STREAMED_SOUND_MISSION_DOOR_6}, {"t3_a", STREAMED_SOUND_MISSION_T3_A}, {"t3_b", STREAMED_SOUND_MISSION_T3_B}, {"t3_c", STREAMED_SOUND_MISSION_T3_C}, - {"k1_b", STREAMED_SOUND_MISSION_K1_B}, {"c_1", STREAMED_SOUND_MISSION_CAT1}}; + {"k1_b", STREAMED_SOUND_MISSION_K1_B}, {"c_1", STREAMED_SOUND_MISSION_CAT1}, {nil, 0}}; int32 FindMissionAudioSfx(const char *name) { - for (uint32 i = 0; i < ARRAY_SIZE(MissionAudioNameSfxAssoc); ++i) { + for (uint32 i = 0; MissionAudioNameSfxAssoc[i].m_pName != nil; ++i) { if (!CGeneral::faststricmp(MissionAudioNameSfxAssoc[i].m_pName, name)) return MissionAudioNameSfxAssoc[i].m_nId; } From 926281f9097ee754ccf1467ca4ef0a7c73a607b8 Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 27 May 2020 06:49:29 +0200 Subject: [PATCH 061/133] MT function for fakerw --- src/fakerw/fake.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp index 71646020..0c85728b 100644 --- a/src/fakerw/fake.cpp +++ b/src/fakerw/fake.cpp @@ -615,8 +615,8 @@ RpGeometry *RpGeometryCreateSpace(RwReal radius); RpMorphTarget *RpMorphTargetSetBoundingSphere(RpMorphTarget *morphTarget, const RwSphere *boundingSphere) { morphTarget->boundingSphere = *boundingSphere; return morphTarget; } RwSphere *RpMorphTargetGetBoundingSphere(RpMorphTarget *morphTarget) { return &morphTarget->boundingSphere; } const RpMorphTarget *RpMorphTargetCalcBoundingSphere(const RpMorphTarget *morphTarget, RwSphere *boundingSphere) { *boundingSphere = morphTarget->calculateBoundingSphere(); return morphTarget; } -RwInt32 RpGeometryAddMorphTargets(RpGeometry *geometry, RwInt32 mtcount); -RwInt32 RpGeometryAddMorphTarget(RpGeometry *geometry); +RwInt32 RpGeometryAddMorphTargets(RpGeometry *geometry, RwInt32 mtcount) { RwInt32 n = geometry->numMorphTargets; geometry->addMorphTargets(mtcount); return n; } +RwInt32 RpGeometryAddMorphTarget(RpGeometry *geometry) { return RpGeometryAddMorphTargets(geometry, 1); } RpGeometry *RpGeometryRemoveMorphTarget(RpGeometry *geometry, RwInt32 morphTarget); RwInt32 RpGeometryGetNumMorphTargets(const RpGeometry *geometry); RpMorphTarget *RpGeometryGetMorphTarget(const RpGeometry *geometry, RwInt32 morphTarget) { return &geometry->morphTargets[morphTarget]; } From 1af4edd43a902b127b4c4f0f5bdd6596c886214d Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 27 May 2020 09:47:21 +0200 Subject: [PATCH 062/133] RwCameraGetCurrentCamera --- src/extras/debugmenu.cpp | 12 +++--------- src/fakerw/fake.cpp | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/extras/debugmenu.cpp b/src/extras/debugmenu.cpp index f6b6eeb8..3a4c4175 100644 --- a/src/extras/debugmenu.cpp +++ b/src/extras/debugmenu.cpp @@ -1028,12 +1028,6 @@ DebugMenuProcess(void) } -#ifdef LIBRW -#define CURRENTCAM (rw::engine->currentCamera) -#else -#define CURRENTCAM ((RwCamera*)RWSRCGLOBAL(curCamera)) -#endif - void DebugMenuRender(void) { @@ -1048,7 +1042,7 @@ DebugMenuRender(void) RwRenderStateSet(rwRENDERSTATEFOGENABLE, 0); RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE); - RwCamera *cam = CURRENTCAM; + RwCamera *cam = RwCameraGetCurrentCamera(); screenWidth = RwRasterGetWidth(RwCameraGetRaster(cam)); screenHeight = RwRasterGetHeight(RwCameraGetRaster(cam)); @@ -1080,7 +1074,7 @@ drawArrow(RwRect r, int direction, int style) static RwImVertexIndex indices[] = { 0, 1, 2, 2, 1, 3 }; static RwIm2DVertex arrowVerts[4]; - RwCamera *cam = CURRENTCAM; + RwCamera *cam = RwCameraGetCurrentCamera(); float recipz = 1.0f/RwCameraGetNearClipPlane(cam); int width = RwRasterGetWidth(arrow); @@ -1183,7 +1177,7 @@ drawMouse(void) static RwIm2DVertex vertices[4]; RwIm2DVertex *vert; RwCamera *cam; - cam = CURRENTCAM; + cam = RwCameraGetCurrentCamera(); float x = mouseX; float y = mouseY; float w = RwRasterGetWidth(cursor); diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp index 0c85728b..08d106f4 100644 --- a/src/fakerw/fake.cpp +++ b/src/fakerw/fake.cpp @@ -152,7 +152,7 @@ RwReal RwCameraGetNearClipPlane(const RwCamera *camera) { return camera->n RwReal RwCameraGetFarClipPlane(const RwCamera *camera) { return camera->farPlane; } RwCamera *RwCameraSetFogDistance(RwCamera *camera, RwReal fogDistance) { camera->fogPlane = fogDistance; return camera; } RwReal RwCameraGetFogDistance(const RwCamera *camera) { return camera->fogPlane; } -RwCamera *RwCameraGetCurrentCamera(void); +RwCamera *RwCameraGetCurrentCamera(void) { return rw::engine->currentCamera; } RwCameraProjection RwCameraGetProjection(const RwCamera *camera); const RwV2d *RwCameraGetViewWindow(const RwCamera *camera) { return &camera->viewWindow; } RwMatrix *RwCameraGetViewMatrix(RwCamera *camera) { return &camera->viewMatrix; } From 3a5a12288755a90cf274b04c591e4ba38bf8f1c7 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Wed, 27 May 2020 20:48:47 +0300 Subject: [PATCH 063/133] Fix city sound playing on restarting a new game --- src/audio/MusicManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index 8e8e9c24..b8d6dc03 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -301,14 +301,14 @@ cMusicManager::GetRadioInCar(void) CVehicle *veh = FindPlayerVehicle(); if (veh != nil){ if (UsesPoliceRadio(veh)) { - if (m_nRadioInCar == NO_STREAMED_SOUND || CReplay::IsPlayingBack() && AudioManager.m_nUserPause) + if (m_nRadioInCar == NO_STREAMED_SOUND || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0)) return POLICE_RADIO; return m_nRadioInCar; } else return veh->m_nRadioStation; } } - if (m_nRadioInCar == NO_STREAMED_SOUND || CReplay::IsPlayingBack() && AudioManager.m_nUserPause) + if (m_nRadioInCar == NO_STREAMED_SOUND || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0)) return RADIO_OFF; return m_nRadioInCar; } From d8749c2305408b65d298f5e2e302dd5e9d68d249 Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 27 May 2020 20:41:13 +0200 Subject: [PATCH 064/133] librw update --- librw | 2 +- src/fakerw/fake.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/librw b/librw index 84c582c1..6ff378bb 160000 --- a/librw +++ b/librw @@ -1 +1 @@ -Subproject commit 84c582c1d7a64a213523b8e4c8211f8b7a4fdcd1 +Subproject commit 6ff378bb16007ad003b1a71996944a20f2e76556 diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp index 08d106f4..f95845a8 100644 --- a/src/fakerw/fake.cpp +++ b/src/fakerw/fake.cpp @@ -790,6 +790,12 @@ RpMaterial *RpMatFXMaterialSetEnvMapFrame( RpMaterial *material, RwFrame *frame mfx->setEnvFrame(frame); return material; } +RpMaterial *RpMatFXMaterialSetEnvMapFrameBufferAlpha( RpMaterial *material, RwBool useFrameBufferAlpha ) +{ + MatFX *mfx = MatFX::get(material); + mfx->setEnvFBAlpha(useFrameBufferAlpha); + return material; +} RpMaterial *RpMatFXMaterialSetEnvMapCoefficient( RpMaterial *material, RwReal coef ) { MatFX *mfx = MatFX::get(material); From 2a1b9281e49685b6d5d3cf0770cfa0c3e15d1e94 Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 27 May 2020 22:32:57 +0200 Subject: [PATCH 065/133] automobile fixes --- src/vehicles/Automobile.cpp | 32 ++++++++++++++++++++------------ src/vehicles/DamageManager.cpp | 10 +++------- src/vehicles/DamageManager.h | 2 +- src/vehicles/Vehicle.cpp | 8 ++++---- 4 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index e572c123..5d39b525 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -3232,7 +3232,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece) if(impulse > 25.0f && GetStatus() != STATUS_WRECKED){ if(bIsLawEnforcer && FindPlayerVehicle() && FindPlayerVehicle() == m_pDamageEntity && - GetStatus() != STATUS_ABANDONED && + GetStatus() != STATUS_ABANDONED && FindPlayerVehicle()->m_vecMoveSpeed.Magnitude() >= m_vecMoveSpeed.Magnitude() && FindPlayerVehicle()->m_vecMoveSpeed.Magnitude() > 0.1f) FindPlayerPed()->SetWantedLevelNoDrop(1); @@ -3276,6 +3276,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece) case CAR_PIECE_BONNET: GetComponentWorldPosition(CAR_BONNET, pos); dmgDrawCarCollidingParticles(pos, impulse); + if(GetModelIndex() != MI_DODO) if(Damage.ApplyDamage(COMPONENT_DOOR_BONNET, impulse*impulseMult, pHandling->fCollisionDamageMultiplier)){ SetDoorDamage(CAR_BONNET, DOOR_BONNET); doubleMoney = true; @@ -3286,7 +3287,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece) case CAR_PIECE_BUMP_REAR: GetComponentWorldPosition(CAR_BUMP_REAR, pos); dmgDrawCarCollidingParticles(pos, impulse); - if(Damage.ApplyDamage(COMPONENT_BUMPER_FRONT, impulse*impulseMult, pHandling->fCollisionDamageMultiplier)){ + if(Damage.ApplyDamage(COMPONENT_BUMPER_REAR, impulse*impulseMult, pHandling->fCollisionDamageMultiplier)){ SetBumperDamage(CAR_BUMP_REAR, VEHBUMPER_REAR); doubleMoney = true; } @@ -3542,8 +3543,8 @@ CAutomobile::AddWheelDirtAndWater(CColPoint *colpoint, uint32 belowEffectSpeed) int i; CVector dir; static RwRGBA grassCol = { 8, 24, 8, 255 }; - static RwRGBA dirtCol = { 64, 64, 64, 255 }; - static RwRGBA dirttrackCol = { 64, 32, 16, 255 }; + static RwRGBA gravelCol = { 64, 64, 64, 255 }; + static RwRGBA mudCol = { 64, 32, 16, 255 }; static RwRGBA waterCol = { 48, 48, 64, 0 }; if(!belowEffectSpeed) @@ -3565,7 +3566,7 @@ CAutomobile::AddWheelDirtAndWater(CColPoint *colpoint, uint32 belowEffectSpeed) for(i = 0; i < 4; i++){ dir.z = CGeneral::GetRandomNumberInRange(0.03f, 0.06f); CParticle::AddParticle(PARTICLE_WHEEL_DIRT, colpoint->point, dir, nil, - CGeneral::GetRandomNumberInRange(0.02f, 0.06f), dirtCol); + CGeneral::GetRandomNumberInRange(0.02f, 0.06f), gravelCol); } return 1; case SURFACE_MUD_DRY: @@ -3574,7 +3575,7 @@ CAutomobile::AddWheelDirtAndWater(CColPoint *colpoint, uint32 belowEffectSpeed) for(i = 0; i < 4; i++){ dir.z = CGeneral::GetRandomNumberInRange(0.03f, 0.06f); CParticle::AddParticle(PARTICLE_WHEEL_DIRT, colpoint->point, dir, nil, - CGeneral::GetRandomNumberInRange(0.02f, 0.06f), dirttrackCol); + CGeneral::GetRandomNumberInRange(0.02f, 0.06f), mudCol); } return 0; default: @@ -4404,7 +4405,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type) (component == COMPGROUP_BONNET || component == COMPGROUP_BOOT || component == CAR_WINDSCREEN)){ obj->m_vecMoveSpeed.z *= -1.5f; obj->m_vecMoveSpeed.z += 0.04f; - }else{ + }else{p obj->m_vecMoveSpeed.z *= 0.25f; } obj->m_vecMoveSpeed.x *= 0.75f; @@ -4420,7 +4421,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type) dist += GetUp(); if(GetUp().z > 0.0f){ // simulate fast upward movement if going fast - float speed = CVector2D(m_vecMoveSpeed).MagnitudeSqr(); + float speed = CVector2D(m_vecMoveSpeed).Magnitude(); obj->GetMatrix().Translate(GetUp()*speed); } } @@ -4452,8 +4453,11 @@ CAutomobile::RemoveBonnetInPedCollision(void) if(Damage.GetDoorStatus(DOOR_BONNET) == DOOR_STATUS_SWINGING && Doors[DOOR_BONNET].RetAngleWhenOpen()*0.4f < Doors[DOOR_BONNET].m_fAngle){ - // BUG? why not COMPGROUP_BONNET? +#ifdef FIX_BUGS + obj = SpawnFlyingComponent(CAR_BONNET, COMPGROUP_BONNET); +#else obj = SpawnFlyingComponent(CAR_BONNET, COMPGROUP_DOOR); +#endif // make both doors invisible on car SetComponentVisibility(m_aCarNodes[CAR_BONNET], ATOMIC_FLAG_NONE); Damage.SetDoorStatus(DOOR_BONNET, DOOR_STATUS_MISSING); @@ -4514,13 +4518,16 @@ CAutomobile::SetDoorDamage(int32 component, eDoors door, bool noFlyingComponents status = DOOR_STATUS_MISSING; } - if(status == DOOR_STATUS_SMASHED){ + switch(status){ + case DOOR_STATUS_SMASHED: // show damaged part SetComponentVisibility(m_aCarNodes[component], ATOMIC_FLAG_DAM); - }else if(status == DOOR_STATUS_SWINGING){ + break; + case DOOR_STATUS_SWINGING: // turn off angle cull for swinging doors RwFrameForAllObjects(m_aCarNodes[component], CVehicleModelInfo::SetAtomicFlagCB, (void*)ATOMIC_FLAG_NOCULL); - }else if(status == DOOR_STATUS_MISSING){ + break; + case DOOR_STATUS_MISSING: if(!noFlyingComponents){ if(door == DOOR_BONNET) SpawnFlyingComponent(component, COMPGROUP_BONNET); @@ -4531,6 +4538,7 @@ CAutomobile::SetDoorDamage(int32 component, eDoors door, bool noFlyingComponents } // hide both SetComponentVisibility(m_aCarNodes[component], ATOMIC_FLAG_NONE); + break; } } diff --git a/src/vehicles/DamageManager.cpp b/src/vehicles/DamageManager.cpp index 6b59ccda..c625a4e7 100644 --- a/src/vehicles/DamageManager.cpp +++ b/src/vehicles/DamageManager.cpp @@ -11,7 +11,7 @@ CDamageManager::CDamageManager(void) { ResetDamageStatus(); m_fWheelDamageEffect = 0.75f; - field_24 = 1; + field_18 = 1; } void @@ -28,12 +28,8 @@ CDamageManager::FuckCarCompletely(void) m_wheelStatus[0] = WHEEL_STATUS_MISSING; // wheels 1-3 not reset? - m_doorStatus[0] = DOOR_STATUS_MISSING; - m_doorStatus[1] = DOOR_STATUS_MISSING; - m_doorStatus[2] = DOOR_STATUS_MISSING; - m_doorStatus[3] = DOOR_STATUS_MISSING; - m_doorStatus[4] = DOOR_STATUS_MISSING; - m_doorStatus[5] = DOOR_STATUS_MISSING; + for(i = 0; i < ARRAY_SIZE(m_doorStatus); i++) + m_doorStatus[i] = DOOR_STATUS_MISSING; for(i = 0; i < 3; i++){ #ifdef FIX_BUGS diff --git a/src/vehicles/DamageManager.h b/src/vehicles/DamageManager.h index bf0c59a1..312006e3 100644 --- a/src/vehicles/DamageManager.h +++ b/src/vehicles/DamageManager.h @@ -86,7 +86,7 @@ public: uint8 m_doorStatus[6]; uint32 m_lightStatus; uint32 m_panelStatus; - uint32 field_24; + uint8 field_18; CDamageManager(void); diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index e264d7ed..77c549f9 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -780,7 +780,7 @@ CVehicle::ShufflePassengersToMakeSpace(void) return false; if (pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR) && - IsRoomForPedToLeaveCar(COMPONENT_DOOR_REAR_LEFT, nil)) { + IsRoomForPedToLeaveCar(CAR_DOOR_LR, nil)) { if (!pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR)) { pPassengers[2] = pPassengers[1]; pPassengers[1] = nil; @@ -797,7 +797,7 @@ CVehicle::ShufflePassengersToMakeSpace(void) } if (pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR) && - IsRoomForPedToLeaveCar(COMPONENT_DOOR_REAR_RIGHT, nil)) { + IsRoomForPedToLeaveCar(CAR_DOOR_RR, nil)) { if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) { pPassengers[1] = pPassengers[2]; pPassengers[2] = nil; @@ -814,7 +814,7 @@ CVehicle::ShufflePassengersToMakeSpace(void) } if (pPassengers[0] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RF) && - IsRoomForPedToLeaveCar(COMPONENT_DOOR_FRONT_RIGHT, nil)) { + IsRoomForPedToLeaveCar(CAR_DOOR_RF, nil)) { if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) { pPassengers[1] = pPassengers[0]; pPassengers[0] = nil; @@ -1192,7 +1192,7 @@ CVehicle::ProcessCarAlarm(void) { uint32 step; - if(m_nAlarmState == 0 || m_nAlarmState == -1) + if(!IsAlarmOn()) return; step = CTimer::GetTimeStepInMilliseconds(); From 0bc6eef55d560a0d17c58792668d01cfeaf4bf66 Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 27 May 2020 22:34:10 +0200 Subject: [PATCH 066/133] bla --- src/vehicles/Automobile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 5d39b525..654713b1 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -4405,7 +4405,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type) (component == COMPGROUP_BONNET || component == COMPGROUP_BOOT || component == CAR_WINDSCREEN)){ obj->m_vecMoveSpeed.z *= -1.5f; obj->m_vecMoveSpeed.z += 0.04f; - }else{p + }else{ obj->m_vecMoveSpeed.z *= 0.25f; } obj->m_vecMoveSpeed.x *= 0.75f; From d9d57f12fc28c4d93a3534bd3c96be2158e213b9 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Thu, 28 May 2020 01:00:49 +0300 Subject: [PATCH 067/133] crash fix --- src/control/Script.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 406b11b7..1ea970c4 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -10398,8 +10398,8 @@ void CRunningScript::LocateCharCarCommand(int32 command, uint32* pIp) case COMMAND_LOCATE_CHAR_ON_FOOT_CAR_3D: result = !pPed->bInVehicle; break; - case COMMAND_LOCATE_CHAR_IN_CAR_CHAR_2D: - case COMMAND_LOCATE_CHAR_IN_CAR_CHAR_3D: + case COMMAND_LOCATE_CHAR_IN_CAR_CAR_2D: + case COMMAND_LOCATE_CHAR_IN_CAR_CAR_3D: result = pPed->bInVehicle; break; default: From 329a387fdfab403bfd8fadef025510ee1081e38f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Thu, 28 May 2020 03:07:26 +0300 Subject: [PATCH 068/133] Frontend customization functions, freecam toggle, minor things --- src/control/Script.cpp | 13 +- src/core/Cam.cpp | 2 +- src/core/Frontend.cpp | 227 +++++++++++++------- src/core/Frontend.h | 17 +- src/core/Game.cpp | 6 +- src/core/{MenuScreens.h => MenuScreens.cpp} | 36 +--- src/core/config.h | 1 + src/core/main.cpp | 1 - src/core/re3.cpp | 98 +++++++++ src/extras/frontendoption.cpp | 163 ++++++++++++++ src/extras/frontendoption.h | 86 ++++++++ src/skel/glfw/glfw.cpp | 2 +- 12 files changed, 531 insertions(+), 121 deletions(-) rename src/core/{MenuScreens.h => MenuScreens.cpp} (95%) create mode 100644 src/extras/frontendoption.cpp create mode 100644 src/extras/frontendoption.h diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 1ea970c4..c52b28c6 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1,4 +1,3 @@ -#define WITHWINDOWS // for our script loading hack #include "common.h" #include "Script.h" @@ -504,10 +503,22 @@ void CRunningScript::Init() } #ifdef USE_DEBUG_SCRIPT_LOADER +#ifdef _WIN32 +#include +#endif int open_script() { static int scriptToLoad = 0; + // Doesn't work because of CGame::Initialise is blocking + /* + if (glfwGetKey(PSGLOBAL(window), GLFW_KEY_G) == GLFW_PRESS) + scriptToLoad = 0; + if (glfwGetKey(PSGLOBAL(window), GLFW_KEY_R) == GLFW_PRESS) + scriptToLoad = 1; + if (glfwGetKey(PSGLOBAL(window), GLFW_KEY_D) == GLFW_PRESS) + scriptToLoad = 2; + */ #ifdef _WIN32 if (GetAsyncKeyState('G') & 0x8000) scriptToLoad = 0; diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 247e77ce..6347e111 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -29,7 +29,7 @@ bool PrintDebugCode = false; int16 DebugCamMode; #ifdef FREE_CAM -bool CCamera::bFreeCam = true; +bool CCamera::bFreeCam; int nPreviousMode = -1; #endif diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index d58d0576..710fc692 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -23,7 +23,6 @@ #include "GenericGameStorage.h" #include "Script.h" #include "Camera.h" -#include "MenuScreens.h" #include "ControllerConfig.h" #include "Vehicle.h" #include "MBlur.h" @@ -36,6 +35,7 @@ #include "Stats.h" #include "Messages.h" #include "FileLoader.h" +#include "frontendoption.h" #define TIDY_UP_PBP // ProcessButtonPresses #define MAX_VISIBLE_LIST_ROW 30 @@ -382,7 +382,7 @@ CMenuManager::PageDownList(bool playSoundOnSuccess) } inline void -CMenuManager::ThingsToDoBeforeLeavingPage() +CMenuManager::ThingsToDoBeforeGoingBack() { if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) && strcmp(m_aSkinName, m_PrefsSkinFile) != 0) { CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile); @@ -395,9 +395,6 @@ CMenuManager::ThingsToDoBeforeLeavingPage() #endif } else if (m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) { m_nDisplayVideoMode = m_nPrefsVideoMode; -#ifdef IMPROVED_VIDEOMODE - m_nSelectedScreenMode = m_nPrefsWindowed; -#endif } if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) { @@ -407,6 +404,43 @@ CMenuManager::ThingsToDoBeforeLeavingPage() if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) || (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS)) { m_nTotalListRow = 0; } + +#ifdef CUSTOM_FRONTEND_OPTIONS + for (int i = 0; i < numCustomFrontendOptions; i++) { + FrontendOption &option = customFrontendOptions[i]; + if (option.type != FEOPTION_REDIRECT && option.type != FEOPTION_GOBACK && m_nCurrScreen == option.screen) { + if (option.returnPrevPageFunc) + option.returnPrevPageFunc(); + + if (option.onlyApplyOnEnter) + option.displayedValue = *option.value; + } + } +#endif +} + +inline int8 +CMenuManager::GetPreviousPageOption() +{ +#ifndef CUSTOM_FRONTEND_OPTIONS + return !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry[1] : aScreens[m_nCurrScreen].m_ParentEntry[0]; +#else + int8 prevPage = !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0]; + + if (prevPage == -1) // Game also does same + return 0; + + prevPage = prevPage == MENUPAGE_NONE ? (!m_bGameNotLoaded ? MENUPAGE_PAUSE_MENU : MENUPAGE_START_MENU) : prevPage; + + for (int i = 0; i < NUM_MENUROWS; i++) { + if (aScreens[prevPage].m_aEntries[i].m_TargetMenu == m_nCurrScreen) { + return i; + } + } + + // Couldn't find current screen option on previous page, use default behaviour (maybe save-related screen?) + return !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry[1] : aScreens[m_nCurrScreen].m_ParentEntry[0]; +#endif } // ------ Functions not in the game/inlined ends @@ -923,6 +957,9 @@ CMenuManager::Draw() #endif for (int i = 0; i < NUM_MENUROWS; ++i) { +#ifdef CUSTOM_FRONTEND_OPTIONS + bool isOptionDisabled = false; +#endif if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action != MENUACTION_LABEL && aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName[0] != '\0') { wchar *rightText = nil; wchar *leftText; @@ -1105,17 +1142,6 @@ CMenuManager::Draw() AsciiToUnicode(_psGetVideoModeList()[m_nDisplayVideoMode], unicodeTemp); rightText = unicodeTemp; break; -#ifdef IMPROVED_VIDEOMODE - case MENUACTION_SCREENMODE: - if (m_nSelectedScreenMode == 0) - sprintf(asciiTemp, "FULLSCREEN"); - else - sprintf(asciiTemp, "WINDOWED"); - - AsciiToUnicode(asciiTemp, unicodeTemp); - rightText = unicodeTemp; - break; -#endif case MENUACTION_AUDIOHW: if (m_nPrefsAudio3DProviderIndex == -1) rightText = TheText.Get("FEA_NAH"); @@ -1166,6 +1192,28 @@ CMenuManager::Draw() case MENUACTION_MOUSESTEER: rightText = TheText.Get(CVehicle::m_bDisableMouseSteering ? "FEM_OFF" : "FEM_ON"); break; +#ifdef CUSTOM_FRONTEND_OPTIONS + case MENUACTION_TRIGGERFUNC: + FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu]; + if (m_nCurrScreen == option.screen && i == option.screenOptionOrder) { + leftText = (wchar*)option.leftText; + if (option.type == FEOPTION_SELECT) { + if (option.displayedValue >= option.numRightTexts || option.displayedValue < 0) + option.displayedValue = 0; + + rightText = (wchar*)option.rightTexts[option.displayedValue]; + + } else if (option.type == FEOPTION_DYNAMIC) { + if (option.drawFunc) { + option.drawFunc(unicodeTemp, &isOptionDisabled); + rightText = unicodeTemp; + } + } + } else + assert(0 && "Custom frontend options is borked"); + + break; +#endif } float nextItemY = headerHeight + nextYToUse; @@ -1244,7 +1292,11 @@ CMenuManager::Draw() CFont::SetRightJustifyOn(); if(!strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FED_RES") - && !m_bGameNotLoaded && textLayer == 1) { + && !m_bGameNotLoaded && textLayer == 1 +#ifdef CUSTOM_FRONTEND_OPTIONS + || isOptionDisabled +#endif + ) { CFont::SetColor(CRGBA(155, 117, 6, FadeIn(255))); } CFont::PrintString(MENU_X_RIGHT_ALIGNED(columnWidth - textLayer), itemY, rightText); @@ -1287,12 +1339,12 @@ CMenuManager::Draw() SetHelperText(3); } } -#ifdef IMPROVED_VIDEOMODE - if (m_nSelectedScreenMode != m_nPrefsWindowed) { - if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "SCRFOR") != 0 - && m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) { - m_nSelectedScreenMode = m_nPrefsWindowed; - } + +#ifdef CUSTOM_FRONTEND_OPTIONS + if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action == MENUACTION_TRIGGERFUNC) { + FrontendOption &option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu]; + if (option.onlyApplyOnEnter && m_nCurrOption != i) + option.displayedValue = *option.value; } #endif @@ -2993,6 +3045,11 @@ CMenuManager::InitialiseChangedLanguageSettings() default: break; } + +#ifdef CUSTOM_FRONTEND_OPTIONS + RemoveCustomFrontendOptions(); + CustomFrontendOptionsPopulate(); +#endif } } @@ -3138,6 +3195,9 @@ CMenuManager::LoadSettings() CFileMgr::Read(fileHandle, m_PrefsSkinFile, 256); CFileMgr::Read(fileHandle, (char*)&m_ControlMethod, 1); CFileMgr::Read(fileHandle, (char*)&m_PrefsLanguage, 1); +#ifdef FREE_CAM + CFileMgr::Read(fileHandle, (char*)&TheCamera.bFreeCam, 1); +#endif } } @@ -3228,6 +3288,9 @@ CMenuManager::SaveSettings() CFileMgr::Write(fileHandle, m_PrefsSkinFile, 256); CFileMgr::Write(fileHandle, (char*)&m_ControlMethod, 1); CFileMgr::Write(fileHandle, (char*)&m_PrefsLanguage, 1); +#ifdef FREE_CAM + CFileMgr::Write(fileHandle, (char*)&TheCamera.bFreeCam, 1); +#endif } CFileMgr::CloseFile(fileHandle); @@ -4322,10 +4385,12 @@ CMenuManager::ProcessButtonPresses(void) CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile); SaveSettings(); } else { - if (!m_bGameNotLoaded) - ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[1], aScreens[m_nCurrScreen].m_ParentEntry[1], true, true); - else - ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[0], aScreens[m_nCurrScreen].m_ParentEntry[0], true, true); +#ifndef TIDY_UP_PBP + ChangeScreen(!m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0], + GetPreviousPageOption(), true, true); +#else + goBack = true; +#endif } } else if (m_nCurrScreen != MENUPAGE_MULTIPLAYER_FIND_GAME) { option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action; @@ -4377,26 +4442,6 @@ CMenuManager::ProcessButtonPresses(void) InitialiseChangedLanguageSettings(); SaveSettings(); break; -#ifdef MORE_LANGUAGES - case MENUACTION_LANG_PL: - m_PrefsLanguage = LANGUAGE_POLISH; - m_bFrontEnd_ReloadObrTxtGxt = true; - InitialiseChangedLanguageSettings(); - SaveSettings(); - break; - case MENUACTION_LANG_RUS: - m_PrefsLanguage = LANGUAGE_RUSSIAN; - m_bFrontEnd_ReloadObrTxtGxt = true; - CMenuManager::InitialiseChangedLanguageSettings(); - SaveSettings(); - break; - case MENUACTION_LANG_JAP: - m_PrefsLanguage = LANGUAGE_JAPANESE; - m_bFrontEnd_ReloadObrTxtGxt = true; - InitialiseChangedLanguageSettings(); - SaveSettings(); - break; -#endif case MENUACTION_POPULATESLOTS_CHANGEMENU: PcSaveHelper.PopulateSlotInfo(); @@ -4426,10 +4471,8 @@ CMenuManager::ProcessButtonPresses(void) if (strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB", 8) == 0) { #ifndef TIDY_UP_PBP ResetHelperText(); - if (!m_bGameNotLoaded) - ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[1], aScreens[m_nCurrScreen].m_ParentEntry[1], true, true); - else - ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[0], aScreens[m_nCurrScreen].m_ParentEntry[0], true, true); + ChangeScreen(!m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0], + GetPreviousPageOption(), true, true); #else goBack = true; break; @@ -4536,16 +4579,6 @@ CMenuManager::ProcessButtonPresses(void) SaveSettings(); } break; -#ifdef IMPROVED_VIDEOMODE - case MENUACTION_SCREENMODE: - if (m_nSelectedScreenMode != m_nPrefsWindowed) { - m_nPrefsWindowed = m_nSelectedScreenMode; - _psSelectScreenVM(m_nPrefsVideoMode); // apply same resolution - SetHelperText(0); - SaveSettings(); - } - break; -#endif case MENUACTION_AUDIOHW: { int selectedProvider = m_nPrefsAudio3DProviderIndex; @@ -4661,6 +4694,31 @@ CMenuManager::ProcessButtonPresses(void) DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); OutputDebugString("STARTED PLAYING FRONTEND AUDIO TRACK"); break; +#ifdef CUSTOM_FRONTEND_OPTIONS + case MENUACTION_TRIGGERFUNC: + FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu]; + if (m_nCurrScreen == option.screen && m_nCurrOption == option.screenOptionOrder) { + if (option.type == FEOPTION_SELECT) { + if (!option.onlyApplyOnEnter) { + option.displayedValue++; + if (option.displayedValue >= option.numRightTexts || option.displayedValue < 0) + option.displayedValue = 0; + } + option.changeFunc(option.displayedValue); + *option.value = option.displayedValue; + + } else if (option.type == FEOPTION_DYNAMIC) { + option.buttonPressFunc(FEOPTION_ACTION_SELECT); + } else if (option.type == FEOPTION_REDIRECT) { + ChangeScreen(option.to, option.option, true, option.fadeIn); + } else if (option.type == FEOPTION_GOBACK) { + goBack = true; + } + } else + assert(0 && "Custom frontend options are borked"); + + break; +#endif } } ProcessOnOffMenuOptions(); @@ -4693,7 +4751,7 @@ CMenuManager::ProcessButtonPresses(void) #endif RequestFrontEndShutDown(); } - // It's now in ThingsToDoBeforeLeavingPage() + // It's now in ThingsToDoBeforeGoingBack() #ifndef TIDY_UP_PBP else if (m_nCurrScreen == MENUPAGE_SOUND_SETTINGS) { DMAudio.StopFrontEndTrack(); @@ -4702,10 +4760,10 @@ CMenuManager::ProcessButtonPresses(void) #endif int oldScreen = !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0]; - int oldOption = !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry[1] : aScreens[m_nCurrScreen].m_ParentEntry[0]; + int oldOption = GetPreviousPageOption(); if (oldScreen != -1) { - ThingsToDoBeforeLeavingPage(); + ThingsToDoBeforeGoingBack(); #ifdef PS2_LIKE_MENU if (!bottomBarActive && @@ -4803,11 +4861,11 @@ CMenuManager::ProcessButtonPresses(void) if (changeValueBy > 0) { m_PrefsUseWideScreen++; if (m_PrefsUseWideScreen > 2) - m_PrefsUseWideScreen = 2; + m_PrefsUseWideScreen = 0; } else { m_PrefsUseWideScreen--; if (m_PrefsUseWideScreen < 0) - m_PrefsUseWideScreen = 0; + m_PrefsUseWideScreen = 2; } DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); SaveSettings(); @@ -4834,12 +4892,6 @@ CMenuManager::ProcessButtonPresses(void) } } break; -#ifdef IMPROVED_VIDEOMODE - case MENUACTION_SCREENMODE: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); - m_nSelectedScreenMode = !m_nSelectedScreenMode; - break; -#endif case MENUACTION_AUDIOHW: if (m_nPrefsAudio3DProviderIndex != -1) { m_nPrefsAudio3DProviderIndex += changeValueBy; @@ -4862,6 +4914,34 @@ CMenuManager::ProcessButtonPresses(void) DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); SaveSettings(); break; +#ifdef CUSTOM_FRONTEND_OPTIONS + case MENUACTION_TRIGGERFUNC: + FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu]; + if (m_nCurrScreen == option.screen && m_nCurrOption == option.screenOptionOrder) { + if (option.type == FEOPTION_SELECT) { + if (changeValueBy > 0) { + option.displayedValue++; + if (option.displayedValue >= option.numRightTexts) + option.displayedValue = 0; + } else { + option.displayedValue--; + if (option.displayedValue < 0) + option.displayedValue = option.numRightTexts - 1; + } + if (!option.onlyApplyOnEnter) { + option.changeFunc(option.displayedValue); + *option.value = option.displayedValue; + } + } else if (option.type == FEOPTION_DYNAMIC) { + option.buttonPressFunc(changeValueBy > 0 ? FEOPTION_ACTION_RIGHT : FEOPTION_ACTION_LEFT); + } + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + } + else + assert(0 && "Custom frontend options are borked"); + + break; +#endif } ProcessOnOffMenuOptions(); if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) { @@ -5083,7 +5163,7 @@ CMenuManager::SwitchMenuOnAndOff() bottomBarActive = false; #endif #ifdef FIX_BUGS - ThingsToDoBeforeLeavingPage(); + ThingsToDoBeforeGoingBack(); #endif ShutdownJustMenu(); SaveSettings(); @@ -5830,3 +5910,4 @@ uint8 CMenuManager::GetNumberOfMenuOptions() #undef GetBackJustUp #undef GetBackJustDown +#undef ChangeScreen diff --git a/src/core/Frontend.h b/src/core/Frontend.h index 89517528..6f68de33 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -366,13 +366,8 @@ enum eMenuAction MENUACTION_UNK108, MENUACTION_UNK109, MENUACTION_UNK110, -#ifdef MORE_LANGUAGES - MENUACTION_LANG_PL, - MENUACTION_LANG_RUS, - MENUACTION_LANG_JAP, -#endif -#ifdef IMPROVED_VIDEOMODE - MENUACTION_SCREENMODE +#ifdef CUSTOM_FRONTEND_OPTIONS + MENUACTION_TRIGGERFUNC #endif }; @@ -468,7 +463,7 @@ struct CMenuScreen int32 m_Action; // eMenuAction char m_EntryName[8]; int32 m_SaveSlot; // eSaveSlot - int32 m_TargetMenu; // eMenuScreen + int32 m_TargetMenu; // eMenuScreen // FrontendOption ID if it's a custom option } m_aEntries[NUM_MENUROWS]; }; @@ -647,12 +642,13 @@ public: int GetNumOptionsCntrlConfigScreens(); int ConstructStatLine(int); - // New (not in function or inlined in the game) - void ThingsToDoBeforeLeavingPage(); + // New (inlined ones and the ones we can't believe it's not inlined) + void ThingsToDoBeforeGoingBack(); void ScrollUpListByOne(); void ScrollDownListByOne(); void PageUpList(bool); void PageDownList(bool); + int8 GetPreviousPageOption(); // uint8 GetNumberOfMenuOptions(); }; @@ -662,3 +658,4 @@ VALIDATE_SIZE(CMenuManager, 0x564); #endif extern CMenuManager FrontEndMenuManager; +extern CMenuScreen aScreens[]; \ No newline at end of file diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 33afc956..7983a7c3 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -85,8 +85,7 @@ #include "ZoneCull.h" #include "Zones.h" #include "debugmenu.h" - - +#include "frontendoption.h" eLevelName CGame::currLevel; bool CGame::bDemoMode = true; @@ -234,6 +233,9 @@ bool CGame::InitialiseOnceAfterRW(void) DMAudio.SetMusicFadeVol(127); CWorld::Players[0].SetPlayerSkin(CMenuManager::m_PrefsSkinFile); +#ifdef CUSTOM_FRONTEND_OPTIONS + CustomFrontendOptionsPopulate(); +#endif return true; } diff --git a/src/core/MenuScreens.h b/src/core/MenuScreens.cpp similarity index 95% rename from src/core/MenuScreens.h rename to src/core/MenuScreens.cpp index 6c2ebdb8..ca561af8 100644 --- a/src/core/MenuScreens.h +++ b/src/core/MenuScreens.cpp @@ -1,17 +1,12 @@ -#pragma once +#include "common.h" +#include "Frontend.h" -// TODO: There are some missing/wrong entries in here. - -const CMenuScreen aScreens[] = { +CMenuScreen aScreens[] = { // MENUPAGE_NONE = 0 { "", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, // MENUPAGE_STATS = 1 -#ifdef MENU_MAP - { "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 3, -#else { "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2, -#endif MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, @@ -24,11 +19,7 @@ const CMenuScreen aScreens[] = { }, // MENUPAGE_BRIEFS = 3 -#ifdef MENU_MAP - { "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 4, -#else { "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 3, -#endif MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, @@ -62,9 +53,6 @@ const CMenuScreen aScreens[] = { MENUACTION_SUBTITLES, "FED_SUB", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, MENUACTION_WIDESCREEN, "FED_WIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, MENUACTION_SCREENRES, "FED_RES", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, -#ifdef IMPROVED_VIDEOMODE - MENUACTION_SCREENMODE, "SCRFOR", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, -#endif MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, @@ -76,11 +64,6 @@ const CMenuScreen aScreens[] = { MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LANG_ITA, "FEL_ITA", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LANG_SPA, "FEL_SPA", SAVESLOT_NONE, MENUPAGE_NONE, -#ifdef MORE_LANGUAGES - MENUACTION_LANG_PL, "FEL_POL", SAVESLOT_NONE, MENUPAGE_NONE, - MENUACTION_LANG_RUS, "FEL_RUS", SAVESLOT_NONE, MENUPAGE_NONE, - MENUACTION_LANG_JAP, "FEL_JAP", SAVESLOT_NONE, MENUPAGE_NONE, -#endif MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, @@ -333,11 +316,7 @@ const CMenuScreen aScreens[] = { }, // MENUPAGE_OPTIONS = 41 -#ifdef MENU_MAP - { "FET_OPT", 1, MENUPAGE_NONE, MENUPAGE_NONE, 1, 5, -#else { "FET_OPT", 1, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4, -#endif MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, MENUACTION_LOADRADIO, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, @@ -347,11 +326,7 @@ const CMenuScreen aScreens[] = { }, // MENUPAGE_EXIT = 42 -#ifdef MENU_MAP - { "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 6, -#else { "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5, -#endif MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CANCELGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE, @@ -412,9 +387,6 @@ const CMenuScreen aScreens[] = { { "FET_PAU", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, MENUACTION_RESUME, "FEM_RES", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME, -#ifdef MENU_MAP - MENUACTION_CHANGEMENU, "FEG_MAP", SAVESLOT_NONE, MENUPAGE_MAP, -#endif MENUACTION_CHANGEMENU, "FEP_STA", SAVESLOT_NONE, MENUPAGE_STATS, MENUACTION_CHANGEMENU, "FEP_BRI", SAVESLOT_NONE, MENUPAGE_BRIEFS, MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS, @@ -463,4 +435,4 @@ const CMenuScreen aScreens[] = { MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, #endif -}; +}; \ No newline at end of file diff --git a/src/core/config.h b/src/core/config.h index f43067d7..b7a811a0 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -196,6 +196,7 @@ enum Config { #define USE_TXD_CDIMAGE // generate and load textures from txd.img #define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number //#define USE_TEXTURE_POOL +#define CUSTOM_FRONTEND_OPTIONS // Particle //#define PC_PARTICLE diff --git a/src/core/main.cpp b/src/core/main.cpp index 666758c8..b5e222be 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -95,7 +95,6 @@ void TheGame(void); void DebugMenuPopulate(void); #endif - void ValidateVersion() { diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 883caec5..df394056 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -27,6 +27,7 @@ #include "Radar.h" #include "debugmenu.h" #include "Frontend.h" +#include "Text.h" #ifndef _WIN32 #include "assert.h" @@ -66,6 +67,100 @@ mysrand(unsigned int seed) myrand_seed = seed; } +#ifdef CUSTOM_FRONTEND_OPTIONS +#include "frontendoption.h" +#include "platform.h" + +void ReloadFrontendOptions(void) +{ + RemoveCustomFrontendOptions(); + CustomFrontendOptionsPopulate(); +} + +#ifdef MORE_LANGUAGES +void LangPolSelect(int8 action) +{ + if (action == FEOPTION_ACTION_SELECT) { + FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_POLISH; + FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true; + FrontEndMenuManager.InitialiseChangedLanguageSettings(); + FrontEndMenuManager.SaveSettings(); + } +} + +void LangRusSelect(int8 action) +{ + if (action == FEOPTION_ACTION_SELECT) { + FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_RUSSIAN; + FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true; + FrontEndMenuManager.InitialiseChangedLanguageSettings(); + FrontEndMenuManager.SaveSettings(); + } +} + +void LangJapSelect(int8 action) +{ + if (action == FEOPTION_ACTION_SELECT) { + FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_JAPANESE; + FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true; + FrontEndMenuManager.InitialiseChangedLanguageSettings(); + FrontEndMenuManager.SaveSettings(); + } +} +#endif + +#ifdef IMPROVED_VIDEOMODE +void ScreenModeChange(int8 displayedValue) +{ + if (displayedValue != FrontEndMenuManager.m_nPrefsWindowed) { + FrontEndMenuManager.m_nPrefsWindowed = displayedValue; + _psSelectScreenVM(FrontEndMenuManager.m_nPrefsVideoMode); // apply same resolution + FrontEndMenuManager.SetHelperText(0); + FrontEndMenuManager.SaveSettings(); + } +} +#endif + +#ifdef FREE_CAM +void ToggleFreeCam(int8 action) +{ + if (action == FEOPTION_ACTION_SELECT) { + TheCamera.bFreeCam = !TheCamera.bFreeCam; + FrontEndMenuManager.SaveSettings(); + } +} +#endif + +// Reloaded on language change, so you can use hardcoded wchar* and TheText.Get with peace of mind +void +CustomFrontendOptionsPopulate(void) +{ +#ifdef MORE_LANGUAGES + FrontendOptionSetPosition(MENUPAGE_LANGUAGE_SETTINGS); + FrontendOptionAddDynamic(TheText.Get("FEL_POL"), nil, LangPolSelect, nil); + FrontendOptionAddDynamic(TheText.Get("FEL_RUS"), nil, LangRusSelect, nil); + FrontendOptionAddDynamic(TheText.Get("FEL_JAP"), nil, LangJapSelect, nil); +#endif + +#ifdef IMPROVED_VIDEOMODE + static const wchar *screenModes[] = { (wchar*)L"FULLSCREEN", (wchar*)L"WINDOWED" }; + FrontendOptionSetPosition(MENUPAGE_GRAPHICS_SETTINGS, 8); + FrontendOptionAddSelect(TheText.Get("SCRFOR"), screenModes, 2, (int8*)&FrontEndMenuManager.m_nPrefsWindowed, true, ScreenModeChange, nil); +#endif + +#ifdef MENU_MAP + FrontendOptionSetPosition(MENUPAGE_PAUSE_MENU, 2); + FrontendOptionAddRedirect(TheText.Get("FEG_MAP"), MENUPAGE_MAP); +#endif + +#ifdef FREE_CAM + static const wchar *text = (wchar*)L"TOGGLE FREE CAM"; + FrontendOptionSetPosition(MENUPAGE_CONTROLLER_PC, 1); + FrontendOptionAddDynamic(text, nil, ToggleFreeCam, nil); +#endif +} +#endif + #ifdef DEBUGMENU void WeaponCheat(); void HealthCheat(); @@ -382,6 +477,9 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Debug", "Catalina Fly Away", CHeli::MakeCatalinaHeliFlyAway); DebugMenuAddVarBool8("Debug", "Script Heli On", &CHeli::ScriptHeliOn, nil); +#ifdef CUSTOM_FRONTEND_OPTIONS + DebugMenuAddCmd("Debug", "Reload custom frontend options", ReloadFrontendOptions); +#endif #ifdef TOGGLEABLE_BETA_FEATURES DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", &CPed::bPopHeadsOnHeadshot, nil); DebugMenuAddVarBool8("Debug", "Toggle peds running to phones to report crimes", &CPed::bMakePedsRunToPhonesToReportCrimes, nil); diff --git a/src/extras/frontendoption.cpp b/src/extras/frontendoption.cpp new file mode 100644 index 00000000..7b7ad229 --- /dev/null +++ b/src/extras/frontendoption.cpp @@ -0,0 +1,163 @@ +#include "common.h" + +#ifdef CUSTOM_FRONTEND_OPTIONS +#include "frontendoption.h" + +int numCustomFrontendOptions = 0; +FrontendOption *customFrontendOptions; + +int optionCursor = -1; +eMenuScreen currentMenu; + +void ChangeScreen(eMenuScreen screen, int option, bool fadeIn) +{ + FrontEndMenuManager.m_nPrevScreen = FrontEndMenuManager.m_nCurrScreen; + FrontEndMenuManager.m_nCurrScreen = screen; + FrontEndMenuManager.m_nCurrOption = option; + if (fadeIn) + FrontEndMenuManager.m_nMenuFadeAlpha = 0; +} + +void GoBack(bool fadeIn) +{ + int screen = !FrontEndMenuManager.m_bGameNotLoaded ? + aScreens[FrontEndMenuManager.m_nCurrScreen].m_PreviousPage[1] : aScreens[FrontEndMenuManager.m_nCurrScreen].m_PreviousPage[0]; + int option = !FrontEndMenuManager.m_bGameNotLoaded ? + aScreens[FrontEndMenuManager.m_nCurrScreen].m_ParentEntry[1] : aScreens[FrontEndMenuManager.m_nCurrScreen].m_ParentEntry[0]; + + FrontEndMenuManager.ThingsToDoBeforeGoingBack(); + + ChangeScreen((eMenuScreen)screen, option, fadeIn); +} + +uint8 +GetNumberOfMenuOptions(int screen) +{ + uint8 Rows = 0; + for (int i = 0; i < NUM_MENUROWS; i++) { + if (aScreens[screen].m_aEntries[i].m_Action == MENUACTION_NOTHING) + break; + + ++Rows; + } + return Rows; +} + +// Used before reloading in InitialiseChangedLanguageSettings and debugmenu +void +RemoveCustomFrontendOptions() +{ + for (int i = 0; i < MENUPAGES; i++) { + for (int j = 0; j < NUM_MENUROWS; j++) { + if (aScreens[i].m_aEntries[j].m_Action == MENUACTION_TRIGGERFUNC) { + aScreens[i].m_aEntries[j].m_Action = MENUACTION_NOTHING; + aScreens[i].m_aEntries[j].m_EntryName[0] = '\0'; + } + } + } + free(customFrontendOptions); + numCustomFrontendOptions = 0; +} + +int8 RegisterNewOption(int screen) +{ + numCustomFrontendOptions++; + if (numCustomFrontendOptions == 1) + customFrontendOptions = (FrontendOption*)malloc(numCustomFrontendOptions * sizeof(FrontendOption)); + else + customFrontendOptions = (FrontendOption*)realloc(customFrontendOptions, numCustomFrontendOptions * sizeof(FrontendOption)); + + uint8 nth = GetNumberOfMenuOptions(screen); + if (optionCursor < 0) { + if (optionCursor == -1) { + if (!strcmp(aScreens[screen].m_aEntries[nth - 1].m_EntryName, "FEDS_TB") || !strcmp(aScreens[screen].m_aEntries[nth - 1].m_EntryName, "FESZ_CA")) { + // Move back button one below + memcpy(&aScreens[screen].m_aEntries[nth], &aScreens[screen].m_aEntries[nth - 1], sizeof(CMenuScreen::CMenuEntry)); + nth--; + } + } + } else { + if (aScreens[screen].m_aEntries[optionCursor].m_Action != MENUACTION_NOTHING) { + for (int i = nth - 1; i >= optionCursor; i--) { + memcpy(&aScreens[screen].m_aEntries[i + 1], &aScreens[screen].m_aEntries[i], sizeof(CMenuScreen::CMenuEntry)); + } + } + nth = optionCursor; + optionCursor++; + } + + aScreens[screen].m_aEntries[nth].m_Action = MENUACTION_TRIGGERFUNC; + aScreens[screen].m_aEntries[nth].m_TargetMenu = numCustomFrontendOptions - 1; + aScreens[screen].m_aEntries[nth].m_EntryName[0] = 1; // just something to fool it + return nth; +} + +void FrontendOptionSetPosition(eMenuScreen screen, int8 option) +{ + currentMenu = screen; + optionCursor = option; +} + +void FrontendOptionAddSelect(const wchar* leftText, const wchar** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, ReturnPrevPageFunc returnPrevPageFunc) +{ + int8 screenOptionOrder = RegisterNewOption(currentMenu); + + FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1]; + option.screen = currentMenu; + option.type = FEOPTION_SELECT; + option.leftText = leftText; + option.rightTexts = rightTexts; + option.numRightTexts = numRightTexts; + option.value = var; + option.displayedValue = *var; + option.onlyApplyOnEnter = onlyApplyOnEnter; + option.changeFunc = changeFunc; + option.screenOptionOrder = screenOptionOrder; + option.returnPrevPageFunc = returnPrevPageFunc; +} + +void FrontendOptionAddDynamic(const wchar* leftText, DrawFunc drawFunc, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc) +{ + int8 screenOptionOrder = RegisterNewOption(currentMenu); + + FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1]; + option.screen = currentMenu; + option.type = FEOPTION_DYNAMIC; + option.drawFunc = drawFunc; + option.buttonPressFunc = buttonPressFunc; + option.leftText = leftText; + option.onlyApplyOnEnter = false; + option.screenOptionOrder = screenOptionOrder; + option.returnPrevPageFunc = returnPrevPageFunc; +} + +void FrontendOptionAddRedirect(const wchar* text, eMenuScreen to, int8 selectedOption, bool fadeIn) +{ + int8 screenOptionOrder = RegisterNewOption(currentMenu); + + FrontendOption &option = customFrontendOptions[numCustomFrontendOptions - 1]; + option.screen = currentMenu; + option.type = FEOPTION_REDIRECT; + option.to = to; + option.option = selectedOption; + option.fadeIn = fadeIn; + option.leftText = text; + option.onlyApplyOnEnter = false; + option.screenOptionOrder = screenOptionOrder; + option.returnPrevPageFunc = nil; +} + +void FrontendOptionAddBackButton(const wchar* text, bool fadeIn) +{ + int8 screenOptionOrder = RegisterNewOption(currentMenu); + + FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1]; + option.screen = currentMenu; + option.type = FEOPTION_GOBACK; + option.fadeIn = fadeIn; + option.leftText = text; + option.onlyApplyOnEnter = false; + option.screenOptionOrder = screenOptionOrder; + option.returnPrevPageFunc = nil; +} +#endif \ No newline at end of file diff --git a/src/extras/frontendoption.h b/src/extras/frontendoption.h new file mode 100644 index 00000000..6c6ac20c --- /dev/null +++ b/src/extras/frontendoption.h @@ -0,0 +1,86 @@ +#pragma once +#include "common.h" + +#ifdef CUSTOM_FRONTEND_OPTIONS +#include "Frontend.h" + +// Warning: All of the code relies on that you won't use more then NUM_MENUROWS(18) options on one page. Also congrats if you can make 18 options visible at once. + + +// Static/select: User allocates variable, passes it to function and it's set automatically from input among the strings given to function, +// then you can handle ChangeFunc and ReturnPrevPageFunc if needed. +// +// Dynamic: Function doesn't accept value pointer, user should do operations with handling ButtonPressFunc. +// Right-side text can be set via DrawFunc, which is called on every draw. ReturnPrevPageFunc is also here if needed. + +#define FEOPTION_SELECT 0 +#define FEOPTION_DYNAMIC 1 +#define FEOPTION_REDIRECT 2 +#define FEOPTION_GOBACK 3 + +#define FEOPTION_ACTION_LEFT 0 +#define FEOPTION_ACTION_RIGHT 1 +#define FEOPTION_ACTION_SELECT 2 + +void RemoveCustomFrontendOptions(); +void CustomFrontendOptionsPopulate(); + +// for static and dynamic options +typedef void (*ReturnPrevPageFunc)(); + +// for static options +typedef void (*ChangeFunc)(int8 displayedValue); // called before updating the value + +// for dynamic options +typedef void (*DrawFunc)(wchar* out, bool* disabled); // parameters should be set by user, both is allocated. disabled option will be dark yellow +typedef void (*ButtonPressFunc)(int8 action); // see FEOPTION_ACTIONs above + +struct FrontendOption +{ + int8 type; + int8 screenOptionOrder; + eMenuScreen screen; + const wchar* leftText; + ReturnPrevPageFunc returnPrevPageFunc; + + union { + // Only for dynamic + struct { + DrawFunc drawFunc; + ButtonPressFunc buttonPressFunc; + }; + + // Only for static/select + struct { + const wchar** rightTexts; + int8 numRightTexts; + int8 *value; + int8 displayedValue; // if onlyApplyOnEnter enabled + bool onlyApplyOnEnter; + ChangeFunc changeFunc; + }; + + // Only for redirect + struct { + eMenuScreen to; + int8 option; + bool fadeIn; + }; + }; +}; + +extern int numCustomFrontendOptions; +extern FrontendOption* customFrontendOptions; + +// To be used in ButtonPressFunc / ChangeFunc(but that would be weird): +void ChangeScreen(eMenuScreen screen, int option = 0, bool fadeIn = true); +void GoBack(bool fadeIn = true); + +// If option is positive number, all calls will increase it before using it (you can think it as cursor). -1 means before the back button, -2 is end of page +void FrontendOptionSetPosition(eMenuScreen screen, int8 option = -1); + +void FrontendOptionAddSelect(const wchar* leftText, const wchar** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, ReturnPrevPageFunc returnPrevPageFunc); +void FrontendOptionAddDynamic(const wchar* leftText, DrawFunc rightTextDrawFunc, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc); +void FrontendOptionAddRedirect(const wchar* text, eMenuScreen to, int8 selectedOption = 0, bool fadeIn = true); +void FrontendOptionAddBackButton(const wchar* text, bool fadeIn = true); +#endif \ No newline at end of file diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 21115585..3ef0ab63 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -1747,7 +1747,7 @@ void CapturePad(RwInt32 padID) void joysChangeCB(int jid, int event) { - if (event == GLFW_CONNECTED) + if (event == GLFW_CONNECTED && !IsThisJoystickBlacklisted(jid)) { if (PSGLOBAL(joy1id) == -1) PSGLOBAL(joy1id) = jid; From 98a97a32fac0e97bd9810128d97c418ead52330e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Thu, 28 May 2020 11:49:58 +0300 Subject: [PATCH 069/133] config reorganization --- src/core/config.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core/config.h b/src/core/config.h index a652c9fe..9b620cef 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -192,11 +192,14 @@ enum Config { #define FIX_BUGS // fixes bugs that we've came across during reversing, TODO: use this more #define TOGGLEABLE_BETA_FEATURES // toggleable from debug menu. not too many things #define MORE_LANGUAGES // Add more translations to the game +#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible + +// Rendering/display +#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios #define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch) #define USE_TXD_CDIMAGE // generate and load textures from txd.img #define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number //#define USE_TEXTURE_POOL -#define CUSTOM_FRONTEND_OPTIONS // Particle //#define PC_PARTICLE @@ -213,7 +216,6 @@ enum Config { #define REGISTER_START_BUTTON // Hud, frontend and radar -#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios #define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC #define PS2_SAVE_DIALOG // PS2 style save dialog with transparent black box // #define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc. @@ -223,6 +225,7 @@ enum Config { // #define CIRCLE_BACK_BUTTON #define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better. #define BETA_SLIDING_TEXT +#define CUSTOM_FRONTEND_OPTIONS // Script #define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default @@ -231,8 +234,6 @@ enum Config { #define MISSION_REPLAY // mobile feature //#define SIMPLIER_MISSIONS // apply simplifications from mobile -#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible - // Replay //#define DONT_FIX_REPLAY_BUGS // keeps various bugs in CReplay, some of which are fairly cool! //#define USE_BETA_REPLAY_MODE // adds another replay mode, a few seconds slomo (caution: buggy!) From e6401bce181b2a9eb1ba31db0945e79277207a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Thu, 28 May 2020 12:46:51 +0300 Subject: [PATCH 070/133] Detect R and start game on menu --- src/control/Script.cpp | 14 +++----------- src/control/Script.h | 4 ++++ src/core/Frontend.cpp | 21 +++++++++++++++++++++ 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 0b0341b4..bc15a695 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -538,22 +538,14 @@ void CRunningScript::Init() } #ifdef USE_DEBUG_SCRIPT_LOADER +int scriptToLoad = 0; + #ifdef _WIN32 #include #endif int open_script() { - static int scriptToLoad = 0; - - // Doesn't work because of CGame::Initialise is blocking - /* - if (glfwGetKey(PSGLOBAL(window), GLFW_KEY_G) == GLFW_PRESS) - scriptToLoad = 0; - if (glfwGetKey(PSGLOBAL(window), GLFW_KEY_R) == GLFW_PRESS) - scriptToLoad = 1; - if (glfwGetKey(PSGLOBAL(window), GLFW_KEY_D) == GLFW_PRESS) - scriptToLoad = 2; - */ + // glfwGetKey doesn't work because of CGame::Initialise is blocking #ifdef _WIN32 if (GetAsyncKeyState('G') & 0x8000) scriptToLoad = 0; diff --git a/src/control/Script.h b/src/control/Script.h index 743fad99..7964ec6c 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -521,3 +521,7 @@ extern bool doingMissionRetry; uint32 AddExtraDeathDelay(); void RetryMission(int, int); #endif + +#ifdef USE_DEBUG_SCRIPT_LOADER +extern int scriptToLoad; +#endif \ No newline at end of file diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 53a95ae6..cdacc0a4 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -3568,6 +3568,9 @@ CMenuManager::Process(void) } #endif if (CheckSlotDataValid(m_nCurrSaveSlot)) { +#ifdef USE_DEBUG_SCRIPT_LOADER + scriptToLoad = 0; +#endif TheCamera.m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDARD; if (m_PrefsVsyncDisp != m_PrefsVsync) m_PrefsVsync = m_PrefsVsyncDisp; @@ -3688,6 +3691,24 @@ CMenuManager::ProcessButtonPresses(void) bool assumeIncrease = false; #endif +#ifdef USE_DEBUG_SCRIPT_LOADER + if (m_nCurrScreen == MENUPAGE_START_MENU || m_nCurrScreen == MENUPAGE_NEW_GAME || m_nCurrScreen == MENUPAGE_NEW_GAME_RELOAD) { +#ifdef RW_GL3 + if (glfwGetKey(PSGLOBAL(window), GLFW_KEY_R) == GLFW_PRESS) { + scriptToLoad = 1; + DoSettingsBeforeStartingAGame(); + return; + } +#elif defined _WIN32 + if (GetAsyncKeyState('R') & 0x8000) { + scriptToLoad = 1; + DoSettingsBeforeStartingAGame(); + return; + } +#endif + } +#endif + if (!m_bShowMouse && (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY)) { m_bShowMouse = true; } From a61736c51b3712d78cdf76afe466eb48b2be5227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Thu, 28 May 2020 13:08:21 +0300 Subject: [PATCH 071/133] theoretically fix linux build --- src/core/Frontend.cpp | 12 ++++++------ src/core/Frontend.h | 12 ++++++------ src/core/MenuScreens.cpp | 2 ++ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index cdacc0a4..fc3a05d9 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -315,7 +315,7 @@ ScaleAndCenterX(float x) // --- Functions not in the game/inlined starts -inline void +void CMenuManager::ScrollUpListByOne() { if (m_nSelectedListRow == m_nFirstVisibleRowOnList) { @@ -329,7 +329,7 @@ CMenuManager::ScrollUpListByOne() } } -inline void +void CMenuManager::ScrollDownListByOne() { if (m_nSelectedListRow == m_nFirstVisibleRowOnList + MAX_VISIBLE_LIST_ROW - 1) { @@ -345,7 +345,7 @@ CMenuManager::ScrollDownListByOne() } } -inline void +void CMenuManager::PageUpList(bool playSoundOnSuccess) { if (m_nTotalListRow > MAX_VISIBLE_LIST_ROW) { @@ -363,7 +363,7 @@ CMenuManager::PageUpList(bool playSoundOnSuccess) } } -inline void +void CMenuManager::PageDownList(bool playSoundOnSuccess) { if (m_nTotalListRow > MAX_VISIBLE_LIST_ROW) { @@ -381,7 +381,7 @@ CMenuManager::PageDownList(bool playSoundOnSuccess) } } -inline void +void CMenuManager::ThingsToDoBeforeGoingBack() { if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) && strcmp(m_aSkinName, m_PrefsSkinFile) != 0) { @@ -419,7 +419,7 @@ CMenuManager::ThingsToDoBeforeGoingBack() #endif } -inline int8 +int8 CMenuManager::GetPreviousPageOption() { #ifndef CUSTOM_FRONTEND_OPTIONS diff --git a/src/core/Frontend.h b/src/core/Frontend.h index aa2b92f5..9a364b71 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -647,12 +647,12 @@ public: int ConstructStatLine(int); // New (inlined ones and the ones we can't believe it's not inlined) - void ThingsToDoBeforeGoingBack(); - void ScrollUpListByOne(); - void ScrollDownListByOne(); - void PageUpList(bool); - void PageDownList(bool); - int8 GetPreviousPageOption(); + inline void ThingsToDoBeforeGoingBack(); + inline void ScrollUpListByOne(); + inline void ScrollDownListByOne(); + inline void PageUpList(bool); + inline void PageDownList(bool); + inline int8 GetPreviousPageOption(); // uint8 GetNumberOfMenuOptions(); }; diff --git a/src/core/MenuScreens.cpp b/src/core/MenuScreens.cpp index be914c09..4ced8c0b 100644 --- a/src/core/MenuScreens.cpp +++ b/src/core/MenuScreens.cpp @@ -1,6 +1,8 @@ #include "common.h" #include "Frontend.h" +// If you want to add new options, please don't do that here and see CustomFrontendOptionsPopulate in re3.cpp. + CMenuScreen aScreens[] = { // MENUPAGE_NONE = 0 { "", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, From 111d23beabbc580d2f1befec11b2fd114f297d5f Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Thu, 28 May 2020 17:21:00 +0300 Subject: [PATCH 072/133] fix --- src/core/World.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/World.cpp b/src/core/World.cpp index 39681428..c3633d77 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -120,14 +120,14 @@ CWorld::ClearExcitingStuffFromArea(const CVector &pos, float radius, bool bRemov for(int32 i = 0; i < pedPool->GetSize(); i++) { CPed *pPed = pedPool->GetSlot(i); if(pPed && !pPed->IsPlayer() && pPed->CanBeDeleted() && - CVector2D(pPed->GetPosition() - pos).MagnitudeSqr() < radius) { + CVector2D(pPed->GetPosition() - pos).MagnitudeSqr() < SQR(radius)) { CPopulation::RemovePed(pPed); } } CVehiclePool *VehiclePool = CPools::GetVehiclePool(); for(int32 i = 0; i < VehiclePool->GetSize(); i++) { CVehicle *pVehicle = VehiclePool->GetSlot(i); - if(pVehicle && CVector2D(pVehicle->GetPosition() - pos).MagnitudeSqr() < radius && + if(pVehicle && CVector2D(pVehicle->GetPosition() - pos).MagnitudeSqr() < SQR(radius) && !pVehicle->bIsLocked && pVehicle->CanBeDeleted()) { if(pVehicle->pDriver) { CPopulation::RemovePed(pVehicle->pDriver); From 9acf27fc5359ec8a4e047a35384ca28270145db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Thu, 28 May 2020 13:39:08 +0300 Subject: [PATCH 073/133] remove inlining attempts + reload frontend options for real --- src/core/Frontend.h | 15 ++++++++------- src/extras/frontendoption.cpp | 9 +++++++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/core/Frontend.h b/src/core/Frontend.h index 9a364b71..7d4cdacc 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -646,13 +646,14 @@ public: int GetNumOptionsCntrlConfigScreens(); int ConstructStatLine(int); - // New (inlined ones and the ones we can't believe it's not inlined) - inline void ThingsToDoBeforeGoingBack(); - inline void ScrollUpListByOne(); - inline void ScrollDownListByOne(); - inline void PageUpList(bool); - inline void PageDownList(bool); - inline int8 GetPreviousPageOption(); + // Those are either inlined in game, not in function yet, or I can't believe that they're not inlined. + // Names were made up by me. + void ThingsToDoBeforeGoingBack(); + void ScrollUpListByOne(); + void ScrollDownListByOne(); + void PageUpList(bool); + void PageDownList(bool); + int8 GetPreviousPageOption(); // uint8 GetNumberOfMenuOptions(); }; diff --git a/src/extras/frontendoption.cpp b/src/extras/frontendoption.cpp index 7b7ad229..6ab2801c 100644 --- a/src/extras/frontendoption.cpp +++ b/src/extras/frontendoption.cpp @@ -50,8 +50,13 @@ RemoveCustomFrontendOptions() for (int i = 0; i < MENUPAGES; i++) { for (int j = 0; j < NUM_MENUROWS; j++) { if (aScreens[i].m_aEntries[j].m_Action == MENUACTION_TRIGGERFUNC) { - aScreens[i].m_aEntries[j].m_Action = MENUACTION_NOTHING; - aScreens[i].m_aEntries[j].m_EntryName[0] = '\0'; + int k; + for (k = j; k < NUM_MENUROWS-1; k++) { + memcpy(&aScreens[i].m_aEntries[k], &aScreens[i].m_aEntries[k+1], sizeof(CMenuScreen::CMenuEntry)); + } + aScreens[i].m_aEntries[k].m_Action = MENUACTION_NOTHING; + aScreens[i].m_aEntries[k].m_EntryName[0] = '\0'; + j--; } } } From 20cacb18f0ed75d51766d0006d9181613842e95c Mon Sep 17 00:00:00 2001 From: rollschuh2282 <53496587+rollschuh2282@users.noreply.github.com> Date: Fri, 29 May 2020 12:03:32 +0200 Subject: [PATCH 074/133] Add files via upload --- src/core/config.h | 4 ++-- src/core/main.cpp | 8 ++++++++ src/core/main.h | 4 ++++ src/core/re3.cpp | 6 ++++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/core/config.h b/src/core/config.h index 9b620cef..837d8165 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -186,7 +186,7 @@ enum Config { # define NO_CDCHECK # define CHATTYSPLASH // print what the game is loading # define DEBUGMENU -//# define TIMEBARS // print debug timers +# define TIMEBARS // print debug timers #endif #define FIX_BUGS // fixes bugs that we've came across during reversing, TODO: use this more @@ -228,7 +228,7 @@ enum Config { #define CUSTOM_FRONTEND_OPTIONS // Script -#define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default +#define USE_DEBUG_SCRIPT_LOADER // Loads main.scm by default. Hold R for main_freeroam.scm and D for main_d.scm #define USE_MEASUREMENTS_IN_METERS // makes game use meters instead of feet in script #define USE_PRECISE_MEASUREMENT_CONVERTION // makes game convert feet to meeters more precisely #define MISSION_REPLAY // mobile feature diff --git a/src/core/main.cpp b/src/core/main.cpp index b5e222be..a69890b0 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -73,6 +73,10 @@ float FramesPerSecond = 30.0f; bool gbPrintShite = false; bool gbModelViewer; +//Custom Timebars Toggle +#ifdef TIMEBARS +bool gbShowTimebars; +#endif int32 frameCount; @@ -1096,8 +1100,12 @@ Idle(void *arg) #endif CCredits::Render(); + #ifdef TIMEBARS +//Custom Timebars toggle + if (gbShowTimebars) tbDisplay(); + #endif DoRWStuffEndOfFrame(); diff --git a/src/core/main.h b/src/core/main.h index 32a880d6..5c514bbb 100644 --- a/src/core/main.h +++ b/src/core/main.h @@ -14,6 +14,10 @@ extern wchar gUString[256]; extern wchar gUString2[256]; extern bool gbPrintShite; extern bool gbModelViewer; +//Custom Timebars Toggle +#ifdef TIMEBARS +extern bool gbShowTimebars; +#endif class CSprite2d; diff --git a/src/core/re3.cpp b/src/core/re3.cpp index df394056..c77cf6d9 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -28,6 +28,8 @@ #include "debugmenu.h" #include "Frontend.h" #include "Text.h" +#include "WaterLevel.h" +#include "main.h" #ifndef _WIN32 #include "assert.h" @@ -459,6 +461,7 @@ DebugMenuPopulate(void) DebugMenuAddVarBool8("Render", "Don't render Peds", &gbDontRenderPeds, nil); DebugMenuAddVarBool8("Render", "Don't render Vehicles", &gbDontRenderVehicles, nil); DebugMenuAddVarBool8("Render", "Don't render Objects", &gbDontRenderObjects, nil); + DebugMenuAddVarBool8("Render", "Don´t Render Water", &gbDontRenderWater, nil); DebugMenuAddVarBool8("Debug", "Edit on", &CSceneEdit::m_bEditOn, nil); #ifdef MENU_MAP @@ -488,6 +491,9 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start); DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop); + DebugMenuAddVarBool8("Debug", "Show DebugStuffInRelease", &gbDebugStuffInRelease, nil); + DebugMenuAddVarBool8("Debug", "Show Timebars", &gbShowTimebars, nil); + extern bool PrintDebugCode; extern int16 DebugCamMode; DebugMenuAddVarBool8("Cam", "Use mouse Cam", &CCamera::m_bUseMouse3rdPerson, nil); From 2d5f7d92e5ced42e787caabcaa6c5b535c4cdfd1 Mon Sep 17 00:00:00 2001 From: rollschuh2282 <53496587+rollschuh2282@users.noreply.github.com> Date: Fri, 29 May 2020 12:04:20 +0200 Subject: [PATCH 075/133] Add files via upload --- src/render/WaterLevel.cpp | 7 +++++++ src/render/WaterLevel.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp index 1a28ce83..6133b1d7 100644 --- a/src/render/WaterLevel.cpp +++ b/src/render/WaterLevel.cpp @@ -35,6 +35,8 @@ bool CWaterLevel::WavesCalculatedThisFrame; RpAtomic *CWaterLevel::ms_pWavyAtomic; RpGeometry *CWaterLevel::apGeomArray[8]; int16 CWaterLevel::nGeomUsed; +//"Custom" Don´t Render Water Toggle +bool gbDontRenderWater; //RwTexture *gpWaterTex; //RwRaster *gpWaterRaster; @@ -332,6 +334,11 @@ SectorRadius(float fSize) void CWaterLevel::RenderWater() { +//"Custom" Don´t Render Water Toggle +#ifndef MASTER + if (gbDontRenderWater) + return; +#endif bool bUseCamEndX = false; bool bUseCamStartY = false; diff --git a/src/render/WaterLevel.h b/src/render/WaterLevel.h index 985c9744..325be0a5 100644 --- a/src/render/WaterLevel.h +++ b/src/render/WaterLevel.h @@ -65,6 +65,8 @@ #define MAX_BOAT_WAKES 8 extern RwRaster* gpWaterRaster; +//"Custom" Don´t Render Water Toggle +extern bool gbDontRenderWater; class CWaterLevel { From 9adde91b3a22d15d5e83f94cc9f0b5a9aa4b6b2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Fri, 29 May 2020 20:29:18 +0300 Subject: [PATCH 076/133] frontend options fix --- src/core/Frontend.cpp | 28 ++++++++++++++++++++-------- src/extras/frontendoption.h | 3 ++- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index fc3a05d9..5350cb02 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -412,6 +412,9 @@ CMenuManager::ThingsToDoBeforeGoingBack() if (option.returnPrevPageFunc) option.returnPrevPageFunc(); + if (option.type == FEOPTION_DYNAMIC) + option.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS); + if (option.onlyApplyOnEnter) option.displayedValue = *option.value; } @@ -1205,8 +1208,7 @@ CMenuManager::Draw() } else if (option.type == FEOPTION_DYNAMIC) { if (option.drawFunc) { - option.drawFunc(unicodeTemp, &isOptionDisabled); - rightText = unicodeTemp; + rightText = option.drawFunc(&isOptionDisabled); } } } else @@ -1291,14 +1293,15 @@ CMenuManager::Draw() if (!CFont::Details.centre) CFont::SetRightJustifyOn(); - if(!strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FED_RES") - && !m_bGameNotLoaded && textLayer == 1 + if(textLayer == 1) + if(!strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FED_RES") + && !m_bGameNotLoaded #ifdef CUSTOM_FRONTEND_OPTIONS - || isOptionDisabled + || isOptionDisabled #endif - ) { - CFont::SetColor(CRGBA(155, 117, 6, FadeIn(255))); - } + ) + CFont::SetColor(CRGBA(155, 117, 6, FadeIn(255))); + CFont::PrintString(MENU_X_RIGHT_ALIGNED(columnWidth - textLayer), itemY, rightText); } if (i == m_nCurrOption && itemsAreSelectable){ @@ -1345,6 +1348,7 @@ CMenuManager::Draw() FrontendOption &option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu]; if (option.onlyApplyOnEnter && m_nCurrOption != i) option.displayedValue = *option.value; + } #endif @@ -4318,6 +4322,7 @@ CMenuManager::ProcessButtonPresses(void) } #endif + int prevOption = m_nCurrOption; if (goDown && (m_nCurrScreen != MENUPAGE_MULTIPLAYER_FIND_GAME)) { m_nCurrOption++; if (m_nCurrOption == NUM_MENUROWS || (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_NOTHING)) { @@ -4334,6 +4339,13 @@ CMenuManager::ProcessButtonPresses(void) m_nCurrOption--; } } +#ifdef CUSTOM_FRONTEND_OPTIONS + if (m_nCurrOption != prevOption && aScreens[m_nCurrScreen].m_aEntries[prevOption].m_Action == MENUACTION_TRIGGERFUNC) { + FrontendOption &option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[prevOption].m_TargetMenu]; + if (option.type == FEOPTION_DYNAMIC) + option.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS); + } +#endif if (optionSelected) { int option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action; diff --git a/src/extras/frontendoption.h b/src/extras/frontendoption.h index 6c6ac20c..7cfc09a7 100644 --- a/src/extras/frontendoption.h +++ b/src/extras/frontendoption.h @@ -21,6 +21,7 @@ #define FEOPTION_ACTION_LEFT 0 #define FEOPTION_ACTION_RIGHT 1 #define FEOPTION_ACTION_SELECT 2 +#define FEOPTION_ACTION_FOCUSLOSS 3 void RemoveCustomFrontendOptions(); void CustomFrontendOptionsPopulate(); @@ -32,7 +33,7 @@ typedef void (*ReturnPrevPageFunc)(); typedef void (*ChangeFunc)(int8 displayedValue); // called before updating the value // for dynamic options -typedef void (*DrawFunc)(wchar* out, bool* disabled); // parameters should be set by user, both is allocated. disabled option will be dark yellow +typedef wchar* (*DrawFunc)(bool* disabled); // should return pointer to right text. *disabled = true will make it dark yellow typedef void (*ButtonPressFunc)(int8 action); // see FEOPTION_ACTIONs above struct FrontendOption From e38f2a7fb238787aec527f648fc5ce2bce2296c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Fri, 29 May 2020 21:06:08 +0300 Subject: [PATCH 077/133] fix fix --- src/core/Frontend.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 5350cb02..a38df5e0 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -412,7 +412,7 @@ CMenuManager::ThingsToDoBeforeGoingBack() if (option.returnPrevPageFunc) option.returnPrevPageFunc(); - if (option.type == FEOPTION_DYNAMIC) + if (m_nCurrOption == option.screenOptionOrder && option.type == FEOPTION_DYNAMIC) option.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS); if (option.onlyApplyOnEnter) @@ -1344,11 +1344,18 @@ CMenuManager::Draw() } #ifdef CUSTOM_FRONTEND_OPTIONS + static int lastOption = m_nCurrOption; if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action == MENUACTION_TRIGGERFUNC) { FrontendOption &option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu]; if (option.onlyApplyOnEnter && m_nCurrOption != i) option.displayedValue = *option.value; + if (m_nCurrOption != lastOption && lastOption == i) { + FrontendOption &oldOption = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[lastOption].m_TargetMenu]; + if (oldOption.type == FEOPTION_DYNAMIC) + oldOption.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS); + } + lastOption = m_nCurrOption; } #endif @@ -4339,13 +4346,6 @@ CMenuManager::ProcessButtonPresses(void) m_nCurrOption--; } } -#ifdef CUSTOM_FRONTEND_OPTIONS - if (m_nCurrOption != prevOption && aScreens[m_nCurrScreen].m_aEntries[prevOption].m_Action == MENUACTION_TRIGGERFUNC) { - FrontendOption &option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[prevOption].m_TargetMenu]; - if (option.type == FEOPTION_DYNAMIC) - option.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS); - } -#endif if (optionSelected) { int option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action; From 517f0b9189bed37c06110f8cb6bc2ab7763ce8f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Fri, 29 May 2020 21:31:06 +0300 Subject: [PATCH 078/133] fix fix fix --- src/core/Frontend.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index a38df5e0..b95deee3 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -959,6 +959,10 @@ CMenuManager::Draw() } #endif +#ifdef CUSTOM_FRONTEND_OPTIONS + static int lastOption = m_nCurrOption; +#endif + for (int i = 0; i < NUM_MENUROWS; ++i) { #ifdef CUSTOM_FRONTEND_OPTIONS bool isOptionDisabled = false; @@ -1344,7 +1348,6 @@ CMenuManager::Draw() } #ifdef CUSTOM_FRONTEND_OPTIONS - static int lastOption = m_nCurrOption; if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action == MENUACTION_TRIGGERFUNC) { FrontendOption &option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu]; if (option.onlyApplyOnEnter && m_nCurrOption != i) @@ -1355,7 +1358,6 @@ CMenuManager::Draw() if (oldOption.type == FEOPTION_DYNAMIC) oldOption.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS); } - lastOption = m_nCurrOption; } #endif @@ -1402,6 +1404,10 @@ CMenuManager::Draw() } } +#ifdef CUSTOM_FRONTEND_OPTIONS + lastOption = m_nCurrOption; +#endif + switch (m_nCurrScreen) { case MENUPAGE_CONTROLLER_SETTINGS: case MENUPAGE_SOUND_SETTINGS: From e6b9c2013146af9271398d899caa346a0c5f04ff Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sat, 30 May 2020 18:07:01 +0300 Subject: [PATCH 079/133] fix --- src/control/RoadBlocks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp index 572f8134..caf9ed34 100644 --- a/src/control/RoadBlocks.cpp +++ b/src/control/RoadBlocks.cpp @@ -174,7 +174,7 @@ CRoadBlocks::GenerateRoadBlocks(void) pVehicle->bExtendedRange = true; if (pVehicle->UsesSiren(pVehicle->GetModelIndex()) && CGeneral::GetRandomNumber() & 1) pVehicle->m_bSirenOrAlarm = true; - if (pVehicle->GetForward().z > 0.94f) { + if (pVehicle->GetUp().z > 0.94f) { CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), 0); CWorld::Add(pVehicle); pVehicle->bCreateRoadBlockPeds = true; From bae3a3e72f6b22b72155d377d38725cdbdff688c Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 31 May 2020 17:45:26 +0200 Subject: [PATCH 080/133] fixed to CAutomobile and friends --- src/core/Cam.cpp | 5 +- src/math/Matrix.h | 1 + src/math/math.cpp | 6 ++ src/modelinfo/SimpleModelInfo.cpp | 7 +++ src/render/Skidmarks.h | 2 +- src/vehicles/Automobile.cpp | 91 ++++++++++++++----------------- src/vehicles/Automobile.h | 6 +- src/vehicles/Vehicle.cpp | 10 ++-- 8 files changed, 65 insertions(+), 63 deletions(-) diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 6347e111..60145cd0 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -3792,7 +3792,7 @@ CCam::Process_Debug(const CVector&, float, float, float) if(FindPlayerVehicle()) FindPlayerVehicle()->Teleport(Source); else - CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source); + CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source); } // stay inside sectors @@ -3859,8 +3859,7 @@ CCam::Process_Debug(const CVector&, float, float, float) if(FindPlayerVehicle()) FindPlayerVehicle()->Teleport(Source); else - CWorld::Players[CWorld::PlayerInFocus].m_pPed->GetPosition() = Source; - + CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source); } // stay inside sectors diff --git a/src/math/Matrix.h b/src/math/Matrix.h index b7e055c5..5ec79aba 100644 --- a/src/math/Matrix.h +++ b/src/math/Matrix.h @@ -223,6 +223,7 @@ public: void SetRotate(float xAngle, float yAngle, float zAngle); void Rotate(float x, float y, float z); void RotateX(float x); + void RotateY(float y); void RotateZ(float z); void Reorthogonalise(void); diff --git a/src/math/math.cpp b/src/math/math.cpp index eeb9d3fa..29f18d03 100644 --- a/src/math/math.cpp +++ b/src/math/math.cpp @@ -59,6 +59,12 @@ CMatrix::RotateX(float x) Rotate(x, 0.0f, 0.0f); } +void +CMatrix::RotateY(float y) +{ + Rotate(0.0f, y, 0.0f); +} + void CMatrix::RotateZ(float z) { diff --git a/src/modelinfo/SimpleModelInfo.cpp b/src/modelinfo/SimpleModelInfo.cpp index a781cf58..091d4dff 100644 --- a/src/modelinfo/SimpleModelInfo.cpp +++ b/src/modelinfo/SimpleModelInfo.cpp @@ -157,6 +157,13 @@ CSimpleModelInfo::SetupBigBuilding(void) if(related) m_lodDistances[2] = related->GetLargestLodDistance()/TheCamera.LODDistMultiplier; else +#ifdef FIX_BUGS + if(strnicmp(GetName(), "lod", 3) == 0) m_lodDistances[2] = 100.0f; + else + m_lodDistances[2] = 0.0f; +#else + m_lodDistances[2] = 100.0f; +#endif } } diff --git a/src/render/Skidmarks.h b/src/render/Skidmarks.h index 085b4c6d..c061782d 100644 --- a/src/render/Skidmarks.h +++ b/src/render/Skidmarks.h @@ -11,7 +11,7 @@ public: bool m_isMuddy; uintptr m_id; int16 m_last; - uint32 m_lastUpdate;; + uint32 m_lastUpdate; uint32 m_fadeStart; uint32 m_fadeEnd; CVector m_pos[SKIDMARK_LENGTH]; diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 654713b1..37b224d1 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -67,7 +67,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy) CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(id); m_fFireBlowUpTimer = 0.0f; - field_4E0 = 0; + m_auto_unk1 = 0; bTaxiLight = m_sAllTaxiLights; bFixedColour = false; bBigWheels = false; @@ -77,8 +77,8 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy) pHandling = mod_HandlingManager.GetHandlingData((eHandlingId)mi->m_handlingId); - field_49C = 20.0f; - field_4D8 = 0; + m_auto_unused1 = 20.0f; + m_auto_unused2 = 0; mi->ChooseVehicleColour(m_currentColour1, m_currentColour2); @@ -236,23 +236,16 @@ CAutomobile::ProcessControl(void) // Improve grip of vehicles in certain cases bool strongGrip1 = false; bool strongGrip2 = false; - if(FindPlayerVehicle() && this != FindPlayerVehicle()){ - switch(AutoPilot.m_nCarMission){ - case MISSION_RAMPLAYER_FARAWAY: - case MISSION_RAMPLAYER_CLOSE: - case MISSION_BLOCKPLAYER_FARAWAY: - case MISSION_BLOCKPLAYER_CLOSE: - if(FindPlayerSpeed().Magnitude() > 0.3f){ - strongGrip1 = true; - if(FindPlayerSpeed().Magnitude() > 0.4f){ - if(m_vecMoveSpeed.Magnitude() < 0.3f) - strongGrip2 = true; - }else{ - if((GetPosition() - FindPlayerCoors()).Magnitude() > 50.0f) - strongGrip2 = true; - } - } - default: break; + if(FindPlayerVehicle() && this != FindPlayerVehicle() && + (AutoPilot.m_nCarMission == MISSION_RAMPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_RAMPLAYER_CLOSE || + AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_CLOSE)){ + if(FindPlayerSpeed().Magnitude() > 0.3f){ + strongGrip1 = true; + if(FindPlayerSpeed().Magnitude() > 0.4f && + m_vecMoveSpeed.Magnitude() < 0.3f) + strongGrip2 = true; + else if((GetPosition() - FindPlayerCoors()).Magnitude() > 50.0f) + strongGrip2 = true; } } @@ -263,7 +256,7 @@ CAutomobile::ProcessControl(void) // Scan if this car sees the player committing any crimes if(GetStatus() != STATUS_ABANDONED && GetStatus() != STATUS_WRECKED && - GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_PLAYER_REMOTE && GetStatus() != STATUS_PLAYER_DISABLED){ + GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_PLAYER_REMOTE && GetStatus() != STATUS_PLAYER_DISABLED){ switch(GetModelIndex()) case MI_FBICAR: case MI_POLICE: @@ -596,7 +589,7 @@ CAutomobile::ProcessControl(void) m_aSuspensionSpringRatio[i] = (m_aSuspensionSpringRatio[i]-wheelRadius)/(1.0f-wheelRadius); } - float fwdSpeed = DotProduct(m_vecMoveSpeed, GetForward()); + float fwdSpeed = Abs(DotProduct(m_vecMoveSpeed, GetForward())); CVector contactPoints[4]; // relative to model CVector contactSpeeds[4]; // speed at contact points CVector springDirections[4]; // normalized, in model space @@ -689,7 +682,7 @@ CAutomobile::ProcessControl(void) float brakeBiasFront = neutralHandling ? 1.0f : 2.0f*pHandling->fBrakeBias; float brakeBiasRear = neutralHandling ? 1.0f : 2.0f*(1.0f-pHandling->fBrakeBias); float tractionBiasFront = neutralHandling ? 1.0f : 2.0f*pHandling->fTractionBias; - float tractionBiasRear = neutralHandling ? 1.0f : 2.0f*(1.0f-pHandling->fTractionBias); + float tractionBiasRear = neutralHandling ? 1.0f : 2.0f-tractionBiasFront; // Count how many wheels are touching the ground @@ -1160,7 +1153,7 @@ CAutomobile::ProcessControl(void) uint8 freq = Min(200.0f*suspShake*speed*2000.0f/m_fMass + 100.0f, 250.0f); CPad::GetPad(0)->StartShake(20000.0f*CTimer::GetTimeStep()/freq, freq); }else{ - uint8 freq = Min(200.0f*surfShake*speed*2000.0f/m_fMass + 40.0f, 145.0f); + uint8 freq = Min(200.0f*surfShake*speed*2000.0f/m_fMass + 40.0f, 150.0f); CPad::GetPad(0)->StartShake(5000.0f*CTimer::GetTimeStep()/freq, freq); } } @@ -1302,7 +1295,7 @@ CAutomobile::PreRender(void) int drawParticles = Abs(fwdSpeed) < 90.0f; if(GetStatus() == STATUS_SIMPLE || GetStatus() == STATUS_PHYSICS || - GetStatus() == STATUS_PLAYER || GetStatus() == STATUS_PLAYER_PLAYBACKFROMBUFFER){ + GetStatus() == STATUS_PLAYER || GetStatus() == STATUS_PLAYER_PLAYBACKFROMBUFFER){ bool rearSkidding = false; if(m_aWheelState[CARWHEEL_REAR_LEFT] == WHEEL_STATE_SKIDDING || m_aWheelState[CARWHEEL_REAR_RIGHT] == WHEEL_STATE_SKIDDING) @@ -1434,7 +1427,7 @@ CAutomobile::PreRender(void) n = 6.0f*CWeather::Rain; for(j = 0; j <= n; j++) CParticle::AddParticle(PARTICLE_RAIN_SPLASHUP, - c + CVector(CGeneral::GetRandomNumberInRange(-.04f, 0.4f), CGeneral::GetRandomNumberInRange(-.04f, 0.4f), 0.0f), + c + CVector(CGeneral::GetRandomNumberInRange(-0.4f, 0.4f), CGeneral::GetRandomNumberInRange(-0.4f, 0.4f), 0.0f), CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, 0, 0, CGeneral::GetRandomNumber() & 1); } @@ -1622,11 +1615,9 @@ CAutomobile::PreRender(void) break; } - if(GetModelIndex() == MI_RCBANDIT || GetModelIndex() == MI_DODO || - GetModelIndex() == MI_RHINO) { - CShadows::StoreShadowForCar(this); - return; - } + if(GetModelIndex() != MI_RCBANDIT && GetModelIndex() != MI_DODO && + GetModelIndex() != MI_RHINO) { + // Process lights // Turn lights on/off bool shouldLightsBeOn = @@ -1873,14 +1864,9 @@ CAutomobile::PreRender(void) CPointLights::FOG_NONE, false); } } - }else{ + }else if(GetStatus() != STATUS_ABANDONED && GetStatus() != STATUS_WRECKED){ // Lights off - if(GetStatus() == STATUS_ABANDONED || GetStatus() == STATUS_WRECKED) { - CShadows::StoreShadowForCar(this); - return; - } - CVector lightPos = mi->m_positions[CAR_POS_TAILLIGHTS]; CVector lightR = GetMatrix() * lightPos; CVector lightL = lightR; @@ -1937,6 +1923,8 @@ CAutomobile::PreRender(void) CCoronas::UpdateCoronaCoors((uintptr)this + 3, lightR, 50.0f*TheCamera.LODDistMultiplier, 0.0f); } } + // end of lights + } CShadows::StoreShadowForCar(this); } @@ -2507,7 +2495,7 @@ CAutomobile::TankControl(void) float f = i/15.0f; CParticle::AddParticle(PARTICLE_GUNSMOKE2, point1, shotDir*CGeneral::GetRandomNumberInRange(0.3f, 1.0f)*f, - nil, CGeneral::GetRandomNumberInRange(0.5f, 1.0f)*f, black); + nil, CGeneral::GetRandomNumberInRange(0.5f, 1.5f)*f, black); } // And some gun flashes near the gun @@ -2539,6 +2527,9 @@ CAutomobile::TankControl(void) } } +#define HYDRAULIC_UPPER_EXT (-0.12f) +#define HYDRAULIC_LOWER_EXT (0.14f) + void CAutomobile::HydraulicControl(void) { @@ -2601,8 +2592,8 @@ CAutomobile::HydraulicControl(void) m_hydraulicState = 20; else{ m_hydraulicState = 0; - normalUpperLimit += -0.12f; - normalSpringLength = normalUpperLimit - (normalLowerLimit+0.14f); + normalUpperLimit += HYDRAULIC_UPPER_EXT; + normalSpringLength = normalUpperLimit - (normalLowerLimit+HYDRAULIC_LOWER_EXT); DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_HYDRAULIC_2, 0.0f); } @@ -2635,7 +2626,7 @@ CAutomobile::HydraulicControl(void) float radius = Max(specialColModel->boundingBox.min.Magnitude(), specialColModel->boundingBox.max.Magnitude()); if(specialColModel->boundingSphere.radius < radius) specialColModel->boundingSphere.radius = radius; - + return; } if(playerInfo->m_WBState != WBSTATE_PLAYING) @@ -2645,8 +2636,6 @@ CAutomobile::HydraulicControl(void) if(m_hydraulicState < 20 && m_fVelocityChangeForAudio > 0.2f){ if(m_hydraulicState == 0){ m_hydraulicState = 20; - for(i = 0; i < 4; i++) - m_aWheelPosition[i] -= 0.06f; DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_HYDRAULIC_1, 0.0f); setPrevRatio = true; }else{ @@ -2674,8 +2663,8 @@ CAutomobile::HydraulicControl(void) if(m_hydraulicState < 100){ if(m_hydraulicState == 0){ - normalUpperLimit += -0.12f; - normalLowerLimit += 0.14f; + normalUpperLimit += HYDRAULIC_UPPER_EXT; + normalLowerLimit += HYDRAULIC_LOWER_EXT; normalSpringLength = normalUpperLimit - normalLowerLimit; } @@ -2740,8 +2729,8 @@ CAutomobile::HydraulicControl(void) // Lowered, move wheels up if(m_hydraulicState == 0){ - normalUpperLimit += -0.12f; - normalLowerLimit += 0.14f; + normalUpperLimit += HYDRAULIC_UPPER_EXT; + normalLowerLimit += HYDRAULIC_LOWER_EXT; normalSpringLength = normalUpperLimit - normalLowerLimit; } @@ -2782,8 +2771,8 @@ CAutomobile::HydraulicControl(void) } if(m_fVelocityChangeForAudio < 0.1f){ - normalUpperLimit += -0.12f; - normalLowerLimit += 0.14f; + normalUpperLimit += HYDRAULIC_UPPER_EXT; + normalLowerLimit += HYDRAULIC_LOWER_EXT; normalSpringLength = normalUpperLimit - normalLowerLimit; } @@ -2920,7 +2909,7 @@ CAutomobile::ProcessBuoyancy(void) DMAudio.PlayOneShot(m_audioEntityId, SOUND_WATER_FALL, 0.0f); } - if(nGenerateWaterCircles > 0 && nGenerateWaterCircles < CTimer::GetTimeInMilliseconds()){ + if(nGenerateWaterCircles > 0 && nGenerateWaterCircles <= CTimer::GetTimeInMilliseconds()){ CVector pos = GetPosition(); float waterLevel = 0.0f; if(CWaterLevel::GetWaterLevel(pos.x, pos.y, pos.z, &waterLevel, false)) @@ -2940,7 +2929,7 @@ CAutomobile::ProcessBuoyancy(void) } } - if(nGenerateRaindrops > 0 && nGenerateRaindrops < CTimer::GetTimeInMilliseconds()){ + if(nGenerateRaindrops > 0 && nGenerateRaindrops <= CTimer::GetTimeInMilliseconds()){ CVector pos = GetPosition(); float waterLevel = 0.0f; if(CWaterLevel::GetWaterLevel(pos.x, pos.y, pos.z, &waterLevel, false)) diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h index 0c02379f..8fa7ed67 100644 --- a/src/vehicles/Automobile.h +++ b/src/vehicles/Automobile.h @@ -84,13 +84,13 @@ public: float m_aSuspensionSpringRatio[4]; float m_aSuspensionSpringRatioPrev[4]; float m_aWheelTimer[4]; // set to 4.0 when wheel is touching ground, then decremented - float field_49C; + float m_auto_unused1; bool m_aWheelSkidmarkMuddy[4]; bool m_aWheelSkidmarkBloody[4]; float m_aWheelRotation[4]; float m_aWheelPosition[4]; float m_aWheelSpeed[4]; - uint8 field_4D8; + uint8 m_auto_unused2; uint8 m_bombType : 3; uint8 bTaxiLight : 1; uint8 bDriverLastFrame : 1; // for bombs @@ -100,7 +100,7 @@ public: uint8 bNotDamagedUpsideDown : 1; uint8 bMoreResistantToDamage : 1; CEntity *m_pBombRigger; - int16 field_4E0; + int16 m_auto_unk1; uint16 m_hydraulicState; uint32 m_nBusDoorTimerEnd; uint32 m_nBusDoorTimerStart; diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 77c549f9..1132f79f 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -288,7 +288,7 @@ CVehicle::FlyingControl(eFlightModel flightModel) { // thrust float fForwSpeed = DotProduct(GetMoveSpeed(), GetForward()); - CVector vecWidthForward = GetColModel()->boundingBox.min.y * GetForward(); + CVector vecTail = GetColModel()->boundingBox.min.y * GetForward(); float fThrust = (CPad::GetPad(0)->GetAccelerate() - CPad::GetPad(0)->GetBrake()) / 255.0f; if (fForwSpeed > 0.1f || (flightModel == FLIGHT_MODEL_RCPLANE && fForwSpeed > 0.02f)) fThrust += 1.0f; @@ -311,13 +311,13 @@ CVehicle::FlyingControl(eFlightModel flightModel) fSideSlipAccel = Abs(fSideSpeed) * fSideSpeed * fSeaSideSlipMult; ApplyMoveForce(m_fMass * GetRight() * fSideSlipAccel * CTimer::GetTimeStep()); - float fYaw = -DotProduct(GetSpeed(vecWidthForward), GetRight()); + float fYaw = -DotProduct(GetSpeed(vecTail), GetRight()); float fYawAccel; if (flightModel == FLIGHT_MODEL_RCPLANE) fYawAccel = fRCRudderMult * fYaw * Abs(fYaw) + fRCYawMult * fSteerLR * fForwSpeed; else fYawAccel = fSeaRudderMult * fYaw * Abs(fYaw) + fSeaYawMult * fSteerLR * fForwSpeed; - ApplyTurnForce(fYawAccel * GetRight() * m_fTurnMass * CTimer::GetTimeStep(), vecWidthForward); + ApplyTurnForce(fYawAccel * GetRight() * m_fTurnMass * CTimer::GetTimeStep(), vecTail); float fRollAccel; if (flightModel == FLIGHT_MODEL_RCPLANE) { @@ -341,14 +341,14 @@ CVehicle::FlyingControl(eFlightModel flightModel) ApplyTurnForce(fStabiliseSpeed * m_fTurnMass * GetRight(), GetUp()); // no CTimer::GetTimeStep(), is it right? VC doesn't have it too // up/down - float fTail = -DotProduct(GetSpeed(vecWidthForward), GetUp()); + float fTail = -DotProduct(GetSpeed(vecTail), GetUp()); float fSteerUD = -CPad::GetPad(0)->GetSteeringUpDown() / 128.0f; float fPitchAccel; if (flightModel == FLIGHT_MODEL_RCPLANE) fPitchAccel = fRCTailMult * fTail * Abs(fTail) + fRCPitchMult * fSteerUD * fForwSpeed; else fPitchAccel = fSeaTailMult * fTail * Abs(fTail) + fSeaPitchMult * fSteerUD * fForwSpeed; - ApplyTurnForce(fPitchAccel * m_fTurnMass * GetUp() * CTimer::GetTimeStep(), vecWidthForward); + ApplyTurnForce(fPitchAccel * m_fTurnMass * GetUp() * CTimer::GetTimeStep(), vecTail); float fLift = -DotProduct(GetMoveSpeed(), GetUp()) / Max(0.01f, GetMoveSpeed().Magnitude()); float fLiftAccel; From 12cc0e4132f9bdb0440a4e9223618ef3e2c00240 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 31 May 2020 22:35:29 +0200 Subject: [PATCH 081/133] getting rid of strnicmp --- src/modelinfo/SimpleModelInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modelinfo/SimpleModelInfo.cpp b/src/modelinfo/SimpleModelInfo.cpp index 091d4dff..32204500 100644 --- a/src/modelinfo/SimpleModelInfo.cpp +++ b/src/modelinfo/SimpleModelInfo.cpp @@ -158,7 +158,7 @@ CSimpleModelInfo::SetupBigBuilding(void) m_lodDistances[2] = related->GetLargestLodDistance()/TheCamera.LODDistMultiplier; else #ifdef FIX_BUGS - if(strnicmp(GetName(), "lod", 3) == 0) + if(toupper(m_name[0]) == 'L' && toupper(m_name[1]) == 'O' && toupper(m_name[2]) == 'D') m_lodDistances[2] = 100.0f; else m_lodDistances[2] = 0.0f; From c8b93d057552c271e5b200555084a4ee338f2c0b Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 1 Jun 2020 10:30:01 +0200 Subject: [PATCH 082/133] fixed bumper colmodel --- src/core/TempColModels.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/TempColModels.cpp b/src/core/TempColModels.cpp index b4d994ec..1252e2c7 100644 --- a/src/core/TempColModels.cpp +++ b/src/core/TempColModels.cpp @@ -155,7 +155,7 @@ CTempColModels::Initialise(void) } ms_colModelBumper1.boundingSphere.Set(2.2f, CVector(0.0f, -0.6f, 0.0f), SURFACE_DEFAULT, 0); - ms_colModelBumper1.boundingBox.Set(CVector(-1.2f, -0.3f, -0.2f), CVector(1.2f, 0.3f, -0.2f), SURFACE_DEFAULT, 0); + ms_colModelBumper1.boundingBox.Set(CVector(-1.2f, -0.3f, -0.2f), CVector(1.2f, 0.3f, 0.2f), SURFACE_DEFAULT, 0); SET_COLMODEL_SPHERES(ms_colModelBumper1, s_aBumperSpheres); From 0803c821ae4d78f827f593cb6030988e8f91aa27 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Mon, 1 Jun 2020 12:45:03 +0300 Subject: [PATCH 083/133] fixed roadblocks --- src/control/PathFind.cpp | 7 ++- src/control/RoadBlocks.cpp | 100 ++++++++++++++++++------------------- 2 files changed, 53 insertions(+), 54 deletions(-) diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp index ee15b82f..46895678 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -404,11 +404,10 @@ CPathFind::PreparePathData(void) maxX = 0.0f; maxY = 0.0f; for(j = 0; j < 12; j++){ - k = i*12 + j; + k = m_mapObjects[i]->GetModelIndex()*12 + j; if(InfoForTileCars[k].type == NodeTypeExtern){ numExtern++; - if(InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes > numLanes) - numLanes = InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes; + numLanes = Max(numLanes, InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes); maxX = Max(maxX, Abs(InfoForTileCars[k].x)); maxY = Max(maxY, Abs(InfoForTileCars[k].y)); }else if(InfoForTileCars[k].type == NodeTypeIntern) @@ -417,7 +416,7 @@ CPathFind::PreparePathData(void) if(numIntern == 1 && numExtern == 2){ if(numLanes < 4){ - if((i & 7) == 4){ // WHAT? + if((i & 7) == 4){ // 1/8 probability m_objectFlags[i] |= UseInRoadBlock; if(maxX > maxY) m_objectFlags[i] |= ObjectEastWest; diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp index caf9ed34..ee9ec17e 100644 --- a/src/control/RoadBlocks.cpp +++ b/src/control/RoadBlocks.cpp @@ -132,58 +132,58 @@ CRoadBlocks::GenerateRoadBlocks(void) CColModel *pVehicleColModel = CModelInfo::GetModelInfo(vehicleId)->GetColModel(); float fModelRadius = 2.0f * pVehicleColModel->boundingSphere.radius + 0.25f; int16 radius = (int16)(fMapObjectRadius / fModelRadius); - if (radius > 0 && radius < 6) { - CVector2D vecDistanceToCamera = TheCamera.GetPosition() - mapObject->GetPosition(); - float fDotProduct = DotProduct2D(vecDistanceToCamera, mapObject->GetForward()); - float fOffset = 0.5f * fModelRadius * (float)(radius - 1); - for (int16 i = 0; i < radius; i++) { - uint8 nRoadblockType = fDotProduct < 0.0f; - if (CGeneral::GetRandomNumber() & 1) { - offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f + HALFPI); + if (radius >= 6) + continue; + CVector2D vecDistanceToCamera = TheCamera.GetPosition() - mapObject->GetPosition(); + float fDotProduct = DotProduct2D(vecDistanceToCamera, mapObject->GetForward()); + float fOffset = 0.5f * fModelRadius * (float)(radius - 1); + for (int16 i = 0; i < radius; i++) { + uint8 nRoadblockType = fDotProduct < 0.0f; + if (CGeneral::GetRandomNumber() & 1) { + offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f + HALFPI); + } + else { + nRoadblockType = !nRoadblockType; + offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f - HALFPI); + } + if (ThePaths.m_objectFlags[RoadBlockObjects[nRoadblockNode]] & ObjectEastWest) + offsetMatrix.GetPosition() = CVector(0.0f, i * fModelRadius - fOffset, 0.6f); + else + offsetMatrix.GetPosition() = CVector(i * fModelRadius - fOffset, 0.0f, 0.6f); + CMatrix vehicleMatrix = mapObject->m_matrix * offsetMatrix; + float fModelRadius = CModelInfo::GetModelInfo(vehicleId)->GetColModel()->boundingSphere.radius - 0.25f; + int16 colliding = 0; + CWorld::FindObjectsKindaColliding(vehicleMatrix.GetPosition(), fModelRadius, 0, &colliding, 2, nil, false, true, true, false, false); + if (!colliding) { + CAutomobile *pVehicle = new CAutomobile(vehicleId, RANDOM_VEHICLE); + pVehicle->SetStatus(STATUS_ABANDONED); + // pVehicle->GetHeightAboveRoad(); // called but return value is ignored? + vehicleMatrix.GetPosition().z += fModelRadius - 0.6f; + pVehicle->m_matrix = vehicleMatrix; + pVehicle->PlaceOnRoadProperly(); + pVehicle->bIsStatic = false; + pVehicle->m_matrix.UpdateRW(); + pVehicle->m_nDoorLock = CARLOCK_UNLOCKED; + CCarCtrl::JoinCarWithRoadSystem(pVehicle); + pVehicle->bIsLocked = false; + pVehicle->AutoPilot.m_nCarMission = MISSION_NONE; + pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE; + pVehicle->AutoPilot.m_nCurrentLane = 0; + pVehicle->AutoPilot.m_nNextLane = 0; + pVehicle->AutoPilot.m_fMaxTrafficSpeed = 0.0f; + pVehicle->AutoPilot.m_nCruiseSpeed = 0.0f; + pVehicle->bExtendedRange = true; + if (pVehicle->UsesSiren(pVehicle->GetModelIndex()) && CGeneral::GetRandomNumber() & 1) + pVehicle->m_bSirenOrAlarm = true; + if (pVehicle->GetUp().z > 0.94f) { + CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), 0); + CWorld::Add(pVehicle); + pVehicle->bCreateRoadBlockPeds = true; + pVehicle->m_nRoadblockType = nRoadblockType; + pVehicle->m_nRoadblockNode = nRoadblockNode; } else { - nRoadblockType = !nRoadblockType; - offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f - HALFPI); - } - if (ThePaths.m_objectFlags[RoadBlockObjects[nRoadblockNode]] & ObjectEastWest) - offsetMatrix.GetPosition() = CVector(0.0f, -fOffset, 0.6f); - else - offsetMatrix.GetPosition() = CVector(-fOffset, 0.0f, 0.6f); - CMatrix vehicleMatrix = mapObject->m_matrix * offsetMatrix; - float fModelRadius = CModelInfo::GetModelInfo(vehicleId)->GetColModel()->boundingSphere.radius - 0.25f; - int16 colliding = 0; - CWorld::FindObjectsKindaColliding(vehicleMatrix.GetPosition(), fModelRadius, 0, &colliding, 2, nil, false, true, true, false, false); - if (!colliding) { - CAutomobile *pVehicle = new CAutomobile(vehicleId, RANDOM_VEHICLE); - pVehicle->SetStatus(STATUS_ABANDONED); - // pVehicle->GetHeightAboveRoad(); // called but return value is ignored? - vehicleMatrix.GetPosition().z += fModelRadius - 0.6f; - pVehicle->m_matrix = vehicleMatrix; - pVehicle->PlaceOnRoadProperly(); - pVehicle->bIsStatic = false; - pVehicle->m_matrix.UpdateRW(); - pVehicle->m_nDoorLock = CARLOCK_UNLOCKED; - CCarCtrl::JoinCarWithRoadSystem(pVehicle); - pVehicle->bIsLocked = false; - pVehicle->AutoPilot.m_nCarMission = MISSION_NONE; - pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE; - pVehicle->AutoPilot.m_nCurrentLane = 0; - pVehicle->AutoPilot.m_nNextLane = 0; - pVehicle->AutoPilot.m_fMaxTrafficSpeed = 0.0f; - pVehicle->AutoPilot.m_nCruiseSpeed = 0.0f; - pVehicle->bExtendedRange = true; - if (pVehicle->UsesSiren(pVehicle->GetModelIndex()) && CGeneral::GetRandomNumber() & 1) - pVehicle->m_bSirenOrAlarm = true; - if (pVehicle->GetUp().z > 0.94f) { - CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), 0); - CWorld::Add(pVehicle); - pVehicle->bCreateRoadBlockPeds = true; - pVehicle->m_nRoadblockType = nRoadblockType; - pVehicle->m_nRoadblockNode = nRoadblockNode; - } - else { - delete pVehicle; - } + delete pVehicle; } } } From 7c7727e7dab52483d9dbcf0002d95a8bf10e7b41 Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 1 Jun 2020 13:21:19 +0200 Subject: [PATCH 084/133] fixed timebar toggle --- src/core/main.cpp | 5 +---- src/core/main.h | 1 - src/core/re3.cpp | 4 +++- src/render/WaterLevel.h | 1 - 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/core/main.cpp b/src/core/main.cpp index a69890b0..eb39b287 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -73,7 +73,6 @@ float FramesPerSecond = 30.0f; bool gbPrintShite = false; bool gbModelViewer; -//Custom Timebars Toggle #ifdef TIMEBARS bool gbShowTimebars; #endif @@ -1102,10 +1101,8 @@ Idle(void *arg) #ifdef TIMEBARS -//Custom Timebars toggle if (gbShowTimebars) - tbDisplay(); - + tbDisplay(); #endif DoRWStuffEndOfFrame(); diff --git a/src/core/main.h b/src/core/main.h index 5c514bbb..9ad4ed1c 100644 --- a/src/core/main.h +++ b/src/core/main.h @@ -14,7 +14,6 @@ extern wchar gUString[256]; extern wchar gUString2[256]; extern bool gbPrintShite; extern bool gbModelViewer; -//Custom Timebars Toggle #ifdef TIMEBARS extern bool gbShowTimebars; #endif diff --git a/src/core/re3.cpp b/src/core/re3.cpp index c77cf6d9..38854f25 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -461,7 +461,7 @@ DebugMenuPopulate(void) DebugMenuAddVarBool8("Render", "Don't render Peds", &gbDontRenderPeds, nil); DebugMenuAddVarBool8("Render", "Don't render Vehicles", &gbDontRenderVehicles, nil); DebugMenuAddVarBool8("Render", "Don't render Objects", &gbDontRenderObjects, nil); - DebugMenuAddVarBool8("Render", "Don´t Render Water", &gbDontRenderWater, nil); + DebugMenuAddVarBool8("Render", "Don't Render Water", &gbDontRenderWater, nil); DebugMenuAddVarBool8("Debug", "Edit on", &CSceneEdit::m_bEditOn, nil); #ifdef MENU_MAP @@ -492,7 +492,9 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop); DebugMenuAddVarBool8("Debug", "Show DebugStuffInRelease", &gbDebugStuffInRelease, nil); +#ifdef TIMEBARS DebugMenuAddVarBool8("Debug", "Show Timebars", &gbShowTimebars, nil); +#endif extern bool PrintDebugCode; extern int16 DebugCamMode; diff --git a/src/render/WaterLevel.h b/src/render/WaterLevel.h index 325be0a5..269d6091 100644 --- a/src/render/WaterLevel.h +++ b/src/render/WaterLevel.h @@ -65,7 +65,6 @@ #define MAX_BOAT_WAKES 8 extern RwRaster* gpWaterRaster; -//"Custom" Don´t Render Water Toggle extern bool gbDontRenderWater; class CWaterLevel From 8bbb6a2a4a104469f1c3a285f68088445332d671 Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 1 Jun 2020 20:28:04 +0200 Subject: [PATCH 085/133] hanim fix --- src/core/common.h | 4 ++-- src/rw/RwHelper.cpp | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/core/common.h b/src/core/common.h index f79b199b..7d339660 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -29,14 +29,14 @@ #define STREAMFILE(str) (((rw::StreamFile*)(str))->file) #define HIERNODEINFO(hier) ((hier)->nodeInfo) #define HIERNODEID(hier, i) ((hier)->nodeInfo[i].id) -#define HANIMFRAMES(anim) ((anim)->keyframes) +#define HANIMFRAME(anim, i) ((RwUInt8*)(anim)->keyframes + (i)*(anim)->interpInfo->animKeyFrameSize) #else #define RWHALFPIXEL // always d3d #define STREAMPOS(str) ((str)->Type.memory.position) #define STREAMFILE(str) ((str)->Type.file.fpFile) #define HIERNODEINFO(hier) ((hier)->pNodeInfo) #define HIERNODEID(hier, i) ((hier)->pNodeInfo[i].nodeID) -#define HANIMFRAMES(anim) ((anim)->pFrames) +#define HANIMFRAME(anim, i) ((RwUInt8*)(anim)->pFrames + (i)*(anim)->interpInfo->keyFrameSize) #endif #ifdef RWHALFPIXEL diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp index 191fc7ab..cd2a1bf6 100644 --- a/src/rw/RwHelper.cpp +++ b/src/rw/RwHelper.cpp @@ -319,14 +319,20 @@ HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier) RpHAnimAnimation *anim = RpHAnimAnimationCreate(rpHANIMSTDKEYFRAMETYPEID, numNodes, 0, 0.0f); if(anim == nil) return nil; - RpHAnimStdKeyFrame *frame = (RpHAnimStdKeyFrame*)HANIMFRAMES(anim); + RpHAnimStdKeyFrame *frame; for(i = 0; i < numNodes; i++){ + frame = (RpHAnimStdKeyFrame*)HANIMFRAME(anim, i); // games uses struct size here, not safe frame->q.real = 1.0f; frame->q.imag.x = frame->q.imag.y = frame->q.imag.z = 0.0f; frame->t.x = frame->t.y = frame->t.z = 0.0f; +#ifdef FIX_BUGS + // times are subtracted and divided giving NaNs + // so they can't both be 0 + frame->time = i/hier->numNodes; +#else frame->time = 0.0f; +#endif frame->prevFrame = nil; - frame++; } return anim; } From c00f7a8d222dae3f9a3989fefdd875ca2ef19c04 Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 1 Jun 2020 20:50:26 +0200 Subject: [PATCH 086/133] CTimer fix --- src/core/Timer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/Timer.h b/src/core/Timer.h index e7b6fec8..4e8b8805 100644 --- a/src/core/Timer.h +++ b/src/core/Timer.h @@ -18,10 +18,10 @@ public: static const float &GetTimeStep(void) { return ms_fTimeStep; } static void SetTimeStep(float ts) { ms_fTimeStep = ts; } static float GetTimeStepInSeconds() { return ms_fTimeStep / 50.0f; } - static float GetTimeStepInMilliseconds() { return ms_fTimeStep / 50.0f * 1000.0f; } + static uint32 GetTimeStepInMilliseconds() { return ms_fTimeStep / 50.0f * 1000.0f; } static const float &GetTimeStepNonClipped(void) { return ms_fTimeStepNonClipped; } static float GetTimeStepNonClippedInSeconds(void) { return ms_fTimeStepNonClipped / 50.0f; } - static float GetTimeStepNonClippedInMilliseconds(void) { return ms_fTimeStepNonClipped / 50.0f * 1000.0f; } + static uint32 GetTimeStepNonClippedInMilliseconds(void) { return ms_fTimeStepNonClipped / 50.0f * 1000.0f; } static void SetTimeStepNonClipped(float ts) { ms_fTimeStepNonClipped = ts; } static const uint32 &GetFrameCounter(void) { return m_FrameCounter; } static void SetFrameCounter(uint32 fc) { m_FrameCounter = fc; } From 5d90e4b2f095079221de35e0e172cbc52f4a9a4c Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Mon, 1 Jun 2020 22:10:11 +0200 Subject: [PATCH 087/133] Fix collision with peds heads --- src/peds/Ped.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 6b3b8686..cfdbb6bc 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -6187,6 +6187,9 @@ CPed::Die(void) uint8 CPed::DoesLOSBulletHitPed(CColPoint &colPoint) { +#ifdef FIX_BUGS + return 1; +#else uint8 retVal = 2; float headZ = GetNodePosition(PED_HEAD).z; @@ -6202,6 +6205,7 @@ CPed::DoesLOSBulletHitPed(CColPoint &colPoint) retVal = 0; return retVal; +#endif } bool From 575c5466dfb3d0d0cdaa47a03b601e4f23f6af94 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 2 Jun 2020 14:38:57 +0200 Subject: [PATCH 088/133] renamed a vehicle thing --- src/vehicles/Automobile.cpp | 18 +++++++++--------- src/vehicles/Vehicle.cpp | 2 +- src/vehicles/Vehicle.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 37b224d1..f35dd9e3 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -2241,22 +2241,22 @@ CAutomobile::ProcessControlInputs(uint8 pad) // Steer left/right if(CCamera::m_bUseMouse3rdPerson && !CVehicle::m_bDisableMouseSteering){ if(CPad::GetPad(pad)->GetMouseX() != 0.0f){ - m_fSteerRatio += fMouseSteerSens*CPad::GetPad(pad)->GetMouseX(); + m_fSteerInput += fMouseSteerSens*CPad::GetPad(pad)->GetMouseX(); nLastControlInput = 2; - if(Abs(m_fSteerRatio) < fMouseCentreRange) - m_fSteerRatio *= Pow(fMouseCentreMult, CTimer::GetTimeStep()); + if(Abs(m_fSteerInput) < fMouseCentreRange) + m_fSteerInput *= Pow(fMouseCentreMult, CTimer::GetTimeStep()); }else if(CPad::GetPad(pad)->GetSteeringLeftRight() || nLastControlInput != 2){ // mouse hasn't move, steer with pad like below - m_fSteerRatio += (-CPad::GetPad(pad)->GetSteeringLeftRight()/128.0f - m_fSteerRatio)* + m_fSteerInput += (-CPad::GetPad(pad)->GetSteeringLeftRight()/128.0f - m_fSteerInput)* 0.2f*CTimer::GetTimeStep(); nLastControlInput = 0; } }else{ - m_fSteerRatio += (-CPad::GetPad(pad)->GetSteeringLeftRight()/128.0f - m_fSteerRatio)* + m_fSteerInput += (-CPad::GetPad(pad)->GetSteeringLeftRight()/128.0f - m_fSteerInput)* 0.2f*CTimer::GetTimeStep(); nLastControlInput = 0; } - m_fSteerRatio = clamp(m_fSteerRatio, -1.0f, 1.0f); + m_fSteerInput = clamp(m_fSteerInput, -1.0f, 1.0f); // Accelerate/Brake float acceleration = (CPad::GetPad(pad)->GetAccelerate() - CPad::GetPad(pad)->GetBrake())/255.0f; @@ -2307,10 +2307,10 @@ CAutomobile::ProcessControlInputs(uint8 pad) // Actually turn wheels static float fValue; // why static? - if(m_fSteerRatio < 0.0f) - fValue = -sq(m_fSteerRatio); + if(m_fSteerInput < 0.0f) + fValue = -sq(m_fSteerInput); else - fValue = sq(m_fSteerRatio); + fValue = sq(m_fSteerInput); m_fSteerAngle = DEGTORAD(pHandling->fSteeringLock) * fValue; if(bComedyControls){ diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 1132f79f..dbb15b5d 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -52,7 +52,7 @@ CVehicle::CVehicle(uint8 CreatedBy) m_nCurrentGear = 1; m_fChangeGearTime = 0.0f; - m_fSteerRatio = 0.0f; + m_fSteerInput = 0.0f; m_type = ENTITY_TYPE_VEHICLE; VehicleCreatedBy = CreatedBy; bIsLocked = false; diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index de4d3f88..89117d40 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -194,7 +194,7 @@ public: bool m_bSirenOrAlarm; int8 m_comedyControlState; CStoredCollPoly m_aCollPolys[2]; // poly which is under front/rear part of car - float m_fSteerRatio; + float m_fSteerInput; eVehicleType m_vehType; static void *operator new(size_t); From 04a91761df7c90ed16b37407d65d8674033efd3f Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 2 Jun 2020 23:34:53 +0200 Subject: [PATCH 089/133] some vehicle cleanup --- src/core/Cam.cpp | 3 ++- src/modelinfo/VehicleModelInfo.cpp | 21 ++++++++-------- src/modelinfo/VehicleModelInfo.h | 38 +++++++++++++++++++++++++++++ src/peds/Ped.cpp | 39 ++++++------------------------ src/vehicles/Automobile.cpp | 28 +++++++++++++++------ src/vehicles/Automobile.h | 16 ------------ src/vehicles/Plane.h | 7 ------ src/vehicles/Train.h | 9 ------- src/vehicles/Vehicle.h | 6 ----- src/weapons/Weapon.cpp | 21 ++++++++-------- 10 files changed, 88 insertions(+), 100 deletions(-) diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 60145cd0..53c49634 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -5,6 +5,7 @@ #include "World.h" #include "Vehicle.h" #include "Automobile.h" +#include "Boat.h" #include "Ped.h" #include "PlayerPed.h" #include "CopPed.h" @@ -2732,7 +2733,7 @@ CCam::Process_1stPerson(const CVector &CameraTarget, float TargetOrientation, fl }else{ assert(CamTargetEntity->IsVehicle()); CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(CamTargetEntity->GetModelIndex()); - CVector CamPos = mi->m_vehicleType == VEHICLE_TYPE_BOAT ? mi->m_positions[BOAT_POS_FRONTSEAT] : mi->m_positions[CAR_POS_FRONTSEAT]; + CVector CamPos = mi->GetFrontSeatPosn(); CamPos.x = 0.0f; CamPos.y += -0.08f; CamPos.z += 0.62f; diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp index 74285c19..d8b388d5 100644 --- a/src/modelinfo/VehicleModelInfo.cpp +++ b/src/modelinfo/VehicleModelInfo.cpp @@ -16,6 +16,7 @@ #include "Train.h" #include "Plane.h" #include "Heli.h" +#include "Bike.h" #include "ModelIndices.h" #include "ModelInfo.h" @@ -120,16 +121,16 @@ RwObjectNameIdAssocation planeIds[] = { }; RwObjectNameIdAssocation bikeIds[] = { - { "chassis_dummy", 1, 0 }, - { "forks_front", 2, 0 }, - { "forks_rear", 3, 0 }, - { "wheel_front", 4, 0 }, - { "wheel_rear", 5, 0 }, - { "mudguard", 6, 0 }, - { "ped_frontseat", 2, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, - { "headlights", 0, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, - { "taillights", 1, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, - { "exhaust", 9, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, + { "chassis_dummy", BIKE_CHASSIS, 0 }, + { "forks_front", BIKE_FORKS_FRONT, 0 }, + { "forks_rear", BIKE_FORKS_REAR, 0 }, + { "wheel_front", BIKE_WHEEL_FRONT, 0 }, + { "wheel_rear", BIKE_WHEEL_REAR, 0 }, + { "mudguard", BIKE_MUDGUARD, 0 }, + { "ped_frontseat", CAR_POS_FRONTSEAT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, + { "headlights", CAR_POS_HEADLIGHTS, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, + { "taillights", CAR_POS_TAILLIGHTS, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, + { "exhaust", CAR_POS_EXHAUST, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, { "extra1", 0, VEHICLE_FLAG_DRAWLAST | VEHICLE_FLAG_COMP | CLUMP_FLAG_NO_HIERID }, { "extra2", 0, VEHICLE_FLAG_DRAWLAST | VEHICLE_FLAG_COMP | CLUMP_FLAG_NO_HIERID }, { "extra3", 0, VEHICLE_FLAG_DRAWLAST | VEHICLE_FLAG_COMP | CLUMP_FLAG_NO_HIERID }, diff --git a/src/modelinfo/VehicleModelInfo.h b/src/modelinfo/VehicleModelInfo.h index ba25d3cd..468ce96d 100644 --- a/src/modelinfo/VehicleModelInfo.h +++ b/src/modelinfo/VehicleModelInfo.h @@ -35,6 +35,43 @@ enum eVehicleType { NUM_VEHICLE_TYPES }; +enum eCarPositions +{ + CAR_POS_HEADLIGHTS, + CAR_POS_TAILLIGHTS, + CAR_POS_FRONTSEAT, + CAR_POS_BACKSEAT, + // these are unused so we don't know the actual values + CAR_POS_REVERSELIGHTS, + CAR_POS_BRAKELIGHTS, + CAR_POS_INDICATORS_FRONT, + CAR_POS_INDICATORS_BACK, + CAR_POS_STEERWHEEL, + // + CAR_POS_EXHAUST +}; + +enum eBoatPositions +{ + BOAT_POS_FRONTSEAT +}; + +enum eTrainPositions +{ + TRAIN_POS_LIGHT_FRONT, + TRAIN_POS_LIGHT_REAR, + TRAIN_POS_LEFT_ENTRY, + TRAIN_POS_MID_ENTRY, + TRAIN_POS_RIGHT_ENTRY +}; + +enum ePlanePositions +{ + PLANE_POS_LIGHT_LEFT, + PLANE_POS_LIGHT_RIGHT, + PLANE_POS_LIGHT_TAIL, +}; + enum { NUM_VEHICLE_POSITIONS = 10 }; @@ -100,6 +137,7 @@ public: void SetVehicleComponentFlags(RwFrame *frame, uint32 flags); void PreprocessHierarchy(void); void GetWheelPosn(int32 n, CVector &pos); + CVector &GetFrontSeatPosn(void) { return m_positions[m_vehicleType == VEHICLE_TYPE_BOAT ? BOAT_POS_FRONTSEAT : CAR_POS_FRONTSEAT]; }; int32 ChooseComponent(void); int32 ChooseSecondComponent(void); diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 6b3b8686..055581ad 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -1682,11 +1682,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatP switch (component) { case CAR_DOOR_RF: - if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT) - vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT]; - else - vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT]; - + vehDoorPos = vehModel->GetFrontSeatPosn(); vehDoorPos.x += seatOffset; vehDoorOffset.x = -vehDoorOffset.x; break; @@ -1698,11 +1694,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatP break; case CAR_DOOR_LF: - if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT) - vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT]; - else - vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT]; - + vehDoorPos = vehModel->GetFrontSeatPosn(); vehDoorPos.x = -(vehDoorPos.x + seatOffset); break; @@ -1712,11 +1704,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatP break; default: - if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT) - vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT]; - else - vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT]; - + vehDoorPos = vehModel->GetFrontSeatPosn(); vehDoorOffset = CVector(0.0f, 0.0f, 0.0f); } return vehDoorPos - vehDoorOffset; @@ -15031,11 +15019,7 @@ CPed::SeekBoatPosition(void) CVehicleModelInfo *boatModel = m_carInObjective->GetModelInfo(); CVector enterOffset; - if (boatModel->m_vehicleType == VEHICLE_TYPE_BOAT) - enterOffset = boatModel->m_positions[BOAT_POS_FRONTSEAT]; - else - enterOffset = boatModel->m_positions[CAR_POS_FRONTSEAT]; - + enterOffset = boatModel->GetFrontSeatPosn(); enterOffset.x = 0.0f; CMatrix boatMat(m_carInObjective->GetMatrix()); SetMoveState(PEDMOVE_WALK); @@ -16817,29 +16801,20 @@ CPed::SetPedPositionInCar(void) CMatrix newMat(m_pMyVehicle->GetMatrix()); CVector seatPos; if (m_pMyVehicle->pDriver == this) { - if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT) - seatPos = vehModel->m_positions[BOAT_POS_FRONTSEAT]; - else - seatPos = vehModel->m_positions[CAR_POS_FRONTSEAT]; - + seatPos = vehModel->GetFrontSeatPosn(); if (!m_pMyVehicle->IsBoat() && m_pMyVehicle->m_vehType != VEHICLE_TYPE_BIKE) seatPos.x = -seatPos.x; } else if (m_pMyVehicle->pPassengers[0] == this) { - if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT) - seatPos = vehModel->m_positions[BOAT_POS_FRONTSEAT]; - else - seatPos = vehModel->m_positions[CAR_POS_FRONTSEAT]; + seatPos = vehModel->GetFrontSeatPosn(); } else if (m_pMyVehicle->pPassengers[1] == this) { seatPos = vehModel->m_positions[CAR_POS_BACKSEAT]; seatPos.x = -seatPos.x; } else { if (m_pMyVehicle->pPassengers[2] == this) { seatPos = vehModel->m_positions[CAR_POS_BACKSEAT]; - } else if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT) { - seatPos = vehModel->m_positions[BOAT_POS_FRONTSEAT]; } else { - seatPos = vehModel->m_positions[CAR_POS_FRONTSEAT]; + seatPos = vehModel->GetFrontSeatPosn(); } } newMat.GetPosition() += Multiply3x3(newMat, seatPos); diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index f35dd9e3..9aa5ae7c 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -145,8 +145,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy) for(i = 0; i < 4; i++){ m_aGroundPhysical[i] = nil; m_aGroundOffset[i] = CVector(0.0f, 0.0f, 0.0f); - m_aSuspensionSpringRatio[i] = 1.0f; - m_aSuspensionSpringRatioPrev[i] = m_aSuspensionSpringRatio[i]; + m_aSuspensionSpringRatioPrev[i] = m_aSuspensionSpringRatio[i] = 1.0f; m_aWheelTimer[i] = 0.0f; m_aWheelRotation[i] = 0.0f; m_aWheelSpeed[i] = 0.0f; @@ -2314,6 +2313,17 @@ CAutomobile::ProcessControlInputs(uint8 pad) m_fSteerAngle = DEGTORAD(pHandling->fSteeringLock) * fValue; if(bComedyControls){ +#if 0 // old comedy controls from PS2 - same as bike's + if(((CTimer::GetTimeInMilliseconds() >> 10) & 0xF) < 12) + m_fGasPedal = 1.0f; + if((((CTimer::GetTimeInMilliseconds() >> 10)+6) & 0xF) < 12) + m_fBrakePedal = 0.0f; + bIsHandbrakeOn = false; + if(CTimer::GetTimeInMilliseconds() & 0x800) + m_fSteerAngle += 0.08f; + else + m_fSteerAngle -= 0.03f; +#else int rnd = CGeneral::GetRandomNumber() % 10; switch(m_comedyControlState){ case 0: @@ -2333,8 +2343,10 @@ CAutomobile::ProcessControlInputs(uint8 pad) m_comedyControlState = 0; break; } - }else + }else{ m_comedyControlState = 0; +#endif + } // Brake if player isn't in control // BUG: game always uses pad 0 here @@ -3948,8 +3960,8 @@ CAutomobile::BurstTyre(uint8 wheel) CCarCtrl::SwitchVehicleToRealPhysics(this); } - ApplyMoveForce(GetRight() * CGeneral::GetRandomNumberInRange(-0.3f, 0.3f)); - ApplyTurnForce(GetRight() * CGeneral::GetRandomNumberInRange(-0.3f, 0.3f), GetForward()); + ApplyMoveForce(GetRight() * m_fMass * CGeneral::GetRandomNumberInRange(-0.03f, 0.03f)); + ApplyTurnForce(GetRight() * m_fTurnMass * CGeneral::GetRandomNumberInRange(-0.03f, 0.03f), GetForward()); } } @@ -3964,10 +3976,10 @@ CAutomobile::IsRoomForPedToLeaveCar(uint32 component, CVector *doorOffset) CVector seatPos; switch(component){ case CAR_DOOR_RF: - seatPos = mi->m_positions[mi->m_vehicleType == VEHICLE_TYPE_BOAT ? BOAT_POS_FRONTSEAT : CAR_POS_FRONTSEAT]; + seatPos = mi->GetFrontSeatPosn(); break; case CAR_DOOR_LF: - seatPos = mi->m_positions[mi->m_vehicleType == VEHICLE_TYPE_BOAT ? BOAT_POS_FRONTSEAT : CAR_POS_FRONTSEAT]; + seatPos = mi->GetFrontSeatPosn(); seatPos.x = -seatPos.x; break; case CAR_DOOR_RR: @@ -4558,7 +4570,7 @@ CAutomobile::SetupModelNodes(void) int i; for(i = 0; i < NUM_CAR_NODES; i++) m_aCarNodes[i] = nil; - CClumpModelInfo::FillFrameArray((RpClump*)m_rwObject, m_aCarNodes); + CClumpModelInfo::FillFrameArray(GetClump(), m_aCarNodes); } void diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h index 8fa7ed67..604bed17 100644 --- a/src/vehicles/Automobile.h +++ b/src/vehicles/Automobile.h @@ -30,22 +30,6 @@ enum eCarNodes NUM_CAR_NODES, }; -enum eCarPositions -{ - CAR_POS_HEADLIGHTS, - CAR_POS_TAILLIGHTS, - CAR_POS_FRONTSEAT, - CAR_POS_BACKSEAT, - // these are unused so we don't know the actual values - CAR_POS_REVERSELIGHTS, - CAR_POS_BRAKELIGHTS, - CAR_POS_INDICATORS_FRONT, - CAR_POS_INDICATORS_BACK, - CAR_POS_STEERWHEEL, - // - CAR_POS_EXHAUST -}; - // These are used for all the wheel arrays // DON'T confuse with VEHWHEEL, which are vehicle components enum { diff --git a/src/vehicles/Plane.h b/src/vehicles/Plane.h index a6f6e1d9..783c53b3 100644 --- a/src/vehicles/Plane.h +++ b/src/vehicles/Plane.h @@ -9,13 +9,6 @@ enum ePlaneNodes NUM_PLANE_NODES }; -enum ePlanePositions -{ - PLANE_POS_LIGHT_LEFT, - PLANE_POS_LIGHT_RIGHT, - PLANE_POS_LIGHT_TAIL, -}; - struct CPlaneNode { CVector p; // position diff --git a/src/vehicles/Train.h b/src/vehicles/Train.h index c645ecaf..3446eeb5 100644 --- a/src/vehicles/Train.h +++ b/src/vehicles/Train.h @@ -24,15 +24,6 @@ enum eTrainNodes NUM_TRAIN_NODES }; -enum eTrainPositions -{ - TRAIN_POS_LIGHT_FRONT, - TRAIN_POS_LIGHT_REAR, - TRAIN_POS_LEFT_ENTRY, - TRAIN_POS_MID_ENTRY, - TRAIN_POS_RIGHT_ENTRY -}; - struct CTrainNode { CVector p; // position diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index 89117d40..c9b6c9e3 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -28,12 +28,6 @@ enum eCarLock { CARLOCK_SKIP_SHUT_DOORS }; - -enum -{ - BOAT_POS_FRONTSEAT -}; - enum eDoors { DOOR_BONNET = 0, diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index 93481105..378e621a 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -25,7 +25,8 @@ #include "Stats.h" #include "TempColModels.h" #include "Timer.h" -#include "Vehicle.h" +#include "Automobile.h" +#include "Boat.h" #include "WaterLevel.h" #include "WeaponInfo.h" #include "World.h" @@ -1631,31 +1632,29 @@ CWeapon::FireInstantHitFromCar(CAutomobile *shooter, bool left) CVehicleModelInfo *modelInfo = shooter->GetModelInfo(); - #define FRONTSEATPOS() (&(shooter->IsBoat() ? modelInfo->m_positions[BOAT_POS_FRONTSEAT] : modelInfo->m_positions[CAR_POS_FRONTSEAT])) - CVector source, target; if ( left ) { source = shooter->GetMatrix() * CVector(-shooter->GetColModel()->boundingBox.max.x + -0.2f, - float(CGeneral::GetRandomNumber() & 255) * 0.001f + FRONTSEATPOS()->y, - FRONTSEATPOS()->z + 0.5f); + float(CGeneral::GetRandomNumber() & 255) * 0.001f + modelInfo->GetFrontSeatPosn().y, + modelInfo->GetFrontSeatPosn().z + 0.5f); source += CTimer::GetTimeStep() * shooter->m_vecMoveSpeed; target = shooter->GetMatrix() * CVector(-info->m_fRange, - FRONTSEATPOS()->y, - FRONTSEATPOS()->z + 0.5f); + modelInfo->GetFrontSeatPosn().y, + modelInfo->GetFrontSeatPosn().z + 0.5f); } else { source = shooter->GetMatrix() * CVector(shooter->GetColModel()->boundingBox.max.x + 0.2f, - float(CGeneral::GetRandomNumber() & 255) * 0.001f + FRONTSEATPOS()->y, - FRONTSEATPOS()->z + 0.5f); + float(CGeneral::GetRandomNumber() & 255) * 0.001f + modelInfo->GetFrontSeatPosn().y, + modelInfo->GetFrontSeatPosn().z + 0.5f); source += CTimer::GetTimeStep() * shooter->m_vecMoveSpeed; target = shooter->GetMatrix() * CVector(info->m_fRange, - FRONTSEATPOS()->y, - FRONTSEATPOS()->z + 0.5f); + modelInfo->GetFrontSeatPosn().y, + modelInfo->GetFrontSeatPosn().z + 0.5f); } #undef FRONTSEATPOS From 2df44208dd21bd8b86bea0214afe61c0c0bf432d Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Wed, 3 Jun 2020 04:45:25 +0300 Subject: [PATCH 090/133] Range2D and Range3D --- src/core/Range2D.cpp | 22 ++++++++++++++++++++++ src/core/Range2D.h | 11 +++++++++++ src/core/Range3D.cpp | 23 +++++++++++++++++++++++ src/core/Range3D.h | 11 +++++++++++ 4 files changed, 67 insertions(+) create mode 100644 src/core/Range2D.cpp create mode 100644 src/core/Range2D.h create mode 100644 src/core/Range3D.cpp create mode 100644 src/core/Range3D.h diff --git a/src/core/Range2D.cpp b/src/core/Range2D.cpp new file mode 100644 index 00000000..daa36d6a --- /dev/null +++ b/src/core/Range2D.cpp @@ -0,0 +1,22 @@ +#include "common.h" +#include "Range2D.h" +#include "General.h" + +CRange2D::CRange2D(CVector2D _min, CVector2D _max) : min(_min), max(_max) {} + +bool +CRange2D::IsInRange(CVector2D vec) +{ + return min.x < vec.x && max.x > vec.x && min.y < vec.y && max.y > vec.y; +} + +void +CRange2D::DebugShowRange(float, int) +{ +} + +CVector2D +CRange2D::GetRandomPointInRange() +{ + return CVector2D(CGeneral::GetRandomNumberInRange(min.x, max.x), CGeneral::GetRandomNumberInRange(min.y, max.y)); +} diff --git a/src/core/Range2D.h b/src/core/Range2D.h new file mode 100644 index 00000000..f239e7de --- /dev/null +++ b/src/core/Range2D.h @@ -0,0 +1,11 @@ +#pragma once + +class CRange2D +{ + CVector2D min, max; +public: + CRange2D(CVector2D _min, CVector2D _max); + bool IsInRange(CVector2D vec); + void DebugShowRange(float, int); + CVector2D GetRandomPointInRange(); +}; \ No newline at end of file diff --git a/src/core/Range3D.cpp b/src/core/Range3D.cpp new file mode 100644 index 00000000..14d2dbd2 --- /dev/null +++ b/src/core/Range3D.cpp @@ -0,0 +1,23 @@ +#include "common.h" +#include "Range3D.h" +#include "General.h" + +CRange3D::CRange3D(CVector _min, CVector _max) : min(_min), max(_max) {} + +bool +CRange3D::IsInRange(CVector vec) +{ + return min.x < vec.x && max.x > vec.x && min.y < vec.y && max.y > vec.y && min.z < vec.z && max.z > vec.z; +} + +void +CRange3D::DebugShowRange(float, int) +{ +} + +CVector +CRange3D::GetRandomPointInRange() +{ + return CVector(CGeneral::GetRandomNumberInRange(min.x, max.x), CGeneral::GetRandomNumberInRange(min.y, max.y), + CGeneral::GetRandomNumberInRange(min.z, max.z)); +} diff --git a/src/core/Range3D.h b/src/core/Range3D.h new file mode 100644 index 00000000..f42b523b --- /dev/null +++ b/src/core/Range3D.h @@ -0,0 +1,11 @@ +#pragma once + +class CRange3D +{ + CVector min, max; +public: + CRange3D(CVector _min, CVector _max); + bool IsInRange(CVector vec); + void DebugShowRange(float, int); + CVector GetRandomPointInRange(); +}; \ No newline at end of file From 04de93796bf6b19e10d46cbca3db3d296dd1612f Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 3 Jun 2020 09:24:02 +0200 Subject: [PATCH 091/133] fix accident~ --- src/vehicles/Automobile.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 9aa5ae7c..9fe172fa 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -2648,6 +2648,8 @@ CAutomobile::HydraulicControl(void) if(m_hydraulicState < 20 && m_fVelocityChangeForAudio > 0.2f){ if(m_hydraulicState == 0){ m_hydraulicState = 20; + for(i = 0; i < 4; i++) + m_aWheelPosition[i] -= 0.06f; DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_HYDRAULIC_1, 0.0f); setPrevRatio = true; }else{ From 12717917cc67c7fa854991b606b7ea71499ec602 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 4 Jun 2020 04:31:04 +0300 Subject: [PATCH 092/133] Restore original logic of CPed::WanderRange --- src/core/Range2D.cpp | 8 +++++++- src/core/Range3D.cpp | 11 +++++++++-- src/peds/Ped.cpp | 15 ++++----------- src/peds/Ped.h | 2 +- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/core/Range2D.cpp b/src/core/Range2D.cpp index daa36d6a..33eafd0e 100644 --- a/src/core/Range2D.cpp +++ b/src/core/Range2D.cpp @@ -18,5 +18,11 @@ CRange2D::DebugShowRange(float, int) CVector2D CRange2D::GetRandomPointInRange() { - return CVector2D(CGeneral::GetRandomNumberInRange(min.x, max.x), CGeneral::GetRandomNumberInRange(min.y, max.y)); + int distX = Abs(max.x - min.x); + int distY = Abs(max.y - min.y); + + float outX = CGeneral::GetRandomNumber() % distX + min.x; + float outY = CGeneral::GetRandomNumber() % distY + min.y; + + return CVector2D(outX, outY); } diff --git a/src/core/Range3D.cpp b/src/core/Range3D.cpp index 14d2dbd2..7fa28d67 100644 --- a/src/core/Range3D.cpp +++ b/src/core/Range3D.cpp @@ -18,6 +18,13 @@ CRange3D::DebugShowRange(float, int) CVector CRange3D::GetRandomPointInRange() { - return CVector(CGeneral::GetRandomNumberInRange(min.x, max.x), CGeneral::GetRandomNumberInRange(min.y, max.y), - CGeneral::GetRandomNumberInRange(min.z, max.z)); + int distX = Abs(max.x - min.x); + int distY = Abs(max.y - min.y); + int distZ = Abs(max.z - min.z); + + float outX = CGeneral::GetRandomNumber() % distX + min.x; + float outY = CGeneral::GetRandomNumber() % distY + min.y; + float outZ = CGeneral::GetRandomNumber() % distZ + min.z; + + return CVector(outX, outY, outZ); } diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 055581ad..88b09e91 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -57,6 +57,7 @@ #include "Timecycle.h" #include "ParticleObject.h" #include "Floater.h" +#include "Range2D.h" #define CAN_SEE_ENTITY_ANGLE_THRESHOLD DEGTORAD(60.0f) @@ -14927,17 +14928,9 @@ CPed::WanderRange(void) bool arrived = Seek(); if (arrived) { Idle(); - if (((m_randomSeed % 256) + 3 * CTimer::GetFrameCounter()) % 1000 > 997) { - - int xDiff = Abs(m_wanderRangeBounds[1].x - m_wanderRangeBounds[0].x); - int yDiff = Abs(m_wanderRangeBounds[1].y - m_wanderRangeBounds[0].y); - - CVector newCoords( - (CGeneral::GetRandomNumber() % xDiff) + m_wanderRangeBounds[0].x, - (CGeneral::GetRandomNumber() % yDiff) + m_wanderRangeBounds[0].y, - GetPosition().z); - - SetSeek(newCoords, 2.5f); + if ((m_randomSeed + 3 * CTimer::GetFrameCounter()) % 1000 > 997) { + CVector2D newCoords2D = m_wanderRangeBounds->GetRandomPointInRange(); + SetSeek(CVector(newCoords2D.x, newCoords2D.y, GetPosition().z), 2.5f); } } } diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 56e527c5..31a75ace 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -468,7 +468,7 @@ public: CEntity *m_pCollidingEntity; uint8 m_stateUnused; uint32 m_timerUnused; - CVector2D *m_wanderRangeBounds; // array with 2 CVector2D (actually unused CRange2D class) - unused + class CRange2D *m_wanderRangeBounds; CWeapon m_weapons[WEAPONTYPE_TOTAL_INVENTORY_WEAPONS]; eWeaponType m_storedWeapon; uint8 m_currentWeapon; // eWeaponType From 2578880e1c7bb0b09e2799efdb364dedc57d46f0 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 4 Jun 2020 05:04:00 +0300 Subject: [PATCH 093/133] PedChat & PedDebug --- src/peds/Ped.cpp | 367 +----------------------------------------- src/peds/Ped.h | 13 ++ src/peds/PedChat.cpp | 153 ++++++++++++++++++ src/peds/PedDebug.cpp | 310 +++++++++++++++++++++++++++++++++++ 4 files changed, 477 insertions(+), 366 deletions(-) create mode 100644 src/peds/PedChat.cpp create mode 100644 src/peds/PedDebug.cpp diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 88b09e91..89c0b6af 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -66,48 +66,6 @@ uint16 gnNumTempPedList; static CColPoint aTempPedColPts[MAX_COLLISION_POINTS]; -// Corresponds to ped sounds (from SOUND_PED_DEATH to SOUND_PED_TAXI_CALL) -PedAudioData CommentWaitTime[39] = { - {500, 800, 500, 2}, - {500, 800, 500, 2}, - {500, 800, 500, 2}, - {500, 800, 500, 2}, - {100, 2, 100, 2}, - {700, 500, 1000, 500}, - {700, 500, 1000, 500}, - {5000, 2000, 15000, 3000}, - {5000, 2000, 15000, 3000}, - {5000, 2000, 15000, 3000}, - {6000, 6000, 6000, 6000}, - {1000, 1000, 2000, 2000}, - {1000, 500, 2000, 1500}, - {1000, 500, 2000, 1500}, - {800, 200, 1000, 500}, - {800, 200, 1000, 500}, - {800, 400, 2000, 1000}, - {800, 400, 2000, 1000}, - {400, 300, 2000, 1000}, - {2000, 1000, 2500, 1500}, - {200, 200, 200, 200}, - {6000, 3000, 5000, 6000}, - {6000, 3000, 9000, 5000}, - {6000, 3000, 9000, 5000}, - {6000, 3000, 9000, 5000}, - {400, 300, 4000, 1000}, - {400, 300, 4000, 1000}, - {400, 300, 4000, 1000}, - {1000, 500, 3000, 1000}, - {1000, 500, 1000, 1000}, - {3000, 2000, 3000, 2000}, - {1000, 500, 3000, 6000}, - {1000, 500, 2000, 4000}, - {1000, 500, 2000, 5000}, - {1000, 500, 3000, 2000}, - {1600, 1000, 2000, 2000}, - {3000, 2000, 5000, 3000}, - {1000, 1000, 1000, 1000}, - {1000, 1000, 5000, 5000}, -}; uint16 nPlayerInComboMove; RpClump *flyingClumpTemp; @@ -160,228 +118,11 @@ void *CPed::operator new(size_t sz, int handle) { return CPools::GetPedPool()->N void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); } void CPed::operator delete(void *p, int handle) { CPools::GetPedPool()->Delete((CPed*)p); } -static char ObjectiveText[][28] = { - "No Obj", - "Wait on Foot", - "Flee on Foot Till Safe", - "Guard Spot", - "Guard Area", - "Wait in Car", - "Wait in Car then Getout", - "Kill Char on Foot", - "Kill Char Any Means", - "Flee Char on Foot Till Safe", - "Flee Char on Foot Always", - "GoTo Char on Foot", - "Follow Char in Formation", - "Leave Car", - "Enter Car as Passenger", - "Enter Car as Driver", - "Follow Car in Car", - "Fire at Obj from Vehicle", - "Destroy Obj", - "Destroy Car", - "GoTo Area Any Means", - "GoTo Area on Foot", - "Run to Area", - "GoTo Area in Car", - "Follow Car on Foot Woffset", - "Guard Attack", - "Set Leader", - "Follow Route", - "Solicit", - "Take Taxi", - "Catch Train", - "Buy IceCream", - "Steal Any Car", - "Mug Char", -#ifdef VC_PED_PORTS - "Leave Car and Die" -#endif -}; - -static char StateText[][18] = { - "None", - "Idle", - "Look Entity", - "Look Heading", - "Wander Range", - "Wander Path", - "Seek Pos", - "Seek Entity", - "Flee Pos", - "Flee Entity", - "Pursue", - "Follow Path", - "Sniper Mode", - "Rocket Mode", - "Dummy", - "Pause", - "Attack", - "Fight", - "Face Phone", - "Make Call", - "Chat", - "Mug", - "AimGun", - "AI Control", - "Seek Car", - "Seek InBoat", - "Follow Route", - "C.P.R.", - "Solicit", - "Buy IceCream", - "Investigate", - "Step away", - "On Fire", - "Unknown", - "STATES_NO_AI", - "Jump", - "Fall", - "GetUp", - "Stagger", - "Dive away", - "STATES_NO_ST", - "Enter Train", - "Exit Train", - "Arrest Plyr", - "Driving", - "Passenger", - "Taxi Passngr", - "Open Door", - "Die", - "Dead", - "CarJack", - "Drag fm Car", - "Enter Car", - "Steal Car", - "Exit Car", - "Hands Up", - "Arrested", -}; - -static char PersonalityTypeText[][18] = { - "Player", - "Cop", - "Medic", - "Fireman", - "Gang 1", - "Gang 2", - "Gang 3", - "Gang 4", - "Gang 5", - "Gang 6", - "Gang 7", - "Street Guy", - "Suit Guy", - "Sensible Guy", - "Geek Guy", - "Old Guy", - "Tough Guy", - "Street Girl", - "Suit Girl", - "Sensible Girl", - "Geek Girl", - "Old Girl", - "Tough Girl", - "Tramp Male", - "Tramp Female", - "Tourist", - "Prostitute", - "Criminal", - "Busker", - "Taxi Driver", - "Psycho", - "Steward", - "Sports Fan", - "Shopper", - "Old Shopper" -}; - -static char WaitStateText[][16] = { - "No Wait", - "Traffic Lights", - "Pause CrossRoad", - "Look CrossRoad", - "Look Ped", - "Look Shop", - "Look Accident", - "FaceOff Gang", - "Double Back", - "Hit Wall", - "Turn 180deg", - "Surprised", - "Ped Stuck", - "Look About", - "Play Duck", - "Play Cower", - "Play Taxi", - "Play HandsUp", - "Play HandsCower", - "Play Chat", - "Finish Flee", -}; - #ifdef TOGGLEABLE_BETA_FEATURES bool CPed::bPopHeadsOnHeadshot = false; bool CPed::bMakePedsRunToPhonesToReportCrimes = false; #endif -#ifndef MASTER -int nDisplayDebugInfo = 0; - -void -CPed::SwitchDebugDisplay(void) -{ - nDisplayDebugInfo = !nDisplayDebugInfo; -} - -void -CPed::DebugRenderOnePedText(void) -{ - if ((GetPosition() - TheCamera.GetPosition()).MagnitudeSqr() < sq(30.0f)) { - float width, height; - RwV3d screenCoords; - CVector bitAbove = GetPosition(); - bitAbove.z += 2.0f; - if (CSprite::CalcScreenCoors(bitAbove, &screenCoords, &width, &height, true)) { - - float lineHeight = SCREEN_SCALE_Y(Min(height/100.0f, 0.7f) * 22.0f); - - DefinedState(); - CFont::SetPropOn(); - CFont::SetBackgroundOn(); - - // Originally both of them were being divided by 60.0f. - float xScale = Min(width / 240.0f, 0.7f); - float yScale = Min(height / 80.0f, 0.7f); - - CFont::SetScale(SCREEN_SCALE_X(xScale), SCREEN_SCALE_Y(yScale)); - CFont::SetCentreOn(); - CFont::SetCentreSize(SCREEN_WIDTH); - CFont::SetJustifyOff(); - CFont::SetColor(CRGBA(255, 255, 0, 255)); - CFont::SetBackGroundOnlyTextOn(); - CFont::SetFontStyle(0); - AsciiToUnicode(StateText[m_nPedState], gUString); - CFont::PrintString(screenCoords.x, screenCoords.y, gUString); - AsciiToUnicode(ObjectiveText[m_objective], gUString); - CFont::PrintString(screenCoords.x, screenCoords.y + lineHeight, gUString); - AsciiToUnicode(PersonalityTypeText[m_pedStats->m_type], gUString); - CFont::PrintString(screenCoords.x, screenCoords.y + 2 * lineHeight, gUString); - AsciiToUnicode(WaitStateText[m_nWaitState], gUString); - CFont::PrintString(screenCoords.x, screenCoords.y + 3 * lineHeight, gUString); - if (m_nPedState == PED_SEEK_POS || m_nPedState == PED_SEEK_ENTITY) { - sprintf(gString, "Safe distance to target: %.2f", m_distanceToCountSeekDone); - AsciiToUnicode(gString, gUString); - CFont::PrintString(screenCoords.x, screenCoords.y + 4 * lineHeight, gUString); - } - DefinedState(); - } - } -} -#endif - CPed::~CPed(void) { CWorld::Remove(this); @@ -2369,7 +2110,7 @@ CPed::SetupLighting(void) #ifndef MASTER // Originally this was being called through iteration of Sectors, but putting it here is better. - if (nDisplayDebugInfo && !IsPlayer()) + if (GetDebugDisplay() != 0 && !IsPlayer()) DebugRenderOnePedText(); #endif @@ -5565,78 +5306,6 @@ CPed::PlayHitSound(CPed *hitTo) DMAudio.PlayOneShot(m_audioEntityId, soundId, 0.0f); } -void -CPed::Say(uint16 audio) -{ - uint16 audioToPlay = audio; - - if (IsPlayer()) { - - // Ofc this part isn't in VC. - switch (audio) { - case SOUND_PED_DEATH: - audioToPlay = SOUND_PED_DAMAGE; - break; - case SOUND_PED_DAMAGE: - case SOUND_PED_HIT: - case SOUND_PED_LAND: - break; - case SOUND_PED_BULLET_HIT: - case SOUND_PED_CAR_JACKED: - case SOUND_PED_DEFEND: - audioToPlay = SOUND_PED_HIT; - break; - default: - return; - } - } else { - if (3.0f + TheCamera.GetPosition().z < GetPosition().z) - return; - - if (TheCamera.m_CameraAverageSpeed > 1.65f) { -#ifdef VC_PED_PORTS - if (audio != SOUND_PED_DAMAGE && audio != SOUND_PED_HIT && audio != SOUND_PED_LAND) -#endif - return; - - } else if (TheCamera.m_CameraAverageSpeed > 1.25f) { - if (audio != SOUND_PED_DEATH && -#ifdef VC_PED_PORTS - audio != SOUND_PED_DAMAGE && audio != SOUND_PED_HIT && audio != SOUND_PED_LAND && -#endif - audio != SOUND_PED_TAXI_WAIT && audio != SOUND_PED_EVADE) - return; - - } else if (TheCamera.m_CameraAverageSpeed > 0.9f) { - switch (audio) { - case SOUND_PED_DEATH: -#ifdef VC_PED_PORTS - case SOUND_PED_DAMAGE: - case SOUND_PED_HIT: - case SOUND_PED_LAND: -#endif - case SOUND_PED_BURNING: - case SOUND_PED_FLEE_SPRINT: - case SOUND_PED_TAXI_WAIT: - case SOUND_PED_EVADE: - case SOUND_PED_CAR_COLLISION: - break; - default: - return; - } - } - } - - if (audioToPlay < m_queuedSound) { - if (audioToPlay != m_lastQueuedSound || audioToPlay == SOUND_PED_DEATH - || CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nOverrideMaxRandomDelayTime - + m_lastSoundStart - + (uint32) CGeneral::GetRandomNumberInRange(0, CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nMaxRandomDelayTime) <= CTimer::GetTimeInMilliseconds()) { - m_queuedSound = audioToPlay; - } - } -} - void CPed::CollideWithPed(CPed *collideWith) { @@ -11053,12 +10722,6 @@ CPed::SetJump(void) } } -bool -CPed::ServiceTalkingWhenDead(void) -{ - return m_queuedSound == SOUND_PED_DEATH; -} - void CPed::RemoveInCarAnims(void) { @@ -16250,34 +15913,6 @@ CPed::SeekCar(void) } } -void -CPed::ServiceTalking(void) -{ - if (!bBodyPartJustCameOff || m_bodyPartBleeding != PED_HEAD) { - if (CGeneral::faststricmp(CModelInfo::GetModelInfo(GetModelIndex())->GetName(), "bomber")) { - if (m_nPedState == PED_ON_FIRE) - m_queuedSound = SOUND_PED_BURNING; - } else { - m_queuedSound = SOUND_PED_BOMBER; - } - if (m_queuedSound != SOUND_NO_SOUND) { - if (m_queuedSound == SOUND_PED_DEATH) - m_soundStart = CTimer::GetTimeInMilliseconds() - 1; - - if (CTimer::GetTimeInMilliseconds() > m_soundStart) { - DMAudio.PlayOneShot(m_audioEntityId, m_queuedSound, 1.0f); - m_lastSoundStart = CTimer::GetTimeInMilliseconds(); - m_soundStart = - CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nFixedDelayTime - + CTimer::GetTimeInMilliseconds() - + CGeneral::GetRandomNumberInRange(0, CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nOverrideFixedDelayTime); - m_lastQueuedSound = m_queuedSound; - m_queuedSound = SOUND_NO_SOUND; - } - } - } -} - void CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk) { diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 31a75ace..59e0053b 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -879,8 +879,21 @@ public: #ifndef MASTER // Mobile things + void DebugDrawPedDestination(CPed *, int, int); + void DebugDrawPedDesiredHeading(CPed *, int, int); + void DebugDrawCollisionRadius(float, float, float, float, int); + void DebugDrawVisionRange(CVector, float); + void DebugDrawVisionSimple(CVector, float); + void DebugDrawLook(); + void DebugDrawPedPsyche(); + void DebugDrawDebugLines(); + static void SwitchDebugDisplay(void); + static int GetDebugDisplay(void); + + void DebugDrawLookAtPoints(); void DebugRenderOnePedText(void); + void DebugRenderClosePedText(); #endif #ifdef PED_SKIN diff --git a/src/peds/PedChat.cpp b/src/peds/PedChat.cpp new file mode 100644 index 00000000..9045a2e0 --- /dev/null +++ b/src/peds/PedChat.cpp @@ -0,0 +1,153 @@ +#include "common.h" +#include "Camera.h" +#include "DMAudio.h" +#include "General.h" +#include "Ped.h" + +// Corresponds to ped sounds (from SOUND_PED_DEATH to SOUND_PED_TAXI_CALL) +PedAudioData CommentWaitTime[39] = { + {500, 800, 500, 2}, + {500, 800, 500, 2}, + {500, 800, 500, 2}, + {500, 800, 500, 2}, + {100, 2, 100, 2}, + {700, 500, 1000, 500}, + {700, 500, 1000, 500}, + {5000, 2000, 15000, 3000}, + {5000, 2000, 15000, 3000}, + {5000, 2000, 15000, 3000}, + {6000, 6000, 6000, 6000}, + {1000, 1000, 2000, 2000}, + {1000, 500, 2000, 1500}, + {1000, 500, 2000, 1500}, + {800, 200, 1000, 500}, + {800, 200, 1000, 500}, + {800, 400, 2000, 1000}, + {800, 400, 2000, 1000}, + {400, 300, 2000, 1000}, + {2000, 1000, 2500, 1500}, + {200, 200, 200, 200}, + {6000, 3000, 5000, 6000}, + {6000, 3000, 9000, 5000}, + {6000, 3000, 9000, 5000}, + {6000, 3000, 9000, 5000}, + {400, 300, 4000, 1000}, + {400, 300, 4000, 1000}, + {400, 300, 4000, 1000}, + {1000, 500, 3000, 1000}, + {1000, 500, 1000, 1000}, + {3000, 2000, 3000, 2000}, + {1000, 500, 3000, 6000}, + {1000, 500, 2000, 4000}, + {1000, 500, 2000, 5000}, + {1000, 500, 3000, 2000}, + {1600, 1000, 2000, 2000}, + {3000, 2000, 5000, 3000}, + {1000, 1000, 1000, 1000}, + {1000, 1000, 5000, 5000}, +}; + +bool +CPed::ServiceTalkingWhenDead(void) +{ + return m_queuedSound == SOUND_PED_DEATH; +} + +void +CPed::ServiceTalking(void) +{ + if (!bBodyPartJustCameOff || m_bodyPartBleeding != PED_HEAD) { + if (!CGeneral::faststricmp(CModelInfo::GetModelInfo(GetModelIndex())->GetName(), "bomber")) + m_queuedSound = SOUND_PED_BOMBER; + else if (m_nPedState == PED_ON_FIRE) + m_queuedSound = SOUND_PED_BURNING; + + if (m_queuedSound != SOUND_NO_SOUND) { + if (m_queuedSound == SOUND_PED_DEATH) + m_soundStart = CTimer::GetTimeInMilliseconds() - 1; + + if (CTimer::GetTimeInMilliseconds() > m_soundStart) { + DMAudio.PlayOneShot(m_audioEntityId, m_queuedSound, 1.0f); + m_lastSoundStart = CTimer::GetTimeInMilliseconds(); + m_soundStart = + CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nFixedDelayTime + + CTimer::GetTimeInMilliseconds() + + CGeneral::GetRandomNumberInRange(0, CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nOverrideFixedDelayTime); + m_lastQueuedSound = m_queuedSound; + m_queuedSound = SOUND_NO_SOUND; + } + } + } +} + +void +CPed::Say(uint16 audio) +{ + uint16 audioToPlay = audio; + + if (IsPlayer()) { + + // Ofc this part isn't in VC. + switch (audio) { + case SOUND_PED_DEATH: + audioToPlay = SOUND_PED_DAMAGE; + break; + case SOUND_PED_DAMAGE: + case SOUND_PED_HIT: + case SOUND_PED_LAND: + break; + case SOUND_PED_BULLET_HIT: + case SOUND_PED_CAR_JACKED: + case SOUND_PED_DEFEND: + audioToPlay = SOUND_PED_HIT; + break; + default: + return; + } + } else { + if (TheCamera.GetPosition().z + 3.0f < GetPosition().z) + return; + + if (TheCamera.m_CameraAverageSpeed > 1.65f) { +#ifdef VC_PED_PORTS + if (audio != SOUND_PED_DAMAGE && audio != SOUND_PED_HIT && audio != SOUND_PED_LAND) +#endif + return; + + } else if (TheCamera.m_CameraAverageSpeed > 1.25f) { + if (audio != SOUND_PED_DEATH && +#ifdef VC_PED_PORTS + audio != SOUND_PED_DAMAGE && audio != SOUND_PED_HIT && audio != SOUND_PED_LAND && +#endif + audio != SOUND_PED_TAXI_WAIT && audio != SOUND_PED_EVADE) + return; + + } else if (TheCamera.m_CameraAverageSpeed > 0.9f) { + switch (audio) { + case SOUND_PED_DEATH: +#ifdef VC_PED_PORTS + case SOUND_PED_DAMAGE: + case SOUND_PED_HIT: + case SOUND_PED_LAND: +#endif + case SOUND_PED_BURNING: + case SOUND_PED_FLEE_SPRINT: + case SOUND_PED_TAXI_WAIT: + case SOUND_PED_EVADE: + case SOUND_PED_CAR_COLLISION: + break; + default: + return; + } + } + } + + if (audioToPlay < m_queuedSound) { + if (audioToPlay != m_lastQueuedSound || audioToPlay == SOUND_PED_DEATH + || CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nOverrideMaxRandomDelayTime + + m_lastSoundStart + + (uint32) CGeneral::GetRandomNumberInRange(0, CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nMaxRandomDelayTime) <= CTimer::GetTimeInMilliseconds()) { + m_queuedSound = audioToPlay; + } + } +} \ No newline at end of file diff --git a/src/peds/PedDebug.cpp b/src/peds/PedDebug.cpp new file mode 100644 index 00000000..1c22963e --- /dev/null +++ b/src/peds/PedDebug.cpp @@ -0,0 +1,310 @@ +#include "common.h" +#ifndef MASTER +#include "main.h" +#include "Camera.h" +#include "Font.h" +#include "Ped.h" +#include "Sprite.h" +#include "Text.h" + + +static char ObjectiveText[][28] = { + "No Obj", + "Wait on Foot", + "Flee on Foot Till Safe", + "Guard Spot", + "Guard Area", + "Wait in Car", + "Wait in Car then Getout", + "Kill Char on Foot", + "Kill Char Any Means", + "Flee Char on Foot Till Safe", + "Flee Char on Foot Always", + "GoTo Char on Foot", + "Follow Char in Formation", + "Leave Car", + "Enter Car as Passenger", + "Enter Car as Driver", + "Follow Car in Car", + "Fire at Obj from Vehicle", + "Destroy Obj", + "Destroy Car", + "GoTo Area Any Means", + "GoTo Area on Foot", + "Run to Area", + "GoTo Area in Car", + "Follow Car on Foot Woffset", + "Guard Attack", + "Set Leader", + "Follow Route", + "Solicit", + "Take Taxi", + "Catch Train", + "Buy IceCream", + "Steal Any Car", + "Mug Char", +#ifdef VC_PED_PORTS + "Leave Car and Die" +#endif +}; + +static char StateText[][18] = { + "None", + "Idle", + "Look Entity", + "Look Heading", + "Wander Range", + "Wander Path", + "Seek Pos", + "Seek Entity", + "Flee Pos", + "Flee Entity", + "Pursue", + "Follow Path", + "Sniper Mode", + "Rocket Mode", + "Dummy", + "Pause", + "Attack", + "Fight", + "Face Phone", + "Make Call", + "Chat", + "Mug", + "AimGun", + "AI Control", + "Seek Car", + "Seek InBoat", + "Follow Route", + "C.P.R.", + "Solicit", + "Buy IceCream", + "Investigate", + "Step away", + "On Fire", + "Unknown", + "STATES_NO_AI", + "Jump", + "Fall", + "GetUp", + "Stagger", + "Dive away", + "STATES_NO_ST", + "Enter Train", + "Exit Train", + "Arrest Plyr", + "Driving", + "Passenger", + "Taxi Passngr", + "Open Door", + "Die", + "Dead", + "CarJack", + "Drag fm Car", + "Enter Car", + "Steal Car", + "Exit Car", + "Hands Up", + "Arrested", +}; + +static char PersonalityTypeText[][18] = { + "Player", + "Cop", + "Medic", + "Fireman", + "Gang 1", + "Gang 2", + "Gang 3", + "Gang 4", + "Gang 5", + "Gang 6", + "Gang 7", + "Street Guy", + "Suit Guy", + "Sensible Guy", + "Geek Guy", + "Old Guy", + "Tough Guy", + "Street Girl", + "Suit Girl", + "Sensible Girl", + "Geek Girl", + "Old Girl", + "Tough Girl", + "Tramp Male", + "Tramp Female", + "Tourist", + "Prostitute", + "Criminal", + "Busker", + "Taxi Driver", + "Psycho", + "Steward", + "Sports Fan", + "Shopper", + "Old Shopper" +}; + +static char WaitStateText[][16] = { + "No Wait", + "Traffic Lights", + "Pause CrossRoad", + "Look CrossRoad", + "Look Ped", + "Look Shop", + "Look Accident", + "FaceOff Gang", + "Double Back", + "Hit Wall", + "Turn 180deg", + "Surprised", + "Ped Stuck", + "Look About", + "Play Duck", + "Play Cower", + "Play Taxi", + "Play HandsUp", + "Play HandsCower", + "Play Chat", + "Finish Flee", +}; + +void +CPed::DebugDrawPedDestination(CPed *, int, int) +{ +#ifndef FINAL + // TODO: something was here +#endif // !FINAL +} + +void +CPed::DebugDrawPedDesiredHeading(CPed *, int, int) +{ +#ifndef FINAL + // TODO: something was here +#endif // !FINAL +} + +void +CPed::DebugDrawCollisionRadius(float, float, float, float, int) +{ +#ifndef FINAL + // TODO: something was here +#endif // !FINAL +} + +void +CPed::DebugDrawVisionRange(CVector a1, float) +{ + for (int i = a1.x - 90; i < a1.x + 89; i += 30) { +#ifndef FINAL + // TODO: something was here +#endif // !FINAL + } +} + +void +CPed::DebugDrawVisionSimple(CVector, float) +{ +#ifndef FINAL + // TODO: something was here +#endif // !FINAL +} + +void +CPed::DebugDrawLook() +{ +#ifndef FINAL + // TODO: something was here +#endif // !FINAL +} + +void +CPed::DebugDrawPedPsyche() +{ +#ifndef FINAL + // TODO: something was here +#endif // !FINAL +} + +void +CPed::DebugDrawDebugLines() +{ +#ifndef FINAL + // TODO: something was here +#endif // !FINAL +} + +int nDisplayDebugInfo = 0; + +void +CPed::SwitchDebugDisplay(void) +{ + if (++nDisplayDebugInfo > 2) + nDisplayDebugInfo = 0; +} + +int +CPed::GetDebugDisplay(void) +{ + return nDisplayDebugInfo; +} + +void +CPed::DebugDrawLookAtPoints() +{ + // TODO: mobile code +} + +void +CPed::DebugRenderOnePedText(void) +{ + if ((GetPosition() - TheCamera.GetPosition()).MagnitudeSqr() < sq(30.0f)) { + float width, height; + RwV3d screenCoords; + CVector bitAbove = GetPosition(); + bitAbove.z += 2.0f; + if (CSprite::CalcScreenCoors(bitAbove, &screenCoords, &width, &height, true)) { + + float lineHeight = SCREEN_SCALE_Y(Min(height / 100.0f, 0.7f) * 22.0f); + + DefinedState(); + CFont::SetPropOn(); + CFont::SetBackgroundOn(); + + // Originally both of them were being divided by 60.0f. + float xScale = Min(width / 240.0f, 0.7f); + float yScale = Min(height / 80.0f, 0.7f); + + CFont::SetScale(SCREEN_SCALE_X(xScale), SCREEN_SCALE_Y(yScale)); + CFont::SetCentreOn(); + CFont::SetCentreSize(SCREEN_WIDTH); + CFont::SetJustifyOff(); + CFont::SetColor(CRGBA(255, 255, 0, 255)); + CFont::SetBackGroundOnlyTextOn(); + CFont::SetFontStyle(0); + AsciiToUnicode(StateText[m_nPedState], gUString); + CFont::PrintString(screenCoords.x, screenCoords.y, gUString); + AsciiToUnicode(ObjectiveText[m_objective], gUString); + CFont::PrintString(screenCoords.x, screenCoords.y + lineHeight, gUString); + AsciiToUnicode(PersonalityTypeText[m_pedStats->m_type], gUString); + CFont::PrintString(screenCoords.x, screenCoords.y + 2 * lineHeight, gUString); + AsciiToUnicode(WaitStateText[m_nWaitState], gUString); + CFont::PrintString(screenCoords.x, screenCoords.y + 3 * lineHeight, gUString); + if (m_nPedState == PED_SEEK_POS || m_nPedState == PED_SEEK_ENTITY) { + sprintf(gString, "Safe distance to target: %.2f", m_distanceToCountSeekDone); + AsciiToUnicode(gString, gUString); + CFont::PrintString(screenCoords.x, screenCoords.y + 4 * lineHeight, gUString); + } + DefinedState(); + } + } +} + +void +CPed::DebugRenderClosePedText() +{ + // TODO: mobile code +} +#endif \ No newline at end of file From 016ebc0b00905c35ca16dcbd22c41fb4602c3e37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Thu, 4 Jun 2020 06:03:12 +0300 Subject: [PATCH 094/133] fixes, mostly from miami --- src/audio/AudioLogic.cpp | 39 +++++----- src/audio/AudioManager.h | 2 +- src/audio/soundlist.h | 36 ++++----- src/core/Frontend.cpp | 154 ++++++++++++++++++++------------------- src/core/Frontend.h | 2 +- src/core/MenuScreens.cpp | 46 ++++++------ src/core/PlayerInfo.cpp | 2 +- src/peds/Ped.cpp | 56 ++++++++------ src/peds/Ped.h | 2 +- src/peds/PlayerPed.cpp | 12 ++- src/render/Hud.cpp | 2 +- src/vehicles/Train.cpp | 4 +- src/vehicles/Vehicle.h | 5 +- 13 files changed, 191 insertions(+), 171 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index ab135877..b6fb5a86 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -1554,27 +1554,23 @@ cAudioManager::UsesSirenSwitching(int32 model) const } } -void +bool cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params) { const float SOUND_INTENSITY = 110.0f; if (params->m_fDistance < SQR(SOUND_INTENSITY)) { CVehicle *veh = params->m_pVehicle; - if (veh->m_bSirenOrAlarm == false && veh->m_nAlarmState <= 0) - return; + if (veh->m_bSirenOrAlarm == false && !veh->IsAlarmOn()) + return true; -#ifdef FIX_BUGS - if (params->m_pVehicle->GetStatus() == STATUS_WRECKED) - return; -#endif CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, SOUND_INTENSITY, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 5; if (UsesSiren(params->m_nIndex)) { if (params->m_pVehicle->GetStatus() == STATUS_ABANDONED) - return; + return true; if (veh->m_nCarHornTimer && params->m_nIndex != FIRETRUK) { m_sQueueSample.m_nSampleIndex = SFX_SIREN_FAST; if (params->m_nIndex == FBICAR) @@ -1604,8 +1600,11 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params) m_sQueueSample.m_bReverbFlag = true; m_sQueueSample.m_bRequireReflection = false; AddSampleToRequestedQueue(); - } - } + return true; + } else + return true; + } else + return false; } bool @@ -2046,7 +2045,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params) maxDist = SQR(SOUND_INTENSITY); break; } - case SOUND_17: { + case SOUND_BOAT_SLOWDOWN: { const float SOUND_INTENSITY = 50.0f; m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_THUMB_OFF; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -2059,8 +2058,8 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params) maxDist = SQR(SOUND_INTENSITY); break; } - case SOUND_18: - case SOUND_19: { + case SOUND_TRAIN_DOOR_CLOSE: + case SOUND_TRAIN_DOOR_OPEN: { const float SOUND_INTENSITY = 35.0f; m_sQueueSample.m_nSampleIndex = SFX_AIR_BRAKES; m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; @@ -2414,7 +2413,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params) m_sQueueSample.m_nSampleIndex = SFX_POLICE_BOAT_IDLE; if (LastAccel > 20) { oneShotVol = LastVol; - PlayOneShot(m_sQueueSample.m_nEntityIndex, SOUND_17, oneShotVol); + PlayOneShot(m_sQueueSample.m_nEntityIndex, SOUND_BOAT_SLOWDOWN, oneShotVol); } } else { emittingVol = 105 * padAccelerate / 255 + 15; @@ -8002,7 +8001,7 @@ cAudioManager::ProcessFrontEnd() processedPickup = true; stereo = true; break; - case SOUND_4A: + case SOUND_PICKUP_ERROR: m_sQueueSample.m_nSampleIndex = SFX_PICKUP_ERROR_LEFT; processedPickup = true; stereo = true; @@ -8037,19 +8036,19 @@ cAudioManager::ProcessFrontEnd() m_sQueueSample.m_nSampleIndex = SFX_START_BUTTON_LEFT; stereo = true; break; - case SOUND_FRONTEND_MENU_COMPLETED: + case SOUND_FRONTEND_MENU_NEW_PAGE: m_sQueueSample.m_nSampleIndex = SFX_PAGE_CHANGE_AND_BACK_LEFT; stereo = true; break; - case SOUND_FRONTEND_MENU_DENIED: + case SOUND_FRONTEND_MENU_NAVIGATION: m_sQueueSample.m_nSampleIndex = SFX_HIGHLIGHT_LEFT; stereo = true; break; - case SOUND_FRONTEND_MENU_SUCCESS: + case SOUND_FRONTEND_MENU_SETTING_CHANGE: m_sQueueSample.m_nSampleIndex = SFX_SELECT_LEFT; stereo = true; break; - case SOUND_FRONTEND_EXIT: + case SOUND_FRONTEND_MENU_BACK: m_sQueueSample.m_nSampleIndex = SFX_SUB_MENU_BACK_LEFT; stereo = true; break; @@ -8071,7 +8070,7 @@ cAudioManager::ProcessFrontEnd() case SOUND_FRONTEND_RADIO_CHANGE: m_sQueueSample.m_nSampleIndex = SFX_RADIO_CLICK; break; - case SOUND_A0: + case SOUND_HUD: m_sQueueSample.m_nSampleIndex = SFX_INFO; break; default: diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 8e1c9590..c9cb5bef 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -420,7 +420,7 @@ public: void ProcessVehicleOneShots(cVehicleParams *params); bool ProcessVehicleReverseWarning(cVehicleParams *params); bool ProcessVehicleRoadNoise(cVehicleParams *params); - void ProcessVehicleSirenOrAlarm(cVehicleParams *params); + bool ProcessVehicleSirenOrAlarm(cVehicleParams *params); void ProcessVehicleSkidding(cVehicleParams *params); void ProcessWaterCannon(int32); void ProcessWeather(int32 id); diff --git a/src/audio/soundlist.h b/src/audio/soundlist.h index 6d1ff6e3..08a1631e 100644 --- a/src/audio/soundlist.h +++ b/src/audio/soundlist.h @@ -25,9 +25,9 @@ enum eSound : uint16 SOUND_CAR_HYDRAULIC_3, SOUND_CAR_JERK, SOUND_CAR_SPLASH, - SOUND_17, - SOUND_18, - SOUND_19, + SOUND_BOAT_SLOWDOWN, + SOUND_TRAIN_DOOR_CLOSE, + SOUND_TRAIN_DOOR_OPEN, SOUND_CAR_TANK_TURRET_ROTATE, SOUND_CAR_BOMB_TICK, SOUND_PLANE_ON_GROUND, @@ -76,7 +76,7 @@ enum eSound : uint16 SOUND_PICKUP_WEAPON_BOUGHT, SOUND_PICKUP_WEAPON, SOUND_PICKUP_HEALTH, - SOUND_4A, + SOUND_PICKUP_ERROR, SOUND_4B, SOUND_PICKUP_ADRENALINE, SOUND_PICKUP_ARMOUR, @@ -99,25 +99,25 @@ enum eSound : uint16 SOUND_EVIDENCE_PICKUP, SOUND_UNLOAD_GOLD, SOUND_PAGER, - SOUND_PED_DEATH, // 103 in VC - SOUND_PED_DAMAGE, // 104 in VC - SOUND_PED_HIT, // 105 in VC - SOUND_PED_LAND, // hopefully 106 in VC + SOUND_PED_DEATH, + SOUND_PED_DAMAGE, + SOUND_PED_HIT, + SOUND_PED_LAND, SOUND_PED_BULLET_HIT, SOUND_PED_BOMBER, - SOUND_PED_BURNING, // 108 in VC + SOUND_PED_BURNING, SOUND_PED_ARREST_FBI, SOUND_PED_ARREST_SWAT, SOUND_PED_ARREST_COP, SOUND_PED_HELI_PLAYER_FOUND, SOUND_PED_HANDS_UP, SOUND_PED_HANDS_COWER, - SOUND_PED_FLEE_SPRINT, // 120 in VC + SOUND_PED_FLEE_SPRINT, SOUND_PED_CAR_JACKING, SOUND_PED_MUGGING, SOUND_PED_CAR_JACKED, SOUND_PED_ROBBED, - SOUND_PED_TAXI_WAIT, // 137 in VC + SOUND_PED_TAXI_WAIT, SOUND_PED_ATTACK, SOUND_PED_DEFEND, SOUND_PED_PURSUIT_ARMY, @@ -127,9 +127,9 @@ enum eSound : uint16 SOUND_PED_HEALING, SOUND_PED_7B, SOUND_PED_LEAVE_VEHICLE, - SOUND_PED_EVADE, // 142 in VC + SOUND_PED_EVADE, SOUND_PED_FLEE_RUN, - SOUND_PED_CAR_COLLISION, // 144-145-146 in VC + SOUND_PED_CAR_COLLISION, SOUND_PED_SOLICIT, SOUND_PED_EXTINGUISHING_FIRE, SOUND_PED_WAIT_DOUBLEBACK, @@ -152,17 +152,17 @@ enum eSound : uint16 SOUND_CLOCK_TICK, SOUND_PART_MISSION_COMPLETE, SOUND_FRONTEND_MENU_STARTING, - SOUND_FRONTEND_MENU_COMPLETED, - SOUND_FRONTEND_MENU_DENIED, - SOUND_FRONTEND_MENU_SUCCESS, - SOUND_FRONTEND_EXIT, + SOUND_FRONTEND_MENU_NEW_PAGE, + SOUND_FRONTEND_MENU_NAVIGATION, + SOUND_FRONTEND_MENU_SETTING_CHANGE, + SOUND_FRONTEND_MENU_BACK, SOUND_9A, SOUND_9B, SOUND_FRONTEND_AUDIO_TEST, SOUND_FRONTEND_FAIL, SOUND_FRONTEND_NO_RADIO, SOUND_FRONTEND_RADIO_CHANGE, - SOUND_A0, + SOUND_HUD, SOUND_AMMUNATION_WELCOME_1, SOUND_AMMUNATION_WELCOME_2, SOUND_AMMUNATION_WELCOME_3, diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index b95deee3..3ead688b 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -274,8 +274,9 @@ ScaleAndCenterX(float x) #define ChangeScreen(screen, option, updateDelay, clearAlpha) \ do { \ m_nPrevScreen = m_nCurrScreen; \ + int newOpt = option; \ m_nCurrScreen = screen; \ - m_nCurrOption = option; \ + m_nCurrOption = newOpt; \ if(updateDelay) \ m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode(); \ if(clearAlpha) \ @@ -351,7 +352,7 @@ CMenuManager::PageUpList(bool playSoundOnSuccess) if (m_nTotalListRow > MAX_VISIBLE_LIST_ROW) { if (m_nFirstVisibleRowOnList > 0) { if(playSoundOnSuccess) - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); m_nFirstVisibleRowOnList = Max(0, m_nFirstVisibleRowOnList - MAX_VISIBLE_LIST_ROW); m_nSelectedListRow = Min(m_nSelectedListRow, m_nFirstVisibleRowOnList + MAX_VISIBLE_LIST_ROW - 1); @@ -369,7 +370,7 @@ CMenuManager::PageDownList(bool playSoundOnSuccess) if (m_nTotalListRow > MAX_VISIBLE_LIST_ROW) { if (m_nFirstVisibleRowOnList < m_nTotalListRow - MAX_VISIBLE_LIST_ROW) { if(playSoundOnSuccess) - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); m_nFirstVisibleRowOnList = Min(m_nFirstVisibleRowOnList + MAX_VISIBLE_LIST_ROW, m_nTotalListRow - MAX_VISIBLE_LIST_ROW); m_nSelectedListRow = Max(m_nSelectedListRow, m_nFirstVisibleRowOnList); @@ -652,7 +653,7 @@ CMenuManager::DisplayHelperText() case 0: { int action = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action; - if (action != MENUACTION_CHANGEMENU && action != MENUACTION_REDEFCTRL && action != MENUACTION_RESTOREDEF) { + if (action != MENUACTION_CHANGEMENU && action != MENUACTION_KEYBOARDCTRLS && action != MENUACTION_RESTOREDEF) { CFont::SetColor(CRGBA(255, 255, 255, 255)); CFont::PrintString(MENU_X_LEFT_ALIGNED(320.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), TheText.Get("FET_MIG")); } @@ -1255,7 +1256,7 @@ CMenuManager::Draw() } if (oldOption != m_nCurrOption) { if (oldScreen == m_nCurrScreen && m_bShowMouse) - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); oldOption = m_nCurrOption; oldScreen = m_nCurrScreen; @@ -1769,7 +1770,7 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8 CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE)); CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); if (!m_bKeyIsOK) - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); m_bKeyIsOK = true; } else { @@ -1973,7 +1974,7 @@ CMenuManager::DrawControllerSetupScreen() float curOptY = i * rowHeight + yStart; if (m_nMousePosY > MENU_Y(curOptY) && m_nMousePosY < MENU_Y(rowHeight + curOptY)) { if (m_nPrevOption != i && m_nCurrExLayer == HOVEROPTION_LIST) - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); m_nPrevOption = i; if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) { @@ -1987,7 +1988,7 @@ CMenuManager::DrawControllerSetupScreen() if (m_nMousePosX > MENU_X_LEFT_ALIGNED(0.0f) && m_nMousePosX < MENU_X_LEFT_ALIGNED(370.0f)) { #endif if (m_nSelectedContSetupColumn != CONTSETUP_PED_COLUMN && m_nCurrExLayer == HOVEROPTION_LIST) - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); m_nSelectedContSetupColumn = CONTSETUP_PED_COLUMN; #ifdef FIX_BUGS @@ -1996,7 +1997,7 @@ CMenuManager::DrawControllerSetupScreen() } else if (m_nMousePosX > MENU_X_LEFT_ALIGNED(370.0f) && m_nMousePosX < SCREEN_WIDTH) { #endif if (m_nSelectedContSetupColumn != CONTSETUP_VEHICLE_COLUMN && m_nCurrExLayer == HOVEROPTION_LIST) - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); m_nSelectedContSetupColumn = CONTSETUP_VEHICLE_COLUMN; } @@ -2694,13 +2695,13 @@ CMenuManager::DrawPlayerSetupScreen() if (rowIdx == m_nSelectedListRow) { m_nHoverOption = HOVEROPTION_NOT_HOVERING; if (m_nSkinsTotal > 0) { - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); strcpy(m_PrefsSkinFile, m_aSkinName); CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile); SaveSettings(); } } else { - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); m_nCurrExLayer = HOVEROPTION_LIST; m_nSelectedListRow = rowIdx; m_nHoverOption = HOVEROPTION_NOT_HOVERING; @@ -2856,7 +2857,7 @@ CMenuManager::DrawPlayerSetupScreen() && m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM - 26)) || m_nCurrExLayer == HOVEROPTION_BACK) { if (m_nHoverOption != HOVEROPTION_BACK) - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); m_nHoverOption = HOVEROPTION_BACK; @@ -2867,7 +2868,7 @@ CMenuManager::DrawPlayerSetupScreen() && m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM - 26)) || m_nCurrExLayer == HOVEROPTION_USESKIN) { if (m_nHoverOption != HOVEROPTION_USESKIN) - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); m_nHoverOption = HOVEROPTION_USESKIN; @@ -3655,7 +3656,7 @@ CMenuManager::Process(void) field_535 = true; } else { - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); for (int i = 0; i < 4; i++) ControlsManager.ClearSettingsAssociatedWithAction((e_ControllerAction)m_CurrCntrlAction, (eControllerType)i); m_bKeyIsOK = false; @@ -3782,7 +3783,7 @@ CMenuManager::ProcessButtonPresses(void) } if (CPad::GetPad(0)->GetTabJustDown()) { - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); m_bShowMouse = false; switch (m_nCurrExLayer) { case HOVEROPTION_BACK: @@ -3818,7 +3819,7 @@ CMenuManager::ProcessButtonPresses(void) if (!m_bPressedUpOnList) { m_bPressedUpOnList = true; lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); ScrollUpListByOne(); } } else { @@ -3840,7 +3841,7 @@ CMenuManager::ProcessButtonPresses(void) if (!m_bPressedDownOnList) { m_bPressedDownOnList = true; lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); ScrollDownListByOne(); } } else { @@ -3856,7 +3857,7 @@ CMenuManager::ProcessButtonPresses(void) m_bPressedPgUpOnList = true; lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); m_bShowMouse = false; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); PageUpList(false); } } @@ -3868,14 +3869,14 @@ CMenuManager::ProcessButtonPresses(void) m_bPressedPgDnOnList = true; lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); m_bShowMouse = false; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); PageDownList(false); } } if (CPad::GetPad(0)->GetHome()) { m_nCurrExLayer = HOVEROPTION_LIST; m_bShowMouse = false; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); if (m_nTotalListRow >= MAX_VISIBLE_LIST_ROW) { m_nFirstVisibleRowOnList = 0; } @@ -3885,7 +3886,7 @@ CMenuManager::ProcessButtonPresses(void) if (CPad::GetPad(0)->GetEnd()) { m_nCurrExLayer = HOVEROPTION_LIST; m_bShowMouse = false; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); if (m_nTotalListRow >= MAX_VISIBLE_LIST_ROW) { m_nFirstVisibleRowOnList = m_nTotalListRow - MAX_VISIBLE_LIST_ROW; } @@ -3914,7 +3915,7 @@ CMenuManager::ProcessButtonPresses(void) break; case HOVEROPTION_USESKIN: if (m_nSkinsTotal > 0) { - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); m_pSelectedSkin = m_pSkinListHead.nextSkin; strcpy(m_PrefsSkinFile, m_aSkinName); CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile); @@ -3983,11 +3984,11 @@ CMenuManager::ProcessButtonPresses(void) } else { if (CPad::GetPad(0)->GetDownJustDown() || CPad::GetPad(0)->GetAnaloguePadDown() || CPad::GetPad(0)->GetDPadDownJustDown()) { m_bShowMouse = false; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); goDown = true; } else if (CPad::GetPad(0)->GetUpJustDown() || CPad::GetPad(0)->GetAnaloguePadUp() || CPad::GetPad(0)->GetDPadUpJustDown()) { m_bShowMouse = false; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); goUp = true; } @@ -4018,7 +4019,7 @@ CMenuManager::ProcessButtonPresses(void) } else if (CPad::GetPad(0)->GetLeftMouseJustDown()) { #ifdef TIDY_UP_PBP if (m_nHoverOption >= HOVEROPTION_RADIO_0 && m_nHoverOption <= HOVEROPTION_RADIO_9) { - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); m_PrefsRadioStation = m_nHoverOption - HOVEROPTION_RADIO_0; SaveSettings(); DMAudio.SetRadioInCar(m_PrefsRadioStation); @@ -4032,7 +4033,7 @@ CMenuManager::ProcessButtonPresses(void) #else switch (m_nHoverOption) { case HOVEROPTION_RADIO_0: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); m_PrefsRadioStation = HEAD_RADIO; SaveSettings(); DMAudio.SetRadioInCar(m_PrefsRadioStation); @@ -4040,7 +4041,7 @@ CMenuManager::ProcessButtonPresses(void) OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RADIO_1: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); m_PrefsRadioStation = DOUBLE_CLEF; SaveSettings(); DMAudio.SetRadioInCar(m_PrefsRadioStation); @@ -4048,7 +4049,7 @@ CMenuManager::ProcessButtonPresses(void) OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RADIO_2: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); m_PrefsRadioStation = JAH_RADIO; SaveSettings(); DMAudio.SetRadioInCar(m_PrefsRadioStation); @@ -4056,7 +4057,7 @@ CMenuManager::ProcessButtonPresses(void) OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RADIO_3: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); m_PrefsRadioStation = RISE_FM; SaveSettings(); DMAudio.SetRadioInCar(m_PrefsRadioStation); @@ -4064,7 +4065,7 @@ CMenuManager::ProcessButtonPresses(void) OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RADIO_4: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); m_PrefsRadioStation = LIPS_106; SaveSettings(); DMAudio.SetRadioInCar(m_PrefsRadioStation); @@ -4072,7 +4073,7 @@ CMenuManager::ProcessButtonPresses(void) OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RADIO_5: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); m_PrefsRadioStation = GAME_FM; SaveSettings(); DMAudio.SetRadioInCar(m_PrefsRadioStation); @@ -4080,7 +4081,7 @@ CMenuManager::ProcessButtonPresses(void) OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RADIO_6: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); m_PrefsRadioStation = MSX_FM; SaveSettings(); DMAudio.SetRadioInCar(m_PrefsRadioStation); @@ -4088,7 +4089,7 @@ CMenuManager::ProcessButtonPresses(void) OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RADIO_7: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); m_PrefsRadioStation = FLASHBACK; SaveSettings(); DMAudio.SetRadioInCar(m_PrefsRadioStation); @@ -4096,7 +4097,7 @@ CMenuManager::ProcessButtonPresses(void) OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RADIO_8: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); m_PrefsRadioStation = CHATTERBOX; SaveSettings(); DMAudio.SetRadioInCar(m_PrefsRadioStation); @@ -4104,7 +4105,7 @@ CMenuManager::ProcessButtonPresses(void) OutputDebugString("FRONTEND RADIO STATION CHANGED"); break; case HOVEROPTION_RADIO_9: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); m_PrefsRadioStation = USERTRACK; SaveSettings(); DMAudio.SetRadioInCar(m_PrefsRadioStation); @@ -4234,11 +4235,11 @@ CMenuManager::ProcessButtonPresses(void) || CPad::GetPad(0)->GetMouseWheelUpJustDown() || CPad::GetPad(0)->GetMouseWheelDownJustDown()) { int option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action; if (option == MENUACTION_BRIGHTNESS || option == MENUACTION_DRAWDIST) - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); else if (option == MENUACTION_SFXVOLUME) DMAudio.PlayFrontEndSound(SOUND_FRONTEND_AUDIO_TEST, 0); else if (option == MENUACTION_MOUSESENS) - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); } #ifndef TIDY_UP_PBP @@ -4298,14 +4299,14 @@ CMenuManager::ProcessButtonPresses(void) #ifdef PS2_LIKE_MENU if (CPad::GetPad(0)->GetLeftMouseJustDown() && hoveredBottomBarOption != -1) { - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); bottomBarActive = false; curBottomBarOption = hoveredBottomBarOption; ChangeScreen(bbNames[curBottomBarOption].screenId, 0, true, false); return; } else if (bottomBarActive) { if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown()) { - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); bottomBarActive = false; // If there's a menu change with fade ongoing, finish it now @@ -4315,7 +4316,7 @@ CMenuManager::ProcessButtonPresses(void) } else if (CPad::GetPad(0)->GetLeftJustDown() || CPad::GetPad(0)->GetAnaloguePadLeft() || CPad::GetPad(0)->GetDPadLeftJustDown() || CPad::GetPad(0)->GetUpJustDown() || CPad::GetPad(0)->GetAnaloguePadUp() || CPad::GetPad(0)->GetDPadUpJustDown()) { m_bShowMouse = false; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); if (curBottomBarOption > 0) curBottomBarOption--; ChangeScreen(bbNames[curBottomBarOption].screenId, 0, true, true); @@ -4323,7 +4324,7 @@ CMenuManager::ProcessButtonPresses(void) } else if (CPad::GetPad(0)->GetRightJustDown() || CPad::GetPad(0)->GetAnaloguePadRight() || CPad::GetPad(0)->GetDPadRightJustDown() || CPad::GetPad(0)->GetDownJustDown() || CPad::GetPad(0)->GetAnaloguePadDown() || CPad::GetPad(0)->GetDPadDownJustDown()) { m_bShowMouse = false; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); if (curBottomBarOption < bbTabCount-1) curBottomBarOption++; ChangeScreen(bbNames[curBottomBarOption].screenId, 0, true, true); @@ -4363,9 +4364,9 @@ CMenuManager::ProcessButtonPresses(void) if (Slots[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot - 1] == SLOT_EMPTY) DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0); else - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); } else - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_COMPLETED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); } else { // This is duplicate, back button already processed below #ifndef TIDY_UP_PBP @@ -4381,7 +4382,7 @@ CMenuManager::ProcessButtonPresses(void) DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0); } else { if (m_nCurrScreen != MENUPAGE_NEW_GAME_RELOAD) { - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); } } } else if (option != MENUACTION_CHANGEMENU && option != MENUACTION_BRIGHTNESS && option != MENUACTION_DRAWDIST @@ -4389,7 +4390,7 @@ CMenuManager::ProcessButtonPresses(void) && option != MENUACTION_CHECKSAVE && option != MENUACTION_UNK24 && option != MENUACTION_MOUSESENS && option != MENUACTION_SCREENRES) { - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); } if ((m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) || (m_nCurrScreen == MENUPAGE_SKIN_SELECT)) { @@ -4588,7 +4589,7 @@ CMenuManager::ProcessButtonPresses(void) SaveSettings(); ChangeScreen(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, 0, true, true); break; - case MENUACTION_REDEFCTRL: + case MENUACTION_KEYBOARDCTRLS: ChangeScreen(MENUPAGE_KEYBOARD_CONTROLS, 0, true, true); m_nSelectedListRow = 0; m_nCurrExLayer = HOVEROPTION_LIST; @@ -4615,7 +4616,8 @@ CMenuManager::ProcessButtonPresses(void) #endif break; case MENUACTION_DONTCANCEL: - ChangeScreen(aScreens[m_nCurrScreen].m_PreviousPage[1], aScreens[m_nCurrScreen].m_ParentEntry[1], true, true); + ChangeScreen(!m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0], + GetPreviousPageOption(), true, true); break; case MENUACTION_SCREENRES: if (m_nDisplayVideoMode != m_nPrefsVideoMode) { @@ -4631,7 +4633,7 @@ CMenuManager::ProcessButtonPresses(void) if (selectedProvider != -1) { m_nPrefsAudio3DProviderIndex = DMAudio.SetCurrent3DProvider(m_nPrefsAudio3DProviderIndex); if (selectedProvider == m_nPrefsAudio3DProviderIndex) { - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); SetHelperText(0); } else { DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0); @@ -4784,7 +4786,7 @@ CMenuManager::ProcessButtonPresses(void) if (goBack) { ResetHelperText(); - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_EXIT, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_BACK, 0); #ifdef PS2_LIKE_MENU if (m_nCurrScreen == MENUPAGE_PAUSE_MENU || bottomBarActive) { #else @@ -4897,7 +4899,7 @@ CMenuManager::ProcessButtonPresses(void) switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) { case MENUACTION_RADIO: m_PrefsRadioStation += changeValueBy; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); if (DMAudio.IsMP3RadioChannelAvailable()) { if (m_PrefsRadioStation < HEAD_RADIO) m_PrefsRadioStation = USERTRACK; @@ -4925,14 +4927,14 @@ CMenuManager::ProcessButtonPresses(void) if (m_PrefsUseWideScreen < 0) m_PrefsUseWideScreen = 2; } - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); SaveSettings(); break; #endif case MENUACTION_SCREENRES: if (m_bGameNotLoaded) { RwChar** videoMods = _psGetVideoModeList(); - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); if (changeValueBy > 0) { do { ++m_nDisplayVideoMode; @@ -4955,7 +4957,7 @@ CMenuManager::ProcessButtonPresses(void) m_nPrefsAudio3DProviderIndex += changeValueBy; m_nPrefsAudio3DProviderIndex = clamp(m_nPrefsAudio3DProviderIndex, 0, DMAudio.GetNum3DProvidersAvailable() - 1); } - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); break; case MENUACTION_SPEAKERCONF: if (m_nPrefsAudio3DProviderIndex != -1) { @@ -4963,13 +4965,13 @@ CMenuManager::ProcessButtonPresses(void) m_PrefsSpeakers = clamp(m_PrefsSpeakers, 0, 2); DMAudio.SetSpeakerConfig(m_PrefsSpeakers); SaveSettings(); - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); } break; case MENUACTION_CTRLMETHOD: m_ControlMethod = !m_ControlMethod; CCamera::m_bUseMouse3rdPerson = !m_ControlMethod; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); SaveSettings(); break; #ifdef CUSTOM_FRONTEND_OPTIONS @@ -4993,7 +4995,7 @@ CMenuManager::ProcessButtonPresses(void) } else if (option.type == FEOPTION_DYNAMIC) { option.buttonPressFunc(changeValueBy > 0 ? FEOPTION_ACTION_RIGHT : FEOPTION_ACTION_LEFT); } - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); } else assert(0 && "Custom frontend options are borked"); @@ -5008,7 +5010,7 @@ CMenuManager::ProcessButtonPresses(void) } else { m_nSelectedContSetupColumn = CONTSETUP_VEHICLE_COLUMN; } - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); } } } @@ -5024,31 +5026,31 @@ CMenuManager::ProcessOnOffMenuOptions() CPad::GetPad(0)->StartShake(350, 150); TimeToStopPadShaking = CTimer::GetTimeInMillisecondsPauseMode() + 500; } - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); break; case MENUACTION_CTRLCONFIG: CPad::GetPad(0)->Mode++; if (CPad::GetPad(0)->Mode > 3) CPad::GetPad(0)->Mode = 0; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); break; case MENUACTION_CTRLDISPLAY: m_DisplayControllerOnFoot = !m_DisplayControllerOnFoot; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); break; case MENUACTION_FRAMESYNC: m_PrefsVsyncDisp = !m_PrefsVsyncDisp; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); SaveSettings(); break; case MENUACTION_FRAMELIMIT: m_PrefsFrameLimiter = !m_PrefsFrameLimiter; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); SaveSettings(); break; case MENUACTION_TRAILS: CMBlur::BlurOn = !CMBlur::BlurOn; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); SaveSettings(); if (CMBlur::BlurOn) CMBlur::MotionBlurOpen(Scene.camera); @@ -5057,60 +5059,60 @@ CMenuManager::ProcessOnOffMenuOptions() break; case MENUACTION_SUBTITLES: m_PrefsShowSubtitles = !m_PrefsShowSubtitles; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); SaveSettings(); break; #ifndef ASPECT_RATIO_SCALE case MENUACTION_WIDESCREEN: m_PrefsUseWideScreen = !m_PrefsUseWideScreen; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); SaveSettings(); break; #endif case MENUACTION_SETDBGFLAG: CTheScripts::InvertDebugFlag(); - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); break; case MENUACTION_SWITCHBIGWHITEDEBUGLIGHT: gbBigWhiteDebugLightSwitchedOn = !gbBigWhiteDebugLightSwitchedOn; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); break; case MENUACTION_PEDROADGROUPS: gbShowPedRoadGroups = !gbShowPedRoadGroups; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); break; case MENUACTION_CARROADGROUPS: gbShowCarRoadGroups = !gbShowCarRoadGroups; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); break; case MENUACTION_COLLISIONPOLYS: gbShowCollisionPolys = !gbShowCollisionPolys; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); break; case MENUACTION_MP_PLAYERCOLOR: PickNewPlayerColour(); - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); SaveSettings(); break; case MENUACTION_SHOWHEADBOB: TheCamera.m_bHeadBob = !TheCamera.m_bHeadBob; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); SaveSettings(); break; case MENUACTION_INVVERT: MousePointerStateHelper.bInvertVertically = !MousePointerStateHelper.bInvertVertically; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); SaveSettings(); break; case MENUACTION_DYNAMICACOUSTIC: m_PrefsDMA = !m_PrefsDMA; DMAudio.SetDynamicAcousticModelingStatus(m_PrefsDMA); - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); SaveSettings(); break; case MENUACTION_MOUSESTEER: CVehicle::m_bDisableMouseSteering = !CVehicle::m_bDisableMouseSteering; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); SaveSettings(); break; } @@ -5678,7 +5680,7 @@ CMenuManager::PrintMap(void) float x = ((mapPoint.x - diffX) / (fMapSize * 2)) * 4000.0f - 2000.0f; float y = 2000.0f - ((mapPoint.y - diffY) / (fMapSize * 2)) * 4000.0f; CRadar::ToggleTargetMarker(x, y); - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); } } diff --git a/src/core/Frontend.h b/src/core/Frontend.h index 7d4cdacc..f992b5c8 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -327,7 +327,7 @@ enum eMenuAction MENUACTION_UNK69, MENUACTION_UNK70, MENUACTION_FINDMP, - MENUACTION_REDEFCTRL, + MENUACTION_KEYBOARDCTRLS, MENUACTION_UNK73, MENUACTION_INITMP, MENUACTION_MP_PLAYERCOLOR, diff --git a/src/core/MenuScreens.cpp b/src/core/MenuScreens.cpp index 4ced8c0b..7b66a27a 100644 --- a/src/core/MenuScreens.cpp +++ b/src/core/MenuScreens.cpp @@ -61,38 +61,38 @@ CMenuScreen aScreens[] = { // MENUPAGE_LANGUAGE_SETTINGS = 7 { "FET_LAN", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 3, 3, - MENUACTION_LANG_ENG, "FEL_ENG", SAVESLOT_NONE, MENUPAGE_NONE, - MENUACTION_LANG_FRE, "FEL_FRE", SAVESLOT_NONE, MENUPAGE_NONE, - MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_NONE, - MENUACTION_LANG_ITA, "FEL_ITA", SAVESLOT_NONE, MENUPAGE_NONE, - MENUACTION_LANG_SPA, "FEL_SPA", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_LANG_ENG, "FEL_ENG", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS, + MENUACTION_LANG_FRE, "FEL_FRE", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS, + MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS, + MENUACTION_LANG_ITA, "FEL_ITA", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS, + MENUACTION_LANG_SPA, "FEL_SPA", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, // MENUPAGE_CHOOSE_LOAD_SLOT = 8 { "FET_LG", 1, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 1, 1, MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME, - MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_LOAD_SLOT_CONFIRM, - MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_LOAD_SLOT_CONFIRM, - MENUACTION_CHECKSAVE, "FEM_SL3", SAVESLOT_3, MENUPAGE_LOAD_SLOT_CONFIRM, - MENUACTION_CHECKSAVE, "FEM_SL4", SAVESLOT_4, MENUPAGE_LOAD_SLOT_CONFIRM, - MENUACTION_CHECKSAVE, "FEM_SL5", SAVESLOT_5, MENUPAGE_LOAD_SLOT_CONFIRM, - MENUACTION_CHECKSAVE, "FEM_SL6", SAVESLOT_6, MENUPAGE_LOAD_SLOT_CONFIRM, - MENUACTION_CHECKSAVE, "FEM_SL7", SAVESLOT_7, MENUPAGE_LOAD_SLOT_CONFIRM, - MENUACTION_CHECKSAVE, "FEM_SL8", SAVESLOT_8, MENUPAGE_LOAD_SLOT_CONFIRM, + MENUACTION_CHECKSAVE, "FEM_SL0", SAVESLOT_1, MENUPAGE_LOAD_SLOT_CONFIRM, + MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_2, MENUPAGE_LOAD_SLOT_CONFIRM, + MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_3, MENUPAGE_LOAD_SLOT_CONFIRM, + MENUACTION_CHECKSAVE, "FEM_SL3", SAVESLOT_4, MENUPAGE_LOAD_SLOT_CONFIRM, + MENUACTION_CHECKSAVE, "FEM_SL4", SAVESLOT_5, MENUPAGE_LOAD_SLOT_CONFIRM, + MENUACTION_CHECKSAVE, "FEM_SL5", SAVESLOT_6, MENUPAGE_LOAD_SLOT_CONFIRM, + MENUACTION_CHECKSAVE, "FEM_SL6", SAVESLOT_7, MENUPAGE_LOAD_SLOT_CONFIRM, + MENUACTION_CHECKSAVE, "FEM_SL7", SAVESLOT_8, MENUPAGE_LOAD_SLOT_CONFIRM, }, // MENUPAGE_CHOOSE_DELETE_SLOT = 9 { "FET_DG", 1, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 2, 2, MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME, - MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_DELETE_SLOT_CONFIRM, - MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_DELETE_SLOT_CONFIRM, - MENUACTION_CHECKSAVE, "FEM_SL3", SAVESLOT_3, MENUPAGE_DELETE_SLOT_CONFIRM, - MENUACTION_CHECKSAVE, "FEM_SL4", SAVESLOT_4, MENUPAGE_DELETE_SLOT_CONFIRM, - MENUACTION_CHECKSAVE, "FEM_SL5", SAVESLOT_5, MENUPAGE_DELETE_SLOT_CONFIRM, - MENUACTION_CHECKSAVE, "FEM_SL6", SAVESLOT_6, MENUPAGE_DELETE_SLOT_CONFIRM, - MENUACTION_CHECKSAVE, "FEM_SL7", SAVESLOT_7, MENUPAGE_DELETE_SLOT_CONFIRM, - MENUACTION_CHECKSAVE, "FEM_SL8", SAVESLOT_8, MENUPAGE_DELETE_SLOT_CONFIRM, + MENUACTION_CHANGEMENU, "FEM_SL0", SAVESLOT_1, MENUPAGE_DELETE_SLOT_CONFIRM, + MENUACTION_CHANGEMENU, "FEM_SL1", SAVESLOT_2, MENUPAGE_DELETE_SLOT_CONFIRM, + MENUACTION_CHANGEMENU, "FEM_SL2", SAVESLOT_3, MENUPAGE_DELETE_SLOT_CONFIRM, + MENUACTION_CHANGEMENU, "FEM_SL3", SAVESLOT_4, MENUPAGE_DELETE_SLOT_CONFIRM, + MENUACTION_CHANGEMENU, "FEM_SL4", SAVESLOT_5, MENUPAGE_DELETE_SLOT_CONFIRM, + MENUACTION_CHANGEMENU, "FEM_SL5", SAVESLOT_6, MENUPAGE_DELETE_SLOT_CONFIRM, + MENUACTION_CHANGEMENU, "FEM_SL6", SAVESLOT_7, MENUPAGE_DELETE_SLOT_CONFIRM, + MENUACTION_CHANGEMENU, "FEM_SL7", SAVESLOT_8, MENUPAGE_DELETE_SLOT_CONFIRM, }, // MENUPAGE_NEW_GAME_RELOAD = 10 @@ -269,7 +269,7 @@ CMenuScreen aScreens[] = { // MENUPAGE_CONTROLLER_PC = 35 { "FET_CTL", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0, MENUACTION_CTRLMETHOD, "FET_CME", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, - MENUACTION_CHANGEMENU, "FET_RDK", SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS, + MENUACTION_KEYBOARDCTRLS,"FET_RDK", SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS, MENUACTION_CHANGEMENU, "FET_AMS", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS, MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, @@ -330,7 +330,7 @@ CMenuScreen aScreens[] = { // MENUPAGE_EXIT = 42 { "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5, MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE, - MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE, + MENUACTION_DONTCANCEL, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CANCELGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE, }, diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index 487f536f..c3cc0960 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -397,7 +397,7 @@ CPlayerInfo::Process(void) else enterOrExitVeh = CPad::GetPad(0)->GetExitVehicle(); - if (enterOrExitVeh && m_pPed->m_nPedState != PED_SNIPER_MODE && m_pPed->m_nPedState != PED_ROCKET_ODE) { + if (enterOrExitVeh && m_pPed->m_nPedState != PED_SNIPER_MODE && m_pPed->m_nPedState != PED_ROCKET_MODE) { if (m_pPed->bInVehicle) { if (!m_pRemoteVehicle) { CEntity *surfaceBelowVeh = m_pPed->m_pMyVehicle->m_pCurGroundEntity; diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 89c0b6af..a2068645 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -829,6 +829,9 @@ CPed::ClearAimFlag(void) bIsAimingGun = false; bIsRestoringGun = true; m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM; +#ifdef VC_PED_PORTS + m_lookTimer = 0; +#endif } if (IsPlayer()) @@ -3378,9 +3381,14 @@ CPed::SetStoredState(void) if (m_nMoveState == PEDMOVE_NONE || m_nMoveState == PEDMOVE_STILL) m_nMoveState = PEDMOVE_WALK; } - m_nLastPedState = m_nPedState; - if (m_nMoveState >= m_nPrevMoveState) - m_nPrevMoveState = m_nMoveState; +#ifdef VC_PED_PORTS + if (m_nPedState != PED_IDLE) +#endif + { + m_nLastPedState = m_nPedState; + if (m_nMoveState >= m_nPrevMoveState) + m_nPrevMoveState = m_nMoveState; + } } void @@ -5149,7 +5157,10 @@ CPed::SetWaitState(eWaitState state, void *time) case WAITSTATE_DOUBLEBACK: m_headingRate = 0.0f; m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 3500; - CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_HBHB, 4.0f); + animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_HBHB, 4.0f); +#ifdef FIX_BUGS + animAssoc->SetFinishCallback(RestoreHeadingRateCB, this); +#endif break; case WAITSTATE_HITWALL: m_headingRate = 2.0f; @@ -5183,7 +5194,10 @@ CPed::SetWaitState(eWaitState state, void *time) SetMoveAnim(); m_headingRate = 0.0f; m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 5000; - CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f); + animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f); +#ifdef FIX_BUGS + animAssoc->SetFinishCallback(RestoreHeadingRateCB, this); +#endif if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == RANDOM_CHAR && m_nPedState == PED_SEEK_CAR) { ClearObjective(); @@ -5196,7 +5210,11 @@ CPed::SetWaitState(eWaitState state, void *time) SetMoveAnim(); m_headingRate = 0.0f; m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 5000; - CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_HBHB, 4.0f); + animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_HBHB, 4.0f); +#ifdef FIX_BUGS + animAssoc->SetFinishCallback(RestoreHeadingRateCB, this); +#endif + break; case WAITSTATE_PLAYANIM_COWER: waitAnim = ANIM_HANDSCOWER; @@ -5238,7 +5256,10 @@ CPed::SetWaitState(eWaitState state, void *time) SetMoveAnim(); m_headingRate = 0.0f; m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 2500; - CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f); + animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f); +#ifdef FIX_BUGS + animAssoc->SetFinishCallback(RestoreHeadingRateCB, this); +#endif break; default: m_nWaitState = WAITSTATE_FALSE; @@ -5730,6 +5751,9 @@ CPed::SetChat(CEntity *chatWith, uint32 time) m_nPedState = PED_CHAT; SetMoveState(PEDMOVE_STILL); +#ifdef VC_PED_PORTS + m_lookTimer = 0; +#endif SetLookFlag(chatWith, true); m_standardTimer = CTimer::GetTimeInMilliseconds() + time; m_lookTimer = CTimer::GetTimeInMilliseconds() + 3000; @@ -5738,10 +5762,7 @@ CPed::SetChat(CEntity *chatWith, uint32 time) void CPed::SetDead(void) { -#ifdef VC_PED_PORTS - if (!RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DROWN)) -#endif - bUsesCollision = false; + bUsesCollision = false; m_fHealth = 0.0f; if (m_nPedState == PED_DRIVING) @@ -9236,17 +9257,6 @@ CPed::ProcessControl(void) float oldDestRot = CGeneral::LimitRadianAngle(m_fRotationDest); -#ifdef VC_PED_PORTS - if (m_nPedState == PED_FOLLOW_PATH) { - if (DotProduct(m_vecDamageNormal, GetForward()) < -0.866f && CanPedJumpThis(collidingEnt, &m_vecDamageNormal)) { - SetJump(); - - // Moved break into here, for compatibility with III - break; - } - // break; - } -#endif if (m_pedInObjective && (m_objective == OBJECTIVE_GOTO_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT)) { @@ -10072,7 +10082,7 @@ CPed::ProcessControl(void) case PED_SEEK_ENTITY: case PED_PURSUE: case PED_SNIPER_MODE: - case PED_ROCKET_ODE: + case PED_ROCKET_MODE: case PED_DUMMY: case PED_FACE_PHONE: case PED_MAKE_CALL: diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 59e0053b..6e536ede 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -231,7 +231,7 @@ enum PedState PED_PURSUE, PED_FOLLOW_PATH, PED_SNIPER_MODE, - PED_ROCKET_ODE, + PED_ROCKET_MODE, PED_DUMMY, PED_PAUSE, PED_ATTACK, diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index eb4ac09e..305c329e 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -1058,6 +1058,9 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) } #ifdef FREE_CAM + static int8 changedHeadingRate = 0; + if (changedHeadingRate == 2) changedHeadingRate = 1; + // Rotate player/arm when shooting. We don't have auto-rotation anymore if (CCamera::m_bUseMouse3rdPerson && CCamera::bFreeCam && m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) { @@ -1081,6 +1084,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) #endif } else { m_fRotationDest = limitedCam; + changedHeadingRate = 2; m_headingRate = 50.0f; // Anim. fix for shotgun, ak47 and m16 (we must finish rot. it quickly) @@ -1099,10 +1103,12 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) } } else if (weaponInfo->m_bCanAimWithArm) ClearPointGunAt(); - else - RestoreHeadingRate(); } } + if (changedHeadingRate == 1) { + changedHeadingRate = 0; + RestoreHeadingRate(); + } #endif if (padUsed->GetTarget() && m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) { @@ -1347,7 +1353,7 @@ CPlayerPed::ProcessControl(void) case PED_WANDER_PATH: case PED_PURSUE: case PED_FOLLOW_PATH: - case PED_ROCKET_ODE: + case PED_ROCKET_MODE: case PED_DUMMY: case PED_PAUSE: case PED_FACE_PHONE: diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 8c7904ef..c7f61d5d 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -1044,7 +1044,7 @@ void CHud::DrawAfterFade() m_fHelpMessageTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f; if (TheCamera.m_ScreenReductionPercentage == 0.0f) - DMAudio.PlayFrontEndSound(SOUND_A0, 0); + DMAudio.PlayFrontEndSound(SOUND_HUD, 0); break; case 1: case 2: diff --git a/src/vehicles/Train.cpp b/src/vehicles/Train.cpp index 1d47ca3a..21cde17f 100644 --- a/src/vehicles/Train.cpp +++ b/src/vehicles/Train.cpp @@ -197,7 +197,7 @@ CTrain::ProcessControl(void) if(m_bTrainStopping){ m_nDoorTimer = CTimer::GetTimeInMilliseconds() + 1000; m_nDoorState = TRAIN_DOOR_OPENING; - DMAudio.PlayOneShot(m_audioEntityId, SOUND_18, 0.0f); + DMAudio.PlayOneShot(m_audioEntityId, SOUND_TRAIN_DOOR_CLOSE, 0.0f); } break; @@ -214,7 +214,7 @@ CTrain::ProcessControl(void) if(!m_bTrainStopping){ m_nDoorTimer = CTimer::GetTimeInMilliseconds() + 1000; m_nDoorState = TRAIN_DOOR_CLOSING; - DMAudio.PlayOneShot(m_audioEntityId, SOUND_19, 0.0f); + DMAudio.PlayOneShot(m_audioEntityId, SOUND_TRAIN_DOOR_OPEN, 0.0f); } break; diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index c9b6c9e3..48546e68 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -265,8 +265,11 @@ public: void InflictDamage(CEntity *damagedBy, eWeaponType weaponType, float damage); void DoFixedMachineGuns(void); - +#ifdef FIX_BUGS + bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1 && GetStatus() != STATUS_WRECKED; } +#else bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1; } +#endif CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); } bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE; } AnimationId GetDriverAnim(void) { return IsCar() && bLowVehicle ? ANIM_CAR_LSIT : (IsBoat() && GetModelIndex() != MI_SPEEDER ? ANIM_DRIVE_BOAT : ANIM_CAR_SIT); } From 95e96c86a1924a98c648fbcd251c9dca5d66c4bb Mon Sep 17 00:00:00 2001 From: aap Date: Thu, 4 Jun 2020 17:39:18 +0200 Subject: [PATCH 095/133] minor stuff --- src/math/Quaternion.h | 1 + src/math/math.cpp | 11 +++++++++++ src/vehicles/Automobile.cpp | 7 +++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/math/Quaternion.h b/src/math/Quaternion.h index 1d04bdff..dac49362 100644 --- a/src/math/Quaternion.h +++ b/src/math/Quaternion.h @@ -60,6 +60,7 @@ public: } void Slerp(const CQuaternion &q1, const CQuaternion &q2, float theta, float invSin, float t); + void Set(RwV3d *axis, float angle); void Get(RwMatrix *matrix); }; diff --git a/src/math/math.cpp b/src/math/math.cpp index 29f18d03..0cfc2ce9 100644 --- a/src/math/math.cpp +++ b/src/math/math.cpp @@ -183,6 +183,17 @@ CQuaternion::Slerp(const CQuaternion &q1, const CQuaternion &q2, float theta, fl } } +void +CQuaternion::Set(RwV3d *axis, float angle) +{ + float halfCos = Cos(angle*0.5f); + float halfSin = Sin(angle*0.5f); + x = axis->x*halfSin; + y = axis->y*halfSin; + z = axis->z*halfSin; + w = halfCos; +} + void CQuaternion::Get(RwMatrix *matrix) { diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 9fe172fa..eb1bad97 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -220,6 +220,7 @@ void CAutomobile::ProcessControl(void) { int i; + float wheelRot; CColModel *colModel; if(bUsingSpecialColModel) @@ -372,11 +373,9 @@ CAutomobile::ProcessControl(void) pHandling->Transmission.CalculateGearForSimpleCar(AutoPilot.m_fMaxTrafficSpeed/50.0f, m_nCurrentGear); - { - float wheelRot = ProcessWheelRotation(WHEEL_STATE_NORMAL, GetForward(), m_vecMoveSpeed, 0.35f); + wheelRot = ProcessWheelRotation(WHEEL_STATE_NORMAL, GetForward(), m_vecMoveSpeed, 0.35f); for(i = 0; i < 4; i++) m_aWheelRotation[i] += wheelRot; - } PlayHornIfNecessary(); ReduceHornCounter(); @@ -618,7 +617,7 @@ CAutomobile::ProcessControl(void) for(i = 0; i < 4; i++){ if(m_aSuspensionSpringRatio[i] < 1.0f){ float bias = pHandling->fSuspensionBias; - if(i == 1 || i == 3) // rear + if(i == CARWHEEL_REAR_LEFT || i == CARWHEEL_REAR_RIGHT) bias = 1.0f - bias; ApplySpringCollision(pHandling->fSuspensionForceLevel, From 147dca44fa9c759b0d576cb8d4f9575720fc937b Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 5 Jun 2020 11:27:33 +0300 Subject: [PATCH 096/133] ProcessTrainAnnouncements --- src/audio/AudioLogic.cpp | 6 +++--- src/audio/soundlist.h | 4 ++-- src/vehicles/Train.cpp | 43 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index b6fb5a86..01b074ed 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -6536,9 +6536,9 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_bIs2D = false; emittingVolume = m_anRandomTable[2] % 20 + 90; break; - case SCRIPT_SOUND_110: - case SCRIPT_SOUND_111: - if (SampleManager.IsSampleBankLoaded(0) != 1) + case SCRIPT_SOUND_TRAIN_ANNOUNCEMENT_1: + case SCRIPT_SOUND_TRAIN_ANNOUNCEMENT_2: + if (!SampleManager.IsSampleBankLoaded(0)) return; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_TRAIN_STATION_ANNOUNCE; diff --git a/src/audio/soundlist.h b/src/audio/soundlist.h index 08a1631e..c88229a2 100644 --- a/src/audio/soundlist.h +++ b/src/audio/soundlist.h @@ -284,8 +284,8 @@ enum eScriptSounds : uint16 { SCRIPT_SOUND_BULLET_HIT_GROUND_2, SCRIPT_SOUND_BULLET_HIT_GROUND_3, SCRIPT_SOUND_BULLET_HIT_WATER, // no sound - SCRIPT_SOUND_110, - SCRIPT_SOUND_111, + SCRIPT_SOUND_TRAIN_ANNOUNCEMENT_1, + SCRIPT_SOUND_TRAIN_ANNOUNCEMENT_2, SCRIPT_SOUND_PAYPHONE_RINGING, SCRIPT_SOUND_113, SCRIPT_SOUND_GLASS_BREAK_L, diff --git a/src/vehicles/Train.cpp b/src/vehicles/Train.cpp index 21cde17f..38bb1300 100644 --- a/src/vehicles/Train.cpp +++ b/src/vehicles/Train.cpp @@ -13,6 +13,7 @@ #include "DMAudio.h" #include "HandlingMgr.h" #include "Train.h" +#include "AudioScriptObject.h" static CTrainNode* pTrackNodes; static int16 NumTrackNodes; @@ -35,6 +36,8 @@ static float EngineTrackSpeed_S[4]; CVector CTrain::aStationCoors[3]; CVector CTrain::aStationCoors_S[4]; +static bool bTrainArrivalAnnounced[3] = {false, false, false}; + CTrain::CTrain(int32 id, uint8 CreatedBy) : CVehicle(CreatedBy) { @@ -618,10 +621,48 @@ CTrain::ReadAndInterpretTrackFile(Const char *filename, CTrainNode **nodes, int1 interpLines[j].time = *totalDuration; } +void +PlayAnnouncement(uint8 sound, uint8 station) +{ + // this was gone in a PC version but inlined on PS2 + cAudioScriptObject *obj = new cAudioScriptObject; + obj->AudioId = sound; + obj->Posn = CTrain::aStationCoors[station]; + obj->AudioEntity = AEHANDLE_NONE; + DMAudio.CreateOneShotScriptObject(obj); +} + void ProcessTrainAnnouncements(void) { - // TODO but unused + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 3; j++) { + if (!bTrainArrivalAnnounced[i]) { + float preDist = StationDist[i] - 100.0f; + if (preDist < 0.0f) + preDist += TotalLengthOfTrack; + if (EngineTrackPosition[j] > preDist && EngineTrackPosition[j] < StationDist[i]) { + bTrainArrivalAnnounced[i] = true; + PlayAnnouncement(SCRIPT_SOUND_TRAIN_ANNOUNCEMENT_1, i); + break; + } + } else { + float postDist = StationDist[i] + 10.0f; +#ifdef FIX_BUGS + if (postDist > TotalLengthOfTrack) + postDist -= TotalLengthOfTrack; +#else + if (postDist < 0.0f) // does this even make sense here? + postDist += TotalLengthOfTrack; +#endif + if (EngineTrackPosition[j] > StationDist[i] && EngineTrackPosition[j] < postDist) { + bTrainArrivalAnnounced[i] = false; + PlayAnnouncement(SCRIPT_SOUND_TRAIN_ANNOUNCEMENT_2, i); + break; + } + } + } + } } void From 2016cd54b0038cf3a56fb4aa6b36ce98e12cbe7f Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 6 Jun 2020 03:45:24 +0300 Subject: [PATCH 097/133] ps2 audio banks --- src/audio/AudioLogic.cpp | 399 +++++++++++++++++++++++---------------- src/audio/AudioManager.h | 2 +- src/audio/AudioSamples.h | 89 +++++++++ src/audio/sampman.h | 74 ++++++++ 4 files changed, 402 insertions(+), 162 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 01b074ed..ec193bc8 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -59,6 +59,67 @@ void cAudioManager::PreInitialiseGameSpecificSetup() const { BankStartOffset[SAMPLEBANK_MAIN] = SAMPLEBANK_START; +#ifdef GTA_PS2 + BankStartOffset[SAMPLEBANK_CAR_PACARD] = SFX_CAR_ACCEL_1; + BankStartOffset[SAMPLEBANK_CAR_PATHFINDER] = SFX_CAR_ACCEL_2; + BankStartOffset[SAMPLEBANK_CAR_PORSCHE] = SFX_CAR_ACCEL_3; + BankStartOffset[SAMPLEBANK_CAR_SPIDER] = SFX_CAR_ACCEL_4; + BankStartOffset[SAMPLEBANK_CAR_MERC] = SFX_CAR_ACCEL_5; + BankStartOffset[SAMPLEBANK_CAR_MACKTRUCK] = SFX_CAR_ACCEL_6; + BankStartOffset[SAMPLEBANK_CAR_HOTROD] = SFX_CAR_ACCEL_7; + BankStartOffset[SAMPLEBANK_CAR_COBRA] = SFX_CAR_ACCEL_8; + BankStartOffset[SAMPLEBANK_CAR_NONE] = SFX_CAR_ACCEL_9; + BankStartOffset[SAMPLEBANK_FRONTEND] = SFX_PAGE_CHANGE_AND_BACK_LEFT; + BankStartOffset[SAMPLEBANK_TRAIN] = SFX_TRAIN_STATION_AMBIENCE_LOOP; + BankStartOffset[SAMPLEBANK_BUILDING_CLUB_1] = SFX_CLUB_1; + BankStartOffset[SAMPLEBANK_BUILDING_CLUB_2] = SFX_CLUB_2; + BankStartOffset[SAMPLEBANK_BUILDING_CLUB_3] = SFX_CLUB_3; + BankStartOffset[SAMPLEBANK_BUILDING_CLUB_4] = SFX_CLUB_4; + BankStartOffset[SAMPLEBANK_BUILDING_CLUB_5] = SFX_CLUB_5; + BankStartOffset[SAMPLEBANK_BUILDING_CLUB_6] = SFX_CLUB_6; + BankStartOffset[SAMPLEBANK_BUILDING_CLUB_7] = SFX_CLUB_7; + BankStartOffset[SAMPLEBANK_BUILDING_CLUB_8] = SFX_CLUB_8; + BankStartOffset[SAMPLEBANK_BUILDING_CLUB_9] = SFX_CLUB_9; + BankStartOffset[SAMPLEBANK_BUILDING_CLUB_10] = SFX_CLUB_10; + BankStartOffset[SAMPLEBANK_BUILDING_CLUB_11] = SFX_CLUB_11; + BankStartOffset[SAMPLEBANK_BUILDING_CLUB_12] = SFX_CLUB_12; + BankStartOffset[SAMPLEBANK_BUILDING_CLUB_RAGGA] = SFX_CLUB_RAGGA; + BankStartOffset[SAMPLEBANK_BUILDING_STRIP_CLUB_1] = SFX_STRIP_CLUB_1; + BankStartOffset[SAMPLEBANK_BUILDING_STRIP_CLUB_2] = SFX_STRIP_CLUB_2; + BankStartOffset[SAMPLEBANK_BUILDING_WORKSHOP] = SFX_WORKSHOP_1; + BankStartOffset[SAMPLEBANK_BUILDING_PIANO_BAR] = SFX_PIANO_BAR_1; + BankStartOffset[SAMPLEBANK_BUILDING_SAWMILL] = SFX_SAWMILL_LOOP; + BankStartOffset[SAMPLEBANK_BUILDING_DOG_FOOD_FACTORY] = SFX_DOG_FOOD_FACTORY; + BankStartOffset[SAMPLEBANK_BUILDING_LAUNDERETTE] = SFX_LAUNDERETTE_LOOP; + BankStartOffset[SAMPLEBANK_BUILDING_RESTAURANT_CHINATOWN] = SFX_RESTAURANT_CHINATOWN; + BankStartOffset[SAMPLEBANK_BUILDING_RESTAURANT_ITALY] = SFX_RESTAURANT_ITALY; + BankStartOffset[SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_1] = SFX_RESTAURANT_GENERIC_1; + BankStartOffset[SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_2] = SFX_RESTAURANT_GENERIC_2; + BankStartOffset[SAMPLEBANK_BUILDING_AIRPORT] = SFX_AIRPORT_ANNOUNCEMENT_1; + BankStartOffset[SAMPLEBANK_BUILDING_SHOP] = SFX_SHOP_LOOP; + BankStartOffset[SAMPLEBANK_BUILDING_CINEMA] = SFX_CINEMA_BASS_1; + BankStartOffset[SAMPLEBANK_BUILDING_DOCKS] = SFX_DOCKS_FOGHORN; + BankStartOffset[SAMPLEBANK_BUILDING_HOME] = SFX_HOME_1; + BankStartOffset[SAMPLEBANK_BUILDING_PORN_1] = SFX_PORN_1_LOOP; + BankStartOffset[SAMPLEBANK_BUILDING_PORN_2] = SFX_PORN_2_LOOP; + BankStartOffset[SAMPLEBANK_BUILDING_PORN_3] = SFX_PORN_3_LOOP; + BankStartOffset[SAMPLEBANK_BUILDING_POLICE_BALL] = SFX_POLICE_BALL_1; + BankStartOffset[SAMPLEBANK_BUILDING_BANK_ALARM] = SFX_BANK_ALARM_1; + BankStartOffset[SAMPLEBANK_BUILDING_RAVE_INDUSTRIAL] = SFX_RAVE_INDUSTRIAL; + BankStartOffset[SAMPLEBANK_BUILDING_RAVE_COMMERCIAL] = SFX_RAVE_COMMERCIAL; + BankStartOffset[SAMPLEBANK_BUILDING_RAVE_SUBURBAN] = SFX_RAVE_SUBURBAN; + BankStartOffset[SAMPLEBANK_BUILDING_RAVE_COMMERCIAL_2] = SFX_RAVE_COMMERCIAL_2; + BankStartOffset[SAMPLEBANK_BUILDING_39] = SFX_CLUB_1_1; + BankStartOffset[SAMPLEBANK_BUILDING_40] = SFX_CLUB_1_2; + BankStartOffset[SAMPLEBANK_BUILDING_41] = SFX_CLUB_1_3; + BankStartOffset[SAMPLEBANK_BUILDING_42] = SFX_CLUB_1_4; + BankStartOffset[SAMPLEBANK_BUILDING_43] = SFX_CLUB_1_5; + BankStartOffset[SAMPLEBANK_BUILDING_44] = SFX_CLUB_1_6; + BankStartOffset[SAMPLEBANK_BUILDING_45] = SFX_CLUB_1_7; + BankStartOffset[SAMPLEBANK_BUILDING_46] = SFX_CLUB_1_8; + BankStartOffset[SAMPLEBANK_BUILDING_47] = SFX_CLUB_1_9; + BankStartOffset[SAMPLEBANK_EXTRAS] = SFX_EXPLOSION_1; +#endif // GTA_PS2 BankStartOffset[SAMPLEBANK_PED] = SAMPLEBANK_PED_START; } @@ -407,7 +468,7 @@ enum struct tVehicleSampleData { eSfxSample m_nAccelerationSampleIndex; - uint8 m_bEngineSoundType; + uint8 m_nBank; eSfxSample m_nHornSample; int32 m_nHornFrequency; uint8 m_nSirenOrAlarmSample; @@ -415,76 +476,77 @@ struct tVehicleSampleData { uint8 m_bDoorType; }; -const tVehicleSampleData aVehicleSettings[MAX_CARS] = {{SFX_CAR_REV_2, 2, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 11487, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_8, 8, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_ALARM_1, 10928, DOOR_TYPE_NEW}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 12893, SFX_CAR_ALARM_1, 8941, DOOR_TYPE_OLD}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 10706, SFX_CAR_ALARM_1, 11922, DOOR_TYPE_NEW}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 7948, DOOR_TYPE_TRUCK}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_POLICE_SIREN_SLOW, 11556, DOOR_TYPE_TRUCK}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 31478, SFX_CAR_ALARM_1, 8941, DOOR_TYPE_TRUCK}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_BMW328, 9538, SFX_CAR_ALARM_1, 12220, DOOR_TYPE_NEW}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_3, 3, SFX_CAR_HORN_BMW328, 12017, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, - {SFX_CAR_REV_2, 2, SFX_CAR_HORN_JEEP, 22295, SFX_CAR_ALARM_1, 12200, DOOR_TYPE_NEW}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_ALARM_1, 13400, DOOR_TYPE_NEW}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 18286, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, - {SFX_CAR_REV_3, 3, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_ALARM_1, 13600, DOOR_TYPE_NEW}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 22295, SFX_AMBULANCE_SIREN_SLOW, 8795, DOOR_TYPE_TRUCK}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_PORSCHE, 9271, SFX_POLICE_SIREN_SLOW, 16168, DOOR_TYPE_NEW}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 12170, SFX_CAR_ALARM_1, 8000, DOOR_TYPE_NEW}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_BUS2, 12345, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_2, 2, SFX_CAR_HORN_BMW328, 10796, SFX_CAR_ALARM_1, 8543, DOOR_TYPE_NEW}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_PORSCHE, 9271, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, - {SFX_CAR_REV_2, 2, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_PICKUP, 11025, SFX_ICE_CREAM_TUNE, 11025, DOOR_TYPE_OLD}, - {SFX_CAR_REV_7, 7, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 10000, DOOR_TYPE_OLD}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 10706, SFX_POLICE_SIREN_SLOW, 13596, DOOR_TYPE_NEW}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 17260, SFX_POLICE_SIREN_SLOW, 13000, DOOR_TYPE_TRUCK}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, - {SFX_CAR_REV_8, 8, SFX_CAR_HORN_PORSCHE, 10400, SFX_CAR_ALARM_1, 10123, DOOR_TYPE_NEW}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 26513, SFX_POLICE_SIREN_SLOW, 13596, DOOR_TYPE_OLD}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_BUS2, 11652, SFX_CAR_ALARM_1, 10554, DOOR_TYPE_AIRBREAK}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 8000, DOOR_TYPE_TRUCK}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_AIRBREAK}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CESNA_IDLE, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_BUS, 16291, SFX_CAR_ALARM_1, 7500, DOOR_TYPE_AIRBREAK}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10233, SFX_CAR_ALARM_1, 8935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_ALARM_1, 8935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_PICKUP, 2000, SFX_CAR_ALARM_1, 17000, DOOR_TYPE_OLD}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 9003, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, - {SFX_CAR_REV_2, 2, SFX_CAR_HORN_PORSCHE, 12375, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BUS2, 15554, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, - {SFX_CAR_REV_7, 7, SFX_CAR_HORN_BUS2, 13857, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_7, 7, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 20143, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9000, DOOR_TYPE_OLD}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 18286, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_ALARM_1, 13400, DOOR_TYPE_NEW}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}}; +const tVehicleSampleData aVehicleSettings[MAX_CARS] = { + {SFX_CAR_REV_2, SAMPLEBANK_CAR_PATHFINDER, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_56CHEV, 11487, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_8, SAMPLEBANK_CAR_COBRA, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_ALARM_1, 10928, DOOR_TYPE_NEW}, + {SFX_CAR_REV_6, SAMPLEBANK_CAR_MACKTRUCK, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_56CHEV, 12893, SFX_CAR_ALARM_1, 8941, DOOR_TYPE_OLD}, + {SFX_CAR_REV_5, SAMPLEBANK_CAR_MERC, SFX_CAR_HORN_BMW328, 10706, SFX_CAR_ALARM_1, 11922, DOOR_TYPE_NEW}, + {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 7948, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_6, SAMPLEBANK_CAR_MACKTRUCK, SFX_CAR_HORN_TRUCK, 29711, SFX_POLICE_SIREN_SLOW, 11556, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_6, SAMPLEBANK_CAR_MACKTRUCK, SFX_CAR_HORN_TRUCK, 31478, SFX_CAR_ALARM_1, 8941, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_BMW328, 9538, SFX_CAR_ALARM_1, 12220, DOOR_TYPE_NEW}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_3, SAMPLEBANK_CAR_PORSCHE, SFX_CAR_HORN_BMW328, 12017, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, + {SFX_CAR_REV_2, SAMPLEBANK_CAR_PATHFINDER, SFX_CAR_HORN_JEEP, 22295, SFX_CAR_ALARM_1, 12200, DOOR_TYPE_NEW}, + {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_ALARM_1, 13400, DOOR_TYPE_NEW}, + {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_BUS, 18286, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_3, SAMPLEBANK_CAR_PORSCHE, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_ALARM_1, 13600, DOOR_TYPE_NEW}, + {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_JEEP, 22295, SFX_AMBULANCE_SIREN_SLOW, 8795, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_5, SAMPLEBANK_CAR_MERC, SFX_CAR_HORN_PORSCHE, 9271, SFX_POLICE_SIREN_SLOW, 16168, DOOR_TYPE_NEW}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_56CHEV, 12170, SFX_CAR_ALARM_1, 8000, DOOR_TYPE_NEW}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_BUS2, 12345, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_2, SAMPLEBANK_CAR_PATHFINDER, SFX_CAR_HORN_BMW328, 10796, SFX_CAR_ALARM_1, 8543, DOOR_TYPE_NEW}, + {SFX_CAR_REV_5, SAMPLEBANK_CAR_MERC, SFX_CAR_HORN_PORSCHE, 9271, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, + {SFX_CAR_REV_2, SAMPLEBANK_CAR_PATHFINDER, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_PICKUP, 11025, SFX_ICE_CREAM_TUNE, 11025, DOOR_TYPE_OLD}, + {SFX_CAR_REV_7, SAMPLEBANK_CAR_HOTROD, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 10000, DOOR_TYPE_OLD}, + {SFX_CAR_REV_5, SAMPLEBANK_CAR_MERC, SFX_CAR_HORN_BMW328, 10706, SFX_POLICE_SIREN_SLOW, 13596, DOOR_TYPE_NEW}, + {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_BUS, 17260, SFX_POLICE_SIREN_SLOW, 13000, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_8, SAMPLEBANK_CAR_COBRA, SFX_CAR_HORN_PORSCHE, 10400, SFX_CAR_ALARM_1, 10123, DOOR_TYPE_NEW}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 26513, SFX_POLICE_SIREN_SLOW, 13596, DOOR_TYPE_OLD}, + {SFX_CAR_REV_6, SAMPLEBANK_CAR_MACKTRUCK, SFX_CAR_HORN_BUS2, 11652, SFX_CAR_ALARM_1, 10554, DOOR_TYPE_AIRBREAK}, + {SFX_CAR_REV_6, SAMPLEBANK_CAR_MACKTRUCK, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 8000, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_6, SAMPLEBANK_CAR_MACKTRUCK, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_1, SAMPLEBANK_MAIN, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_AIRBREAK}, + {SFX_CAR_REV_1, SAMPLEBANK_MAIN, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CESNA_IDLE, SAMPLEBANK_MAIN, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_6, SAMPLEBANK_CAR_MACKTRUCK, SFX_CAR_HORN_BUS, 16291, SFX_CAR_ALARM_1, 7500, DOOR_TYPE_AIRBREAK}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_56CHEV, 10233, SFX_CAR_ALARM_1, 8935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_ALARM_1, 8935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, SAMPLEBANK_MAIN, SFX_CAR_HORN_PICKUP, 2000, SFX_CAR_ALARM_1, 17000, DOOR_TYPE_OLD}, + {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_5, SAMPLEBANK_CAR_MERC, SFX_CAR_HORN_BMW328, 9003, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, + {SFX_CAR_REV_2, SAMPLEBANK_CAR_PATHFINDER, SFX_CAR_HORN_PORSCHE, 12375, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, + {SFX_CAR_REV_5, SAMPLEBANK_CAR_MERC, SFX_CAR_HORN_BUS2, 15554, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_NEW}, + {SFX_CAR_REV_7, SAMPLEBANK_CAR_HOTROD, SFX_CAR_HORN_BUS2, 13857, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_7, SAMPLEBANK_CAR_HOTROD, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_1, SAMPLEBANK_MAIN, SFX_CAR_HORN_JEEP, 20143, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, SAMPLEBANK_MAIN, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9000, DOOR_TYPE_OLD}, + {SFX_CAR_REV_6, SAMPLEBANK_CAR_MACKTRUCK, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_BUS, 18286, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_TRUCK}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_4, SAMPLEBANK_CAR_SPIDER, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_ALARM_1, 13400, DOOR_TYPE_NEW}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}, + {SFX_CAR_REV_1, SAMPLEBANK_CAR_PACARD, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_ALARM_1, 9935, DOOR_TYPE_OLD}}; bool bPlayerJustEnteredCar; @@ -951,7 +1013,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params) if (m_sQueueSample.m_nVolume != 0) { if (automobile->GetStatus() == STATUS_SIMPLE) { if (modificator < 0.02f) { - m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_bEngineSoundType - 1 + SFX_CAR_IDLE_1; + m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nBank - CAR_SAMPLEBANKS_OFFSET + SFX_CAR_IDLE_1; freq = modificator * 10000 + 22050; m_sQueueSample.m_nCounter = 52; } else { @@ -960,7 +1022,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params) } } else { if (automobile->m_fGasPedal < 0.05f) { - m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_bEngineSoundType - 1 + SFX_CAR_IDLE_1; + m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_nBank - CAR_SAMPLEBANKS_OFFSET + SFX_CAR_IDLE_1; freq = modificator * 10000 + 22050; m_sQueueSample.m_nCounter = 52; } else { @@ -1016,13 +1078,17 @@ cAudioManager::PlayerJustLeftCar(void) const } void -cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1, uint8 counter, bool notLooping) +cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 bank, uint8 counter, bool notLooping) { m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, 50.f, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = counter; m_sQueueSample.m_nSampleIndex = sample; +#ifdef GTA_PS2 + m_sQueueSample.m_nBankIndex = bank; +#else m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; +#endif // GTA_PS2 m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_nFrequency = freq; @@ -1059,11 +1125,11 @@ cAudioManager::ProcessCesna(cVehicleParams *params) } else if (nAccel < 60) { ++nAccel; } - AddPlayerCarSample(85 * (60 - nAccel) / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_IDLE, 0, 52, true); - AddPlayerCarSample(85 * nAccel / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_REV, 0, 2, true); + AddPlayerCarSample(85 * (60 - nAccel) / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_IDLE, SAMPLEBANK_MAIN, 52, true); + AddPlayerCarSample(85 * nAccel / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_REV, SAMPLEBANK_MAIN, 2, true); } } else if (params->m_nIndex == DODO) { - AddPlayerCarSample(105, 17000, SFX_CESNA_IDLE, 0, 52, true); + AddPlayerCarSample(105, 17000, SFX_CESNA_IDLE, SAMPLEBANK_MAIN, 52, true); } else if (params->m_fDistance < SQR(200)) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, 200.f, m_sQueueSample.m_fDistance); @@ -1205,8 +1271,8 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * } else freqModifier = 0; - engineSoundType = aVehicleSettings[params->m_nIndex].m_bEngineSoundType; - soundOffset = 3 * (engineSoundType - 1); + engineSoundType = aVehicleSettings[params->m_nIndex].m_nBank; + soundOffset = 3 * (engineSoundType - CAR_SAMPLEBANKS_OFFSET); if (accelerateState <= 0) { if (params->m_fVelocityChange < -0.001f) { if (channelUsed) { @@ -1233,16 +1299,16 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * } if (gasPedalAudio > 0.05f) { freq = (5000.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 19000; - if (engineSoundType == 6) + if (engineSoundType == SAMPLEBANK_CAR_MACKTRUCK) freq /= 2; AddPlayerCarSample((25.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 40, freq, (soundOffset + SFX_CAR_FINGER_OFF_ACCEL_1), engineSoundType, 63, false); } } freq = (10000.f * gasPedalAudio) + 22050; - if (engineSoundType == 6) + if (engineSoundType == SAMPLEBANK_CAR_MACKTRUCK) freq /= 2; - AddPlayerCarSample(110 - (40.f * gasPedalAudio), freq, (engineSoundType - 1 + SFX_CAR_IDLE_1), 0, 52, true); + AddPlayerCarSample(110 - (40.f * gasPedalAudio), freq, (engineSoundType - CAR_SAMPLEBANKS_OFFSET + SFX_CAR_IDLE_1), SAMPLEBANK_MAIN, 52, true); CurrentPretendGear = Max(1, currentGear); } else { @@ -1263,13 +1329,13 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * automobile->m_fGasPedalAudio = accelerationMultipler; } freq = freqModifier + baseFreq; - if (engineSoundType == 6) + if (engineSoundType == SAMPLEBANK_CAR_MACKTRUCK) freq /= 2; if (channelUsed) { SampleManager.StopChannel(m_nActiveSamples); bAccelSampleStopped = true; } - AddPlayerCarSample(vol, freq, (engineSoundType - 1 + SFX_CAR_REV_1), 0, 2, true); + AddPlayerCarSample(vol, freq, (engineSoundType - CAR_SAMPLEBANKS_OFFSET + SFX_CAR_REV_1), SAMPLEBANK_MAIN, 2, true); } else { TranslateEntity(&m_sQueueSample.m_vecPos, &pos); if (bAccelSampleStopped) { @@ -1303,7 +1369,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z); SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.f, 12.5f); freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050; - if (engineSoundType == 6) + if (engineSoundType == SAMPLEBANK_CAR_MACKTRUCK) freq /= 2; SampleManager.SetChannelFrequency(m_nActiveSamples, freq); if (!channelUsed) { @@ -1326,7 +1392,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * --nCruising; } freq = 27 * nCruising + freqModifier + 22050; - if (engineSoundType == 6) + if (engineSoundType == SAMPLEBANK_CAR_MACKTRUCK) freq /= 2; AddPlayerCarSample(85, freq, (soundOffset + SFX_CAR_AFTER_ACCEL_1), engineSoundType, 64, true); } @@ -6331,7 +6397,7 @@ cAudioManager::ProcessExplosions(int32 explosion) if (type == EXPLOSION_HELI) m_sQueueSample.m_nFrequency = 8 * m_sQueueSample.m_nFrequency / 10; m_sQueueSample.m_nReleasingVolumeModificator = 0; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_EXTRAS; break; } pos = CExplosion::GetExplosionPosition(i); @@ -6538,11 +6604,11 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) break; case SCRIPT_SOUND_TRAIN_ANNOUNCEMENT_1: case SCRIPT_SOUND_TRAIN_ANNOUNCEMENT_2: - if (!SampleManager.IsSampleBankLoaded(0)) + if (!SampleManager.IsSampleBankLoaded(SAMPLEBANK_TRAIN)) return; m_sQueueSample.m_fSoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_TRAIN_STATION_ANNOUNCE; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_TRAIN; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_STATION_ANNOUNCE); m_sQueueSample.m_nReleasingVolumeModificator = 0; @@ -6739,7 +6805,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_1_LOOP_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_1; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6749,7 +6815,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_1_LOOP_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_1; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6759,7 +6825,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_2_LOOP_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_2; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_2; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_2); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6769,7 +6835,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_2_LOOP_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_2; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_2; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_2); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6779,7 +6845,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_3_LOOP_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_3; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_3; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_3); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6789,7 +6855,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_3_LOOP_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_3; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_3; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_3); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6799,7 +6865,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_4_LOOP_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_4; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_4; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_4); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6809,7 +6875,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_4_LOOP_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_4; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_4; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_4); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6819,7 +6885,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_5_LOOP_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_5; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_5; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_5); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6829,7 +6895,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_5_LOOP_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_5; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_5; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_5); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6839,7 +6905,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_6_LOOP_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_6; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_6; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_6); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6849,7 +6915,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_6_LOOP_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_6; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_6; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_6); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6859,7 +6925,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_7_LOOP_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_7; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_7; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_7); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6869,7 +6935,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_7_LOOP_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_7; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_7; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_7); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6879,7 +6945,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_8_LOOP_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_8; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_8; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_8); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6889,7 +6955,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_8_LOOP_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_8; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_8; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_8); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6899,7 +6965,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_9_LOOP_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_9; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_9; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_9); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6909,7 +6975,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_9_LOOP_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_9; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_9; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_9); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6919,7 +6985,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_10_LOOP_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_10; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_10; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_10); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6929,7 +6995,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_10_LOOP_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_10; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_10; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_10); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6939,7 +7005,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_11_LOOP_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_11; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_11; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_11); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6949,7 +7015,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_11_LOOP_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_11; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_11; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_11); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6959,7 +7025,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_12_LOOP_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_12; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_12; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_12); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6969,7 +7035,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_12_LOOP_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_12; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_12; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_12); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6979,7 +7045,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_13_LOOP_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_CLUB_RAGGA; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_RAGGA; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_RAGGA); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6989,7 +7055,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_13_LOOP_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_RAGGA; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_RAGGA; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_RAGGA); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -6999,7 +7065,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_STRIP_CLUB_LOOP_1_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_STRIP_CLUB_1; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7009,7 +7075,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_STRIP_CLUB_LOOP_1_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_STRIP_CLUB_1; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7019,7 +7085,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_STRIP_CLUB_LOOP_2_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_STRIP_CLUB_2; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_2); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7029,7 +7095,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_STRIP_CLUB_LOOP_2_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_STRIP_CLUB_2; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_STRIP_CLUB_2; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_STRIP_CLUB_2); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7047,7 +7113,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_38: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_DOG_FOOD_FACTORY; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_DOG_FOOD_FACTORY; emittingVolume = 110; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOG_FOOD_FACTORY); m_sQueueSample.m_nReleasingVolumeModificator = 6; @@ -7057,7 +7123,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_39: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_DOG_FOOD_FACTORY; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_DOG_FOOD_FACTORY; emittingVolume = 110; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOG_FOOD_FACTORY); m_sQueueSample.m_nReleasingVolumeModificator = 6; @@ -7071,7 +7137,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_CHINATOWN_RESTAURANT_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_CHINATOWN; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RESTAURANT_CHINATOWN; emittingVolume = 110; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_CHINATOWN); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7081,7 +7147,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_CHINATOWN_RESTAURANT_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_CHINATOWN; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RESTAURANT_CHINATOWN; emittingVolume = 110; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_CHINATOWN); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7091,7 +7157,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_CIPRIANI_RESAURANT_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_ITALY; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RESTAURANT_ITALY; emittingVolume = 110; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_ITALY); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7101,7 +7167,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_CIPRIANI_RESAURANT_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_ITALY; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RESTAURANT_ITALY; emittingVolume = 110; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_ITALY); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7111,7 +7177,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_46_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_1; emittingVolume = 110; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7121,7 +7187,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_47_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_1; emittingVolume = 110; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7131,7 +7197,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_MARCO_BISTRO_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_2; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_2; emittingVolume = 110; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_2); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7141,7 +7207,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_MARCO_BISTRO_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_RESTAURANT_GENERIC_2; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_2; emittingVolume = 110; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RESTAURANT_GENERIC_2); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7171,7 +7237,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_FRANKIE_PIANO: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_PIANO_BAR_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_PIANO_BAR; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PIANO_BAR_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7181,7 +7247,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_PARTY_1_LOOP: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_CLUB_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CLUB_1; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CLUB_1); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7201,7 +7267,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_BANK_ALARM_LOOP_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_BANK_ALARM_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_BANK_ALARM; emittingVolume = 90; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BANK_ALARM_1); m_sQueueSample.m_nReleasingVolumeModificator = 2; @@ -7211,7 +7277,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_BANK_ALARM_LOOP_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_BANK_ALARM_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_BANK_ALARM; emittingVolume = 90; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BANK_ALARM_1); m_sQueueSample.m_nReleasingVolumeModificator = 2; @@ -7221,7 +7287,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_POLICE_BALL_LOOP_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_POLICE_BALL; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BALL_1); m_sQueueSample.m_nReleasingVolumeModificator = 2; @@ -7231,7 +7297,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_POLICE_BALL_LOOP_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_POLICE_BALL_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_POLICE_BALL; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_BALL_1); m_sQueueSample.m_nReleasingVolumeModificator = 2; @@ -7241,7 +7307,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RAVE_INDUSTRIAL; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_INDUSTRIAL); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7251,7 +7317,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_RAVE_INDUSTRIAL; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RAVE_INDUSTRIAL; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_INDUSTRIAL); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7266,7 +7332,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_RAVE_2_LOOP_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RAVE_COMMERCIAL; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7277,7 +7343,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_RAVE_2_LOOP_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_RAVE_COMMERCIAL; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RAVE_COMMERCIAL; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7287,7 +7353,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_RAVE_3_LOOP_S: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_S; m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RAVE_SUBURBAN; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_SUBURBAN); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7297,7 +7363,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_RAVE_3_LOOP_L: m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; m_sQueueSample.m_nSampleIndex = SFX_RAVE_SUBURBAN; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_RAVE_SUBURBAN; emittingVolume = MAX_VOLUME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RAVE_SUBURBAN); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -7350,38 +7416,38 @@ cAudioManager::ProcessPornCinema(uint8 sound) case SCRIPT_SOUND_PORN_CINEMA_1_S: case SCRIPT_SOUND_MISTY_SEX_S: m_sQueueSample.m_nSampleIndex = SFX_PORN_1_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_PORN_1; sample = SFX_PORN_1_GROAN_1; m_sQueueSample.m_fSoundIntensity = 20.0f; break; case SCRIPT_SOUND_PORN_CINEMA_1_L: case SCRIPT_SOUND_MISTY_SEX_L: m_sQueueSample.m_nSampleIndex = SFX_PORN_1_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_PORN_1; sample = SFX_PORN_1_GROAN_1; m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; break; case SCRIPT_SOUND_PORN_CINEMA_2_S: m_sQueueSample.m_nSampleIndex = SFX_PORN_2_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_PORN_2; sample = SFX_PORN_2_GROAN_1; m_sQueueSample.m_fSoundIntensity = 20.0f; break; case SCRIPT_SOUND_PORN_CINEMA_2_L: m_sQueueSample.m_nSampleIndex = SFX_PORN_2_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_PORN_2; sample = SFX_PORN_2_GROAN_1; m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; break; case SCRIPT_SOUND_PORN_CINEMA_3_S: m_sQueueSample.m_nSampleIndex = SFX_PORN_3_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_PORN_3; m_sQueueSample.m_fSoundIntensity = 20.0f; sample = SFX_PORN_3_GROAN_1; break; case SCRIPT_SOUND_PORN_CINEMA_3_L: m_sQueueSample.m_nSampleIndex = SFX_PORN_3_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_PORN_3; m_sQueueSample.m_fSoundIntensity = SCRIPT_OBJECT_INTENSITY_L; sample = SFX_PORN_3_GROAN_1; break; @@ -7454,7 +7520,7 @@ cAudioManager::ProcessWorkShopScriptObject(uint8 sound) m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = SFX_WORKSHOP_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_WORKSHOP; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_WORKSHOP_1); m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_bIs2D = false; @@ -7493,7 +7559,7 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound) m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = SFX_SAWMILL_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_SAWMILL; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SAWMILL_LOOP); m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_bIs2D = false; @@ -7513,7 +7579,7 @@ cAudioManager::ProcessSawMillScriptObject(uint8 sound) m_sQueueSample.m_nVolume = ComputeVolume(70, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = SFX_SAWMILL_CUT_WOOD; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_SAWMILL; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nCounter = 1; m_sQueueSample.m_bIs2D = false; @@ -7549,7 +7615,7 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound) m_sQueueSample.m_nVolume = ComputeVolume(45, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = SFX_LAUNDERETTE_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_LAUNDERETTE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_LAUNDERETTE_LOOP); m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_bIs2D = false; @@ -7567,7 +7633,7 @@ cAudioManager::ProcessLaunderetteScriptObject(uint8 sound) m_sQueueSample.m_nVolume = ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = SFX_LAUNDERETTE_SONG_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_LAUNDERETTE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_LAUNDERETTE_SONG_LOOP); m_sQueueSample.m_nCounter = 1; m_sQueueSample.m_bIs2D = false; @@ -7606,7 +7672,7 @@ cAudioManager::ProcessShopScriptObject(uint8 sound) m_sQueueSample.m_nVolume = ComputeVolume(30, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = SFX_SHOP_LOOP; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_SHOP; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SHOP_LOOP); m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_bIs2D = false; @@ -7627,7 +7693,7 @@ cAudioManager::ProcessShopScriptObject(uint8 sound) if (m_sQueueSample.m_nVolume != 0) { rand = m_anRandomTable[1] & 1; m_sQueueSample.m_nSampleIndex = rand + SFX_SHOP_TILL_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_SHOP; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nCounter = rand + 1; m_sQueueSample.m_bIs2D = false; @@ -7670,7 +7736,7 @@ cAudioManager::ProcessAirportScriptObject(uint8 sound) m_sQueueSample.m_nVolume = ComputeVolume(110, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] & 3) + SFX_AIRPORT_ANNOUNCEMENT_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_AIRPORT; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_bIs2D = false; @@ -7716,7 +7782,7 @@ cAudioManager::ProcessCinemaScriptObject(uint8 sound) m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = iSound % 3 + SFX_CINEMA_BASS_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_CINEMA; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 4); m_sQueueSample.m_nCounter = iSound++; @@ -7765,7 +7831,7 @@ cAudioManager::ProcessDocksScriptObject(uint8 sound) m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = SFX_DOCKS_FOGHORN; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_DOCKS; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_DOCKS_FOGHORN); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8); m_sQueueSample.m_nCounter = iSound++; @@ -7813,7 +7879,7 @@ cAudioManager::ProcessHomeScriptObject(uint8 sound) m_sQueueSample.m_nVolume = ComputeVolume(rand, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = m_anRandomTable[0] % 5 + SFX_HOME_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_BUILDING_HOME; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); m_sQueueSample.m_nCounter = iSound++; @@ -7901,7 +7967,7 @@ cAudioManager::ProcessWeather(int32 id) if (m_asAudioEntities[id].m_AudioEvents && m_asAudioEntities[id].m_awAudioEvent[0] == SOUND_LIGHTNING) { if (m_asAudioEntities[id].m_afVolume[0] >= 10.f) { m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_1; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_EXTRAS; m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 4000; vol = (m_asAudioEntities[id].m_afVolume[0] - 10.f) + 40; } else { @@ -7955,6 +8021,7 @@ cAudioManager::ProcessFrontEnd() bool stereo; bool processedPickup; bool processedMission; + bool frontendBank; int16 sample; static uint8 iSound = 0; @@ -7965,6 +8032,7 @@ cAudioManager::ProcessFrontEnd() processedPickup = false; stereo = false; processedMission = false; + frontendBank = false; switch (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]) { case SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM: m_sQueueSample.m_nSampleIndex = SFX_ERROR_FIRE_RIFLE; @@ -8017,6 +8085,7 @@ cAudioManager::ProcessFrontEnd() stereo = true; break; case SOUND_PAGER: + // TODO: ps2 code m_sQueueSample.m_nSampleIndex = SFX_PAGER; break; case SOUND_RACE_START_3: @@ -8039,31 +8108,39 @@ cAudioManager::ProcessFrontEnd() case SOUND_FRONTEND_MENU_NEW_PAGE: m_sQueueSample.m_nSampleIndex = SFX_PAGE_CHANGE_AND_BACK_LEFT; stereo = true; + frontendBank = true; break; case SOUND_FRONTEND_MENU_NAVIGATION: m_sQueueSample.m_nSampleIndex = SFX_HIGHLIGHT_LEFT; stereo = true; + frontendBank = true; break; case SOUND_FRONTEND_MENU_SETTING_CHANGE: m_sQueueSample.m_nSampleIndex = SFX_SELECT_LEFT; stereo = true; + frontendBank = true; break; case SOUND_FRONTEND_MENU_BACK: m_sQueueSample.m_nSampleIndex = SFX_SUB_MENU_BACK_LEFT; stereo = true; + frontendBank = true; break; case SOUND_9A: m_sQueueSample.m_nSampleIndex = SFX_STEREO_LEFT; stereo = true; + frontendBank = true; break; case SOUND_9B: m_sQueueSample.m_nSampleIndex = SFX_MONO; + frontendBank = true; break; case SOUND_FRONTEND_AUDIO_TEST: m_sQueueSample.m_nSampleIndex = m_anRandomTable[0] % 3 + SFX_NOISE_BURST_1; + frontendBank = true; break; case SOUND_FRONTEND_FAIL: m_sQueueSample.m_nSampleIndex = SFX_ERROR_LEFT; + frontendBank = true; stereo = true; break; case SOUND_FRONTEND_NO_RADIO: @@ -8102,7 +8179,7 @@ cAudioManager::ProcessFrontEnd() m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = frontendBank ? SAMPLEBANK_FRONTEND : SAMPLEBANK_MAIN; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_bIs2D = true; m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; @@ -8428,7 +8505,7 @@ cAudioManager::ProcessBridgeWarning() if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nSampleIndex = SFX_BRIDGE_OPEN_WARNING; - m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN; + m_sQueueSample.m_nBankIndex = SAMPLEBANK_EXTRAS; m_sQueueSample.m_bIs2D = false; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BRIDGE_OPEN_WARNING); diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index c9cb5bef..c58d0a39 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -217,7 +217,7 @@ public: // "Should" be in alphabetic order, except "getXTalkSfx" void AddDetailsToRequestedOrderList(uint8 sample); - void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1, + void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 bank, uint8 counter, bool notLooping); void AddReflectionsToRequestedQueue(); void AddReleasingSounds(); diff --git a/src/audio/AudioSamples.h b/src/audio/AudioSamples.h index 937fe633..e2721888 100644 --- a/src/audio/AudioSamples.h +++ b/src/audio/AudioSamples.h @@ -350,42 +350,52 @@ enum eSfxSample : uint32 SFX_RADIO_CLICK, SFX_INFO, + // bank 1 SFX_CAR_ACCEL_1, SFX_CAR_AFTER_ACCEL_1, SFX_CAR_FINGER_OFF_ACCEL_1, + // bank 2 SFX_CAR_ACCEL_2, SFX_CAR_AFTER_ACCEL_2, SFX_CAR_FINGER_OFF_ACCEL_2, + // bank 3 SFX_CAR_ACCEL_3, SFX_CAR_AFTER_ACCEL_3, SFX_CAR_FINGER_OFF_ACCEL_3, + // bank 4 SFX_CAR_ACCEL_4, SFX_CAR_AFTER_ACCEL_4, SFX_CAR_FINGER_OFF_ACCEL_4, + // bank 5 SFX_CAR_ACCEL_5, SFX_CAR_AFTER_ACCEL_5, SFX_CAR_FINGER_OFF_ACCEL_5, + // bank 6 SFX_CAR_ACCEL_6, SFX_CAR_AFTER_ACCEL_6, SFX_CAR_FINGER_OFF_ACCEL_6, + // bank 7 SFX_CAR_ACCEL_7, SFX_CAR_AFTER_ACCEL_7, SFX_CAR_FINGER_OFF_ACCEL_7, + // bank 8 SFX_CAR_ACCEL_8, SFX_CAR_AFTER_ACCEL_8, SFX_CAR_FINGER_OFF_ACCEL_8, + // bank 9 SFX_CAR_ACCEL_9, SFX_CAR_AFTER_ACCEL_9, SFX_CAR_FINGER_OFF_ACCEL_9, + // bank 10 SFX_PAGE_CHANGE_AND_BACK_LEFT, SFX_PAGE_CHANGE_AND_BACK_RIGHT, SFX_HIGHLIGHT_LEFT, @@ -402,64 +412,142 @@ enum eSfxSample : uint32 SFX_NOISE_BURST_3, SFX_ERROR_LEFT, SFX_ERROR_RIGHT, + + // bank 11 SFX_TRAIN_STATION_AMBIENCE_LOOP, SFX_TRAIN_STATION_ANNOUNCE, + + // bank 12 SFX_CLUB_1, + + // bank 13 SFX_CLUB_2, + + // bank 14 SFX_CLUB_3, + + // bank 15 SFX_CLUB_4, + + // bank 16 SFX_CLUB_5, + + // bank 17 SFX_CLUB_6, + + // bank 18 SFX_CLUB_7, + + // bank 19 SFX_CLUB_8, + + // bank 20 SFX_CLUB_9, + + // bank 21 SFX_CLUB_10, + + // bank 22 SFX_CLUB_11, + + // bank 23 SFX_CLUB_12, + + // bank 24 SFX_CLUB_RAGGA, + + // bank 25 SFX_STRIP_CLUB_1, + + // bank 26 SFX_STRIP_CLUB_2, + + // bank 27 SFX_WORKSHOP_1, + + // bank 28 SFX_PIANO_BAR_1, + + // bank 29 SFX_SAWMILL_LOOP, SFX_SAWMILL_CUT_WOOD, + + // bank 30 SFX_DOG_FOOD_FACTORY, + + // bank 31 SFX_LAUNDERETTE_LOOP, SFX_LAUNDERETTE_SONG_LOOP, + + // bank 32 SFX_RESTAURANT_CHINATOWN, + + // bank 33 SFX_RESTAURANT_ITALY, + + // bank 34 SFX_RESTAURANT_GENERIC_1, + + // bank 35 SFX_RESTAURANT_GENERIC_2, + + // bank 36 SFX_AIRPORT_ANNOUNCEMENT_1, SFX_AIRPORT_ANNOUNCEMENT_2, SFX_AIRPORT_ANNOUNCEMENT_3, SFX_AIRPORT_ANNOUNCEMENT_4, + + // bank 37 SFX_SHOP_LOOP, SFX_SHOP_TILL_1, SFX_SHOP_TILL_2, + + // bank 38 SFX_CINEMA_BASS_1, SFX_CINEMA_BASS_2, SFX_CINEMA_BASS_3, + + // bank 39 SFX_DOCKS_FOGHORN, + + // bank 40 SFX_HOME_1, SFX_HOME_2, SFX_HOME_3, SFX_HOME_4, SFX_HOME_5, + + // bank 41 SFX_PORN_1_LOOP, SFX_PORN_1_GROAN_1, SFX_PORN_1_GROAN_2, + + // bank 42 SFX_PORN_2_LOOP, SFX_PORN_2_GROAN_1, SFX_PORN_2_GROAN_2, + + // bank 43 SFX_PORN_3_LOOP, SFX_PORN_3_GROAN_1, SFX_PORN_3_GROAN_2, + + // bank 44 SFX_POLICE_BALL_1, + + // bank 45 SFX_BANK_ALARM_1, + + // bank 46 SFX_RAVE_INDUSTRIAL, + + // bank 47 SFX_RAVE_COMMERCIAL, + + // bank 48 SFX_RAVE_SUBURBAN, + + // bank 49 SFX_RAVE_COMMERCIAL_2, // unused banks 50-58 @@ -473,6 +561,7 @@ enum eSfxSample : uint32 SFX_CLUB_1_8, SFX_CLUB_1_9, + // bank 59 SFX_EXPLOSION_1, SFX_BRIDGE_OPEN_WARNING, diff --git a/src/audio/sampman.h b/src/audio/sampman.h index 621d4015..391e884b 100644 --- a/src/audio/sampman.h +++ b/src/audio/sampman.h @@ -13,9 +13,83 @@ struct tSample { int32 nLoopEnd; }; +#ifdef GTA_PS2 +#define PS2BANK(e) e +#else +#define PS2BANK(e) e = SAMPLEBANK_MAIN +#endif // GTA_PS2 + + enum { SAMPLEBANK_MAIN, + + CAR_SAMPLEBANKS_OFFSET, + SAMPLEBANK_CAR_PACARD = CAR_SAMPLEBANKS_OFFSET, + SAMPLEBANK_CAR_PATHFINDER, + SAMPLEBANK_CAR_PORSCHE, + SAMPLEBANK_CAR_SPIDER, + SAMPLEBANK_CAR_MERC, + SAMPLEBANK_CAR_MACKTRUCK, + SAMPLEBANK_CAR_HOTROD, + SAMPLEBANK_CAR_COBRA, + SAMPLEBANK_CAR_NONE, + + PS2BANK(SAMPLEBANK_FRONTEND), + + PS2BANK(SAMPLEBANK_TRAIN), + + PS2BANK(SAMPLEBANK_BUILDING_CLUB_1), + PS2BANK(SAMPLEBANK_BUILDING_CLUB_2), + PS2BANK(SAMPLEBANK_BUILDING_CLUB_3), + PS2BANK(SAMPLEBANK_BUILDING_CLUB_4), + PS2BANK(SAMPLEBANK_BUILDING_CLUB_5), + PS2BANK(SAMPLEBANK_BUILDING_CLUB_6), + PS2BANK(SAMPLEBANK_BUILDING_CLUB_7), + PS2BANK(SAMPLEBANK_BUILDING_CLUB_8), + PS2BANK(SAMPLEBANK_BUILDING_CLUB_9), + PS2BANK(SAMPLEBANK_BUILDING_CLUB_10), + PS2BANK(SAMPLEBANK_BUILDING_CLUB_11), + PS2BANK(SAMPLEBANK_BUILDING_CLUB_12), + PS2BANK(SAMPLEBANK_BUILDING_CLUB_RAGGA), + PS2BANK(SAMPLEBANK_BUILDING_STRIP_CLUB_1), + PS2BANK(SAMPLEBANK_BUILDING_STRIP_CLUB_2), + PS2BANK(SAMPLEBANK_BUILDING_WORKSHOP), + PS2BANK(SAMPLEBANK_BUILDING_PIANO_BAR), + PS2BANK(SAMPLEBANK_BUILDING_SAWMILL), + PS2BANK(SAMPLEBANK_BUILDING_DOG_FOOD_FACTORY), + PS2BANK(SAMPLEBANK_BUILDING_LAUNDERETTE), + PS2BANK(SAMPLEBANK_BUILDING_RESTAURANT_CHINATOWN), + PS2BANK(SAMPLEBANK_BUILDING_RESTAURANT_ITALY), + PS2BANK(SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_1), + PS2BANK(SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_2), + PS2BANK(SAMPLEBANK_BUILDING_AIRPORT), + PS2BANK(SAMPLEBANK_BUILDING_SHOP), + PS2BANK(SAMPLEBANK_BUILDING_CINEMA), + PS2BANK(SAMPLEBANK_BUILDING_DOCKS), + PS2BANK(SAMPLEBANK_BUILDING_HOME), + PS2BANK(SAMPLEBANK_BUILDING_PORN_1), + PS2BANK(SAMPLEBANK_BUILDING_PORN_2), + PS2BANK(SAMPLEBANK_BUILDING_PORN_3), + PS2BANK(SAMPLEBANK_BUILDING_POLICE_BALL), + PS2BANK(SAMPLEBANK_BUILDING_BANK_ALARM), + PS2BANK(SAMPLEBANK_BUILDING_RAVE_INDUSTRIAL), + PS2BANK(SAMPLEBANK_BUILDING_RAVE_COMMERCIAL), + PS2BANK(SAMPLEBANK_BUILDING_RAVE_SUBURBAN), + PS2BANK(SAMPLEBANK_BUILDING_RAVE_COMMERCIAL_2), + + PS2BANK(SAMPLEBANK_BUILDING_39), + PS2BANK(SAMPLEBANK_BUILDING_40), + PS2BANK(SAMPLEBANK_BUILDING_41), + PS2BANK(SAMPLEBANK_BUILDING_42), + PS2BANK(SAMPLEBANK_BUILDING_43), + PS2BANK(SAMPLEBANK_BUILDING_44), + PS2BANK(SAMPLEBANK_BUILDING_45), + PS2BANK(SAMPLEBANK_BUILDING_46), + PS2BANK(SAMPLEBANK_BUILDING_47), + + PS2BANK(SAMPLEBANK_EXTRAS), + SAMPLEBANK_PED, MAX_SAMPLEBANKS, SAMPLEBANK_INVALID From 408f47fc9d85e930f2dc1a4cc9f50b3c0d4c60b8 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sat, 6 Jun 2020 12:58:10 +0300 Subject: [PATCH 098/133] fixed linux saving --- src/core/common.h | 2 +- src/vehicles/CarGen.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/common.h b/src/core/common.h index 7d339660..ff1feb5c 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -404,7 +404,7 @@ inline T *WriteSaveBuf(uint8 *&buf, const T &value) WriteSaveBuf(buf, b);\ WriteSaveBuf(buf, c);\ WriteSaveBuf(buf, d);\ - WriteSaveBuf(buf, size); + WriteSaveBuf(buf, size); #define CheckSaveHeader(buf,a,b,c,d,size)\ assert(ReadSaveBuf(buf) == a);\ diff --git a/src/vehicles/CarGen.cpp b/src/vehicles/CarGen.cpp index 72b6c30c..cb21b918 100644 --- a/src/vehicles/CarGen.cpp +++ b/src/vehicles/CarGen.cpp @@ -226,7 +226,7 @@ INITSAVEBUF WriteSaveBuf(buffer, ProcessCounter); WriteSaveBuf(buffer, GenerateEvenIfPlayerIsCloseCounter); WriteSaveBuf(buffer, (int16)0); // alignment - WriteSaveBuf(buffer, sizeof(CarGeneratorArray)); + WriteSaveBuf(buffer, (uint32)sizeof(CarGeneratorArray)); for (int i = 0; i < NUM_CARGENS; i++) WriteSaveBuf(buffer, CarGeneratorArray[i]); VALIDATESAVEBUF(*size) From 3f26250d73d5c196a66262821a7980ccdbd8deed Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sat, 6 Jun 2020 13:31:09 +0300 Subject: [PATCH 099/133] fixing some uninitialized stuff --- src/control/Script.cpp | 4 ++++ src/entities/Physical.cpp | 3 +++ src/math/Matrix.h | 4 ++++ src/peds/Ped.cpp | 3 +++ src/peds/PlayerPed.cpp | 8 ++++++-- src/vehicles/Plane.cpp | 4 ++++ src/vehicles/Train.cpp | 4 ++++ src/vehicles/Vehicle.cpp | 3 +++ 8 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index bc15a695..94590087 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -11763,7 +11763,11 @@ void CTheScripts::UpdateObjectIndices() if (!pModel) continue; strcpy(name, pModel->GetName()); +#ifdef FIX_BUGS + for (int k = 0; k < USED_OBJECT_NAME_LENGTH && name[k]; k++) +#else for (int k = 0; k < USED_OBJECT_NAME_LENGTH; k++) +#endif name[k] = toupper(name[k]); if (strcmp(name, UsedObjectArray[i].name) == 0) { found = true; diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 9fc5a853..f76c3e29 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -63,6 +63,9 @@ CPhysical::CPhysical(void) m_phy_flagA10 = false; m_phy_flagA20 = false; +#ifdef FIX_BUGS + m_nSurfaceTouched = SURFACE_DEFAULT; +#endif m_nZoneLevel = LEVEL_NONE; } diff --git a/src/math/Matrix.h b/src/math/Matrix.h index 5ec79aba..d8920a65 100644 --- a/src/math/Matrix.h +++ b/src/math/Matrix.h @@ -30,7 +30,11 @@ public: RwMatrixDestroy(m_attachment); } void Attach(RwMatrix *matrix, bool owner = false){ +#ifdef FIX_BUGS + if(m_attachment && m_hasRwMatrix) +#else if(m_hasRwMatrix && m_attachment) +#endif RwMatrixDestroy(m_attachment); m_attachment = matrix; m_hasRwMatrix = owner; diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index eebfa099..4e9280e6 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -187,6 +187,9 @@ CPed::CPed(uint32 pedType) : m_pedIK(this) m_queuedSound = SOUND_NO_SOUND; m_objective = OBJECTIVE_NONE; m_prevObjective = OBJECTIVE_NONE; +#ifdef FIX_BUGS + m_objectiveTimer = 0; +#endif CharCreatedBy = RANDOM_CHAR; m_leader = nil; m_pedInObjective = nil; diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index 305c329e..6613ea1b 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -35,6 +35,9 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1) { m_fMoveSpeed = 0.0f; SetModelIndex(MI_PLAYER); +#ifdef FIX_BUGS + m_fCurrentStamina = m_fMaxStamina = 150.0f; +#endif SetInitialState(); m_pWanted = new CWanted(); @@ -46,8 +49,9 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1) m_bSpeedTimerFlag = false; m_pPointGunAt = nil; m_nPedState = PED_IDLE; - m_fMaxStamina = 150.0f; - m_fCurrentStamina = m_fMaxStamina; +#ifndef FIX_BUGS + m_fCurrentStamina = m_fMaxStamina = 150.0f; +#endif m_fStaminaProgress = 0.0f; m_nEvadeAmount = 0; field_1367 = 0; diff --git a/src/vehicles/Plane.cpp b/src/vehicles/Plane.cpp index 71189d84..3bf385a0 100644 --- a/src/vehicles/Plane.cpp +++ b/src/vehicles/Plane.cpp @@ -84,6 +84,10 @@ CPlane::CPlane(int32 id, uint8 CreatedBy) SetStatus(STATUS_PLANE); bIsBIGBuilding = true; m_level = LEVEL_NONE; + +#ifdef FIX_BUGS + m_isFarAway = true; +#endif } CPlane::~CPlane() diff --git a/src/vehicles/Train.cpp b/src/vehicles/Train.cpp index 38bb1300..baf6bfb7 100644 --- a/src/vehicles/Train.cpp +++ b/src/vehicles/Train.cpp @@ -63,6 +63,10 @@ CTrain::CTrain(int32 id, uint8 CreatedBy) bUsesCollision = true; SetStatus(STATUS_TRAIN_MOVING); + +#ifdef FIX_BUGS + m_isFarAway = true; +#endif } void diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index dbb15b5d..addbfc3d 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -59,6 +59,9 @@ CVehicle::CVehicle(uint8 CreatedBy) bIsLawEnforcer = false; bIsAmbulanceOnDuty = false; bIsFireTruckOnDuty = false; +#ifdef FIX_BUGS + bIsHandbrakeOn = false; +#endif CCarCtrl::UpdateCarCount(this, false); m_fHealth = 1000.0f; bEngineOn = true; From e099aaaa6b7aa90a632d785c6f83a1fbb110cdd9 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sat, 6 Jun 2020 16:36:26 +0300 Subject: [PATCH 100/133] minor fixes --- src/entities/Physical.cpp | 4 ++++ src/peds/Ped.cpp | 3 +++ src/vehicles/Vehicle.cpp | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index f76c3e29..e89b4858 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -21,6 +21,10 @@ CPhysical::CPhysical(void) { int i; +#ifdef FIX_BUGS + m_nLastTimeCollided = 0; +#endif + m_fForceMultiplier = 1.0f; m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f); diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 4e9280e6..254f89a6 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -243,6 +243,9 @@ CPed::CPed(uint32 pedType) : m_pedIK(this) m_nPedState = PED_IDLE; m_nLastPedState = PED_NONE; m_nMoveState = PEDMOVE_STILL; +#ifdef FIX_BUGS + m_nPrevMoveState = PEDMOVE_NONE; +#endif m_nStoredMoveState = PEDMOVE_NONE; m_pFire = nil; m_pPointGunAt = nil; diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index addbfc3d..eb6c8d6d 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -99,7 +99,7 @@ CVehicle::CVehicle(uint8 CreatedBy) m_numPedsUseItAsCover = 0; bIsCarParkVehicle = false; bHasAlreadyBeenRecorded = false; - m_bSirenOrAlarm = 0; + m_bSirenOrAlarm = false; m_nCarHornTimer = 0; m_nCarHornPattern = 0; m_nAlarmState = 0; From 44e2fcee393a16a3db5251f14e839506ae544898 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 7 Jun 2020 00:03:42 +0200 Subject: [PATCH 101/133] disable skidding bugfix --- src/vehicles/Vehicle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index eb6c8d6d..e21ad07c 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -469,7 +469,7 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon static bool bBraking; static bool bDriving; -#ifdef FIX_BUGS +#ifdef FIX_SIGNIFICANT_BUGS bAlreadySkidding = false; #endif From 552205dfbaea70628df56a4966d269a81a97d28e Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 7 Jun 2020 04:10:06 +0300 Subject: [PATCH 102/133] FONT_BANK renamed to FONT_STANDARD --- src/control/Darkel.cpp | 6 +++--- src/control/Garages.cpp | 2 +- src/control/Pickups.cpp | 2 +- src/control/Replay.cpp | 2 +- src/control/SceneEdit.cpp | 4 ++-- src/core/Debug.cpp | 6 +++--- src/core/Frontend.cpp | 32 ++++++++++++++++---------------- src/core/Pad.cpp | 4 ++-- src/core/main.cpp | 4 ++-- src/core/timebars.cpp | 2 +- src/render/Console.cpp | 2 +- src/render/Font.cpp | 12 ++++++------ src/render/Font.h | 2 +- src/render/Hud.cpp | 16 ++++++++-------- src/render/SpecialFX.cpp | 2 +- src/rw/TexRead.cpp | 2 +- 16 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/control/Darkel.cpp b/src/control/Darkel.cpp index cfd58340..5e87aaec 100644 --- a/src/control/Darkel.cpp +++ b/src/control/Darkel.cpp @@ -74,7 +74,7 @@ CDarkel::DrawMessages() CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f)); CFont::SetJustifyOff(); CFont::SetColor(CRGBA(255, 255, 128, CalcFade(timePassedSinceStart, 3000, 11000))); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); if (pStartMessage) { CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, pStartMessage); } @@ -84,7 +84,7 @@ CDarkel::DrawMessages() CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f)); CFont::SetJustifyOff(); CFont::SetColor(CRGBA(255, 255, 128, CalcFade(timePassedSinceStart, 0, 8000))); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); if (pStartMessage) { CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, pStartMessage); } @@ -124,7 +124,7 @@ CDarkel::DrawMessages() CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f)); CFont::SetJustifyOff(); CFont::SetColor(CRGBA(128, 255, 128, CalcFade(timePassedSinceStart, 0, 5000))); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); int y = SCREEN_HEIGHT / 2 + SCREEN_SCALE_Y(25.0f - timePassedSinceStart * 0.01f); CFont::PrintString(SCREEN_WIDTH / 2, y, TheText.Get("KF_3")); } diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index e37df8d4..71f4b5d0 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -1399,7 +1399,7 @@ void CGarages::PrintMessages() CFont::SetBackgroundOff(); CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(50.0f)); CFont::SetCentreOn(); - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetColor(CRGBA(0, 0, 0, 255)); #if defined(PS2) || defined (FIX_BUGS) diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 32bffa17..33095036 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -975,7 +975,7 @@ CPickups::RenderPickUpText() CFont::SetColor(CRGBA(aMessages[i].m_color.red, aMessages[i].m_color.green, aMessages[i].m_color.blue, aMessages[i].m_color.alpha)); CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); CFont::PrintString(aMessages[i].m_pos.x, aMessages[i].m_pos.y, strToPrint); } NumMessages = 0; diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index 707f1d87..b2ecf38f 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -1581,7 +1581,7 @@ void CReplay::Display() CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f)); CFont::SetAlignment(ALIGN_LEFT); CFont::SetColor(CRGBA(255, 255, 200, 200)); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); if (Mode == MODE_PLAYBACK) CFont::PrintString(SCREEN_SCALE_X(63.5f), SCREEN_SCALE_Y(30.0f), TheText.Get("REPLAY")); } diff --git a/src/control/SceneEdit.cpp b/src/control/SceneEdit.cpp index be8c5519..7b7eb61d 100644 --- a/src/control/SceneEdit.cpp +++ b/src/control/SceneEdit.cpp @@ -269,7 +269,7 @@ void CSceneEdit::Draw(void) CFont::SetRightJustifyWrap(0.0f); CFont::SetBackGroundOnlyTextOff(); #ifdef FIX_BUGS - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); CFont::SetPropOn(); CFont::SetDropColor(CRGBA(0, 0, 0, 255)); CFont::SetDropShadowPosition(1); @@ -292,7 +292,7 @@ void CSceneEdit::Draw(void) CFont::SetCentreOff(); CFont::SetScale(SCREEN_SCALE_X(0.7f), SCREEN_SCALE_Y(0.7f)); #ifdef FIX_BUGS - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); #else CFont::SetFontStyle(FONT_HEADING); #endif diff --git a/src/core/Debug.cpp b/src/core/Debug.cpp index e794dcaf..e319388c 100644 --- a/src/core/Debug.cpp +++ b/src/core/Debug.cpp @@ -55,7 +55,7 @@ CDebug::DebugDisplayTextBuffer() CFont::SetJustifyOn(); CFont::SetRightJustifyWrap(0.0f); CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); #else // this is not even readable CFont::SetPropOff(); @@ -65,7 +65,7 @@ CDebug::DebugDisplayTextBuffer() CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); CFont::SetPropOff(); #endif do { @@ -113,7 +113,7 @@ CDebug::DisplayScreenStrings() CFont::SetRightJustifyWrap(0.0f); CFont::SetWrapx(9999.0f); CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); for(i = 0; i < ms_nScreenStrs; i++){ /* diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 3ead688b..9d231648 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -782,7 +782,7 @@ CMenuManager::Draw() nextYToUse += 24.0f + 10.0f; } - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT * MENU_TEXT_SIZE_X), MENU_Y(MENUACTION_SCALE_MULT * MENU_TEXT_SIZE_Y)); CFont::SetRightJustifyOff(); CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255))); @@ -865,7 +865,7 @@ CMenuManager::Draw() columnWidth = 120; headerHeight = 38; lineHeight = 20; - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = SMALLTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = SMALLTEXT_Y_SCALE)); CFont::SetRightJustifyOff(); break; @@ -902,7 +902,7 @@ CMenuManager::Draw() columnWidth = 180; headerHeight = 60; lineHeight = 24; - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE)); break; #endif @@ -917,7 +917,7 @@ CMenuManager::Draw() } #ifdef PS2_LIKE_MENU - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); #endif switch (m_nCurrScreen) { @@ -1768,7 +1768,7 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8 CFont::SetRightJustifyOff(); CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE)); - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); if (!m_bKeyIsOK) DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); @@ -1781,7 +1781,7 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8 CFont::PrintString(MENU_X_LEFT_ALIGNED(275.0f), SCREEN_SCALE_FROM_BOTTOM(114.0f), TheText.Get("FET_CIG")); // BACKSPACE TO CLEAR - LMB,RETURN TO CHANGE CFont::SetRightJustifyOff(); CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE)); - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); m_bKeyIsOK = false; m_bKeyChangeNotProcessed = false; } @@ -1793,7 +1793,7 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8 CFont::PrintString(MENU_X_LEFT_ALIGNED(275.0f), SCREEN_SCALE_FROM_BOTTOM(114.0f), TheText.Get("FET_EIG")); // CANNOT SET A CONTROL FOR THIS ACTION CFont::SetRightJustifyOff(); CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE)); - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); } } } @@ -1956,7 +1956,7 @@ CMenuManager::DrawControllerSetupScreen() CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X), MENU_Y(CONTSETUP_LIST_TOP), TheText.Get("FET_CCR")); CFont::SetRightJustifyOff(); CFont::SetScale(MENU_X_LEFT_ALIGNED(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE)); - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); int yStart; if (m_ControlMethod == CONTROL_CLASSIC) yStart = CONTSETUP_LIST_HEADER_HEIGHT + 29; @@ -2303,7 +2303,7 @@ CMenuManager::DrawFrontEndNormal() if (CheckHover(xStart, xStart + optionWidth, optionTop, optionBottom)) hoveredBottomBarOption = i; - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetScale(MENU_X(0.35f), MENU_Y(0.7f)); CFont::SetRightJustifyOff(); if (hoveredBottomBarOption == i && hoveredBottomBarOption != curBottomBarOption) @@ -2673,7 +2673,7 @@ CMenuManager::DrawPlayerSetupScreen() // Skin list CFont::SetRightJustifyOff(); CFont::SetScale(MENU_X(PLAYERSETUP_ROW_TEXT_X_SCALE), MENU_Y(PLAYERSETUP_ROW_TEXT_Y_SCALE)); - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); if (m_nSkinsTotal > 0) { for (m_pSelectedSkin = m_pSkinListHead.nextSkin; m_pSelectedSkin->skinId != m_nFirstVisibleRowOnList; m_pSelectedSkin = m_pSelectedSkin->nextSkin); @@ -3340,7 +3340,7 @@ CMenuManager::MessageScreen(const char *text) CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(170.0f)); CFont::SetRightJustifyWrap(SCREEN_SCALE_FROM_RIGHT(170.0f)); CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(120.0f), SCREEN_SCALE_Y(150.0f), SCREEN_SCALE_FROM_RIGHT(120.0f), SCREEN_SCALE_FROM_BOTTOM(220.0f)), CRGBA(50, 50, 50, 210)); - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetCentreSize(SCREEN_SCALE_X(380.0f)); CFont::SetCentreOn(); CFont::SetColor(CRGBA(255, 217, 106, 255)); @@ -3370,7 +3370,7 @@ void CMenuManager::PrintBriefs() { CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255))); - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetRightJustifyOff(); CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why @@ -3425,7 +3425,7 @@ CMenuManager::PrintErrorMessage() return; CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(140.0f), SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f)), CRGBA(64, 16, 16, 224)); - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetBackgroundOff(); CFont::SetPropOn(); CFont::SetCentreOff(); @@ -3446,7 +3446,7 @@ CMenuManager::PrintStats() { int rowNum = ConstructStatLine(99999); #ifdef GTA3_1_1_PATCH - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); #endif CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why float nextYChange, y, alphaMult; @@ -5351,7 +5351,7 @@ CMenuManager::PrintController(void) m_aFrontEndSprites[FE_ARROWS4].Draw(MENU_X_LEFT_ALIGNED(160.0f), MENU_Y(160.0f), MENU_X(235.2f), MENU_Y(175.2f), CRGBA(255, 255, 255, 255)); } - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); // X + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); // X // CFont::SetScale(0.4f, 0.4f); CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE)); // X @@ -5736,7 +5736,7 @@ CMenuManager::PrintMap(void) CRGBA(235, 170, 50, 255)); CFont::SetScale(MENU_X(0.4f), MENU_Y(0.7f)); - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255))); float nextX = MENU_X(30.0f), nextY = 95.0f; diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index 924d4724..a0fd0535 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -2286,7 +2286,7 @@ void CPad::PrintErrorMessage(void) CFont::SetCentreOn(); CFont::SetPropOn(); CFont::SetColor(CRGBA(255, 255, 200, 200)); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); CFont::PrintString ( SCREEN_WIDTH / 2, @@ -2303,7 +2303,7 @@ void CPad::PrintErrorMessage(void) CFont::SetCentreOn(); CFont::SetPropOn(); CFont::SetColor(CRGBA(255, 255, 200, 200)); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); CFont::PrintString ( SCREEN_WIDTH / 2, diff --git a/src/core/main.cpp b/src/core/main.cpp index eb39b287..3fca618b 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -507,7 +507,7 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen) CFont::SetScale(SCREEN_SCALE_X(0.75f), yscale); CFont::SetPropOn(); CFont::SetRightJustifyOff(); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); CFont::SetColor(CRGBA(255, 255, 255, 255)); AsciiToUnicode(str1, tmpstr); CFont::PrintString(hpos, vpos, tmpstr); @@ -702,7 +702,7 @@ DisplayGameDebugText() CFont::SetPropOn(); CFont::SetBackgroundOff(); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); CFont::SetScale(SCREEN_SCALE_X(0.5f), SCREEN_SCALE_Y(0.5f)); CFont::SetCentreOff(); CFont::SetRightJustifyOff(); diff --git a/src/core/timebars.cpp b/src/core/timebars.cpp index 6b841a5c..884feffd 100644 --- a/src/core/timebars.cpp +++ b/src/core/timebars.cpp @@ -92,7 +92,7 @@ void tbDisplay() CFont::SetWrapx(640.0f); CFont::SetRightJustifyOff(); CFont::SetPropOn(); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); sprintf(temp, "FPS: %.2f", Diag_GetFPS()); AsciiToUnicode(temp, wtemp); CFont::SetColor(CRGBA(255, 255, 255, 255)); diff --git a/src/render/Console.cpp b/src/render/Console.cpp index 8ea5b7a3..244bfb17 100644 --- a/src/render/Console.cpp +++ b/src/render/Console.cpp @@ -63,7 +63,7 @@ CConsole::Display() CFont::SetJustifyOn(); CFont::SetRightJustifyWrap(0.0f); CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); #ifndef FIX_BUGS CFont::SetPropOff(); // not sure why this is here anyway #endif diff --git a/src/render/Font.cpp b/src/render/Font.cpp index ef665fae..33b2dca1 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -250,7 +250,7 @@ CFont::Initialise(void) SetBackgroundColor(CRGBA(0x80, 0x80, 0x80, 0x80)); SetBackGroundOnlyTextOff(); SetPropOn(); - SetFontStyle(FONT_BANK); + SetFontStyle(FONT_STANDARD); SetRightJustifyWrap(0.0f); SetAlphaFade(255.0f); SetDropShadowPosition(0); @@ -348,7 +348,7 @@ CFont::PrintChar(float x, float y, wchar c) } #endif - if(Details.style == FONT_BANK || Details.style == FONT_HEADING){ + if(Details.style == FONT_STANDARD || Details.style == FONT_HEADING){ if(Details.dropShadowPosition != 0){ CSprite2d::AddSpriteToBank(Details.bank + Details.style, // BUG: game doesn't add bank CRect(x + SCREEN_SCALE_X(Details.dropShadowPosition), @@ -828,7 +828,7 @@ CFont::GetCharacterWidth(wchar c) if (IsJapanese()) { if (!Details.proportional) return Size[0][Details.style][192]; - if (c <= 94 || Details.style == FONT_HEADING || Details.style == FONT_BANK) { + if (c <= 94 || Details.style == FONT_HEADING || Details.style == FONT_STANDARD) { switch (Details.style) { case FONT_JAPANESE: @@ -844,7 +844,7 @@ CFont::GetCharacterWidth(wchar c) { case FONT_JAPANESE: return 29.4f; - case FONT_BANK: + case FONT_STANDARD: return 10.0f; case FONT_PAGER: return 31.5f; @@ -874,7 +874,7 @@ CFont::GetCharacterSize(wchar c) { if (!Details.proportional) return Size[0][Details.style][192] * Details.scaleX; - if (c <= 94 || Details.style == FONT_HEADING || Details.style == FONT_BANK) { + if (c <= 94 || Details.style == FONT_HEADING || Details.style == FONT_STANDARD) { switch (Details.style) { case FONT_JAPANESE: @@ -890,7 +890,7 @@ CFont::GetCharacterSize(wchar c) { case FONT_JAPANESE: return 29.4f * Details.scaleX; - case FONT_BANK: + case FONT_STANDARD: return 10.0f * Details.scaleX; case FONT_PAGER: return 31.5f * Details.scaleX; diff --git a/src/render/Font.h b/src/render/Font.h index 9b4e7132..fba5125b 100644 --- a/src/render/Font.h +++ b/src/render/Font.h @@ -28,7 +28,7 @@ struct CFontDetails class CSprite2d; enum { - FONT_BANK, + FONT_STANDARD, FONT_PAGER, FONT_HEADING, #ifdef MORE_LANGUAGES diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index c7f61d5d..8e8096a5 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -329,7 +329,7 @@ void CHud::Draw() CFont::SetCentreOn(); CFont::SetCentreSize(SCREEN_SCALE_X(640.0f)); CFont::SetPropOn(); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); if (!CDarkel::FrenzyOnGoing() && WeaponType != WEAPONTYPE_UNARMED && WeaponType != WEAPONTYPE_BASEBALLBAT) { CFont::SetColor(AMMO_COLOR); @@ -520,7 +520,7 @@ void CHud::Draw() CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f) + SCREEN_SCALE_Y(1.0f), m_ZoneToPrint); @@ -614,7 +614,7 @@ void CHud::Draw() CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f) + SCREEN_SCALE_Y(1.0f), m_pVehicleNameToPrint); @@ -920,7 +920,7 @@ void CHud::Draw() CFont::SetScale(SCREEN_SCALE_X(0.48f), SCREEN_SCALE_Y(1.120f)); CFont::SetCentreOn(); CFont::SetPropOn(); - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); float offsetX = SCREEN_SCALE_X(40.0f) + SCREEN_SCALE_X(8.0f); float center = SCREEN_SCALE_FROM_RIGHT(50.0f) - SCREEN_SCALE_X(8.0f) - offsetX; @@ -1123,7 +1123,7 @@ void CHud::DrawAfterFade() else #endif CFont::SetWrapx(SCREEN_SCALE_X(200.0f + 26.0f - 4.0f)); - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetBackgroundOn(); CFont::SetBackGroundOnlyTextOff(); CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha * 0.9f)); @@ -1201,7 +1201,7 @@ void CHud::DrawAfterFade() CFont::SetCentreOn(); CFont::SetPropOn(); CFont::SetCentreSize(SCREEN_SCALE_X(600.0f)); - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[3]); @@ -1218,7 +1218,7 @@ void CHud::DrawAfterFade() CFont::SetPropOn(); CFont::SetCentreSize(SCREEN_SCALE_X(620.0f)); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::PrintString((SCREEN_WIDTH / 2) - SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) - SCREEN_SCALE_Y(2.0f), m_BigMessage[4]); @@ -1275,7 +1275,7 @@ void CHud::DrawAfterFade() CFont::SetPropOn(); CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f)); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); #ifdef BETA_SLIDING_TEXT CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f) - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]); diff --git a/src/render/SpecialFX.cpp b/src/render/SpecialFX.cpp index 7e08fbad..6a42f9d1 100644 --- a/src/render/SpecialFX.cpp +++ b/src/render/SpecialFX.cpp @@ -1049,7 +1049,7 @@ CMoneyMessage::Render() CFont::SetJustifyOff(); CFont::SetColor(CRGBA(m_Colour.r, m_Colour.g, m_Colour.b, (255.0f - 255.0f * fLifeTime) * m_fOpacity)); CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); CFont::PrintString(vecOut.x, vecOut.y, m_aText); } } diff --git a/src/rw/TexRead.cpp b/src/rw/TexRead.cpp index 122ce655..4087029b 100644 --- a/src/rw/TexRead.cpp +++ b/src/rw/TexRead.cpp @@ -233,7 +233,7 @@ ConvertingTexturesScreen(uint32 num, uint32 count, const char *text) CFont::SetJustifyOff(); CFont::SetColor(CRGBA(255, 217, 106, 255)); CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_BANK); + CFont::SetFontStyle(FONT_STANDARD); CFont::PrintString(SCREEN_SCALE_X(170.0f), SCREEN_SCALE_Y(160.0f), TheText.Get(text)); CFont::DrawFonts(); DoRWStuffEndOfFrame(); From 9c0adf6a8f5b7f49ae233d2fce8a7ceaedc34cfb Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Sun, 7 Jun 2020 05:03:06 +0300 Subject: [PATCH 103/133] Revert "FONT_BANK renamed to FONT_STANDARD" This reverts commit 552205dfbaea70628df56a4966d269a81a97d28e. --- src/control/Darkel.cpp | 6 +++--- src/control/Garages.cpp | 2 +- src/control/Pickups.cpp | 2 +- src/control/Replay.cpp | 2 +- src/control/SceneEdit.cpp | 4 ++-- src/core/Debug.cpp | 6 +++--- src/core/Frontend.cpp | 32 ++++++++++++++++---------------- src/core/Pad.cpp | 4 ++-- src/core/main.cpp | 4 ++-- src/core/timebars.cpp | 2 +- src/render/Console.cpp | 2 +- src/render/Font.cpp | 12 ++++++------ src/render/Font.h | 2 +- src/render/Hud.cpp | 16 ++++++++-------- src/render/SpecialFX.cpp | 2 +- src/rw/TexRead.cpp | 2 +- 16 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/control/Darkel.cpp b/src/control/Darkel.cpp index 5e87aaec..cfd58340 100644 --- a/src/control/Darkel.cpp +++ b/src/control/Darkel.cpp @@ -74,7 +74,7 @@ CDarkel::DrawMessages() CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f)); CFont::SetJustifyOff(); CFont::SetColor(CRGBA(255, 255, 128, CalcFade(timePassedSinceStart, 3000, 11000))); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); if (pStartMessage) { CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, pStartMessage); } @@ -84,7 +84,7 @@ CDarkel::DrawMessages() CFont::SetScale(SCREEN_SCALE_X(1.3f), SCREEN_SCALE_Y(1.3f)); CFont::SetJustifyOff(); CFont::SetColor(CRGBA(255, 255, 128, CalcFade(timePassedSinceStart, 0, 8000))); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); if (pStartMessage) { CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, pStartMessage); } @@ -124,7 +124,7 @@ CDarkel::DrawMessages() CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f)); CFont::SetJustifyOff(); CFont::SetColor(CRGBA(128, 255, 128, CalcFade(timePassedSinceStart, 0, 5000))); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); int y = SCREEN_HEIGHT / 2 + SCREEN_SCALE_Y(25.0f - timePassedSinceStart * 0.01f); CFont::PrintString(SCREEN_WIDTH / 2, y, TheText.Get("KF_3")); } diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 71f4b5d0..e37df8d4 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -1399,7 +1399,7 @@ void CGarages::PrintMessages() CFont::SetBackgroundOff(); CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(50.0f)); CFont::SetCentreOn(); - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetColor(CRGBA(0, 0, 0, 255)); #if defined(PS2) || defined (FIX_BUGS) diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 33095036..32bffa17 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -975,7 +975,7 @@ CPickups::RenderPickUpText() CFont::SetColor(CRGBA(aMessages[i].m_color.red, aMessages[i].m_color.green, aMessages[i].m_color.blue, aMessages[i].m_color.alpha)); CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); CFont::PrintString(aMessages[i].m_pos.x, aMessages[i].m_pos.y, strToPrint); } NumMessages = 0; diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index b2ecf38f..707f1d87 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -1581,7 +1581,7 @@ void CReplay::Display() CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f)); CFont::SetAlignment(ALIGN_LEFT); CFont::SetColor(CRGBA(255, 255, 200, 200)); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); if (Mode == MODE_PLAYBACK) CFont::PrintString(SCREEN_SCALE_X(63.5f), SCREEN_SCALE_Y(30.0f), TheText.Get("REPLAY")); } diff --git a/src/control/SceneEdit.cpp b/src/control/SceneEdit.cpp index 7b7eb61d..be8c5519 100644 --- a/src/control/SceneEdit.cpp +++ b/src/control/SceneEdit.cpp @@ -269,7 +269,7 @@ void CSceneEdit::Draw(void) CFont::SetRightJustifyWrap(0.0f); CFont::SetBackGroundOnlyTextOff(); #ifdef FIX_BUGS - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); CFont::SetPropOn(); CFont::SetDropColor(CRGBA(0, 0, 0, 255)); CFont::SetDropShadowPosition(1); @@ -292,7 +292,7 @@ void CSceneEdit::Draw(void) CFont::SetCentreOff(); CFont::SetScale(SCREEN_SCALE_X(0.7f), SCREEN_SCALE_Y(0.7f)); #ifdef FIX_BUGS - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); #else CFont::SetFontStyle(FONT_HEADING); #endif diff --git a/src/core/Debug.cpp b/src/core/Debug.cpp index e319388c..e794dcaf 100644 --- a/src/core/Debug.cpp +++ b/src/core/Debug.cpp @@ -55,7 +55,7 @@ CDebug::DebugDisplayTextBuffer() CFont::SetJustifyOn(); CFont::SetRightJustifyWrap(0.0f); CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); #else // this is not even readable CFont::SetPropOff(); @@ -65,7 +65,7 @@ CDebug::DebugDisplayTextBuffer() CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); CFont::SetPropOff(); #endif do { @@ -113,7 +113,7 @@ CDebug::DisplayScreenStrings() CFont::SetRightJustifyWrap(0.0f); CFont::SetWrapx(9999.0f); CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); for(i = 0; i < ms_nScreenStrs; i++){ /* diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 9d231648..3ead688b 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -782,7 +782,7 @@ CMenuManager::Draw() nextYToUse += 24.0f + 10.0f; } - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT * MENU_TEXT_SIZE_X), MENU_Y(MENUACTION_SCALE_MULT * MENU_TEXT_SIZE_Y)); CFont::SetRightJustifyOff(); CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255))); @@ -865,7 +865,7 @@ CMenuManager::Draw() columnWidth = 120; headerHeight = 38; lineHeight = 20; - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = SMALLTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = SMALLTEXT_Y_SCALE)); CFont::SetRightJustifyOff(); break; @@ -902,7 +902,7 @@ CMenuManager::Draw() columnWidth = 180; headerHeight = 60; lineHeight = 24; - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = BIGTEXT_X_SCALE), MENU_Y(MENU_TEXT_SIZE_Y = BIGTEXT_Y_SCALE)); break; #endif @@ -917,7 +917,7 @@ CMenuManager::Draw() } #ifdef PS2_LIKE_MENU - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); #endif switch (m_nCurrScreen) { @@ -1768,7 +1768,7 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8 CFont::SetRightJustifyOff(); CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE)); - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); if (!m_bKeyIsOK) DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); @@ -1781,7 +1781,7 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8 CFont::PrintString(MENU_X_LEFT_ALIGNED(275.0f), SCREEN_SCALE_FROM_BOTTOM(114.0f), TheText.Get("FET_CIG")); // BACKSPACE TO CLEAR - LMB,RETURN TO CHANGE CFont::SetRightJustifyOff(); CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE)); - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); m_bKeyIsOK = false; m_bKeyChangeNotProcessed = false; } @@ -1793,7 +1793,7 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8 CFont::PrintString(MENU_X_LEFT_ALIGNED(275.0f), SCREEN_SCALE_FROM_BOTTOM(114.0f), TheText.Get("FET_EIG")); // CANNOT SET A CONTROL FOR THIS ACTION CFont::SetRightJustifyOff(); CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE)); - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); } } } @@ -1956,7 +1956,7 @@ CMenuManager::DrawControllerSetupScreen() CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X), MENU_Y(CONTSETUP_LIST_TOP), TheText.Get("FET_CCR")); CFont::SetRightJustifyOff(); CFont::SetScale(MENU_X_LEFT_ALIGNED(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE)); - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); int yStart; if (m_ControlMethod == CONTROL_CLASSIC) yStart = CONTSETUP_LIST_HEADER_HEIGHT + 29; @@ -2303,7 +2303,7 @@ CMenuManager::DrawFrontEndNormal() if (CheckHover(xStart, xStart + optionWidth, optionTop, optionBottom)) hoveredBottomBarOption = i; - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetScale(MENU_X(0.35f), MENU_Y(0.7f)); CFont::SetRightJustifyOff(); if (hoveredBottomBarOption == i && hoveredBottomBarOption != curBottomBarOption) @@ -2673,7 +2673,7 @@ CMenuManager::DrawPlayerSetupScreen() // Skin list CFont::SetRightJustifyOff(); CFont::SetScale(MENU_X(PLAYERSETUP_ROW_TEXT_X_SCALE), MENU_Y(PLAYERSETUP_ROW_TEXT_Y_SCALE)); - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); if (m_nSkinsTotal > 0) { for (m_pSelectedSkin = m_pSkinListHead.nextSkin; m_pSelectedSkin->skinId != m_nFirstVisibleRowOnList; m_pSelectedSkin = m_pSelectedSkin->nextSkin); @@ -3340,7 +3340,7 @@ CMenuManager::MessageScreen(const char *text) CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(170.0f)); CFont::SetRightJustifyWrap(SCREEN_SCALE_FROM_RIGHT(170.0f)); CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(120.0f), SCREEN_SCALE_Y(150.0f), SCREEN_SCALE_FROM_RIGHT(120.0f), SCREEN_SCALE_FROM_BOTTOM(220.0f)), CRGBA(50, 50, 50, 210)); - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetCentreSize(SCREEN_SCALE_X(380.0f)); CFont::SetCentreOn(); CFont::SetColor(CRGBA(255, 217, 106, 255)); @@ -3370,7 +3370,7 @@ void CMenuManager::PrintBriefs() { CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255))); - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetRightJustifyOff(); CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why @@ -3425,7 +3425,7 @@ CMenuManager::PrintErrorMessage() return; CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(140.0f), SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f)), CRGBA(64, 16, 16, 224)); - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetBackgroundOff(); CFont::SetPropOn(); CFont::SetCentreOff(); @@ -3446,7 +3446,7 @@ CMenuManager::PrintStats() { int rowNum = ConstructStatLine(99999); #ifdef GTA3_1_1_PATCH - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); #endif CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why float nextYChange, y, alphaMult; @@ -5351,7 +5351,7 @@ CMenuManager::PrintController(void) m_aFrontEndSprites[FE_ARROWS4].Draw(MENU_X_LEFT_ALIGNED(160.0f), MENU_Y(160.0f), MENU_X(235.2f), MENU_Y(175.2f), CRGBA(255, 255, 255, 255)); } - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); // X + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); // X // CFont::SetScale(0.4f, 0.4f); CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE), MENU_Y(SMALLESTTEXT_Y_SCALE)); // X @@ -5736,7 +5736,7 @@ CMenuManager::PrintMap(void) CRGBA(235, 170, 50, 255)); CFont::SetScale(MENU_X(0.4f), MENU_Y(0.7f)); - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255))); float nextX = MENU_X(30.0f), nextY = 95.0f; diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index a0fd0535..924d4724 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -2286,7 +2286,7 @@ void CPad::PrintErrorMessage(void) CFont::SetCentreOn(); CFont::SetPropOn(); CFont::SetColor(CRGBA(255, 255, 200, 200)); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); CFont::PrintString ( SCREEN_WIDTH / 2, @@ -2303,7 +2303,7 @@ void CPad::PrintErrorMessage(void) CFont::SetCentreOn(); CFont::SetPropOn(); CFont::SetColor(CRGBA(255, 255, 200, 200)); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); CFont::PrintString ( SCREEN_WIDTH / 2, diff --git a/src/core/main.cpp b/src/core/main.cpp index 3fca618b..eb39b287 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -507,7 +507,7 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen) CFont::SetScale(SCREEN_SCALE_X(0.75f), yscale); CFont::SetPropOn(); CFont::SetRightJustifyOff(); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); CFont::SetColor(CRGBA(255, 255, 255, 255)); AsciiToUnicode(str1, tmpstr); CFont::PrintString(hpos, vpos, tmpstr); @@ -702,7 +702,7 @@ DisplayGameDebugText() CFont::SetPropOn(); CFont::SetBackgroundOff(); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); CFont::SetScale(SCREEN_SCALE_X(0.5f), SCREEN_SCALE_Y(0.5f)); CFont::SetCentreOff(); CFont::SetRightJustifyOff(); diff --git a/src/core/timebars.cpp b/src/core/timebars.cpp index 884feffd..6b841a5c 100644 --- a/src/core/timebars.cpp +++ b/src/core/timebars.cpp @@ -92,7 +92,7 @@ void tbDisplay() CFont::SetWrapx(640.0f); CFont::SetRightJustifyOff(); CFont::SetPropOn(); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); sprintf(temp, "FPS: %.2f", Diag_GetFPS()); AsciiToUnicode(temp, wtemp); CFont::SetColor(CRGBA(255, 255, 255, 255)); diff --git a/src/render/Console.cpp b/src/render/Console.cpp index 244bfb17..8ea5b7a3 100644 --- a/src/render/Console.cpp +++ b/src/render/Console.cpp @@ -63,7 +63,7 @@ CConsole::Display() CFont::SetJustifyOn(); CFont::SetRightJustifyWrap(0.0f); CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); #ifndef FIX_BUGS CFont::SetPropOff(); // not sure why this is here anyway #endif diff --git a/src/render/Font.cpp b/src/render/Font.cpp index 33b2dca1..ef665fae 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -250,7 +250,7 @@ CFont::Initialise(void) SetBackgroundColor(CRGBA(0x80, 0x80, 0x80, 0x80)); SetBackGroundOnlyTextOff(); SetPropOn(); - SetFontStyle(FONT_STANDARD); + SetFontStyle(FONT_BANK); SetRightJustifyWrap(0.0f); SetAlphaFade(255.0f); SetDropShadowPosition(0); @@ -348,7 +348,7 @@ CFont::PrintChar(float x, float y, wchar c) } #endif - if(Details.style == FONT_STANDARD || Details.style == FONT_HEADING){ + if(Details.style == FONT_BANK || Details.style == FONT_HEADING){ if(Details.dropShadowPosition != 0){ CSprite2d::AddSpriteToBank(Details.bank + Details.style, // BUG: game doesn't add bank CRect(x + SCREEN_SCALE_X(Details.dropShadowPosition), @@ -828,7 +828,7 @@ CFont::GetCharacterWidth(wchar c) if (IsJapanese()) { if (!Details.proportional) return Size[0][Details.style][192]; - if (c <= 94 || Details.style == FONT_HEADING || Details.style == FONT_STANDARD) { + if (c <= 94 || Details.style == FONT_HEADING || Details.style == FONT_BANK) { switch (Details.style) { case FONT_JAPANESE: @@ -844,7 +844,7 @@ CFont::GetCharacterWidth(wchar c) { case FONT_JAPANESE: return 29.4f; - case FONT_STANDARD: + case FONT_BANK: return 10.0f; case FONT_PAGER: return 31.5f; @@ -874,7 +874,7 @@ CFont::GetCharacterSize(wchar c) { if (!Details.proportional) return Size[0][Details.style][192] * Details.scaleX; - if (c <= 94 || Details.style == FONT_HEADING || Details.style == FONT_STANDARD) { + if (c <= 94 || Details.style == FONT_HEADING || Details.style == FONT_BANK) { switch (Details.style) { case FONT_JAPANESE: @@ -890,7 +890,7 @@ CFont::GetCharacterSize(wchar c) { case FONT_JAPANESE: return 29.4f * Details.scaleX; - case FONT_STANDARD: + case FONT_BANK: return 10.0f * Details.scaleX; case FONT_PAGER: return 31.5f * Details.scaleX; diff --git a/src/render/Font.h b/src/render/Font.h index fba5125b..9b4e7132 100644 --- a/src/render/Font.h +++ b/src/render/Font.h @@ -28,7 +28,7 @@ struct CFontDetails class CSprite2d; enum { - FONT_STANDARD, + FONT_BANK, FONT_PAGER, FONT_HEADING, #ifdef MORE_LANGUAGES diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 8e8096a5..c7f61d5d 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -329,7 +329,7 @@ void CHud::Draw() CFont::SetCentreOn(); CFont::SetCentreSize(SCREEN_SCALE_X(640.0f)); CFont::SetPropOn(); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); if (!CDarkel::FrenzyOnGoing() && WeaponType != WEAPONTYPE_UNARMED && WeaponType != WEAPONTYPE_BASEBALLBAT) { CFont::SetColor(AMMO_COLOR); @@ -520,7 +520,7 @@ void CHud::Draw() CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f) + SCREEN_SCALE_Y(1.0f), m_ZoneToPrint); @@ -614,7 +614,7 @@ void CHud::Draw() CFont::SetRightJustifyOn(); CFont::SetRightJustifyWrap(0.0f); CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f) + SCREEN_SCALE_Y(1.0f), m_pVehicleNameToPrint); @@ -920,7 +920,7 @@ void CHud::Draw() CFont::SetScale(SCREEN_SCALE_X(0.48f), SCREEN_SCALE_Y(1.120f)); CFont::SetCentreOn(); CFont::SetPropOn(); - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); float offsetX = SCREEN_SCALE_X(40.0f) + SCREEN_SCALE_X(8.0f); float center = SCREEN_SCALE_FROM_RIGHT(50.0f) - SCREEN_SCALE_X(8.0f) - offsetX; @@ -1123,7 +1123,7 @@ void CHud::DrawAfterFade() else #endif CFont::SetWrapx(SCREEN_SCALE_X(200.0f + 26.0f - 4.0f)); - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetBackgroundOn(); CFont::SetBackGroundOnlyTextOff(); CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha * 0.9f)); @@ -1201,7 +1201,7 @@ void CHud::DrawAfterFade() CFont::SetCentreOn(); CFont::SetPropOn(); CFont::SetCentreSize(SCREEN_SCALE_X(600.0f)); - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[3]); @@ -1218,7 +1218,7 @@ void CHud::DrawAfterFade() CFont::SetPropOn(); CFont::SetCentreSize(SCREEN_SCALE_X(620.0f)); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); CFont::PrintString((SCREEN_WIDTH / 2) - SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) - SCREEN_SCALE_Y(2.0f), m_BigMessage[4]); @@ -1275,7 +1275,7 @@ void CHud::DrawAfterFade() CFont::SetPropOn(); CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f)); CFont::SetColor(CRGBA(0, 0, 0, 255)); - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); #ifdef BETA_SLIDING_TEXT CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f) - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[5]); diff --git a/src/render/SpecialFX.cpp b/src/render/SpecialFX.cpp index 6a42f9d1..7e08fbad 100644 --- a/src/render/SpecialFX.cpp +++ b/src/render/SpecialFX.cpp @@ -1049,7 +1049,7 @@ CMoneyMessage::Render() CFont::SetJustifyOff(); CFont::SetColor(CRGBA(m_Colour.r, m_Colour.g, m_Colour.b, (255.0f - 255.0f * fLifeTime) * m_fOpacity)); CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); CFont::PrintString(vecOut.x, vecOut.y, m_aText); } } diff --git a/src/rw/TexRead.cpp b/src/rw/TexRead.cpp index 4087029b..122ce655 100644 --- a/src/rw/TexRead.cpp +++ b/src/rw/TexRead.cpp @@ -233,7 +233,7 @@ ConvertingTexturesScreen(uint32 num, uint32 count, const char *text) CFont::SetJustifyOff(); CFont::SetColor(CRGBA(255, 217, 106, 255)); CFont::SetBackGroundOnlyTextOff(); - CFont::SetFontStyle(FONT_STANDARD); + CFont::SetFontStyle(FONT_BANK); CFont::PrintString(SCREEN_SCALE_X(170.0f), SCREEN_SCALE_Y(160.0f), TheText.Get(text)); CFont::DrawFonts(); DoRWStuffEndOfFrame(); From 31569d512c708161b6c2afdf8a6e4356a7db15aa Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 7 Jun 2020 09:10:09 +0300 Subject: [PATCH 104/133] font fix --- src/render/Font.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/render/Font.cpp b/src/render/Font.cpp index ef665fae..de7de81a 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -483,6 +483,8 @@ CFont::PrintString(float xstart, float ystart, wchar *s) xstart; #ifdef MORE_LANGUAGES PrintString(xleft, y, start, s, spaceWidth, xstart); +#else + PrintString(xleft, y, start, s, spaceWidth); #endif // reset things lineLength = 0.0f; From be2291e44cd898a86fc2d0f1da56305e1f4143b2 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 7 Jun 2020 15:07:36 +0300 Subject: [PATCH 105/133] fixed some arithmetic --- src/control/Script.cpp | 48 ++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 94590087..d90f2a0b 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1552,11 +1552,11 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *nScriptVar1 *= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; - case COMMAND_MULT_INT_LVAR_BY_INT_VAR: + case COMMAND_MULT_INT_VAR_BY_INT_LVAR: nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *nScriptVar1 *= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; - case COMMAND_MULT_INT_VAR_BY_INT_LVAR: + case COMMAND_MULT_INT_LVAR_BY_INT_VAR: nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *nScriptVar1 *= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; @@ -1568,11 +1568,11 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; - case COMMAND_MULT_FLOAT_LVAR_BY_FLOAT_VAR: + case COMMAND_MULT_FLOAT_VAR_BY_FLOAT_LVAR: fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; - case COMMAND_MULT_FLOAT_VAR_BY_FLOAT_LVAR: + case COMMAND_MULT_FLOAT_LVAR_BY_FLOAT_VAR: fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *fScriptVar1 *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; @@ -1584,11 +1584,11 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *nScriptVar1 /= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; - case COMMAND_DIV_INT_LVAR_BY_INT_VAR: + case COMMAND_DIV_INT_VAR_BY_INT_LVAR: nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *nScriptVar1 /= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; - case COMMAND_DIV_INT_VAR_BY_INT_LVAR: + case COMMAND_DIV_INT_LVAR_BY_INT_VAR: nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *nScriptVar1 /= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; @@ -1600,11 +1600,11 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; - case COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_VAR: + case COMMAND_DIV_FLOAT_VAR_BY_FLOAT_LVAR: fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; - case COMMAND_DIV_FLOAT_VAR_BY_FLOAT_LVAR: + case COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_VAR: fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *fScriptVar1 /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; @@ -1630,11 +1630,19 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; +#ifdef FIX_BUGS + case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR: +#else case COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR: +#endif fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; +#ifdef FIX_BUGS + case COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR: +#else case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR: +#endif fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; @@ -1660,11 +1668,19 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; +#ifdef FIX_BUGS // in SA it was fixed by reversing their order in enum + case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR: +#else case COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR: +#endif fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; +#ifdef FIX_BUGS + case COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR: +#else case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR: +#endif fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; @@ -1678,13 +1694,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) *ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; } - case COMMAND_SET_LVAR_INT_TO_VAR_INT: + case COMMAND_SET_VAR_INT_TO_LVAR_INT: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *ptr = *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; } - case COMMAND_SET_VAR_INT_TO_LVAR_INT: + case COMMAND_SET_LVAR_INT_TO_VAR_INT: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); @@ -1702,13 +1718,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) *ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; } - case COMMAND_SET_LVAR_FLOAT_TO_VAR_FLOAT: + case COMMAND_SET_VAR_FLOAT_TO_LVAR_FLOAT: { float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; } - case COMMAND_SET_VAR_FLOAT_TO_LVAR_FLOAT: + case COMMAND_SET_LVAR_FLOAT_TO_VAR_FLOAT: { float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); @@ -1726,13 +1742,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) *ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; } - case COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT: + case COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; } - case COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT: + case COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); @@ -1750,13 +1766,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) *ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; } - case COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT: + case COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT: { float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *ptr = *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; } - case COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT: + case COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT: { float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); From af564d865c3883f11a5272be76f3a51863586a8d Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Mon, 8 Jun 2020 01:16:21 +0300 Subject: [PATCH 106/133] fixes --- src/control/CarCtrl.cpp | 12 +++++++----- src/control/Script.cpp | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index e8b3bfd9..5db674cd 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -984,13 +984,15 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f if (pVehicle->GetModelIndex() == MI_RCBANDIT){ if (dotVelocity * GAME_SPEED_TO_METERS_PER_SECOND / 2 > distanceUntilHit) pPed->SetEvasiveStep(pVehicle, 0); - }else if (dotVelocity > 0.3f){ - if (sideLength - 0.5f < sidewaysDistance) + } + else if (dotVelocity > 0.3f) { + if (sideLength + 0.1f < sidewaysDistance) pPed->SetEvasiveStep(pVehicle, 0); else pPed->SetEvasiveDive(pVehicle, 0); - }else{ - if (sideLength + 0.1f < sidewaysDistance) + } + else if (dotVelocity > 0.1f) { + if (sideLength - 0.5f < sidewaysDistance) pPed->SetEvasiveStep(pVehicle, 0); else pPed->SetEvasiveDive(pVehicle, 0); @@ -1019,7 +1021,7 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f CPlayerPed* pPlayerPed = (CPlayerPed*)pPed; if (pPlayerPed->IsPlayer() && dotDirection < frontSafe && pPlayerPed->IsPedInControl() && - pPlayerPed->m_fMoveSpeed < 0.1f && pPlayerPed->bIsLooking && + pPlayerPed->m_fMoveSpeed < 1.0f && !pPlayerPed->bIsLooking && CTimer::GetTimeInMilliseconds() > pPlayerPed->m_lookTimer) { pPlayerPed->AnnoyPlayerPed(false); pPlayerPed->SetLookFlag(pVehicle, true); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index d90f2a0b..da321a28 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -2153,7 +2153,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS; car->SetStatus(STATUS_PHYSICS); car->bEngineOn = true; - car->AutoPilot.m_nCruiseSpeed = Max(car->AutoPilot.m_nCruiseSpeed, 6); + car->AutoPilot.m_nCruiseSpeed = Max(6, car->AutoPilot.m_nCruiseSpeed); car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); return 0; } @@ -2165,7 +2165,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) CCarCtrl::JoinCarWithRoadSystem(car); car->AutoPilot.m_nCarMission = MISSION_CRUISE; car->bEngineOn = true; - car->AutoPilot.m_nCruiseSpeed = Max(car->AutoPilot.m_nCruiseSpeed, 6); + car->AutoPilot.m_nCruiseSpeed = Max(6, car->AutoPilot.m_nCruiseSpeed); car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); return 0; } From be9954ecc6496fec4913c129310c89d83636346a Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Mon, 8 Jun 2020 10:33:32 +0300 Subject: [PATCH 107/133] IsMissionAudioSamplePlaying (from VC) --- src/audio/AudioLogic.cpp | 2 +- src/audio/AudioManager.h | 4 ++-- src/audio/DMAudio.cpp | 2 +- src/audio/DMAudio.h | 2 +- src/audio/MusicManager.cpp | 10 +++++----- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index ec193bc8..58fd9ef3 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -8664,7 +8664,7 @@ cAudioManager::MissionScriptAudioUsesPoliceChannel(int32 soundMission) const } void -cAudioManager::PreloadMissionAudio(const char *name) +cAudioManager::PreloadMissionAudio(Const char *name) { if (m_bIsInitialised) { int32 missionAudioSfx = FindMissionAudioSfx(name); diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index c58d0a39..190d9add 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -213,7 +213,7 @@ public: float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; } int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; } int32 GetRandomNumberInRange(int32 idx, int32 low, int32 high) const { return (m_anRandomTable[idx] % (high - low + 1)) + low; } - bool IsMissionAudioPlaying() const { return m_sMissionAudio.m_nPlayStatus == 1; } + bool IsMissionAudioSamplePlaying() const { return m_sMissionAudio.m_nPlayStatus == 1; } // "Should" be in alphabetic order, except "getXTalkSfx" void AddDetailsToRequestedOrderList(uint8 sample); @@ -358,7 +358,7 @@ public: void PostInitialiseGameSpecificSetup(); void PostTerminateGameSpecificShutdown(); void PreInitialiseGameSpecificSetup() const; - void PreloadMissionAudio(const char *name); + void PreloadMissionAudio(Const char *name); void PreTerminateGameSpecificShutdown(); /// processX - main logic of adding new sounds void ProcessActiveQueues(); diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp index 18d13c9d..76b134ec 100644 --- a/src/audio/DMAudio.cpp +++ b/src/audio/DMAudio.cpp @@ -290,7 +290,7 @@ cDMAudio::StopCutSceneMusic(void) } void -cDMAudio::PreloadMissionAudio(char *missionAudio) +cDMAudio::PreloadMissionAudio(Const char *missionAudio) { AudioManager.PreloadMissionAudio(missionAudio); } diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h index e1a18830..c0e1de1d 100644 --- a/src/audio/DMAudio.h +++ b/src/audio/DMAudio.h @@ -76,7 +76,7 @@ public: void PlayPreloadedCutSceneMusic(void); void StopCutSceneMusic(void); - void PreloadMissionAudio(char *missionAudio); + void PreloadMissionAudio(Const char *missionAudio); uint8 GetMissionAudioLoadingStatus(void); void SetMissionAudioLocation(float x, float y, float z); void PlayLoadedMissionAudio(void); diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index b8d6dc03..9f648d07 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -526,7 +526,7 @@ cMusicManager::ServiceGameMode() } else if (dist >= 100.0f) { int8 volume = ((45.0f - (Sqrt(dist) - 10.0f)) / 45.0f * 100.0f); int8 pan; - if (AudioManager.IsMissionAudioPlaying()) + if (AudioManager.IsMissionAudioSamplePlaying()) volume /= 4; if (volume != 0) { CVector trVec; @@ -538,7 +538,7 @@ cMusicManager::ServiceGameMode() if (gRetuneCounter) volume /= 4; SampleManager.SetStreamedVolumeAndPan(volume, pan, 0, 0); - } else if (AudioManager.IsMissionAudioPlaying()) { + } else if (AudioManager.IsMissionAudioSamplePlaying()) { SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0); } else if (gRetuneCounter) { SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0); @@ -546,7 +546,7 @@ cMusicManager::ServiceGameMode() SampleManager.SetStreamedVolumeAndPan(100, 63, 0, 0); } } - } else if (AudioManager.IsMissionAudioPlaying()) { + } else if (AudioManager.IsMissionAudioSamplePlaying()) { SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0); nFramesSinceCutsceneEnded = 0; } else { @@ -832,7 +832,7 @@ cMusicManager::ServiceAnnouncement() SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0); if (SampleManager.StartStreamedFile(m_nAnnouncement, 0, 0)) { - SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioPlaying() ? 25 : 100, 63, 0, 0); + SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioSamplePlaying() ? 25 : 100, 63, 0, 0); m_bAnnouncementInProgress = true; m_nPreviousStreamedSound = m_nCurrentStreamedSound; m_nCurrentStreamedSound = m_nAnnouncement; @@ -905,7 +905,7 @@ cMusicManager::ChangeRadioChannel() return false; if (!SampleManager.StartStreamedFile(m_nCurrentStreamedSound, GetTrackStartPos(m_nCurrentStreamedSound), 0)) return false; - SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioPlaying() ? 25 : 100, 63, 0, 0); + SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioSamplePlaying() ? 25 : 100, 63, 0, 0); } return true; } From 94e5b24fc80403750af517c76f0caa023f87618b Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 8 Jun 2020 13:01:07 +0200 Subject: [PATCH 108/133] cleaned up and fixed animviewer --- src/core/AnimViewer.cpp | 163 ++++++++++++++++++---------------------- src/core/Pad.cpp | 4 +- src/core/re3.cpp | 1 + 3 files changed, 76 insertions(+), 92 deletions(-) diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp index f49f811f..c8d8cb56 100644 --- a/src/core/AnimViewer.cpp +++ b/src/core/AnimViewer.cpp @@ -47,6 +47,12 @@ CAnimViewer::Render(void) { if (pTarget) { // pTarget->GetPosition() = CVector(0.0f, 0.0f, 0.0f); if (pTarget) { +#ifdef FIX_BUGS +#ifdef PED_SKIN + if(pTarget->IsPed()) + ((CPed*)pTarget)->UpdateRpHAnim(); +#endif +#endif pTarget->Render(); CRenderer::RenderOneNonRoad(pTarget); } @@ -67,11 +73,7 @@ CAnimViewer::Initialise(void) { CReferences::Init(); TheCamera.Init(); TheCamera.SetRwCamera(Scene.camera); - - // I didn't get which camera og code selects. - for (int i = 0; i < 3; i++) { - TheCamera.Cams[i].Distance = 5.0f; - } + TheCamera.Cams[TheCamera.ActiveCam].Distance = 5.0f; gbModelViewer = true; CHud::m_Wants_To_Draw_Hud = false; @@ -146,30 +148,33 @@ int LastPedModelId(int modelId) { CBaseModelInfo *model; - for (int i = modelId; i >= 0; i--) { - model = CModelInfo::GetModelInfo(i); - if (model->GetModelType() == MITYPE_PED) - return i; + for(;;){ + assert(modelId < MODELINFOSIZE); + model = CModelInfo::GetModelInfo(modelId); + if (model && model->GetModelType() == MITYPE_PED) + break; + modelId--; } return modelId; } int -LastVehicleModelId(int modelId) +FirstCarModelId(int modelId) { - CBaseModelInfo* model; - for (int i = modelId; i >= 0; i--) { - model = CModelInfo::GetModelInfo(i); - if (model->GetModelType() == MITYPE_VEHICLE) - return i; + CBaseModelInfo *model; + for(;;){ + assert(modelId < MODELINFOSIZE); + model = CModelInfo::GetModelInfo(modelId); + if (model && model->GetModelType() == MITYPE_VEHICLE) + break; + modelId++; } return modelId; } -// It's me that named this. int -FindMeAModelID(int modelId, int wantedChange) +NextModelId(int modelId, int wantedChange) { // Max. 2 trials wasn't here, it's me that added it. @@ -220,7 +225,6 @@ CAnimViewer::Update(void) AssocGroupId animGroup = ASSOCGRP_STD; int nextModelId = modelId; CBaseModelInfo *modelInfo = CModelInfo::GetModelInfo(modelId); - CEntity *newEntity = nil; if (modelInfo->GetModelType() == MITYPE_PED) { int animGroup = ((CPedModelInfo*)modelInfo)->m_animGroup; @@ -261,40 +265,30 @@ CAnimViewer::Update(void) if (modelInfo->GetModelType() == MITYPE_VEHICLE) { CVehicleModelInfo* veh = (CVehicleModelInfo*)modelInfo; - if (veh->m_vehicleType != VEHICLE_TYPE_CAR) { - // Not ready yet -/* if (veh->m_vehicleType == VEHICLE_TYPE_BOAT) - { - v33 = (CBoat*)CVehicle::operator new((CVehicle*)0x488, v6); - CBoat::CBoat(v33, modelId, 1u); - newEntity = (int)v33; - pTarget = (int)v33; - } - else - { -*/ newEntity = pTarget = new CObject(modelId, true); - if (!modelInfo->GetColModel()) { - modelInfo->SetColModel(&CTempColModels::ms_colModelWheel1); - } -// } + if (veh->m_vehicleType == VEHICLE_TYPE_CAR) { + pTarget = new CAutomobile(modelId, RANDOM_VEHICLE); + } else if (veh->m_vehicleType == VEHICLE_TYPE_BOAT) { + pTarget = new CBoat(modelId, RANDOM_VEHICLE); } else { - newEntity = pTarget = new CAutomobile(modelId, RANDOM_VEHICLE); - newEntity->SetStatus(STATUS_ABANDONED); + pTarget = new CObject(modelId, true); + if (!modelInfo->GetColModel()) { + modelInfo->SetColModel(&CTempColModels::ms_colModelWheel1); + } } - newEntity->bIsStuck = true; + pTarget->SetStatus(STATUS_ABANDONED); } else if (modelInfo->GetModelType() == MITYPE_PED) { - pTarget = newEntity = new CPed(PEDTYPE_CIVMALE); - newEntity->SetModelIndex(modelId); + pTarget = new CPed(PEDTYPE_CIVMALE); + pTarget->SetModelIndex(modelId); } else { - newEntity = pTarget = new CObject(modelId, true); + pTarget = new CObject(modelId, true); if (!modelInfo->GetColModel()) { modelInfo->SetColModel(&CTempColModels::ms_colModelWheel1); } - newEntity->bIsStuck = true; + pTarget->SetStatus(STATUS_ABANDONED); } - newEntity->SetPosition(0.0f, 0.0f, 0.0f); - CWorld::Add(newEntity); + pTarget->SetPosition(0.0f, 0.0f, 0.0f); + CWorld::Add(pTarget); TheCamera.TakeControl(pTarget, CCam::MODE_MODELVIEW, JUMP_CUT, CAMCONTROL_SCRIPT); } if (pTarget->IsVehicle() || pTarget->IsPed() || pTarget->IsObject()) { @@ -302,43 +296,26 @@ CAnimViewer::Update(void) } pTarget->GetMatrix().GetPosition().z = 0.0f; - if (modelInfo->GetModelType() != MITYPE_PED) { - - if (modelInfo->GetModelType() == MITYPE_VEHICLE) { - - if (pad->NewState.LeftShoulder1 && !pad->OldState.LeftShoulder1) { - nextModelId = LastPedModelId(modelId); - AsciiToUnicode("Switched to peds", gUString); - CMessages::AddMessage(gUString, 1000, 0); - } else { - // Start in mobile - if (pad->NewState.Square && !pad->OldState.Square) { - CVehicleModelInfo::LoadVehicleColours(); - AsciiToUnicode("Carcols.dat reloaded", gUString); - CMessages::AddMessage(gUString, 1000, 0); - } - } - } - } else { + if (modelInfo->GetModelType() == MITYPE_PED) { ((CPed*)pTarget)->bKindaStayInSamePlace = true; // Triangle in mobile - if (pad->NewState.Square && !pad->OldState.Square) { + if (pad->GetSquareJustDown()) { reloadIFP = 1; AsciiToUnicode("IFP reloaded", gUString); CMessages::AddMessage(gUString, 1000, 0); - } else if (pad->NewState.Cross && !pad->OldState.Cross) { + } else if (pad->GetCrossJustDown()) { PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId); AsciiToUnicode("Animation restarted", gUString); CMessages::AddMessage(gUString, 1000, 0); - } else if (pad->NewState.Circle && !pad->OldState.Circle) { + } else if (pad->GetCircleJustDown()) { PlayAnimation(pTarget->GetClump(), animGroup, ANIM_IDLE_STANCE); AsciiToUnicode("Idle animation playing", gUString); CMessages::AddMessage(gUString, 1000, 0); - } else if (pad->NewState.DPadUp && pad->OldState.DPadUp == 0) { + } else if (pad->GetDPadUpJustDown()) { animId--; if (animId < 0) { animId = NUM_ANIMS - 1; @@ -349,7 +326,7 @@ CAnimViewer::Update(void) AsciiToUnicode(gString, gUString); CMessages::AddMessage(gUString, 1000, 0); - } else if (pad->NewState.DPadDown && !pad->OldState.DPadDown) { + } else if (pad->GetDPadDownJustDown()) { animId = (animId == (NUM_ANIMS - 1) ? 0 : animId + 1); PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId); @@ -357,42 +334,48 @@ CAnimViewer::Update(void) AsciiToUnicode(gString, gUString); CMessages::AddMessage(gUString, 1000, 0); - } else { - if (pad->NewState.Start && !pad->OldState.Start) { + } else if (pad->GetStartJustDown()) { - } else { - if (pad->NewState.LeftShoulder1 && !pad->OldState.LeftShoulder1) { - nextModelId = LastVehicleModelId(modelId); - AsciiToUnicode("Switched to vehicles", gUString); - CMessages::AddMessage(gUString, 1000, 0); - } else { - // Originally it was GetPad(1)->LeftShoulder2 - if (pad->NewState.Triangle) { + } else if (pad->GetLeftShoulder1JustDown()) { + nextModelId = FirstCarModelId(modelId); + AsciiToUnicode("Switched to vehicles", gUString); + CMessages::AddMessage(gUString, 1000, 0); + // Originally it was GetPad(1)->LeftShoulder2 + } else if (pad->NewState.Triangle) { #ifdef PED_SKIN - if(IsClumpSkinned(pTarget->GetClump())) - ((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->AnimatePedColModelSkinned(pTarget->GetClump()); - else + if(IsClumpSkinned(pTarget->GetClump())) + ((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->AnimatePedColModelSkinned(pTarget->GetClump()); + else #endif - CPedModelInfo::AnimatePedColModel(((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->GetHitColModel(), - RpClumpGetFrame(pTarget->GetClump())); - AsciiToUnicode("Ped Col model will be animated as long as you hold the button", gUString); - CMessages::AddMessage(gUString, 100, 0); - } - } - } + CPedModelInfo::AnimatePedColModel(((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->GetHitColModel(), + RpClumpGetFrame(pTarget->GetClump())); + AsciiToUnicode("Ped Col model will be animated as long as you hold the button", gUString); + CMessages::AddMessage(gUString, 100, 0); + } + } else if (modelInfo->GetModelType() == MITYPE_VEHICLE) { + + if (pad->GetLeftShoulder1JustDown()) { + nextModelId = LastPedModelId(modelId); + AsciiToUnicode("Switched to peds", gUString); + CMessages::AddMessage(gUString, 1000, 0); + // Start in mobile + } else if (pad->GetSquareJustDown()) { + CVehicleModelInfo::LoadVehicleColours(); + AsciiToUnicode("Carcols.dat reloaded", gUString); + CMessages::AddMessage(gUString, 1000, 0); } } } - if (pad->NewState.DPadLeft && pad->OldState.DPadLeft == 0) { - nextModelId = FindMeAModelID(modelId, -1); + if (pad->GetDPadLeftJustDown()) { + nextModelId = NextModelId(modelId, -1); sprintf(gString, "Current model ID: %d", nextModelId); AsciiToUnicode(gString, gUString); CMessages::AddMessage(gUString, 1000, 0); - } else if (pad->NewState.DPadRight && pad->OldState.DPadRight == 0) { - nextModelId = FindMeAModelID(modelId, 1); + } else if (pad->GetDPadRightJustDown()) { + nextModelId = NextModelId(modelId, 1); sprintf(gString, "Current model ID: %d", nextModelId); AsciiToUnicode(gString, gUString); diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index 924d4724..a071ff19 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -1046,8 +1046,8 @@ void CPad::UpdatePads(void) GetPad(0)->UpdateMouse(); #ifdef XINPUT - GetPad(0)->AffectFromXinput(0); - GetPad(1)->AffectFromXinput(1); + GetPad(0)->AffectFromXinput(m_bMapPadOneToPadTwo ? 1 : 0); + GetPad(1)->AffectFromXinput(m_bMapPadOneToPadTwo ? 0 : 1); #else CapturePad(0); #endif diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 38854f25..56ee9aa7 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -463,6 +463,7 @@ DebugMenuPopulate(void) DebugMenuAddVarBool8("Render", "Don't render Objects", &gbDontRenderObjects, nil); DebugMenuAddVarBool8("Render", "Don't Render Water", &gbDontRenderWater, nil); + DebugMenuAddVarBool8("Debug", "pad 1 -> pad 2", &CPad::m_bMapPadOneToPadTwo, nil); DebugMenuAddVarBool8("Debug", "Edit on", &CSceneEdit::m_bEditOn, nil); #ifdef MENU_MAP DebugMenuAddCmd("Debug", "Teleport to map waypoint", TeleportToWaypoint); From 03f3b4fc5a178987e2634f034daaa9be88e09bbf Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Mon, 8 Jun 2020 14:33:10 +0300 Subject: [PATCH 109/133] remove numbers from enum --- src/audio/audio_enums.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/audio/audio_enums.h b/src/audio/audio_enums.h index 8136ff66..3b996205 100644 --- a/src/audio/audio_enums.h +++ b/src/audio/audio_enums.h @@ -238,18 +238,18 @@ enum AudioEntityHandle { enum eAudioType : int32 { AUDIOTYPE_PHYSICAL = 0, - AUDIOTYPE_EXPLOSION = 1, - AUDIOTYPE_FIRE = 2, - AUDIOTYPE_WEATHER = 3, - AUDIOTYPE_CRANE = 4, - AUDIOTYPE_SCRIPTOBJECT = 5, - AUDIOTYPE_BRIDGE = 6, - AUDIOTYPE_COLLISION = 7, - AUDIOTYPE_FRONTEND = 8, - AUDIOTYPE_PROJECTILE = 9, - AUDIOTYPE_GARAGE = 10, - AUDIOTYPE_FIREHYDRANT = 11, - AUDIOTYPE_WATERCANNON = 12, - AUDIOTYPE_POLICERADIO = 13, - TOTAL_AUDIO_TYPES = 14, + AUDIOTYPE_EXPLOSION, + AUDIOTYPE_FIRE, + AUDIOTYPE_WEATHER, + AUDIOTYPE_CRANE, + AUDIOTYPE_SCRIPTOBJECT, + AUDIOTYPE_BRIDGE, + AUDIOTYPE_COLLISION, + AUDIOTYPE_FRONTEND, + AUDIOTYPE_PROJECTILE, + AUDIOTYPE_GARAGE, + AUDIOTYPE_FIREHYDRANT, + AUDIOTYPE_WATERCANNON, + AUDIOTYPE_POLICERADIO, + TOTAL_AUDIO_TYPES, }; From 5a961d02845670f3f647d597f4c30696d2badd24 Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 10 Jun 2020 23:50:17 +0200 Subject: [PATCH 110/133] some cam cleanup; unused PS2 train cams --- src/core/Cam.cpp | 208 +++++++++++++++++++++++++++++++++------------- src/core/Camera.h | 8 +- 2 files changed, 153 insertions(+), 63 deletions(-) diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 53c49634..ee6d8845 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -211,10 +211,18 @@ CCam::Process(void) case MODE_PLAYER_FALLEN_WATER: Process_Player_Fallen_Water(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar); break; -// case MODE_CAM_ON_TRAIN_ROOF: -// case MODE_CAM_RUNNING_SIDE_TRAIN: -// case MODE_BLOOD_ON_THE_TRACKS: -// case MODE_IM_THE_PASSENGER_WOOWOO: + case MODE_CAM_ON_TRAIN_ROOF: + Process_Cam_On_Train_Roof(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar); + break; + case MODE_CAM_RUNNING_SIDE_TRAIN: + Process_Cam_Running_Side_Train(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar); + break; + case MODE_BLOOD_ON_THE_TRACKS: + Process_Blood_On_The_Tracks(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar); + break; + case MODE_IM_THE_PASSENGER_WOOWOO: + Process_Im_The_Passenger_Woo_Woo(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar); + break; case MODE_SYPHON_CRIM_IN_FRONT: Process_Syphon_Crim_In_Front(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar); break; @@ -1776,14 +1784,14 @@ CCam::WorkOutCamHeightWeeCar(CVector &TargetCoors, float TargetOrientation) void CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, float TargetHeight) { + float AlphaOffset = 0.0f; + bool CamClear = true; + static float LastTargetAlphaWithCollisionOn = 0.0f; static float LastTopAlphaSpeed = 0.0f; static float LastAlphaSpeedStep = 0.0f; static bool PreviousNearCheckNearClipSmall = false; - bool CamClear = true; - float ModeAlpha = 0.0f; - if(ResetStatics){ LastTargetAlphaWithCollisionOn = 0.0f; LastTopAlphaSpeed = 0.0f; @@ -1798,17 +1806,16 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa if(zoomvalue < 0.1f) zoomvalue = 0.1f; if(TheCamera.CarZoomIndicator == CAM_ZOOM_1) - ModeAlpha = CGeneral::GetATanOfXY(23.0f, zoomvalue); // near + AlphaOffset = CGeneral::GetATanOfXY(23.0f, zoomvalue); // near else if(TheCamera.CarZoomIndicator == CAM_ZOOM_2) - ModeAlpha = CGeneral::GetATanOfXY(10.8f, zoomvalue); // mid + AlphaOffset = CGeneral::GetATanOfXY(10.8f, zoomvalue); // mid else if(TheCamera.CarZoomIndicator == CAM_ZOOM_3) - ModeAlpha = CGeneral::GetATanOfXY(7.0f, zoomvalue); // far + AlphaOffset = CGeneral::GetATanOfXY(7.0f, zoomvalue); // far float Length = (Source - TargetCoors).Magnitude2D(); if(m_bCollisionChecksOn){ // there's another variable (on PC) but it's uninitialised - CVector Forward = CamTargetEntity->GetForward(); - float CarAlpha = CGeneral::GetATanOfXY(Forward.Magnitude2D(), Forward.z); + float CarAlpha = CGeneral::GetATanOfXY(CamTargetEntity->GetForward().Magnitude2D(), CamTargetEntity->GetForward().z); // this shouldn't be necessary.... while(CarAlpha >= PI) CarAlpha -= 2*PI; while(CarAlpha < -PI) CarAlpha += 2*PI; @@ -1816,11 +1823,11 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa while(Beta >= PI) Beta -= 2*PI; while(Beta < -PI) Beta += 2*PI; - float deltaBeta = Beta - TargetOrientation; - while(deltaBeta >= PI) deltaBeta -= 2*PI; - while(deltaBeta < -PI) deltaBeta += 2*PI; + float DeltaBeta = Beta - TargetOrientation; + while(DeltaBeta >= PI) DeltaBeta -= 2*PI; + while(DeltaBeta < -PI) DeltaBeta += 2*PI; - float BehindCarNess = Cos(deltaBeta); // 1 if behind car, 0 if side, -1 if in front + float BehindCarNess = Cos(DeltaBeta); // 1 if behind car, 0 if side, -1 if in front CarAlpha = -CarAlpha * BehindCarNess; if(CarAlpha < -0.01f) CarAlpha = -0.01f; @@ -1830,10 +1837,10 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa while(DeltaAlpha < -PI) DeltaAlpha += 2*PI; // What's this?? wouldn't it make more sense to clamp? float AngleLimit = DEGTORAD(1.8f); - if(DeltaAlpha < -AngleLimit) - DeltaAlpha += AngleLimit; - else if(DeltaAlpha > AngleLimit) + if(DeltaAlpha > AngleLimit) DeltaAlpha -= AngleLimit; + else if(DeltaAlpha < -AngleLimit) + DeltaAlpha += AngleLimit; else DeltaAlpha = 0.0f; @@ -1852,7 +1859,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa float CarRoof = CWorld::FindRoofZFor3DCoord(TargetCoors.x, TargetCoors.y, CarBottom, &FoundRoofCenter); // Check sides of the car - Forward = CamTargetEntity->GetForward(); // we actually still have that... + CVector Forward = CamTargetEntity->GetForward(); Forward.Normalise(); // shouldn't be necessary float CarSideAngle = CGeneral::GetATanOfXY(Forward.x, Forward.y) + PI/2.0f; float SideX = 2.5f * Cos(CarSideAngle); @@ -1861,7 +1868,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa CWorld::FindRoofZFor3DCoord(TargetCoors.x - SideX, TargetCoors.y - SideY, CarBottom, &FoundRoofSide2); // Now find out at what height we'd like to place the camera - float CamGround = CWorld::FindGroundZFor3DCoord(Source.x, Source.y, TargetCoors.z + Length*Sin(Alpha + ModeAlpha) + m_fCloseInCarHeightOffset, &FoundCamGround); + float CamGround = CWorld::FindGroundZFor3DCoord(Source.x, Source.y, TargetCoors.z + Length*Sin(Alpha + AlphaOffset) + m_fCloseInCarHeightOffset, &FoundCamGround); float CamTargetZ = 0.0f; if(FoundCamGround){ // This is the normal case @@ -1891,15 +1898,15 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa TargetAlpha = DEGTORAD(-7.0f); // huh? - if(TargetAlpha > ModeAlpha) + if(TargetAlpha > AlphaOffset) CamClear = true; - // Camera is contrained by collision in some way + // Camera is constrained by collision in some way PreviousNearCheckNearClipSmall = false; if(!CamClear){ PreviousNearCheckNearClipSmall = true; RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR); - DeltaAlpha = TargetAlpha - (Alpha + ModeAlpha); + DeltaAlpha = TargetAlpha - (Alpha + AlphaOffset); while(DeltaAlpha >= PI) DeltaAlpha -= 2*PI; while(DeltaAlpha < -PI) DeltaAlpha += 2*PI; @@ -1908,43 +1915,42 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa } // Now do things if CamClear...but what is that anyway? - float CamZ = TargetCoors.z + Length*Sin(Alpha + DeltaAlpha + ModeAlpha) + m_fCloseInCarHeightOffset; + float CamZ = TargetCoors.z + Length*Sin(Alpha + DeltaAlpha + AlphaOffset) + m_fCloseInCarHeightOffset; bool FoundGround, FoundRoof; float CamGround2 = CWorld::FindGroundZFor3DCoord(Source.x, Source.y, CamZ, &FoundGround); - if(FoundGround){ - if(CamClear) - if(CamZ - CamGround2 < 1.5f){ - PreviousNearCheckNearClipSmall = true; - RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR); + if(FoundGround && CamClear){ + if(CamZ - CamGround2 < 1.5f){ + PreviousNearCheckNearClipSmall = true; + RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR); - float a; - if(Length == 0.0f || CamGround2 + 1.5f - TargetCoors.z == 0.0f) - a = Alpha; - else - a = CGeneral::GetATanOfXY(Length, CamGround2 + 1.5f - TargetCoors.z); - while(a > PI) a -= 2*PI; - while(a < -PI) a += 2*PI; - DeltaAlpha = a - Alpha; - } - }else{ - if(CamClear){ - float CamRoof2 = CWorld::FindRoofZFor3DCoord(Source.x, Source.y, CamZ, &FoundRoof); - if(FoundRoof && CamZ - CamRoof2 < 1.5f){ - PreviousNearCheckNearClipSmall = true; - RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR); + float dz = CamGround2 + 1.5f - TargetCoors.z; + float a; + if(Length == 0.0f || dz == 0.0f) + a = Alpha; + else + a = CGeneral::GetATanOfXY(Length, dz); + while(a > PI) a -= 2*PI; + while(a < -PI) a += 2*PI; + DeltaAlpha = a - Alpha; + } + }else if(CamClear){ + float CamRoof2 = CWorld::FindRoofZFor3DCoord(Source.x, Source.y, CamZ, &FoundRoof); + if(FoundRoof && CamZ - CamRoof2 < 1.5f){ + PreviousNearCheckNearClipSmall = true; + RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR); - if(CamRoof2 > TargetCoors.z + 3.5f) - CamRoof2 = TargetCoors.z + 3.5f; + if(CamRoof2 > TargetCoors.z + 3.5f) + CamRoof2 = TargetCoors.z + 3.5f; - float a; - if(Length == 0.0f || CamRoof2 + 1.5f - TargetCoors.z == 0.0f) - a = Alpha; - else - a = CGeneral::GetATanOfXY(Length, CamRoof2 + 1.5f - TargetCoors.z); - while(a > PI) a -= 2*PI; - while(a < -PI) a += 2*PI; - DeltaAlpha = a - Alpha; - } + float dz = CamRoof2 + 1.5f - TargetCoors.z; + float a; + if(Length == 0.0f || dz == 0.0f) + a = Alpha; + else + a = CGeneral::GetATanOfXY(Length, dz); + while(a > PI) a -= 2*PI; + while(a < -PI) a += 2*PI; + DeltaAlpha = a - Alpha; } } @@ -1958,7 +1964,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa WellBufferMe(LastTargetAlphaWithCollisionOn, &Alpha, &AlphaSpeed, LastTopAlphaSpeed, LastAlphaSpeedStep, true); - Source.z = TargetCoors.z + Sin(Alpha + ModeAlpha)*Length + m_fCloseInCarHeightOffset; + Source.z = TargetCoors.z + Sin(Alpha + AlphaOffset)*Length + m_fCloseInCarHeightOffset; } // Rotate cam behind the car when the car is moving forward @@ -2108,9 +2114,9 @@ CCam::Process_Cam_On_A_String(const CVector &CameraTarget, float TargetOrientati CBaseModelInfo *mi = CModelInfo::GetModelInfo(CamTargetEntity->GetModelIndex()); CVector Dimensions = mi->GetColModel()->boundingBox.max - mi->GetColModel()->boundingBox.min; + CVector TargetCoors = CameraTarget; float BaseDist = Dimensions.Magnitude2D(); - CVector TargetCoors = CameraTarget; TargetCoors.z += Dimensions.z - 0.1f; // final Beta = CGeneral::GetATanOfXY(TargetCoors.x - Source.x, TargetCoors.y - Source.y); while(Alpha >= PI) Alpha -= 2*PI; @@ -2145,6 +2151,8 @@ CCam::Cam_On_A_String_Unobscured(const CVector &TargetCoors, float BaseDist) if(ResetStatics) Source = TargetCoors + Dist*(CA_MAX_DISTANCE + 1.0f); + Dist = Source - TargetCoors; + float Length = Dist.Magnitude2D(); if(Length < 0.001f){ // This probably shouldn't happen. reset view @@ -2172,7 +2180,7 @@ CCam::FixCamWhenObscuredByVehicle(const CVector &TargetCoors) static float HeightFixerCarsObscuring = 0.0f; static float HeightFixerCarsObscuringSpeed = 0.0f; CColPoint colPoint; - CEntity *entity; + CEntity *entity = nil; float HeightTarget = 0.0f; if(CWorld::ProcessLineOfSight(TargetCoors, Source, colPoint, entity, false, true, false, false, false, false, false)){ @@ -4412,6 +4420,88 @@ CCam::Process_FollowPed_WithBinding(const CVector &CameraTarget, float TargetOri GetVectorsReadyForRW(); } +void +CCam::Process_Im_The_Passenger_Woo_Woo(const CVector &CameraTarget, float TargetOrientation, float, float) +{ + FOV = 50.0f; + + Source = CamTargetEntity->GetPosition(); + Source.z += 2.5f; + Front = CamTargetEntity->GetForward(); + Front.Normalise(); + Source += 1.35f*Front; + float heading = CGeneral::GetATanOfXY(Front.x, Front.y) + DEGTORAD(45.0f); + Front.x = Cos(heading); + Front.y = Sin(heading); + Up = CamTargetEntity->GetUp(); + + GetVectorsReadyForRW(); +} + +void +CCam::Process_Blood_On_The_Tracks(const CVector &CameraTarget, float TargetOrientation, float, float) +{ + FOV = 50.0f; + + Source = CamTargetEntity->GetPosition(); + Source.z += 5.45f; + + static CVector Test = -CamTargetEntity->GetForward(); +#ifdef FIX_BUGS + if(ResetStatics){ + Test = -CamTargetEntity->GetForward(); + ResetStatics = false; + } +#endif + + Source.x += 19.45*Test.x; + Source.y += 19.45*Test.y; + Front = Test; + Front.Normalise(); + Up = CamTargetEntity->GetUp(); + + GetVectorsReadyForRW(); +} + +void +CCam::Process_Cam_Running_Side_Train(const CVector &CameraTarget, float TargetOrientation, float, float) +{ + FOV = 60.0f; + + Source = CamTargetEntity->GetPosition(); + Source.z += 4.0f; + CVector fwd = CamTargetEntity->GetForward(); + float heading = CGeneral::GetATanOfXY(fwd.x, fwd.y) - DEGTORAD(15.0f); + Source.x -= Cos(heading)*10.0f; + Source.y -= Sin(heading)*10.0f; + heading -= DEGTORAD(5.0f); + Front = fwd; + Front.x += Cos(heading); + Front.y += Sin(heading); + Front.z -= 0.056f; + Front.Normalise(); + Up = CamTargetEntity->GetUp(); + + GetVectorsReadyForRW(); +} + +void +CCam::Process_Cam_On_Train_Roof(const CVector &CameraTarget, float TargetOrientation, float, float) +{ + static float RoofMultiplier = 1.5f; + + Source = CamTargetEntity->GetPosition(); + Source.z += 4.8f; + Front = CamTargetEntity->GetForward(); + Front.Normalise(); + Source += Front*RoofMultiplier; + Up = CamTargetEntity->GetUp(); + Up.Normalise(); + + GetVectorsReadyForRW(); +} + + #ifdef FREE_CAM void CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float) diff --git a/src/core/Camera.h b/src/core/Camera.h index 80fc878e..e736b6a7 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -251,10 +251,10 @@ public: // CCam::Process_CheesyZoom // CCam::Process_Aiming // CCam::Process_Bill // same as BehindCar due to unused variables - // CCam::Process_Im_The_Passenger_Woo_Woo - // CCam::Process_Blood_On_The_Tracks - // CCam::Process_Cam_Running_Side_Train - // CCam::Process_Cam_On_Train_Roof + void Process_Im_The_Passenger_Woo_Woo(const CVector &CameraTarget, float TargetOrientation, float, float); + void Process_Blood_On_The_Tracks(const CVector &CameraTarget, float TargetOrientation, float, float); + void Process_Cam_Running_Side_Train(const CVector &CameraTarget, float TargetOrientation, float, float); + void Process_Cam_On_Train_Roof(const CVector &CameraTarget, float TargetOrientation, float, float); // custom stuff void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float); From 41dac0773f4e3ed2800f038340ddcb5adeee5f99 Mon Sep 17 00:00:00 2001 From: aap Date: Fri, 12 Jun 2020 21:53:39 +0200 Subject: [PATCH 111/133] little CCam cleanup; fix in CWorld sphere test --- src/core/Cam.cpp | 53 +++++++++++++++++++++------------------------ src/core/Camera.cpp | 9 +++++++- src/core/World.cpp | 4 ++++ 3 files changed, 37 insertions(+), 29 deletions(-) diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index ee6d8845..567d8c79 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -40,11 +40,11 @@ CCam::Init(void) Mode = MODE_FOLLOWPED; Front = CVector(0.0f, 0.0f, -1.0f); Up = CVector(0.0f, 0.0f, 1.0f); - Rotating = 0; + Rotating = false; m_iDoCollisionChecksOnFrameNum = 1; m_iDoCollisionCheckEveryNumOfFrames = 9; m_iFrameNumWereAt = 0; - m_bCollisionChecksOn = 1; + m_bCollisionChecksOn = false; m_fRealGroundDist = 0.0f; BetaSpeed = 0.0f; AlphaSpeed = 0.0f; @@ -54,19 +54,19 @@ CCam::Init(void) DistanceSpeed = 0.0f; m_pLastCarEntered = 0; m_pLastPedLookedAt = 0; - ResetStatics = 1; + ResetStatics = true; Beta = 0.0f; - m_bFixingBeta = 0; + m_bFixingBeta = false; CA_MIN_DISTANCE = 0.0f; CA_MAX_DISTANCE = 0.0f; - LookingBehind = 0; - LookingLeft = 0; - LookingRight = 0; + LookingBehind = false; + LookingLeft = false; + LookingRight = false; m_fPlayerInFrontSyphonAngleOffSet = DEGTORAD(20.0f); m_fSyphonModeTargetZOffSet = 0.5f; m_fRadiusForDead = 1.5f; DirectionWasLooking = LOOKING_FORWARD; - LookBehindCamWasInFront = 0; + LookBehindCamWasInFront = false; f_Roll = 0.0f; f_rollSpeed = 0.0f; m_fCloseInPedHeightOffset = 0.0f; @@ -1007,6 +1007,9 @@ static float DefaultMaxStep = 0.15f; void CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, float, float) { + if(!CamTargetEntity->IsPed()) + return; + const float GroundDist = 1.85f; CVector TargetCoors, Dist, IdealSource; @@ -1023,7 +1026,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl bool GoingBehind = false; bool Obscured = false; bool BuildingCheckObscured = false; - bool HackPlayerOnStoppingTrain = false; + bool StandingInTrain = false; static int TimeIndicatedWantedToGoDown = 0; static bool StartedCountingForGoDown = false; float DeltaBeta; @@ -1032,12 +1035,6 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl bBelowMinDist = false; bBehindPlayerDesired = false; -#ifdef FIX_BUGS - if(!CamTargetEntity->IsPed()) - return; -#endif - assert(CamTargetEntity->IsPed()); - // CenterDist should be > LateralDist because we don't have an angle for safety in this case float CenterDist, LateralDist; float AngleToGoToSpeed; @@ -1103,7 +1100,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl if(FindPlayerVehicle()) if(FindPlayerVehicle()->m_vehType == VEHICLE_TYPE_TRAIN) - HackPlayerOnStoppingTrain = true; + StandingInTrain = true; if(TheCamera.m_bCamDirectlyInFront){ m_bCollisionChecksOn = true; @@ -1356,7 +1353,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl if(TheCamera.m_bCamDirectlyBehind || TheCamera.m_bCamDirectlyInFront || - HackPlayerOnStoppingTrain || Rotating){ + StandingInTrain || Rotating){ if(TheCamera.m_bCamDirectlyBehind){ Beta = TargetOrientation + PI; Source.x = TargetCoors.x + RotDistance * Cos(Beta); @@ -1367,7 +1364,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl Source.x = TargetCoors.x + RotDistance * Cos(Beta); Source.y = TargetCoors.y + RotDistance * Sin(Beta); } - if(HackPlayerOnStoppingTrain){ + if(StandingInTrain){ Beta = TargetOrientation + PI; Source.x = TargetCoors.x + RotDistance * Cos(Beta); Source.y = TargetCoors.y + RotDistance * Sin(Beta); @@ -2477,8 +2474,8 @@ CCam::Process_Rocket(const CVector &CameraTarget, float, float, float) }else{ float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f; float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f; - Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep(); - Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep(); + Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep(); + Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep(); } while(Beta >= PI) Beta -= 2*PI; while(Beta < -PI) Beta += 2*PI; @@ -2579,8 +2576,8 @@ CCam::Process_M16_1stPerson(const CVector &CameraTarget, float, float, float) }else{ float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f; float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f; - Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep(); - Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep(); + Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep(); + Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep(); } while(Beta >= PI) Beta -= 2*PI; while(Beta < -PI) Beta += 2*PI; @@ -2691,8 +2688,8 @@ CCam::Process_1stPerson(const CVector &CameraTarget, float TargetOrientation, fl LookUpDown = CPad::GetPad(0)->LookAroundUpDown(); float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f; float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f; - Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep(); - Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep(); + Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep(); + Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep(); while(Beta >= PI) Beta -= 2*PI; while(Beta < -PI) Beta += 2*PI; if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f); @@ -2870,8 +2867,8 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float, }else{ float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f; float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f; - Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep(); - Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep(); + Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep(); + Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep(); } while(Beta >= PI) Beta -= 2*PI; while(Beta < -PI) Beta += 2*PI; @@ -2973,8 +2970,8 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float }else{ float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f; float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f; - Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep(); - Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep(); + Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep(); + Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep(); } while(Beta >= PI) Beta -= 2*PI; while(Beta < -PI) Beta += 2*PI; diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index 53bee20f..d7e52170 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -111,7 +111,7 @@ CCamera::Init(void) Cams[0].Mode = CCam::MODE_FOLLOWPED; Cams[1].Mode = CCam::MODE_FOLLOWPED; unknown = 0; - m_bJustJumpedOutOf1stPersonBecauseOfTarget = 0; + m_bJustJumpedOutOf1stPersonBecauseOfTarget = false; ClearPlayerWeaponMode(); m_bInATunnelAndABigVehicle = false; m_iModeObbeCamIsInForCar = OBBE_INVALID; @@ -2869,6 +2869,13 @@ CCamera::Process_Train_Camera_Control(void) if(node >= m_uiNumberOfTrainCamNodes) node = 0; } +#ifdef FIX_BUGS + // Not really a bug but be nice and respect the debug mode + if(DebugCamMode){ + TakeControl(target, DebugCamMode, JUMP_CUT, CAMCONTROL_SCRIPT); + return; + } +#endif if(found){ SetWideScreenOn(); diff --git a/src/core/World.cpp b/src/core/World.cpp index c3633d77..3b77db18 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -949,7 +949,11 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad if(e != entityToIgnore && e->bUsesCollision && !(ignoreSomeObjects && CameraToIgnoreThisObject(e))) { +#ifdef FIX_BUGS + CVector diff = spherePos - e->GetBoundCentre(); +#else CVector diff = spherePos - e->GetPosition(); +#endif float distance = diff.Magnitude(); if(e->GetBoundRadius() + radius > distance) { From d415c4edd363ba04c415d626c8d5bc1a99d798af Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sat, 13 Jun 2020 00:16:10 +0300 Subject: [PATCH 112/133] minor fix --- src/control/Script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index da321a28..089db1b4 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -7743,7 +7743,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) CollectParameters(&m_nIp, 4); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); assert(pObject); - pObject->SetMoveSpeed(pObject->GetMoveSpeed() + 0.02f * *(CVector*)&ScriptParams[1]); + pObject->SetMoveSpeed(pObject->GetMoveSpeed() + METERS_PER_SECOND_TO_GAME_SPEED * *(CVector*)&ScriptParams[1]); return 0; } case COMMAND_DRAW_SPRITE: From beb6f3bf8057232a1b1b5a1673d22cff618e3a83 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 13 Jun 2020 13:57:25 +0300 Subject: [PATCH 113/133] small fixes --- src/render/Fluff.cpp | 35 ++++++++++++++++++----------------- src/render/Hud.cpp | 10 +++++----- src/weapons/BulletInfo.cpp | 3 ++- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp index 9f3f6929..d50bddd6 100644 --- a/src/render/Fluff.cpp +++ b/src/render/Fluff.cpp @@ -142,11 +142,11 @@ void CMovingThings::Init() void CMovingThings::Shutdown() { int i; - for (i = 0; i < 11; ++i) + for (i = 0; i < ARRAY_SIZE(aScrollBars); ++i) aScrollBars[i].SetVisibility(false); - for (i = 0; i < 2; ++i) + for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i) aTowerClocks[i].SetVisibility(false); - for (i = 0; i < 3; ++i) + for (i = 0; i < ARRAY_SIZE(aDigitalClocks); ++i) aDigitalClocks[i].SetVisibility(false); } @@ -168,17 +168,17 @@ void CMovingThings::Update() aMovingThings[i].Update(); } - for (i = 0; i < 11; ++i) + for (i = 0; i < ARRAY_SIZE(aScrollBars); ++i) { if (aScrollBars[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0) aScrollBars[i].Update(); } - for (i = 0; i < 2; ++i) + for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i) { if (aTowerClocks[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0) aTowerClocks[i].Update(); } - for (i = 0; i < 3; ++i) + for (i = 0; i < ARRAY_SIZE(aDigitalClocks); ++i) { if (aDigitalClocks[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0) aDigitalClocks[i].Update(); @@ -188,17 +188,17 @@ void CMovingThings::Update() void CMovingThings::Render() { int i; - for (i = 0; i < 11; ++i) + for (i = 0; i < ARRAY_SIZE(aScrollBars); ++i) { if (aScrollBars[i].IsVisible()) aScrollBars[i].Render(); } - for (i = 0; i < 2; ++i) + for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i) { if (aTowerClocks[i].IsVisible()) aTowerClocks[i].Render(); } - for (i = 0; i < 3; ++i) + for (i = 0; i < ARRAY_SIZE(aDigitalClocks); ++i) { if (aDigitalClocks[i].IsVisible()) aDigitalClocks[i].Render(); @@ -297,7 +297,8 @@ const char* FindDigitalClockMessage() } else { - int temperature = 13.0f - 6.0f * Cos((CClock::GetMinutes() + 60.0f * CClock::GetHours()) * 0.0043611112f - 1.0f); + // they didn't use rad2deg here because of 3.14 + int temperature = 13.0f - 6.0f * Cos((CClock::GetMinutes() + 60.0f * CClock::GetHours()) / (4.0f * 180.0f / 3.14f) - 1.0f); String_DigitalClock[0] = '0' + temperature / 10; if (String_DigitalClock[0] == '0') String_DigitalClock[0] = ' '; @@ -312,7 +313,7 @@ const char* FindDigitalClockMessage() // ---------- CScrollBar ---------- void CScrollBar::Init(CVector position, uint8 type, float sizeX, float sizeY, float sizeZ, uint8 red, uint8 green, uint8 blue, float scale) { - for (int i = 0; i < 40; ++i) + for (int i = 0; i < ARRAY_SIZE(m_MessageBar); ++i) m_MessageBar[i] = 0; m_pMessage = ". "; @@ -618,16 +619,16 @@ void CScrollBar::Update() } // Scroll - for (int i = 0; i < 39; i++) + for (int i = 0; i < ARRAY_SIZE(m_MessageBar)-1; i++) m_MessageBar[i] = m_MessageBar[i + 1]; - m_MessageBar[39] = m_Counter < 5 ? ScrollCharSet[m_pMessage[m_MessageCurrentChar] - ' '][m_Counter] : 0; + m_MessageBar[ARRAY_SIZE(m_MessageBar)-1] = m_Counter < 5 ? ScrollCharSet[m_pMessage[m_MessageCurrentChar] - ' '][m_Counter] : 0; // Introduce some random displaying glitches; signs aren't supposed to be perfect :P switch (CGeneral::GetRandomNumber() & 0xFF) { - case 0x0D: m_MessageBar[39] = 0; break; - case 0xE3: m_MessageBar[39] = 0xE3; break; - case 0x64: m_MessageBar[39] = ~m_MessageBar[39]; break; + case 0x0D: m_MessageBar[ARRAY_SIZE(m_MessageBar)-1] = 0; break; + case 0xE3: m_MessageBar[ARRAY_SIZE(m_MessageBar)-1] = 0xE3; break; + case 0x64: m_MessageBar[ARRAY_SIZE(m_MessageBar)-1] = ~m_MessageBar[ARRAY_SIZE(m_MessageBar)-1]; break; } } @@ -654,7 +655,7 @@ void CScrollBar::Render() CVector coronaCoord, screenCoord; float screenW, screenH; - for (int i = 1; i < 40; ++i) + for (int i = 1; i < ARRAY_SIZE(m_MessageBar); ++i) { for (int j = 0; j < 5; ++j) { diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index c7f61d5d..270cc07c 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -131,16 +131,16 @@ void CHud::Draw() return; if (m_Wants_To_Draw_Hud && !TheCamera.m_WideScreenOn) { - bool DrawCrossHair = 0; - bool DrawCrossHairPC = 0; + bool DrawCrossHair = false; + bool DrawCrossHairPC = false; int32 WeaponType = FindPlayerPed()->m_weapons[FindPlayerPed()->m_currentWeapon].m_eWeaponType; int32 Mode = TheCamera.Cams[TheCamera.ActiveCam].Mode; if (Mode == CCam::MODE_SNIPER || Mode == CCam::MODE_ROCKETLAUNCHER || Mode == CCam::MODE_M16_1STPERSON || Mode == CCam::MODE_HELICANNON_1STPERSON) - DrawCrossHair = 1; + DrawCrossHair = true; if (Mode == CCam::MODE_M16_1STPERSON_RUNABOUT || Mode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT || Mode == CCam::MODE_SNIPER_RUNABOUT) - DrawCrossHairPC = 1; + DrawCrossHairPC = true; /* Draw Crosshairs @@ -149,7 +149,7 @@ void CHud::Draw() (!CPad::GetPad(0)->GetLookBehindForPed() || TheCamera.m_bPlayerIsInGarage) || Mode == CCam::MODE_1STPERSON_RUNABOUT) { if (FindPlayerPed() && !FindPlayerPed()->EnteringCar()) { if ((WeaponType >= WEAPONTYPE_COLT45 && WeaponType <= WEAPONTYPE_M16) || WeaponType == WEAPONTYPE_FLAMETHROWER) - DrawCrossHairPC = 1; + DrawCrossHairPC = true; } } diff --git a/src/weapons/BulletInfo.cpp b/src/weapons/BulletInfo.cpp index 389e7486..26fc459d 100644 --- a/src/weapons/BulletInfo.cpp +++ b/src/weapons/BulletInfo.cpp @@ -22,6 +22,7 @@ #include "Weapon.h" #include "WeaponInfo.h" #include "World.h" +#include "SurfaceTable.h" #define BULLET_LIFETIME (1000) #define NUM_PED_BLOOD_PARTICLES (8) @@ -228,7 +229,7 @@ bool CBulletInfo::TestForSniperBullet(float x1, float x2, float y1, float y2, fl #ifdef FIX_BUGS // original code is not going work anyway... CColLine line(PlayerSniperBulletStart, PlayerSniperBulletEnd); CColBox box; - box.Set(CVector(x1, y1, z1), CVector(x2, y2, z2), 0, 0); + box.Set(CVector(x1, y1, z1), CVector(x2, y2, z2), SURFACE_DEFAULT, 0); return CCollision::TestLineBox(line, box); #else float minP = 0.0f; From 3231c6c3dd319525eb6d3843dd1198773755c7e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sat, 13 Jun 2020 17:33:30 +0300 Subject: [PATCH 114/133] ProcessTrainAnnouncements fix --- src/vehicles/Train.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vehicles/Train.cpp b/src/vehicles/Train.cpp index baf6bfb7..26d0dee7 100644 --- a/src/vehicles/Train.cpp +++ b/src/vehicles/Train.cpp @@ -639,8 +639,8 @@ PlayAnnouncement(uint8 sound, uint8 station) void ProcessTrainAnnouncements(void) { - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 3; j++) { + for (int i = 0; i < ARRAY_SIZE(StationDist); i++) { + for (int j = 0; j < ARRAY_SIZE(EngineTrackPosition); j++) { if (!bTrainArrivalAnnounced[i]) { float preDist = StationDist[i] - 100.0f; if (preDist < 0.0f) From 39177cb3e3d93003c089bd5b5d3a89e5c676cab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sat, 13 Jun 2020 18:03:26 +0300 Subject: [PATCH 115/133] update librw --- librw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librw b/librw index 6ff378bb..556f6af1 160000 --- a/librw +++ b/librw @@ -1 +1 @@ -Subproject commit 6ff378bb16007ad003b1a71996944a20f2e76556 +Subproject commit 556f6af1b5a15d5ba1a2254a95076578cd160185 From 3fe282fbe424c7aaa0b467def533eda6327b6457 Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 13 Jun 2020 23:39:24 +0200 Subject: [PATCH 116/133] a few cam fixes --- src/core/Cam.cpp | 47 +++++++++++++++++++++++++-------------------- src/core/Camera.cpp | 43 ++++++++++++++++++++--------------------- src/core/Camera.h | 4 ++-- 3 files changed, 49 insertions(+), 45 deletions(-) diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 567d8c79..fc03b291 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -52,8 +52,8 @@ CCam::Init(void) f_max_role_angle = DEGTORAD(5.0f); Distance = 30.0f; DistanceSpeed = 0.0f; - m_pLastCarEntered = 0; - m_pLastPedLookedAt = 0; + m_pLastCarEntered = nil; + m_pLastPedLookedAt = nil; ResetStatics = true; Beta = 0.0f; m_bFixingBeta = false; @@ -1001,8 +1001,8 @@ CCam::GetPedBetaAngleForClearView(const CVector &Target, float Dist, float BetaO return 0.0f; } -static float DefaultAcceleration = 0.045f; -static float DefaultMaxStep = 0.15f; +float DefaultAcceleration = 0.045f; +float DefaultMaxStep = 0.15f; void CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, float, float) @@ -1473,14 +1473,14 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl ResetStatics = false; } -static float fBaseDist = 1.7f; -static float fAngleDist = 2.0f; -static float fFalloff = 3.0f; -static float fStickSens = 0.01f; -static float fTweakFOV = 1.05f; -static float fTranslateCamUp = 0.8f; -static int16 nFadeControlThreshhold = 45; -static float fDefaultAlphaOrient = -0.22f; +float fBaseDist = 1.7f; +float fAngleDist = 2.0f; +float fFalloff = 3.0f; +float fStickSens = 0.01f; +float fTweakFOV = 1.05f; +float fTranslateCamUp = 0.8f; +int16 nFadeControlThreshhold = 45; +float fDefaultAlphaOrient = -0.22f; void CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrientation, float, float) @@ -1522,8 +1522,8 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient BetaOffset = LookLeftRight * TheCamera.m_fMouseAccelHorzntl * FOV/80.0f; AlphaOffset = LookUpDown * TheCamera.m_fMouseAccelVertical * FOV/80.0f; }else{ - BetaOffset = LookLeftRight * fStickSens * (0.5f/7.0f) * FOV/80.0f * CTimer::GetTimeStep(); - AlphaOffset = LookUpDown * fStickSens * (0.3f/7.0f) * FOV/80.0f * CTimer::GetTimeStep(); + BetaOffset = LookLeftRight * fStickSens * (1.0f/14.0f) * FOV/80.0f * CTimer::GetTimeStep(); + AlphaOffset = LookUpDown * fStickSens * (0.6f/14.0f) * FOV/80.0f * CTimer::GetTimeStep(); } if(TheCamera.GetFading() && TheCamera.GetFadingDirection() == FADE_IN && nFadeControlThreshhold < CDraw::FadeValue || @@ -1545,7 +1545,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient while(Beta >= PI) Beta -= 2*PI; while(Beta < -PI) Beta += 2*PI; if(Alpha > DEGTORAD(45.0f)) Alpha = DEGTORAD(45.0f); - if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f); + else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f); TargetCoors = CameraTarget; TargetCoors.z += fTranslateCamUp; @@ -1583,7 +1583,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient if(CWorld::ProcessLineOfSight(TargetCoors, Source, colPoint, entity, true, true, true, true, false, false, true)){ float PedColDist = (TargetCoors - colPoint.point).Magnitude(); float ColCamDist = CamDist - PedColDist; - if(entity->IsPed() && ColCamDist > 1.0f){ + if(entity->IsPed() && ColCamDist > DEFAULT_NEAR + 0.1f){ // Ped in the way but not clipping through if(CWorld::ProcessLineOfSight(colPoint.point, Source, colPoint, entity, true, true, true, true, false, false, true)){ PedColDist = (TargetCoors - colPoint.point).Magnitude(); @@ -1621,9 +1621,12 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient if(dist == 0.1f) Source += (TargetCoors - Source)*0.3f; + Near = RwCameraGetNearClipPlane(Scene.camera); #ifndef FIX_BUGS // this is totally wrong... radius = Tan(FOV / 2.0f) * Near; +#else + radius = ViewPlaneWidth*Near; #endif // Keep testing entity = CWorld::TestSphereAgainstWorld(Source + Front*Near, radius, nil, true, true, false, true, false, false); @@ -2693,7 +2696,7 @@ CCam::Process_1stPerson(const CVector &CameraTarget, float TargetOrientation, fl while(Beta >= PI) Beta -= 2*PI; while(Beta < -PI) Beta += 2*PI; if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f); - if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f); + else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f); TargetCoors.x = 3.0f * Cos(Alpha) * Cos(Beta) + Source.x; TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y; @@ -2740,7 +2743,7 @@ CCam::Process_1stPerson(const CVector &CameraTarget, float TargetOrientation, fl CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(CamTargetEntity->GetModelIndex()); CVector CamPos = mi->GetFrontSeatPosn(); CamPos.x = 0.0f; - CamPos.y += -0.08f; + CamPos.y += 0.08f; CamPos.z += 0.62f; FOV = 60.0f; Source = Multiply3x3(CamTargetEntity->GetMatrix(), CamPos); @@ -4581,8 +4584,8 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient BetaOffset = LookLeftRight * TheCamera.m_fMouseAccelHorzntl * FOV/80.0f; AlphaOffset = LookUpDown * TheCamera.m_fMouseAccelVertical * FOV/80.0f; }else{ - BetaOffset = LookLeftRight * fStickSens * (0.5f/10.0f) * FOV/80.0f * CTimer::GetTimeStep(); - AlphaOffset = LookUpDown * fStickSens * (0.3f/10.0f) * FOV/80.0f * CTimer::GetTimeStep(); + BetaOffset = LookLeftRight * fStickSens * (1.0f/20.0f) * FOV/80.0f * CTimer::GetTimeStep(); + AlphaOffset = LookUpDown * fStickSens * (0.6f/20.0f) * FOV/80.0f * CTimer::GetTimeStep(); } // Stop centering once stick has been touched @@ -4654,7 +4657,7 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient if(CWorld::ProcessLineOfSight(TargetCoors, Source, colPoint, entity, true, true, true, true, false, false, true)){ float PedColDist = (TargetCoors - colPoint.point).Magnitude(); float ColCamDist = CamDist - PedColDist; - if(entity->IsPed() && ColCamDist > 1.0f){ + if(entity->IsPed() && ColCamDist > DEFAULT_NEAR + 0.1f){ // Ped in the way but not clipping through if(CWorld::ProcessLineOfSight(colPoint.point, Source, colPoint, entity, true, true, true, true, false, false, true)){ PedColDist = (TargetCoors - colPoint.point).Magnitude(); @@ -4693,6 +4696,8 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient Source += (TargetCoors - Source)*0.3f; // Keep testing + Near = RwCameraGetNearClipPlane(Scene.camera); + radius = ViewPlaneWidth*Near; entity = CWorld::TestSphereAgainstWorld(Source + Front*Near, radius, nil, true, true, false, true, false, false); i++; diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index d7e52170..aa307337 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -129,8 +129,8 @@ CCamera::Init(void) Cams[1].m_fPlayerVelocity = 0.0f; Cams[2].m_fPlayerVelocity = 0.0f; m_bHeadBob = false; - m_fFractionInterToStopMovingTarget = 0.25f; - m_fFractionInterToStopCatchUpTarget = 0.75f; + m_fFractionInterToStopMoving = 0.25f; + m_fFractionInterToStopCatchUp = 0.75f; m_fGaitSwayBuffer = 0.85f; m_bScriptParametersSetForInterPol = false; m_uiCamShakeStart = 0; @@ -329,12 +329,12 @@ CCamera::Process(void) currentTime = m_uiTransitionDuration; float fractionInter = (float) currentTime / m_uiTransitionDuration; - if(fractionInter <= m_fFractionInterToStopMovingTarget){ + if(fractionInter <= m_fFractionInterToStopMoving){ float inter; - if(m_fFractionInterToStopMovingTarget == 0.0f) + if(m_fFractionInterToStopMoving == 0.0f) inter = 0.0f; else - inter = (m_fFractionInterToStopMovingTarget - fractionInter)/m_fFractionInterToStopMovingTarget; + inter = (m_fFractionInterToStopMoving - fractionInter)/m_fFractionInterToStopMoving; inter = 0.5f - 0.5*Cos(inter*PI); // smooth it m_vecSourceWhenInterPol = m_cvecStartingSourceForInterPol + inter*m_cvecSourceSpeedAtStartInter; @@ -388,12 +388,12 @@ CCamera::Process(void) } CamUp.Normalise(); FOV = m_fFOVWhenInterPol; - }else if(fractionInter > m_fFractionInterToStopMovingTarget && fractionInter <= 1.0f){ + }else if(fractionInter > m_fFractionInterToStopMoving && fractionInter <= 1.0f){ float inter; - if(m_fFractionInterToStopCatchUpTarget == 0.0f) + if(m_fFractionInterToStopCatchUp == 0.0f) inter = 0.0f; else - inter = (fractionInter - m_fFractionInterToStopMovingTarget)/m_fFractionInterToStopCatchUpTarget; + inter = (fractionInter - m_fFractionInterToStopMoving)/m_fFractionInterToStopCatchUp; inter = 0.5f - 0.5*Cos(inter*PI); // smooth it CamSource = m_vecSourceWhenInterPol + inter*(Cams[ActiveCam].Source - m_vecSourceWhenInterPol); @@ -1846,10 +1846,9 @@ CCamera::SetCamPositionForFixedMode(const CVector &Source, const CVector &UpOffS void CCamera::StartTransition(int16 newMode) { - bool foo = false; bool switchSyphonMode = false; bool switchPedToCar = false; - bool switchPedMode = false; + bool switchFromFight = false; bool switchFromFixed = false; bool switch1stPersonToVehicle = false; float betaOffset, targetBeta, camBeta, deltaBeta; @@ -1858,8 +1857,8 @@ CCamera::StartTransition(int16 newMode) // missing on PS2 m_bItsOkToLookJustAtThePlayer = false; - m_fFractionInterToStopMovingTarget = 0.25f; - m_fFractionInterToStopCatchUpTarget = 0.75f; + m_fFractionInterToStopMoving = 0.25f; + m_fFractionInterToStopCatchUp = 0.75f; if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT || Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED || @@ -1878,7 +1877,7 @@ CCamera::StartTransition(int16 newMode) if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT && newMode == CCam::MODE_SYPHON) switchSyphonMode = true; if(Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM && newMode == CCam::MODE_FOLLOWPED) - switchPedMode = true; + switchFromFight = true; if(Cams[ActiveCam].Mode == CCam::MODE_FIXED) switchFromFixed = true; @@ -2097,19 +2096,19 @@ CCamera::StartTransition(int16 newMode) m_uiTransitionDuration = 1350; if(switchSyphonMode) m_uiTransitionDuration = 1800; - else if(switchPedMode) + else if(switchFromFight) m_uiTransitionDuration = 750; // not on PS2 else if(switchPedToCar){ - m_fFractionInterToStopMovingTarget = 0.2f; - m_fFractionInterToStopCatchUpTarget = 0.8f; + m_fFractionInterToStopMoving = 0.2f; + m_fFractionInterToStopCatchUp = 0.8f; m_uiTransitionDuration = 950; }else if(switchFromFixed){ - m_fFractionInterToStopMovingTarget = 0.05f; - m_fFractionInterToStopCatchUpTarget = 0.95f; + m_fFractionInterToStopMoving = 0.05f; + m_fFractionInterToStopCatchUp = 0.95f; }else if(switch1stPersonToVehicle){ - m_fFractionInterToStopMovingTarget = 0.0f; - m_fFractionInterToStopCatchUpTarget = 1.0f; + m_fFractionInterToStopMoving = 0.0f; + m_fFractionInterToStopCatchUp = 1.0f; m_uiTransitionDuration = 1; }else m_uiTransitionDuration = 1350; // already set above @@ -2149,8 +2148,8 @@ CCamera::StartTransition(int16 newMode) m_fFOVSpeedAtStartInter = Cams[ActiveCam].m_fFovSpeedOverOneFrame; Cams[ActiveCam].ResetStatics = true; if(!m_bLookingAtPlayer && m_bScriptParametersSetForInterPol){ - m_fFractionInterToStopMovingTarget = m_fScriptPercentageInterToStopMoving; - m_fFractionInterToStopCatchUpTarget = m_fScriptPercentageInterToCatchUp; + m_fFractionInterToStopMoving = m_fScriptPercentageInterToStopMoving; + m_fFractionInterToStopCatchUp = m_fScriptPercentageInterToCatchUp; m_uiTransitionDuration = m_fScriptTimeForInterPolation; } } diff --git a/src/core/Camera.h b/src/core/Camera.h index e736b6a7..bcaaea47 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -524,8 +524,8 @@ public: float m_fFLOATingFadeMusic; float m_fTimeToFadeOut; float m_fTimeToFadeMusic; - float m_fFractionInterToStopMovingTarget; - float m_fFractionInterToStopCatchUpTarget; + float m_fFractionInterToStopMoving; + float m_fFractionInterToStopCatchUp; float m_fGaitSwayBuffer; float m_fScriptPercentageInterToStopMoving; float m_fScriptPercentageInterToCatchUp; From b77d044729c41fb35599525b27357e1b7d7f173a Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 14 Jun 2020 09:50:00 +0200 Subject: [PATCH 117/133] fixed boat wake --- librw | 2 +- src/vehicles/Boat.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/librw b/librw index 556f6af1..6ff378bb 160000 --- a/librw +++ b/librw @@ -1 +1 @@ -Subproject commit 556f6af1b5a15d5ba1a2254a95076578cd160185 +Subproject commit 6ff378bb16007ad003b1a71996944a20f2e76556 diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index 0ed7876a..d86627de 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -904,6 +904,8 @@ CBoat::AddWakePoint(CVector point) } m_avec2dWakePoints[0] = point; m_afWakePointLifeTime[0] = 400.0f; + if(m_nNumWakePoints < ARRAY_SIZE(m_afWakePointLifeTime)) + m_nNumWakePoints++; } }else{ m_avec2dWakePoints[0] = point; From e6d2b49121a8cc03e69be7c9cfa451603332ffc9 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 14 Jun 2020 23:16:22 +0200 Subject: [PATCH 118/133] more cleanup --- src/core/Cam.cpp | 43 +++++++++++++++++++++---------------------- src/core/World.cpp | 34 +++++++++++++++++----------------- src/core/World.h | 4 ++-- 3 files changed, 40 insertions(+), 41 deletions(-) diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index fc03b291..a9d0e474 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -111,7 +111,11 @@ CCam::Process(void) Fwd.x = CamTargetEntity->GetForward().x; Fwd.y = CamTargetEntity->GetForward().y; Fwd.Normalise(); - // Game normalizes again here manually. useless, so skipped + float FwdLength = Fwd.Magnitude2D(); + if(FwdLength != 0.0f){ + Fwd.x /= FwdLength; + Fwd.y /= FwdLength; + } float FwdSpeedX = ((CVehicle*)CamTargetEntity)->GetMoveSpeed().x * Fwd.x; float FwdSpeedY = ((CVehicle*)CamTargetEntity)->GetMoveSpeed().y * Fwd.y; @@ -272,7 +276,7 @@ CCam::Process(void) CVector TargetToCam = Source - m_cvecTargetCoorsForFudgeInter; float DistOnGround = TargetToCam.Magnitude2D(); m_fTrueBeta = CGeneral::GetATanOfXY(TargetToCam.x, TargetToCam.y); - m_fTrueAlpha = CGeneral::GetATanOfXY(TargetToCam.z, DistOnGround); + m_fTrueAlpha = CGeneral::GetATanOfXY(DistOnGround, TargetToCam.z); if(TheCamera.m_uiTransitionState == 0) KeepTrackOfTheSpeed(Source, m_cvecTargetCoorsForFudgeInter, Up, m_fTrueAlpha, m_fTrueBeta, FOV); @@ -2585,7 +2589,7 @@ CCam::Process_M16_1stPerson(const CVector &CameraTarget, float, float, float) while(Beta >= PI) Beta -= 2*PI; while(Beta < -PI) Beta += 2*PI; if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f); - if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f); + else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f); #ifdef GTA3_1_1_PATCH HeadPos.x = 0.0f; @@ -2876,7 +2880,7 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float, while(Beta >= PI) Beta -= 2*PI; while(Beta < -PI) Beta += 2*PI; if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f); - if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f); + else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f); TargetCoors.x = 3.0f * Cos(Alpha) * Cos(Beta) + Source.x; TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y; @@ -2920,13 +2924,8 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float, void CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float, float) { - if(CamTargetEntity->m_rwObject == nil) - return; - -#ifdef FIX_BUGS if(!CamTargetEntity->IsPed()) return; -#endif static bool FailedTestTwelveFramesAgo = false; RwV3d HeadPos; @@ -2936,9 +2935,9 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float static float TargetFOV = 0.0f; if(ResetStatics){ - Beta = TargetOrientation; + Beta = ((CPed*)CamTargetEntity)->m_fRotationCur + HALFPI; Alpha = 0.0f; - m_fInitialPlayerOrientation = TargetOrientation; + m_fInitialPlayerOrientation = ((CPed*)CamTargetEntity)->m_fRotationCur + HALFPI; FailedTestTwelveFramesAgo = false; // static DPadVertical unused // static DPadHorizontal unused @@ -2979,7 +2978,7 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float while(Beta >= PI) Beta -= 2*PI; while(Beta < -PI) Beta += 2*PI; if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f); - if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f); + else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f); TargetCoors.x = 3.0f * Cos(Alpha) * Cos(Beta) + Source.x; TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y; @@ -3627,12 +3626,12 @@ CCam::Process_WheelCam(const CVector&, float, float, float) } CVector NewUp(0.0f, 0.0f, 1.0f); - CVector Left = CrossProduct(Front, NewUp); - Left.Normalise(); - NewUp = CrossProduct(Left, Front); + CVector Right = CrossProduct(Front, NewUp); + Right.Normalise(); + NewUp = CrossProduct(Right, Front); float Roll = Cos((CTimer::GetTimeInMilliseconds()&0x1FFFF)/(float)0x1FFFF * TWOPI); - Up = Cos(Roll*0.4f)*NewUp + Sin(Roll*0.4f)*Left; + Up = Cos(Roll*0.4f)*NewUp + Sin(Roll*0.4f)*Right; } void @@ -3753,7 +3752,7 @@ CCam::Process_Debug(const CVector&, float, float, float) TargetCoors.z = Source.z + Sin(Alpha) * 3.0f; if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f); - if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f); + else if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f); if(CPad::GetPad(1)->GetSquare() || KEYDOWN('W')) Speed += 0.1f; @@ -3846,7 +3845,7 @@ CCam::Process_Debug(const CVector&, float, float, float) TargetCoors.z = Source.z + Sin(Alpha) * 3.0f; if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f); - if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f); + else if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f); if(CPad::GetPad(1)->GetSquare() || CPad::GetPad(1)->GetLeftMouse()) Speed += 0.1f; @@ -3925,7 +3924,7 @@ CCam::Process_Editor(const CVector&, float, float, float) CSceneEdit::m_vecCamHeading = TargetCoors - Source; if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f); - if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f); + else if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f); if(CPad::GetPad(1)->GetSquare() || CPad::GetPad(1)->GetLeftMouse()) Speed += 0.1f; @@ -4056,11 +4055,11 @@ bool CCam::ProcessArrestCamOne(void) { FOV = 45.0f; - if(ResetStatics) + if(!ResetStatics) return true; #ifdef FIX_BUGS - if(!CamTargetEntity->IsPed()) + if(!CamTargetEntity->IsPed() || ((CPlayerPed*)TheCamera.pTargetEntity)->m_pArrestingCop == nil) return true; #endif @@ -4597,7 +4596,7 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient while(Beta >= PI) Beta -= 2.0f*PI; while(Beta < -PI) Beta += 2.0f*PI; if(Alpha > DEGTORAD(45.0f)) Alpha = DEGTORAD(45.0f); - if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f); + else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f); float BetaDiff = TargetOrientation+PI - Beta; diff --git a/src/core/World.cpp b/src/core/World.cpp index 3b77db18..8bcce8e7 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -659,8 +659,8 @@ CWorld::GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bo } void -CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector ¢re, float radius, bool ignoreZ, short *nextObject, - short lastObject, CEntity **objects) +CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector ¢re, float radius, bool ignoreZ, int16 *numObjects, + int16 lastObject, CEntity **objects) { float radiusSqr = radius * radius; float objDistSqr; @@ -676,16 +676,16 @@ CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector ¢re, floa else objDistSqr = diff.MagnitudeSqr(); - if(objDistSqr < radiusSqr && *nextObject < lastObject) { - if(objects) { objects[*nextObject] = object; } - (*nextObject)++; + if(objDistSqr < radiusSqr && *numObjects < lastObject) { + if(objects) { objects[*numObjects] = object; } + (*numObjects)++; } } } } void -CWorld::FindObjectsInRange(Const CVector ¢re, float radius, bool ignoreZ, short *nextObject, short lastObject, +CWorld::FindObjectsInRange(Const CVector ¢re, float radius, bool ignoreZ, int16 *numObjects, int16 lastObject, CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies) { @@ -711,39 +711,39 @@ CWorld::FindObjectsInRange(Const CVector ¢re, float radius, bool ignoreZ, sh AdvanceCurrentScanCode(); - *nextObject = 0; + *numObjects = 0; for(int curY = minY; curY <= maxY; curY++) { for(int curX = minX; curX <= maxX; curX++) { CSector *sector = GetSector(curX, curY); if(checkBuildings) { FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, radius, - ignoreZ, nextObject, lastObject, objects); + ignoreZ, numObjects, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, - radius, ignoreZ, nextObject, lastObject, objects); + radius, ignoreZ, numObjects, lastObject, objects); } if(checkVehicles) { FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, radius, - ignoreZ, nextObject, lastObject, objects); + ignoreZ, numObjects, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, - radius, ignoreZ, nextObject, lastObject, objects); + radius, ignoreZ, numObjects, lastObject, objects); } if(checkPeds) { FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, radius, ignoreZ, - nextObject, lastObject, objects); + numObjects, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, radius, - ignoreZ, nextObject, lastObject, objects); + ignoreZ, numObjects, lastObject, objects); } if(checkObjects) { FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, radius, - ignoreZ, nextObject, lastObject, objects); + ignoreZ, numObjects, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, - radius, ignoreZ, nextObject, lastObject, objects); + radius, ignoreZ, numObjects, lastObject, objects); } if(checkDummies) { FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, radius, - ignoreZ, nextObject, lastObject, objects); + ignoreZ, numObjects, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, - radius, ignoreZ, nextObject, lastObject, objects); + radius, ignoreZ, numObjects, lastObject, objects); } } } diff --git a/src/core/World.h b/src/core/World.h index 2bcc4e43..9465a914 100644 --- a/src/core/World.h +++ b/src/core/World.h @@ -102,8 +102,8 @@ public: static CEntity *TestSphereAgainstWorld(CVector centre, float radius, CEntity *entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects); static CEntity *TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool); - static void FindObjectsInRangeSectorList(CPtrList&, Const CVector&, float, bool, short*, short, CEntity**); - static void FindObjectsInRange(Const CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool); + static void FindObjectsInRangeSectorList(CPtrList &list, Const CVector ¢re, float radius, bool ignoreZ, int16 *numObjects, int16 lastObject, CEntity **objects); + static void FindObjectsInRange(Const CVector ¢re, float radius, bool ignoreZ, int16 *numObjects, int16 lastObject, CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies); static void FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities); static void FindObjectsOfTypeInRange(uint32 modelId, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies); static float FindGroundZForCoord(float x, float y); From 5f3eb76cffe70973735b7000ab60d321932bda68 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 16 Jun 2020 13:50:29 +0200 Subject: [PATCH 119/133] CCam fixes yet again --- src/core/Cam.cpp | 66 +++++++++++++++++++++++++----------------------- src/core/Timer.h | 2 +- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index a9d0e474..6adfde53 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -432,11 +432,11 @@ CCam::ProcessSpecialHeightRoutines(void) float DistScale = (2.1f - dist)/2.1f; if(Mode == MODE_FOLLOWPED){ if(TheCamera.PedZoomIndicator == CAM_ZOOM_1) - Offset = 0.45*DistScale + PedZDist; + Offset = 0.45f*DistScale + PedZDist; if(TheCamera.PedZoomIndicator == CAM_ZOOM_2) - Offset = 0.35*DistScale + PedZDist; + Offset = 0.35f*DistScale + PedZDist; if(TheCamera.PedZoomIndicator == CAM_ZOOM_3) - Offset = 0.25*DistScale + PedZDist; + Offset = 0.25f*DistScale + PedZDist; if(Abs(CGeneral::GetRadianAngleBetweenPoints(CamToPed.x, CamToPed.y, CamToTarget.x, CamToTarget.y)) > HALFPI) Offset += 0.3f; m_fPedBetweenCameraHeightOffset = Offset + 1.3f; @@ -808,7 +808,7 @@ CCam::ClipIfPedInFrontOfPlayer(void) while(DeltaAngle >= PI) DeltaAngle -= 2*PI; while(DeltaAngle < -PI) DeltaAngle += 2*PI; if(Abs(DeltaAngle) < HALFPI){ - fDist = Sqrt(SQR(vDist.x) + SQR(vDist.y)); + fDist = vDist.Magnitude2D(); if(fDist < 1.25f){ Near = DEFAULT_NEAR - (1.25f - fDist); if(Near < 0.05f) @@ -835,9 +835,9 @@ CCam::KeepTrackOfTheSpeed(const CVector &source, const CVector &target, const CV PreviousUp = up; } - m_cvecSourceSpeedOverOneFrame = PreviousSource - source; - m_cvecTargetSpeedOverOneFrame = PreviousTarget - target; - m_cvecUpOverOneFrame = PreviousUp - up; + m_cvecSourceSpeedOverOneFrame = source - PreviousSource; + m_cvecTargetSpeedOverOneFrame = target - PreviousTarget; + m_cvecUpOverOneFrame = up - PreviousUp; m_fFovSpeedOverOneFrame = fov - PreviousFov; m_fBetaSpeedOverOneFrame = beta - PreviousBeta; MakeAngleLessThan180(m_fBetaSpeedOverOneFrame); @@ -859,17 +859,13 @@ CCam::Using3rdPersonMouseCam(void) (Mode == MODE_FOLLOWPED || TheCamera.m_bPlayerIsInGarage && FindPlayerPed() && FindPlayerPed()->m_nPedState != PED_DRIVING && - Mode != MODE_TOPDOWN && this->CamTargetEntity == FindPlayerPed()); + Mode != MODE_TOPDOWN && CamTargetEntity == FindPlayerPed()); } bool CCam::GetWeaponFirstPersonOn(void) { - CEntity *target = this->CamTargetEntity; - if (target && target->IsPed()) - return ((CPed*)target)->GetWeapon()->m_bAddRotOffset; - - return false; + return CamTargetEntity && CamTargetEntity->IsPed() && ((CPed*)CamTargetEntity)->GetWeapon()->m_bAddRotOffset; } bool @@ -2846,7 +2842,7 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float, CVector Fwd = CamTargetEntity->GetForward(); Fwd.z = 0.0f; Fwd.Normalise(); - HeadPos = (HeadDelta*1.23f*Fwd + CamTargetEntity->GetPosition()); + HeadPos = HeadDelta*1.23f*Fwd + CamTargetEntity->GetPosition(); HeadPos.z += 0.59f; } Source = HeadPos; @@ -3183,6 +3179,12 @@ CCam::Process_Syphon_Crim_In_Front(const CVector &CameraTarget, float, float, fl while(AimingAngle >= PI) AimingAngle -= 2*PI; while(AimingAngle < -PI) AimingAngle += 2*PI; + if(ResetStatics){ + if(AimingAngle > 0.0f) + m_fPlayerInFrontSyphonAngleOffSet = -m_fPlayerInFrontSyphonAngleOffSet; + ResetStatics = false; + } + if(TheCamera.PlayerWeaponMode.Mode == MODE_SYPHON) Beta = AimingAngle + m_fPlayerInFrontSyphonAngleOffSet; @@ -3577,8 +3579,7 @@ CCam::Process_FlyBy(const CVector&, float, float, float) CVector Left = CrossProduct(Up, Front); Up = CrossProduct(Front, Left); Up.Normalise(); - FOV = PsuedoFOV; - }else{ + }else if(uiTime >= uiFinishTime){ // end ArrayMarkerSource = (TheCamera.m_arrPathArray[2].m_arr_PathData[0] - 1)*10 + 1; ArrayMarkerFront = (TheCamera.m_arrPathArray[3].m_arr_PathData[0] - 1)*10 + 1; @@ -3605,8 +3606,8 @@ CCam::Process_FlyBy(const CVector&, float, float, float) CVector Left = CrossProduct(Up, Front); Up = CrossProduct(Front, Left); Up.Normalise(); - FOV = PsuedoFOV; } + FOV = PsuedoFOV; } void @@ -3629,6 +3630,7 @@ CCam::Process_WheelCam(const CVector&, float, float, float) CVector Right = CrossProduct(Front, NewUp); Right.Normalise(); NewUp = CrossProduct(Right, Front); + NewUp.Normalise(); float Roll = Cos((CTimer::GetTimeInMilliseconds()&0x1FFFF)/(float)0x1FFFF * TWOPI); Up = Cos(Roll*0.4f)*NewUp + Sin(Roll*0.4f)*Right; @@ -3652,7 +3654,7 @@ CCam::Process_Fixed(const CVector &CameraTarget, float, float, float) if(TheCamera.m_bUseSpecialFovTrain) FOV = TheCamera.m_fFovForTrain; - if(CMenuManager::m_ControlMethod == 0 && Using3rdPersonMouseCam()){ + if(CMenuManager::m_ControlMethod == CONTROL_STANDARD && Using3rdPersonMouseCam()){ CPed *player = FindPlayerPed(); if(player && player->CanStrafeOrMouseControl()){ float Heading = Front.Heading(); @@ -3741,14 +3743,14 @@ CCam::Process_Debug(const CVector&, float, float, float) RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR); FOV = DefaultFOV; Alpha += DEGTORAD(CPad::GetPad(1)->GetLeftStickY()) / 50.0f; - Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX())*1.5f / 19.0f; + Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX()*1.5f) / 19.0f; if(CPad::GetPad(0)->GetLeftMouse()){ Alpha += DEGTORAD(CPad::GetPad(0)->GetMouseY()/2.0f); - Beta -= DEGTORAD(CPad::GetPad(0)->GetMouseX()/2.0f); + Beta += DEGTORAD(CPad::GetPad(0)->GetMouseX()/2.0f); } - TargetCoors.x = Source.x + Cos(Alpha) * Cos(Beta) * 3.0f; - TargetCoors.y = Source.y + Cos(Alpha) * Sin(Beta) * 3.0f; + TargetCoors.x = Source.x + Cos(Alpha) * Sin(Beta) * 7.0f; + TargetCoors.y = Source.y + Cos(Alpha) * Cos(Beta) * 7.0f; TargetCoors.z = Source.z + Sin(Alpha) * 3.0f; if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f); @@ -3838,10 +3840,10 @@ CCam::Process_Debug(const CVector&, float, float, float) RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR); FOV = DefaultFOV; Alpha += DEGTORAD(CPad::GetPad(1)->GetLeftStickY()) / 50.0f; - Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX())*1.5f / 19.0f; + Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX()*1.5f) / 19.0f; - TargetCoors.x = Source.x + Cos(Alpha) * Cos(Beta) * 3.0f; - TargetCoors.y = Source.y + Cos(Alpha) * Sin(Beta) * 3.0f; + TargetCoors.x = Source.x + Cos(Alpha) * Sin(Beta) * 7.0f; + TargetCoors.y = Source.y + Cos(Alpha) * Cos(Beta) * 7.0f; TargetCoors.z = Source.z + Sin(Alpha) * 3.0f; if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f); @@ -3910,13 +3912,13 @@ CCam::Process_Editor(const CVector&, float, float, float) RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR); FOV = DefaultFOV; Alpha += DEGTORAD(CPad::GetPad(1)->GetLeftStickY()) / 50.0f; - Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX())*1.5f / 19.0f; + Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX()*1.5f) / 19.0f; if(CamTargetEntity && CSceneEdit::m_bCameraFollowActor){ TargetCoors = CamTargetEntity->GetPosition(); }else if(CSceneEdit::m_bRecording){ - TargetCoors.x = Source.x + Cos(Alpha) * Cos(Beta) * 7.0f; - TargetCoors.y = Source.y + Cos(Alpha) * Sin(Beta) * 7.0f; + TargetCoors.x = Source.x + Cos(Alpha) * Sin(Beta) * 7.0f; + TargetCoors.y = Source.y + Cos(Alpha) * Cos(Beta) * 7.0f; TargetCoors.z = Source.z + Sin(Alpha) * 7.0f; }else TargetCoors = CSceneEdit::m_vecCamHeading + Source; @@ -4114,18 +4116,18 @@ CCam::ProcessArrestCamTwo(void) CVector TargetCoors, ToCamera; float BetaOffset; float SourceX, SourceY; - CCam *ActiveCam = &TheCamera.Cams[TheCamera.ActiveCam]; - if(&ActiveCam[1] == this){ + if(&TheCamera.Cams[TheCamera.ActiveCam] == this){ SourceX = TheCamera.Cams[(TheCamera.ActiveCam + 1) % 2].Source.x; SourceY = TheCamera.Cams[(TheCamera.ActiveCam + 1) % 2].Source.y; }else{ - SourceX = ActiveCam[1].Source.x; - SourceY = ActiveCam[1].Source.y; + SourceX = TheCamera.Cams[TheCamera.ActiveCam].Source.x; + SourceY = TheCamera.Cams[TheCamera.ActiveCam].Source.y; } for(int i = 0; i <= 1; i++){ int Dir = i == 0 ? 1 : -1; + FOV = 60.0f; TargetCoors = player->GetPosition(); Beta = CGeneral::GetATanOfXY(TargetCoors.x-SourceX, TargetCoors.y-SourceY); BetaOffset = DEGTORAD(Dir*80); diff --git a/src/core/Timer.h b/src/core/Timer.h index 4e8b8805..b696eded 100644 --- a/src/core/Timer.h +++ b/src/core/Timer.h @@ -21,7 +21,7 @@ public: static uint32 GetTimeStepInMilliseconds() { return ms_fTimeStep / 50.0f * 1000.0f; } static const float &GetTimeStepNonClipped(void) { return ms_fTimeStepNonClipped; } static float GetTimeStepNonClippedInSeconds(void) { return ms_fTimeStepNonClipped / 50.0f; } - static uint32 GetTimeStepNonClippedInMilliseconds(void) { return ms_fTimeStepNonClipped / 50.0f * 1000.0f; } + static float GetTimeStepNonClippedInMilliseconds(void) { return ms_fTimeStepNonClipped / 50.0f * 1000.0f; } static void SetTimeStepNonClipped(float ts) { ms_fTimeStepNonClipped = ts; } static const uint32 &GetFrameCounter(void) { return m_FrameCounter; } static void SetFrameCounter(uint32 fc) { m_FrameCounter = fc; } From 4cd4f91e57a4fe60a835aea33c879174883c9451 Mon Sep 17 00:00:00 2001 From: aap Date: Fri, 19 Jun 2020 09:15:23 +0200 Subject: [PATCH 120/133] ccamera cleanup --- src/core/Camera.cpp | 235 ++++++++++++++++++++++---------------------- src/core/Camera.h | 2 +- 2 files changed, 118 insertions(+), 119 deletions(-) diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index aa307337..c9aded85 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -234,7 +234,7 @@ CCamera::Process(void) float oldBeta, newBeta; float deltaBeta = 0.0f; bool lookLRBVehicle = false; - CVector CamFront, CamUp, CamSource, Target; + CVector CamFront, CamUp, CamRight, CamSource, Target; m_bJust_Switched = false; m_RealPreviousCameraPosition = GetPosition(); @@ -378,15 +378,17 @@ CCamera::Process(void) if(Cams[ActiveCam].Mode == CCam::MODE_TOPDOWN || Cams[ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){ CamFront.Normalise(); - CamUp = CrossProduct(CamFront, CVector(-1.0f, 0.0f, 0.0f)); + CamRight = CVector(-1.0f, 0.0f, 0.0f); + CamUp = CrossProduct(CamFront, CamRight); + CamUp.Normalise(); }else{ CamFront.Normalise(); CamUp.Normalise(); - CVector right = CrossProduct(CamFront, CamUp); - right.Normalise(); - CamUp = CrossProduct(right, CamFront); + CamRight = CrossProduct(CamFront, CamUp); + CamRight.Normalise(); + CamUp = CrossProduct(CamRight, CamFront); + CamUp.Normalise(); } - CamUp.Normalise(); FOV = m_fFOVWhenInterPol; }else if(fractionInter > m_fFractionInterToStopMoving && fractionInter <= 1.0f){ float inter; @@ -433,15 +435,17 @@ CCamera::Process(void) if(Cams[ActiveCam].Mode == CCam::MODE_TOPDOWN || Cams[ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){ CamFront.Normalise(); - CamUp = CrossProduct(CamFront, CVector(-1.0f, 0.0f, 0.0f)); + CamRight = CVector(-1.0f, 0.0f, 0.0f); + CamUp = CrossProduct(CamFront, CamRight); + CamUp.Normalise(); }else{ CamFront.Normalise(); CamUp.Normalise(); - CVector right = CrossProduct(CamFront, CamUp); - right.Normalise(); - CamUp = CrossProduct(right, CamFront); + CamRight = CrossProduct(CamFront, CamUp); + CamRight.Normalise(); + CamUp = CrossProduct(CamRight, CamFront); + CamUp.Normalise(); } - CamUp.Normalise(); #ifndef FIX_BUGS // BUG: FOV was already interpolated but m_fFOVWhenInterPol was not FOV = m_fFOVWhenInterPol; @@ -563,7 +567,7 @@ CCamera::Process(void) } m_PreviousCameraPosition = GetPosition(); - // PS2: something doing on with forward vector here + // PS2: something going on with forward vector here if(Cams[ActiveCam].DirectionWasLooking != LOOKING_FORWARD && Cams[ActiveCam].Mode != CCam::MODE_TOP_DOWN_PED){ Cams[ActiveCam].Source = Cams[ActiveCam].SourceBeforeLookBehind; @@ -994,7 +998,7 @@ CCamera::CamControl(void) garageCenter.y = (az->miny + az->maxy)/2.0f; garageCenter.z = 0.0f; }else - garageCenter = pTargetEntity->GetPosition(); + garageCenter = CVector(pTargetEntity->GetPosition().x, pTargetEntity->GetPosition().y, 0.0f); } if(whichDoor == 1) garageCenterToDoor = garageDoorPos1 - garageCenter; @@ -2243,82 +2247,77 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time) switch(obbeMode){ case OBBE_WHEEL: veh = FindPlayerVehicle(); - if(veh == nil){ - if(CTimer::GetTimeInMilliseconds() > t+5000) + if(veh){ + if(veh->IsBoat() || veh->GetModelIndex() == MI_RHINO) + return true; + if(!CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false)) return true; - SetNearClipScript(0.6f); - return false; } - if(veh->IsBoat() || veh->GetModelIndex() == MI_RHINO) + if(CTimer::GetTimeInMilliseconds() > t+5000) return true; - if(CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false)){ - if(CTimer::GetTimeInMilliseconds() > t+5000) - return true; - SetNearClipScript(0.6f); - return false; - } - return true; + SetNearClipScript(0.6f); + return false; case OBBE_1: if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat()) return true; - if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){ - fwd = FindPlayerCoors() - m_vecFixedModeSource; - fwd.z = 0.0f; + if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)) + return true; - // too far and driving away from cam - if(fwd.Magnitude() > 20.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) - return true; - // too close - if(fwd.Magnitude() < 1.6f) - return true; - return false; - } - return true; + fwd = FindPlayerCoors() - m_vecFixedModeSource; + fwd.z = 0.0f; + + // too far and driving away from cam + if(fwd.Magnitude() > 20.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) + return true; + // too close + if(fwd.Magnitude() < 1.6f) + return true; + return false; case OBBE_2: if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat()) return true; - if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){ - fwd = FindPlayerCoors() - m_vecFixedModeSource; - fwd.z = 0.0f; + if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)) + return true; - if(fwd.Magnitude() < 2.0f) - // very close, fix near clip - SetNearClipScript(Max(fwd.Magnitude()*0.5f, 0.05f)); - // too far and driving away from cam - if(fwd.Magnitude() > 19.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) - return true; - // too close - if(fwd.Magnitude() < 1.6f) - return true; - return false; - } - return true; + fwd = FindPlayerCoors() - m_vecFixedModeSource; + fwd.z = 0.0f; + + if(fwd.Magnitude() < 2.0f) + // very close, fix near clip + SetNearClipScript(Max(fwd.Magnitude()*0.5f, 0.05f)); + // too far and driving away from cam + if(fwd.Magnitude() > 19.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) + return true; + // too close + if(fwd.Magnitude() < 1.6f) + return true; + return false; case OBBE_3: - if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){ - fwd = FindPlayerCoors() - m_vecFixedModeSource; - fwd.z = 0.0f; + if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)) + return true; - // too far and driving away from cam - if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) - return true; - return false; - } - return true; + fwd = FindPlayerCoors() - m_vecFixedModeSource; + fwd.z = 0.0f; + + // too far and driving away from cam + if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) + return true; + return false; case OBBE_1STPERSON: return CTimer::GetTimeInMilliseconds() > t+3000; case OBBE_5: if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat()) return true; - if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){ - fwd = FindPlayerCoors() - m_vecFixedModeSource; - fwd.z = 0.0f; + if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)) + return true; - // too far and driving away from cam - if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) - return true; - return false; - } - return true; + fwd = FindPlayerCoors() - m_vecFixedModeSource; + fwd.z = 0.0f; + + // too far and driving away from cam + if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) + return true; + return false; case OBBE_ONSTRING: return CTimer::GetTimeInMilliseconds() > t+3000; case OBBE_COPCAR: @@ -2326,59 +2325,58 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time) case OBBE_COPCAR_WHEEL: if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat()) return true; - if(CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false)){ - if(CTimer::GetTimeInMilliseconds() > t+1000) - return true; - SetNearClipScript(0.6f); - return false; - } - return true; + if(!CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false)) + return true; + if(CTimer::GetTimeInMilliseconds() > t+1000) + return true; + SetNearClipScript(0.6f); + return false; // Ped modes case OBBE_9: - if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){ - fwd = FindPlayerCoors() - m_vecFixedModeSource; - fwd.z = 0.0f; + if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)) + return true; - // too far and driving away from cam - if(fwd.Magnitude() > 20.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) - return true; - return false; - } - return true; + fwd = FindPlayerCoors() - m_vecFixedModeSource; + fwd.z = 0.0f; + + // too far and driving away from cam + if(fwd.Magnitude() > 20.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) + return true; + return false; case OBBE_10: - if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){ - fwd = FindPlayerCoors() - m_vecFixedModeSource; - fwd.z = 0.0f; + if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)) + return true; - // too far and driving away from cam - if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) - return true; - return false; - } - return true; + fwd = FindPlayerCoors() - m_vecFixedModeSource; + fwd.z = 0.0f; + + // too far and driving away from cam + if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) + return true; + return false; case OBBE_11: - if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){ - fwd = FindPlayerCoors() - m_vecFixedModeSource; - fwd.z = 0.0f; + if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)) + return true; - // too far and driving away from cam - if(fwd.Magnitude() > 25.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) - return true; - return false; - } - return true; + fwd = FindPlayerCoors() - m_vecFixedModeSource; + fwd.z = 0.0f; + + // too far and driving away from cam + if(fwd.Magnitude() > 25.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) + return true; + return false; case OBBE_12: - if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){ - fwd = FindPlayerCoors() - m_vecFixedModeSource; - fwd.z = 0.0f; + if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)) + return true; - // too far and driving away from cam - if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) - return true; - return false; - } - return true; + fwd = FindPlayerCoors() - m_vecFixedModeSource; + fwd.z = 0.0f; + + // too far and driving away from cam + if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) + return true; + return false; case OBBE_13: return CTimer::GetTimeInMilliseconds() > t+5000; default: @@ -2653,7 +2651,7 @@ CCamera::TryToStartNewCamMode(int obbeMode) } } -static int32 SequenceOfCams[16] = { +int32 SequenceOfCams[16] = { OBBE_WHEEL, OBBE_COPCAR, OBBE_3, OBBE_1, OBBE_3, OBBE_COPCAR_WHEEL, OBBE_2, OBBE_3, OBBE_COPCAR_WHEEL, OBBE_COPCAR, OBBE_2, OBBE_3, OBBE_5, OBBE_3, @@ -2689,7 +2687,7 @@ CCamera::ProcessObbeCinemaCameraCar(void) bDidWeProcessAnyCinemaCam = true; } -static int32 SequenceOfPedCams[5] = { OBBE_9, OBBE_10, OBBE_11, OBBE_12, OBBE_13 }; +int32 SequenceOfPedCams[5] = { OBBE_9, OBBE_10, OBBE_11, OBBE_12, OBBE_13 }; void CCamera::ProcessObbeCinemaCameraPed(void) @@ -3282,12 +3280,13 @@ CCamera::UpdateAimingCoors(CVector const &coors) m_cvecAimingTargetCoors = coors; } -void +bool CCamera::Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target) { if(CPad::GetPad(0)->GetLookBehindForPed()){ source = pos; target = dist*Cams[ActiveCam].CamTargetEntity->GetForward() + source; + return false; }else{ float angleX = DEGTORAD((m_f3rdPersonCHairMultX-0.5f) * 1.8f * 0.5f * Cams[ActiveCam].FOV * CDraw::GetAspectRatio()); float angleY = DEGTORAD((0.5f-m_f3rdPersonCHairMultY) * 1.8f * 0.5f * Cams[ActiveCam].FOV); @@ -3296,9 +3295,9 @@ CCamera::Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, target += Cams[ActiveCam].Up * Tan(angleY); target += CrossProduct(Cams[ActiveCam].Front, Cams[ActiveCam].Up) * Tan(angleX); target.Normalise(); - float dot = DotProduct(pos - source, target); - source += dot*target; + source += DotProduct(pos - source, target)*target; target = dist*target + source; + return true; } } diff --git a/src/core/Camera.h b/src/core/Camera.h index bcaaea47..0926fd57 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -624,7 +624,7 @@ public: void SetNewPlayerWeaponMode(int16 mode, int16 minZoom, int16 maxZoom); void ClearPlayerWeaponMode(void); void UpdateAimingCoors(CVector const &coors); - void Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target); + bool Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target); float Find3rdPersonQuickAimPitch(void); // Physical camera From 5ad739f096b73430a9bde832985ef7e2712f7cf7 Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 20 Jun 2020 14:38:21 +0200 Subject: [PATCH 121/133] some PS2 cam code; fix for arrest cam --- src/core/Camera.cpp | 113 +++++++++++++++++++++++++++++++++++++++----- src/core/Camera.h | 2 - src/core/config.h | 1 + 3 files changed, 101 insertions(+), 15 deletions(-) diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index c9aded85..31e31718 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -228,6 +228,7 @@ void CCamera::Process(void) { // static bool InterpolatorNotInitialised = true; // unused + static CVector PreviousFudgedTargetCoors; // only PS2 static float PlayerMinDist = 1.6f; // not on PS2 static bool WasPreviouslyInterSyhonFollowPed = false; // only written float FOV = 0.0f; @@ -287,19 +288,19 @@ CCamera::Process(void) // Stop transition when it's done if(m_uiTransitionState != 0){ -/* - // PS2: +#ifdef PS2_CAM_TRANSITION if(!m_bWaitForInterpolToFinish){ Cams[(ActiveCam+1)%2].Process(); Cams[(ActiveCam+1)%2].ProcessSpecialHeightRoutines(); } -*/ - // not PS2 (done in CamControl there it seems) +#else + // done in CamControl on PS2 it seems if(CTimer::GetTimeInMilliseconds() > m_uiTransitionDuration+m_uiTimeTransitionStart){ m_uiTransitionState = 0; m_vecDoingSpecialInterPolation = false; m_bWaitForInterpolToFinish = false; } +#endif } if(m_bUseNearClipScript) @@ -322,8 +323,90 @@ CCamera::Process(void) if(m_uiTransitionState != 0 && !lookLRBVehicle){ // Process transition - // different on PS2 +#ifdef PS2_CAM_TRANSITION + bool lookingAtPlayerNow = false; + bool wasLookingAtPlayer = false; + bool transitionPedMode = false; + bool setWait = false; + if(Cams[ActiveCam].CamTargetEntity == Cams[(ActiveCam+1)%2].CamTargetEntity){ + if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON || + Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT || + Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED || + Cams[ActiveCam].Mode == CCam::MODE_SPECIAL_FIXED_FOR_SYPHON) + lookingAtPlayerNow = true; + if(Cams[(ActiveCam+1)%2].Mode == CCam::MODE_SYPHON || + Cams[(ActiveCam+1)%2].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT || + Cams[(ActiveCam+1)%2].Mode == CCam::MODE_FOLLOWPED || + Cams[(ActiveCam+1)%2].Mode == CCam::MODE_SPECIAL_FIXED_FOR_SYPHON) // checked twice for some reason + wasLookingAtPlayer = true; + if(!m_vecDoingSpecialInterPolation && + (Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED || Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM) && + (Cams[(ActiveCam+1)%2].Mode == CCam::MODE_FOLLOWPED || Cams[(ActiveCam+1)%2].Mode == CCam::MODE_FIGHT_CAM)) + transitionPedMode = true; + } + + if(lookingAtPlayerNow && wasLookingAtPlayer){ + CVector playerDist; + playerDist.x = FindPlayerPed()->GetPosition().x - GetPosition().x; + playerDist.y = FindPlayerPed()->GetPosition().y - GetPosition().y; + playerDist.z = FindPlayerPed()->GetPosition().z - GetPosition().z; + if(playerDist.Magnitude() > 17.5f && + (Cams[ActiveCam].Mode == CCam::MODE_SYPHON || Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT)) + setWait = true; + } + if(setWait) + m_bWaitForInterpolToFinish = true; + + + uint32 currentTime = CTimer::GetTimeInMilliseconds() - m_uiTimeTransitionStart; + if(currentTime >= m_uiTransitionDuration) + currentTime = m_uiTransitionDuration; + float inter = (float) currentTime / m_uiTransitionDuration; + inter = 0.5f - 0.5*Cos(inter*PI); // smooth it + + if(m_vecDoingSpecialInterPolation){ + Cams[(ActiveCam+1)%2].Source = m_vecOldSourceForInter; + Cams[(ActiveCam+1)%2].Front = m_vecOldFrontForInter; + Cams[(ActiveCam+1)%2].Up = m_vecOldUpForInter; + Cams[(ActiveCam+1)%2].FOV = m_vecOldFOVForInter; + if(WasPreviouslyInterSyhonFollowPed) + Cams[(ActiveCam+1)%2].m_cvecTargetCoorsForFudgeInter.z = PreviousFudgedTargetCoors.z; + } + + CamSource = inter*Cams[ActiveCam].Source + (1.0f-inter)*Cams[(ActiveCam+1)%2].Source; + FOV = inter*Cams[ActiveCam].FOV + (1.0f-inter)*Cams[(ActiveCam+1)%2].FOV; + + CVector tmpFront = Cams[(ActiveCam+1)%2].Front; + float Alpha_other = CGeneral::GetATanOfXY(tmpFront.Magnitude2D(), tmpFront.z); + if(Alpha_other > PI) Alpha_other -= TWOPI; + float Beta_other = 0.0f; + if(tmpFront.x != 0.0f || tmpFront.y != 0.0f) + Beta_other = CGeneral::GetATanOfXY(tmpFront.x, tmpFront.y); + tmpFront = Cams[ActiveCam].Front; + float Alpha_active = CGeneral::GetATanOfXY(tmpFront.Magnitude2D(), tmpFront.z); + if(Alpha_active > PI) Alpha_other -= TWOPI; + float Beta_active = 0.0f; + if(tmpFront.x != 0.0f || tmpFront.y != 0.0f) + Beta_active = CGeneral::GetATanOfXY(tmpFront.x, tmpFront.y); + + float DeltaBeta = Beta_active - Beta_other; + float Alpha = inter*Alpha_active + (1.0f-inter)*Alpha_other; + + if(m_uiTransitionJUSTStarted){ + while(DeltaBeta > PI) DeltaBeta -= TWOPI; + while(DeltaBeta <= -PI) DeltaBeta += TWOPI; + m_uiTransitionJUSTStarted = false; + }else{ + if(DeltaBeta < m_fOldBetaDiff) + while(Abs(DeltaBeta - m_fOldBetaDiff) > PI) DeltaBeta += TWOPI; + else + while(Abs(DeltaBeta - m_fOldBetaDiff) > PI) DeltaBeta -= TWOPI; + } + m_fOldBetaDiff = DeltaBeta; + float Beta = inter*DeltaBeta + Beta_other; + assert(0 && "TODO"); +#else uint32 currentTime = CTimer::GetTimeInMilliseconds() - m_uiTimeTransitionStart; if(currentTime >= m_uiTransitionDuration) currentTime = m_uiTransitionDuration; @@ -457,6 +540,7 @@ CCamera::Process(void) float Alpha = CGeneral::GetATanOfXY(DistOnGround, Dist.z); float Beta = CGeneral::GetATanOfXY(Dist.x, Dist.y); Cams[ActiveCam].KeepTrackOfTheSpeed(CamSource, Target, CamUp, Alpha, Beta, FOV); +#endif }else{ // No transition, take Cam values directly if(WorldViewerBeingUsed){ @@ -550,8 +634,10 @@ CCamera::Process(void) LODDistMultiplier = 70.0f/CDraw::GetFOV() * CDraw::GetAspectRatio()/(4.0f/3.0f); else LODDistMultiplier = 1.0f; + // missing on PS2 GenerationDistMultiplier = LODDistMultiplier; LODDistMultiplier *= CRenderer::ms_lodDistScale; + // // Keep track of speed if(m_bJustInitalised || m_bJust_Switched){ @@ -1582,7 +1668,7 @@ CCamera::UpdateTargetEntity(void) pTargetEntity = FindPlayerPed(); if(PLAYER->GetPedState() == PED_DRAG_FROM_CAR) pTargetEntity = FindPlayerPed(); - if(pTargetEntity->IsVehicle() && CarZoomIndicator != CAM_ZOOM_1STPRS && FindPlayerPed()->GetPedState() == PED_ARRESTED) + if(pTargetEntity->IsVehicle() && CarZoomIndicator == CAM_ZOOM_1STPRS && FindPlayerPed()->GetPedState() == PED_ARRESTED) pTargetEntity = FindPlayerPed(); } } @@ -1859,7 +1945,7 @@ CCamera::StartTransition(int16 newMode) int door; bool vehicleVertical; -// missing on PS2 +#ifndef PS2_CAM_TRANSITION m_bItsOkToLookJustAtThePlayer = false; m_fFractionInterToStopMoving = 0.25f; m_fFractionInterToStopCatchUp = 0.75f; @@ -1876,7 +1962,7 @@ CCamera::StartTransition(int16 newMode) if(newMode == CCam::MODE_CAM_ON_A_STRING) switchPedToCar = true; } -// +#endif if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT && newMode == CCam::MODE_SYPHON) switchSyphonMode = true; @@ -1902,11 +1988,11 @@ CCamera::StartTransition(int16 newMode) ((CPed*)pTargetEntity)->m_fRotationDest = angle; } -/* // PS2 +#ifdef PS2_CAM_TRANSITION ActiveCam = (ActiveCam+1)%2; Cams[ActiveCam].Init(); Cams[ActiveCam].Mode = newMode; - */ +#endif Cams[ActiveCam].m_cvecCamFixedModeVector = m_vecFixedModeVector; Cams[ActiveCam].CamTargetEntity = pTargetEntity; @@ -2102,7 +2188,7 @@ CCamera::StartTransition(int16 newMode) m_uiTransitionDuration = 1800; else if(switchFromFight) m_uiTransitionDuration = 750; -// not on PS2 +#ifndef PS2_CAM_TRANSITION else if(switchPedToCar){ m_fFractionInterToStopMoving = 0.2f; m_fFractionInterToStopCatchUp = 0.8f; @@ -2116,11 +2202,11 @@ CCamera::StartTransition(int16 newMode) m_uiTransitionDuration = 1; }else m_uiTransitionDuration = 1350; // already set above -// +#endif m_uiTransitionState = 1; m_uiTimeTransitionStart = CTimer::GetTimeInMilliseconds(); m_uiTransitionJUSTStarted = 1; -// PS2 returns here +#ifndef PS2_CAM_TRANSITION if(m_vecDoingSpecialInterPolation){ m_cvecStartingSourceForInterPol = SourceDuringInter; m_cvecStartingTargetForInterPol = TargetDuringInter; @@ -2156,6 +2242,7 @@ CCamera::StartTransition(int16 newMode) m_fFractionInterToStopCatchUp = m_fScriptPercentageInterToCatchUp; m_uiTransitionDuration = m_fScriptTimeForInterPolation; } +#endif } void diff --git a/src/core/Camera.h b/src/core/Camera.h index 0926fd57..395effa8 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -188,7 +188,6 @@ public: CPed *m_pLastPedLookedAt;// So interpolation works bool m_bFirstPersonRunAboutActive; - CCam(void) { Init(); } void Init(void); void Process(void); @@ -518,7 +517,6 @@ public: CVector m_vecOldSourceForInter; CVector m_vecOldFrontForInter; CVector m_vecOldUpForInter; - float m_vecOldFOVForInter; float m_fFLOATingFade; float m_fFLOATingFadeMusic; diff --git a/src/core/config.h b/src/core/config.h index 837d8165..6835267d 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -254,5 +254,6 @@ enum Config { #define CANCELLABLE_CAR_ENTER // Camera +//#define PS2_CAM_TRANSITION // old way of transitioning between cam modes #define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future #define FREE_CAM // Rotating cam From e1c58131c4637e70dbe533c82a1edab134650b14 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 21 Jun 2020 00:40:07 +0200 Subject: [PATCH 122/133] PS2 cam transition mostly working --- src/core/Cam.cpp | 2 +- src/core/Camera.cpp | 93 ++++++++++++++++++++++++++++++++++++++++++--- src/core/Camera.h | 10 ++++- 3 files changed, 96 insertions(+), 9 deletions(-) diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 6adfde53..69672272 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -3816,7 +3816,7 @@ CCam::Process_Debug(const CVector&, float, float, float) Source.y += 1.0f; GetVectorsReadyForRW(); - CPad::GetPad(0)->DisablePlayerControls = PLAYERCONTROL_DISABLED_1; +// CPad::GetPad(0)->DisablePlayerControls = PLAYERCONTROL_DISABLED_1; if(CPad::GetPad(1)->GetLeftShockJustDown() && gbBigWhiteDebugLightSwitchedOn) CShadows::StoreShadowToBeRendered(SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &Source, diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index 31e31718..f5497b95 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -230,7 +230,7 @@ CCamera::Process(void) // static bool InterpolatorNotInitialised = true; // unused static CVector PreviousFudgedTargetCoors; // only PS2 static float PlayerMinDist = 1.6f; // not on PS2 - static bool WasPreviouslyInterSyhonFollowPed = false; // only written + static bool WasPreviouslyInterSyhonFollowPed = false; // only used on PS2 float FOV = 0.0f; float oldBeta, newBeta; float deltaBeta = 0.0f; @@ -382,13 +382,13 @@ CCamera::Process(void) if(Alpha_other > PI) Alpha_other -= TWOPI; float Beta_other = 0.0f; if(tmpFront.x != 0.0f || tmpFront.y != 0.0f) - Beta_other = CGeneral::GetATanOfXY(tmpFront.x, tmpFront.y); + Beta_other = CGeneral::GetATanOfXY(-tmpFront.y, tmpFront.x); tmpFront = Cams[ActiveCam].Front; float Alpha_active = CGeneral::GetATanOfXY(tmpFront.Magnitude2D(), tmpFront.z); - if(Alpha_active > PI) Alpha_other -= TWOPI; + if(Alpha_active > PI) Alpha_active -= TWOPI; float Beta_active = 0.0f; if(tmpFront.x != 0.0f || tmpFront.y != 0.0f) - Beta_active = CGeneral::GetATanOfXY(tmpFront.x, tmpFront.y); + Beta_active = CGeneral::GetATanOfXY(-tmpFront.y, tmpFront.x); float DeltaBeta = Beta_active - Beta_other; float Alpha = inter*Alpha_active + (1.0f-inter)*Alpha_other; @@ -405,7 +405,71 @@ CCamera::Process(void) } m_fOldBetaDiff = DeltaBeta; float Beta = inter*DeltaBeta + Beta_other; - assert(0 && "TODO"); + + CVector FudgedTargetCoors; + if(lookingAtPlayerNow && wasLookingAtPlayer){ + // BUG? how is this interpolation ever used when values are overwritten below? + float PlayerDist = (pTargetEntity->GetPosition() - CamSource).Magnitude2D(); + float MinDist = Min(Cams[(ActiveCam+1)%2].m_fMinDistAwayFromCamWhenInterPolating, Cams[ActiveCam].m_fMinDistAwayFromCamWhenInterPolating); + if(PlayerDist < MinDist){ + CamSource.x = pTargetEntity->GetPosition().x - MinDist*Cos(Beta - HALFPI); + CamSource.y = pTargetEntity->GetPosition().y - MinDist*Sin(Beta - HALFPI); + }else{ + CamSource.x = pTargetEntity->GetPosition().x - PlayerDist*Cos(Beta - HALFPI); + CamSource.y = pTargetEntity->GetPosition().y - PlayerDist*Sin(Beta - HALFPI); + } + + CColPoint colpoint; + CEntity *entity = nil; + if(CWorld::ProcessLineOfSight(pTargetEntity->GetPosition(), CamSource, colpoint, entity, true, false, false, true, false, true, true)){ + CamSource = colpoint.point; + RwCameraSetNearClipPlane(Scene.camera, 0.05f); + } + + CamFront = pTargetEntity->GetPosition() - CamSource; + FudgedTargetCoors = inter*Cams[ActiveCam].m_cvecTargetCoorsForFudgeInter + (1.0f-inter)*Cams[(ActiveCam+1)%2].m_cvecTargetCoorsForFudgeInter; + PreviousFudgedTargetCoors = FudgedTargetCoors; + CamFront.Normalise(); + CamUp = CVector(0.0f, 0.0f, 1.0f); + CamRight = CrossProduct(CamFront, CamUp); + CamRight.Normalise(); + CamUp = CrossProduct(CamRight, CamFront); + + WasPreviouslyInterSyhonFollowPed = true; + }else + WasPreviouslyInterSyhonFollowPed = false; + + if(transitionPedMode){ + FudgedTargetCoors = inter*Cams[ActiveCam].m_cvecTargetCoorsForFudgeInter + (1.0f-inter)*Cams[(ActiveCam+1)%2].m_cvecTargetCoorsForFudgeInter; + PreviousFudgedTargetCoors = FudgedTargetCoors; + CVector CamToTarget = pTargetEntity->GetPosition() - CamSource; + float tmpBeta = CGeneral::GetATanOfXY(CamToTarget.x, CamToTarget.y); + float PlayerDist = (pTargetEntity->GetPosition() - CamSource).Magnitude2D(); + float MinDist = Min(Cams[(ActiveCam+1)%2].m_fMinDistAwayFromCamWhenInterPolating, Cams[ActiveCam].m_fMinDistAwayFromCamWhenInterPolating); + if(PlayerDist < MinDist){ + CamSource.x = pTargetEntity->GetPosition().x - MinDist*Cos(tmpBeta - HALFPI); + CamSource.y = pTargetEntity->GetPosition().y - MinDist*Sin(tmpBeta - HALFPI); + } + CamFront = FudgedTargetCoors - CamSource; + CamFront.Normalise(); + CamUp = CVector(0.0f, 0.0f, 1.0f); + CamUp.Normalise(); + CamRight = CrossProduct(CamFront, CamUp); + CamRight.Normalise(); + CamUp = CrossProduct(CamRight, CamFront); + CamUp.Normalise(); + }else{ + CamFront.x = Cos(Alpha) * Sin(Beta); + CamFront.y = Cos(Alpha) * -Cos(Beta); + CamFront.z = Sin(Alpha); + CamFront.Normalise(); + CamUp = inter*Cams[ActiveCam].Up + (1.0f-inter)*Cams[(ActiveCam+1)%2].Up; + CamUp.Normalise(); + CamRight = CrossProduct(CamFront, CamUp); + CamRight.Normalise(); + CamUp = CrossProduct(CamRight, CamFront); + CamUp.Normalise(); + } #else uint32 currentTime = CTimer::GetTimeInMilliseconds() - m_uiTimeTransitionStart; if(currentTime >= m_uiTransitionDuration) @@ -699,6 +763,16 @@ CCamera::CamControl(void) if(Cams[ActiveCam].CamTargetEntity == nil && pTargetEntity == nil) pTargetEntity = PLAYER; +#ifdef PS2_CAM_TRANSITION + // Stop transition when it's done + if(m_uiTransitionState != 0) + if(CTimer::GetTimeInMilliseconds() > m_uiTransitionDuration+m_uiTimeTransitionStart){ + m_uiTransitionState = 0; + m_vecDoingSpecialInterPolation = false; + m_bWaitForInterpolToFinish = false; + } +#endif + m_iZoneCullFrameNumWereAt++; if(m_iZoneCullFrameNumWereAt > m_iCheckCullZoneThisNumFrames) m_iZoneCullFrameNumWereAt = 1; @@ -2248,10 +2322,17 @@ CCamera::StartTransition(int16 newMode) void CCamera::StartTransitionWhenNotFinishedInter(int16 mode) { +#ifdef PS2_CAM_TRANSITION + m_vecOldSourceForInter = GetPosition(); + m_vecOldFrontForInter = GetForward(); + m_vecOldUpForInter = GetUp(); + m_vecOldFOVForInter = CDraw::GetFOV(); +#endif m_vecDoingSpecialInterPolation = true; StartTransition(mode); } +#ifndef PS2_CAM_TRANSITION void CCamera::StoreValuesDuringInterPol(CVector &source, CVector &target, CVector &up, float &FOV) { @@ -2264,7 +2345,7 @@ CCamera::StoreValuesDuringInterPol(CVector &source, CVector &target, CVector &up m_fBetaDuringInterPol = CGeneral::GetATanOfXY(Dist.x, Dist.y); m_fAlphaDuringInterPol = CGeneral::GetATanOfXY(DistOnGround, Dist.z); } - +#endif void diff --git a/src/core/Camera.h b/src/core/Camera.h index 395effa8..f370bb98 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -425,9 +425,12 @@ public: float CarZoomValueSmooth; float DistanceToWater; +#ifndef PS2_CAM_TRANSITION float FOVDuringInter; +#endif float LODDistMultiplier; float GenerationDistMultiplier; +#ifndef PS2_CAM_TRANSITION float m_fAlphaSpeedAtStartInter; float m_fAlphaWhenInterPol; float m_fAlphaDuringInterPol; @@ -438,6 +441,7 @@ public: float m_fFOVSpeedAtStartInter; float m_fStartingBetaForInterPol; float m_fStartingAlphaForInterPol; +#endif float m_PedOrientForBehindOrInFront; float m_CameraAverageSpeed; float m_CameraSpeedSoFar; @@ -487,7 +491,7 @@ public: CVector m_vecFixedModeSource; CVector m_vecFixedModeUpOffSet; CVector m_vecCutSceneOffset; - +#ifndef PS2_CAM_TRANSITION CVector m_cvecStartingSourceForInterPol; CVector m_cvecStartingTargetForInterPol; CVector m_cvecStartingUpForInterPol; @@ -497,11 +501,13 @@ public: CVector m_vecSourceWhenInterPol; CVector m_vecTargetWhenInterPol; CVector m_vecUpWhenInterPol; - +#endif CVector m_vecGameCamPos; +#ifndef PS2_CAM_TRANSITION CVector SourceDuringInter; CVector TargetDuringInter; CVector UpDuringInter; +#endif RwCamera *m_pRwCamera; CEntity *pTargetEntity; CCamPathSplines m_arrPathArray[MAX_NUM_OF_SPLINETYPES]; From 586e8a2ab4da35529b19eb3a3c1db05d3469317c Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 21 Jun 2020 11:03:20 +0200 Subject: [PATCH 123/133] tried to reconstruct bills cam --- src/core/Cam.cpp | 42 +++++++++++++++++++++++++++++++++++++++--- src/core/Camera.h | 2 +- src/core/Pad.h | 1 + 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 69672272..6ce3bcb9 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -167,7 +167,9 @@ CCam::Process(void) case MODE_MODELVIEW: Process_ModelView(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar); break; -// case MODE_BILL: + case MODE_BILL: + Process_Bill(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar); + break; case MODE_SYPHON: Process_Syphon(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar); break; @@ -1665,6 +1667,8 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient } } +float fBillsBetaOffset; // made up name, actually in CCam + void CCam::Process_BehindCar(const CVector &CameraTarget, float TargetOrientation, float, float) { @@ -1684,6 +1688,15 @@ CCam::Process_BehindCar(const CVector &CameraTarget, float TargetOrientation, fl if(Length < 0.002f) Length = 0.002f; Beta = CGeneral::GetATanOfXY(TargetCoors.x - Source.x, TargetCoors.y - Source.y); +#ifdef TOGGLEABLE_BETA_FEATURES + // This is completely made up but Bill's cam manipulates an angle before calling this + // and otherwise calculating Beta doesn't make much sense. + Beta += fBillsBetaOffset; + fBillsBetaOffset = 0.0f; + Dist.x = -Length*Cos(Beta); + Dist.y = -Length*Sin(Beta); + Source = TargetCoors + Dist; +#endif if(Length > CA_MAX_DISTANCE){ Source.x = TargetCoors.x + Dist.x/Length * CA_MAX_DISTANCE; Source.y = TargetCoors.y + Dist.y/Length * CA_MAX_DISTANCE; @@ -1773,8 +1786,13 @@ CCam::WorkOutCamHeightWeeCar(CVector &TargetCoors, float TargetOrientation) else WellBufferMe(TargetZOffSet, &RoadHeightFix, &RoadHeightFixSpeed, 0.27f, 0.1f, false); - if((colpoint.surfaceB == SURFACE_DEFAULT || colpoint.surfaceB >= SURFACE_CAR) && - colpoint.surfaceB != SURFACE_THICK_METAL_PLATE && colpoint.surfaceB != SURFACE_STEEP_CLIFF && + if(colpoint.surfaceB != SURFACE_TARMAC && + colpoint.surfaceB != SURFACE_GRASS && + colpoint.surfaceB != SURFACE_GRAVEL && + colpoint.surfaceB != SURFACE_MUD_DRY && + colpoint.surfaceB != SURFACE_PAVEMENT && + colpoint.surfaceB != SURFACE_THICK_METAL_PLATE && + colpoint.surfaceB != SURFACE_STEEP_CLIFF && RoadHeightFix > 1.4f) RoadHeightFix = 1.4f; @@ -4421,6 +4439,24 @@ CCam::Process_FollowPed_WithBinding(const CVector &CameraTarget, float TargetOri GetVectorsReadyForRW(); } +void +CCam::Process_Bill(const CVector &CameraTarget, float TargetOrientation, float SpeedVar, float TargetSpeedVar) +{ +#ifdef FIX_BUGS + fBillsBetaOffset += CPad::GetPad(0)->GetRightStickX()/1000.0f; +#else + // just wtf is this? this code must be ancient + if(CPad::GetPad(0)->GetStart()) + fBillsBetaOffset += CPad::GetPad(0)->GetLeftStickX()/1000.0f; +#endif + while(fBillsBetaOffset > TWOPI) fBillsBetaOffset -= TWOPI; + while(fBillsBetaOffset < 0.0f) fBillsBetaOffset += TWOPI; + TargetOrientation += fBillsBetaOffset; + while(TargetOrientation > TWOPI) TargetOrientation -= TWOPI; + while(TargetOrientation < 0.0f) TargetOrientation += TWOPI; + Process_BehindCar(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar); +} + void CCam::Process_Im_The_Passenger_Woo_Woo(const CVector &CameraTarget, float TargetOrientation, float, float) { diff --git a/src/core/Camera.h b/src/core/Camera.h index f370bb98..d4e01a8e 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -249,7 +249,7 @@ public: // CCam::Process_Look_At_Cars // CCam::Process_CheesyZoom // CCam::Process_Aiming - // CCam::Process_Bill // same as BehindCar due to unused variables + void Process_Bill(const CVector &CameraTarget, float TargetOrientation, float SpeedVar, float TargetSpeedVar); void Process_Im_The_Passenger_Woo_Woo(const CVector &CameraTarget, float TargetOrientation, float, float); void Process_Blood_On_The_Tracks(const CVector &CameraTarget, float TargetOrientation, float, float); void Process_Cam_Running_Side_Train(const CVector &CameraTarget, float TargetOrientation, float, float); diff --git a/src/core/Pad.h b/src/core/Pad.h index ea771f81..1f29aa60 100644 --- a/src/core/Pad.h +++ b/src/core/Pad.h @@ -444,6 +444,7 @@ public: bool GetLeftShoulder2(void) { return !!NewState.LeftShoulder2; } bool GetRightShoulder1(void) { return !!NewState.RightShoulder1; } bool GetRightShoulder2(void) { return !!NewState.RightShoulder2; } + bool GetStart() { return !!NewState.Start; } int16 GetLeftStickX(void) { return NewState.LeftStickX; } int16 GetLeftStickY(void) { return NewState.LeftStickY; } int16 GetRightStickX(void) { return NewState.RightStickX; } From f5cba0ce89c0c472ed041dbc0dcc37e70da4147d Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 21 Jun 2020 13:46:23 +0300 Subject: [PATCH 124/133] script logging --- src/control/Script.cpp | 1434 +++++++++++++++++++++++++++++++++- src/control/Script.h | 6 + src/control/ScriptCommands.h | 35 +- src/core/config.h | 2 + 4 files changed, 1446 insertions(+), 31 deletions(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 089db1b4..4eb72915 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -17,6 +17,7 @@ #include "Cranes.h" #include "Credits.h" #include "CutsceneMgr.h" +#include "Debug.h" #include "DMAudio.h" #include "Darkel.h" #include "EmergencyPed.h" @@ -69,6 +70,9 @@ #include "World.h" #include "Zones.h" #include "main.h" +#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT +#include +#endif #define PICKUP_PLACEMENT_OFFSET 0.5f #define PED_FIND_Z_OFFSET 5.0f @@ -162,6 +166,1201 @@ bool doingMissionRetry; #endif +#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT + +#define REGISTER_COMMAND(command, in, out, cond, ovrd, visual) { command, #command, in, out, cond, ovrd, visual } +#define INPUT_ARGUMENTS(...) { __VA_ARGS__ ARGTYPE_NONE } +#define OUTPUT_ARGUMENTS(...) { __VA_ARGS__ ARGTYPE_NONE } +const tScriptCommandData commands[] = { + REGISTER_COMMAND(COMMAND_NOP, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_WAIT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GOTO, INPUT_ARGUMENTS(ARGTYPE_LABEL,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SHAKE_CAM, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ="), + REGISTER_COMMAND(COMMAND_SET_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ="), + REGISTER_COMMAND(COMMAND_SET_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ="), + REGISTER_COMMAND(COMMAND_SET_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ="), + REGISTER_COMMAND(COMMAND_ADD_VAL_TO_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " +="), + REGISTER_COMMAND(COMMAND_ADD_VAL_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " +="), + REGISTER_COMMAND(COMMAND_ADD_VAL_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " +="), + REGISTER_COMMAND(COMMAND_ADD_VAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " +="), + REGISTER_COMMAND(COMMAND_SUB_VAL_FROM_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " -="), + REGISTER_COMMAND(COMMAND_SUB_VAL_FROM_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -="), + REGISTER_COMMAND(COMMAND_SUB_VAL_FROM_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " -="), + REGISTER_COMMAND(COMMAND_SUB_VAL_FROM_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -="), + REGISTER_COMMAND(COMMAND_MULT_INT_VAR_BY_VAL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " *="), + REGISTER_COMMAND(COMMAND_MULT_FLOAT_VAR_BY_VAL, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " *="), + REGISTER_COMMAND(COMMAND_MULT_INT_LVAR_BY_VAL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " *="), + REGISTER_COMMAND(COMMAND_MULT_FLOAT_LVAR_BY_VAL, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " *="), + REGISTER_COMMAND(COMMAND_DIV_INT_VAR_BY_VAL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " /="), + REGISTER_COMMAND(COMMAND_DIV_FLOAT_VAR_BY_VAL, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " /="), + REGISTER_COMMAND(COMMAND_DIV_INT_LVAR_BY_VAL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " /="), + REGISTER_COMMAND(COMMAND_DIV_FLOAT_LVAR_BY_VAL, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " /="), + REGISTER_COMMAND(COMMAND_IS_INT_VAR_GREATER_THAN_NUMBER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >"), + REGISTER_COMMAND(COMMAND_IS_INT_LVAR_GREATER_THAN_NUMBER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >"), + REGISTER_COMMAND(COMMAND_IS_NUMBER_GREATER_THAN_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >"), + REGISTER_COMMAND(COMMAND_IS_NUMBER_GREATER_THAN_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >"), + REGISTER_COMMAND(COMMAND_IS_INT_VAR_GREATER_THAN_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >"), + REGISTER_COMMAND(COMMAND_IS_INT_LVAR_GREATER_THAN_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >"), + REGISTER_COMMAND(COMMAND_IS_INT_VAR_GREATER_THAN_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >"), + REGISTER_COMMAND(COMMAND_IS_INT_LVAR_GREATER_THAN_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >"), + REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_GREATER_THAN_NUMBER, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >"), + REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_GREATER_THAN_NUMBER, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >"), + REGISTER_COMMAND(COMMAND_IS_NUMBER_GREATER_THAN_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >"), + REGISTER_COMMAND(COMMAND_IS_NUMBER_GREATER_THAN_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >"), + REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_GREATER_THAN_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >"), + REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_GREATER_THAN_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >"), + REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_GREATER_THAN_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >"), + REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_GREATER_THAN_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >"), + REGISTER_COMMAND(COMMAND_IS_INT_VAR_GREATER_OR_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >="), + REGISTER_COMMAND(COMMAND_IS_INT_LVAR_GREATER_OR_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >="), + REGISTER_COMMAND(COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >="), + REGISTER_COMMAND(COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >="), + REGISTER_COMMAND(COMMAND_IS_INT_VAR_GREATER_OR_EQUAL_TO_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >="), + REGISTER_COMMAND(COMMAND_IS_INT_LVAR_GREATER_OR_EQUAL_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >="), + REGISTER_COMMAND(COMMAND_IS_INT_VAR_GREATER_OR_EQUAL_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >="), + REGISTER_COMMAND(COMMAND_IS_INT_LVAR_GREATER_OR_EQUAL_TO_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " >="), + REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >="), + REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >="), + REGISTER_COMMAND(COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >="), + REGISTER_COMMAND(COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >="), + REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >="), + REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >="), + REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >="), + REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " >="), + REGISTER_COMMAND(COMMAND_IS_INT_VAR_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " =="), + REGISTER_COMMAND(COMMAND_IS_INT_LVAR_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " =="), + REGISTER_COMMAND(COMMAND_IS_INT_VAR_EQUAL_TO_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " =="), + REGISTER_COMMAND(COMMAND_IS_INT_LVAR_EQUAL_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " =="), + REGISTER_COMMAND(COMMAND_IS_INT_VAR_EQUAL_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " =="), + REGISTER_COMMAND(COMMAND_IS_INT_VAR_NOT_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " !="), + REGISTER_COMMAND(COMMAND_IS_INT_LVAR_NOT_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " !="), + REGISTER_COMMAND(COMMAND_IS_INT_VAR_NOT_EQUAL_TO_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " !="), + REGISTER_COMMAND(COMMAND_IS_INT_LVAR_NOT_EQUAL_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " !="), + REGISTER_COMMAND(COMMAND_IS_INT_VAR_NOT_EQUAL_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, 0, " !="), + REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " =="), + REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " =="), + REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_EQUAL_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " =="), + REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_EQUAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " =="), + REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_EQUAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " =="), + REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_NOT_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " !="), + REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_NOT_EQUAL_TO_NUMBER, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " !="), + REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_NOT_EQUAL_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " !="), + REGISTER_COMMAND(COMMAND_IS_FLOAT_LVAR_NOT_EQUAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " !="), + REGISTER_COMMAND(COMMAND_IS_FLOAT_VAR_NOT_EQUAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, 0, " !="), + REGISTER_COMMAND(COMMAND_GOTO_IF_TRUE, INPUT_ARGUMENTS(ARGTYPE_LABEL,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GOTO_IF_FALSE, INPUT_ARGUMENTS(ARGTYPE_LABEL,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_TERMINATE_THIS_SCRIPT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_START_NEW_SCRIPT, INPUT_ARGUMENTS(ARGTYPE_LABEL,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GOSUB, INPUT_ARGUMENTS(ARGTYPE_LABEL,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_RETURN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_LINE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_PLAYER_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PLAYER_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_BOOL,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_AREA_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_BOOL,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_INT_VAR_TO_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " +="), + REGISTER_COMMAND(COMMAND_ADD_FLOAT_VAR_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " +="), + REGISTER_COMMAND(COMMAND_ADD_INT_LVAR_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " +="), + REGISTER_COMMAND(COMMAND_ADD_FLOAT_LVAR_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " +="), + REGISTER_COMMAND(COMMAND_ADD_INT_VAR_TO_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " +="), + REGISTER_COMMAND(COMMAND_ADD_FLOAT_VAR_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " +="), + REGISTER_COMMAND(COMMAND_ADD_INT_LVAR_TO_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " +="), + REGISTER_COMMAND(COMMAND_ADD_FLOAT_LVAR_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " +="), + REGISTER_COMMAND(COMMAND_SUB_INT_VAR_FROM_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " -="), + REGISTER_COMMAND(COMMAND_SUB_FLOAT_VAR_FROM_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -="), + REGISTER_COMMAND(COMMAND_SUB_INT_LVAR_FROM_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " -="), + REGISTER_COMMAND(COMMAND_SUB_FLOAT_LVAR_FROM_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -="), + REGISTER_COMMAND(COMMAND_SUB_INT_VAR_FROM_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " -="), + REGISTER_COMMAND(COMMAND_SUB_FLOAT_VAR_FROM_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -="), + REGISTER_COMMAND(COMMAND_SUB_INT_LVAR_FROM_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " -="), + REGISTER_COMMAND(COMMAND_SUB_FLOAT_LVAR_FROM_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -="), + REGISTER_COMMAND(COMMAND_MULT_INT_VAR_BY_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " *="), + REGISTER_COMMAND(COMMAND_MULT_FLOAT_VAR_BY_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " *="), + REGISTER_COMMAND(COMMAND_MULT_INT_LVAR_BY_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " *="), + REGISTER_COMMAND(COMMAND_MULT_FLOAT_LVAR_BY_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " *="), + REGISTER_COMMAND(COMMAND_MULT_INT_VAR_BY_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " *="), + REGISTER_COMMAND(COMMAND_MULT_FLOAT_VAR_BY_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " *="), + REGISTER_COMMAND(COMMAND_MULT_INT_LVAR_BY_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " *="), + REGISTER_COMMAND(COMMAND_MULT_FLOAT_LVAR_BY_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " *="), + REGISTER_COMMAND(COMMAND_DIV_INT_VAR_BY_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " /="), + REGISTER_COMMAND(COMMAND_DIV_FLOAT_VAR_BY_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " /="), + REGISTER_COMMAND(COMMAND_DIV_INT_LVAR_BY_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " /="), + REGISTER_COMMAND(COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " /="), + REGISTER_COMMAND(COMMAND_DIV_INT_VAR_BY_INT_LVAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " /="), + REGISTER_COMMAND(COMMAND_DIV_FLOAT_VAR_BY_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " /="), + REGISTER_COMMAND(COMMAND_DIV_INT_LVAR_BY_INT_VAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " /="), + REGISTER_COMMAND(COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " /="), + REGISTER_COMMAND(COMMAND_ADD_TIMED_VAL_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"), + REGISTER_COMMAND(COMMAND_ADD_TIMED_VAL_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"), + REGISTER_COMMAND(COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"), + REGISTER_COMMAND(COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"), + REGISTER_COMMAND(COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"), + REGISTER_COMMAND(COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"), + REGISTER_COMMAND(COMMAND_SUB_TIMED_VAL_FROM_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"), + REGISTER_COMMAND(COMMAND_SUB_TIMED_VAL_FROM_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"), + REGISTER_COMMAND(COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"), + REGISTER_COMMAND(COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"), + REGISTER_COMMAND(COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"), + REGISTER_COMMAND(COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " -=@"), + REGISTER_COMMAND(COMMAND_SET_VAR_INT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ="), + REGISTER_COMMAND(COMMAND_SET_LVAR_INT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ="), + REGISTER_COMMAND(COMMAND_SET_VAR_FLOAT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ="), + REGISTER_COMMAND(COMMAND_SET_LVAR_FLOAT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ="), + REGISTER_COMMAND(COMMAND_SET_VAR_FLOAT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ="), + REGISTER_COMMAND(COMMAND_SET_LVAR_FLOAT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ="), + REGISTER_COMMAND(COMMAND_SET_VAR_INT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ="), + REGISTER_COMMAND(COMMAND_SET_LVAR_INT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ="), + REGISTER_COMMAND(COMMAND_CSET_VAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), + REGISTER_COMMAND(COMMAND_CSET_VAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), + REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), + REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), + REGISTER_COMMAND(COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), + REGISTER_COMMAND(COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), + REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), + REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), + REGISTER_COMMAND(COMMAND_ABS_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), + REGISTER_COMMAND(COMMAND_ABS_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), + REGISTER_COMMAND(COMMAND_ABS_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), + REGISTER_COMMAND(COMMAND_ABS_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), + REGISTER_COMMAND(COMMAND_GENERATE_RANDOM_FLOAT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GENERATE_RANDOM_INT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_PED_HANDLE,), false, -1, ""), + REGISTER_COMMAND(COMMAND_DELETE_CHAR, INPUT_ARGUMENTS(ARGTYPE_PED_HANDLE,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CHAR_WANDER_DIR, INPUT_ARGUMENTS(ARGTYPE_PED_HANDLE, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CHAR_WANDER_RANGE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CHAR_FOLLOW_PATH, INPUT_ARGUMENTS(ARGTYPE_PED_HANDLE, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CHAR_SET_IDLE, INPUT_ARGUMENTS(ARGTYPE_PED_HANDLE,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CHAR_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_PED_HANDLE,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_PED_HANDLE, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_STILL_ALIVE, INPUT_ARGUMENTS(ARGTYPE_PED_HANDLE,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_PED_HANDLE, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_BOOL,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_IN_AREA_3D, INPUT_ARGUMENTS(ARGTYPE_PED_HANDLE, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_BOOL,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE,), false, -1, ""), + REGISTER_COMMAND(COMMAND_DELETE_CAR, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CAR_GOTO_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CAR_WANDER_RANDOMLY, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CAR_SET_IDLE, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CAR_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_STILL_ALIVE, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_CRUISE_SPEED, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_DRIVING_STYLE, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_MISSION, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_BOOL,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_IN_AREA_3D, INPUT_ARGUMENTS(ARGTYPE_VEHICLE_HANDLE, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_BOOL,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SPECIAL_0, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SPECIAL_1, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SPECIAL_2, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SPECIAL_3, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SPECIAL_4, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SPECIAL_5, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SPECIAL_6, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SPECIAL_7, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_BIG, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_PRINTS, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_TIME_OF_DAY, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TIME_OF_DAY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_MINUTES_TO_TIME_OF_DAY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_POINT_ON_SCREEN, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_DEBUG_ON, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DEBUG_OFF, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_RETURN_TRUE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_RETURN_FALSE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_VAR_INT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_VAR_FLOAT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_LVAR_INT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_LVAR_FLOAT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_LBRACKET, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_RBRACKET, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REPEAT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ENDREPEAT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IF, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IFNOT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ELSE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ENDIF, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_WHILE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_WHILENOT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ENDWHILE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ANDOR, INPUT_ARGUMENTS(ARGTYPE_ANDOR,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_LAUNCH_MISSION, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_MISSION_HAS_FINISHED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_STORE_CAR_CHAR_IS_IN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_STORE_CAR_PLAYER_IS_IN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_IN_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_IN_ANY_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_ANY_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_BUTTON_PRESSED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_GET_PAD_STATE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ANY_MEANS_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_PLAYER_ANY_MEANS_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_PLAYER_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_PLAYER_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ANY_MEANS_CHAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ON_FOOT_CHAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_IN_CAR_CHAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ANY_MEANS_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_CHAR_ANY_MEANS_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_CHAR_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_CHAR_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ANY_MEANS_CHAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ON_FOOT_CHAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_IN_CAR_CHAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ANY_MEANS_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_PLAYER_ANY_MEANS_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_PLAYER_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_PLAYER_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ANY_MEANS_CHAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ON_FOOT_CHAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_IN_CAR_CHAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ANY_MEANS_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_CHAR_ANY_MEANS_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_CHAR_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_CHAR_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ANY_MEANS_CHAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ON_FOOT_CHAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_IN_CAR_CHAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), true, -1, ""), + REGISTER_COMMAND(COMMAND_DELETE_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_SCORE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_SCORE_GREATER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_STORE_SCORE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GIVE_REMOTE_CONTROLLED_CAR_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ALTER_WANTED_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ALTER_WANTED_LEVEL_NO_DROP, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_WANTED_LEVEL_GREATER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_WANTED_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_DEATHARREST_STATE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_DEATHARREST_BEEN_EXECUTED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_AMMO_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_AMMO_TO_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_AMMO_TO_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_STILL_ALIVE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_DEAD, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_DEAD, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_DEAD, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_THREAT_SEARCH, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_THREAT_REACTION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_NO_OBJ, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ORDER_DRIVER_OUT_OF_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ORDER_CHAR_TO_DRIVE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_PATROL_POINT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_GANGZONE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_ZONE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_PRESSING_HORN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_CHAR_SPOTTED_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_ORDER_CHAR_TO_BACKDOOR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_CHAR_TO_GANG, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_OBJECTIVE_PASSED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_DRIVE_AGGRESSION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_MAX_DRIVESPEED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_CHAR_INSIDE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_WARP_PLAYER_FROM_CAR_TO_COORD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_MAKE_CHAR_DO_NOTHING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_INVINCIBLE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PLAYER_INVINCIBLE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_GRAPHIC_TYPE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PLAYER_GRAPHIC_TYPE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_PLAYER_BEEN_ARRESTED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_STOP_CHAR_DRIVING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_KILL_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_FAVOURITE_CAR_MODEL_FOR_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OCCUPATION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CHANGE_CAR_LOCK, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SHAKE_CAM_WITH_POINT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_REMAP, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_CAR_JUST_SUNK, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_NO_COLLIDE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_DEAD_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_DEAD_IN_AREA_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_TRAILER_ATTACHED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_ON_TRAILER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_CAR_GOT_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_PARK, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_PARK_FINISHED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_KILL_ALL_PASSENGERS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_BULLETPROOF, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_FLAMEPROOF, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_ROCKETPROOF, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CARBOMB_ACTIVE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_GIVE_CAR_ALARM, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PUT_CAR_ON_TRAILER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_CRUSHED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_GANG_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_CAR_GENERATOR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SWITCH_CAR_GENERATOR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_PAGER_MESSAGE, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DISPLAY_ONSCREEN_TIMER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_ONSCREEN_TIMER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DISPLAY_ONSCREEN_COUNTER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_ONSCREEN_COUNTER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_ZONE_CAR_INFO, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_IN_GANG_ZONE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_IN_ZONE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_DENSITY, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PED_DENSITY, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_POINT_CAMERA_AT_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_POINT_CAMERA_AT_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_POINT_CAMERA_AT_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_RESTORE_CAMERA, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SHAKE_PAD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_ZONE_PED_INFO, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TIME_SCALE, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_IN_AIR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_FIXED_CAMERA_POSITION, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_POINT_CAMERA_AT_POINT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_CAR_OLD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_CHAR_OLD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_OBJECT_OLD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_REMOVE_BLIP, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CHANGE_BLIP_COLOUR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DIM_BLIP, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_COORD_OLD, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_CHANGE_BLIP_SCALE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_FADING_COLOUR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DO_FADE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_FADING_STATUS, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_HOSPITAL_RESTART, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_POLICE_RESTART, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_OVERRIDE_NEXT_RESTART, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DRAW_SHADOW, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_PLAYER_HEADING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PLAYER_HEADING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CHAR_HEADING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_HEADING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CAR_HEADING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_HEADING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_OBJECT_HEADING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_OBJECT_HEADING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_TOUCHING_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_TOUCHING_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PLAYER_AMMO, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_AMMO, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_AMMO, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_LOAD_CAMERA_SPLINE, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_MOVE_CAMERA_ALONG_SPLINE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CAMERA_POSITION_ALONG_SPLINE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_DECLARE_MISSION_FLAG, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DECLARE_MISSION_FLAG_FOR_CONTACT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DECLARE_BASE_BRIEF_ID_FOR_CONTACT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_HEALTH_GREATER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_HEALTH_GREATER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_HEALTH_GREATER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_CONTACT_POINT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_COORD, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_CHANGE_BLIP_DISPLAY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_ONE_OFF_SOUND, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_CONTINUOUS_SOUND, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_REMOVE_SOUND, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_STUCK_ON_ROOF, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_UPSIDEDOWN_CAR_CHECK, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REMOVE_UPSIDEDOWN_CAR_CHECK, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_WAIT_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FLEE_ON_FOOT_TILL_SAFE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GUARD_SPOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GUARD_AREA, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_WAIT_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_AREA_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_AREA_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_AREA_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_AREA_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_AREA_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_AREA_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_AREA_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_AREA_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_AREA_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_IN_AREA_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_IN_AREA_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_STOPPED_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_STOPPED_IN_AREA_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_STOPPED_IN_AREA_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_IN_AREA_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_IN_AREA_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_STOPPED_IN_AREA_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_STOPPED_IN_AREA_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_STOPPED_IN_AREA_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_STOPPED_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_STOPPED_IN_AREA_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_GIVE_WEAPON_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GIVE_WEAPON_TO_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GIVE_WEAPON_TO_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PLAYER_CONTROL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_FORCE_WEATHER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_FORCE_WEATHER_NOW, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_RELEASE_WEATHER, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CURRENT_PLAYER_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CURRENT_CHAR_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CURRENT_CAR_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_OBJECT_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_OBJECT_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_GAME_TIMER, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_TURN_CHAR_TO_FACE_COORD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_TURN_PLAYER_TO_FACE_COORD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_STORE_WANTED_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_STOPPED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_MARK_CHAR_AS_NO_LONGER_NEEDED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_MARK_CAR_AS_NO_LONGER_NEEDED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_MARK_OBJECT_AS_NO_LONGER_NEEDED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DONT_REMOVE_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DONT_REMOVE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DONT_REMOVE_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_CHAR_AS_PASSENGER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_KILL_CHAR_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_KILL_PLAYER_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_KILL_CHAR_ANY_MEANS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_KILL_PLAYER_ANY_MEANS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FLEE_CHAR_ON_FOOT_TILL_SAFE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FLEE_PLAYER_ON_FOOT_TILL_SAFE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FLEE_CHAR_ON_FOOT_ALWAYS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FLEE_PLAYER_ON_FOOT_ALWAYS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GOTO_CHAR_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GOTO_PLAYER_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_LEAVE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_ENTER_CAR_AS_PASSENGER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_ENTER_CAR_AS_DRIVER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FOLLOW_CAR_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FIRE_AT_OBJECT_FROM_VEHICLE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_DESTROY_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_DESTROY_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GOTO_AREA_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GOTO_AREA_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FOLLOW_CAR_ON_FOOT_WITH_OFFSET, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GUARD_ATTACK, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_AS_LEADER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PLAYER_AS_LEADER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_LEAVE_GROUP, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FOLLOW_ROUTE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_ROUTE_POINT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_NUMBER_BIG, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_NUMBER, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_NUMBER_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_NUMBER_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SWITCH_ROADS_ON, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SWITCH_ROADS_OFF, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_NUMBER_OF_PASSENGERS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_MAXIMUM_NUMBER_OF_PASSENGERS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_DENSITY_MULTIPLIER, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_HEAVY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_CHAR_THREAT_SEARCH, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ACTIVATE_CRANE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DEACTIVATE_CRANE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_MAX_WANTED_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SAVE_VAR_INT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SAVE_VAR_FLOAT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_IN_AIR_PROPER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_UPSIDEDOWN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_GET_PLAYER_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_CANCEL_OVERRIDE_RESTART, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_POLICE_IGNORE_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_PAGER_MESSAGE_WITH_NUMBER, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_START_KILL_FRENZY, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_READ_KILL_FRENZY_STATUS, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SQRT, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ANY_MEANS_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ON_FOOT_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_IN_CAR_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ANY_MEANS_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_ON_FOOT_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_PLAYER_IN_CAR_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ANY_MEANS_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ON_FOOT_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_IN_CAR_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ANY_MEANS_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ON_FOOT_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_IN_CAR_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_GENERATE_RANDOM_FLOAT_IN_RANGE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GENERATE_RANDOM_INT_IN_RANGE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_LOCK_CAR_DOORS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_EXPLODE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_EXPLOSION, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_UPRIGHT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_TURN_CHAR_TO_FACE_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_TURN_CHAR_TO_FACE_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_TURN_PLAYER_TO_FACE_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GOTO_COORD_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GOTO_COORD_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_PICKUP, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_PICKUP_BEEN_COLLECTED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_REMOVE_PICKUP, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TAXI_LIGHTS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_BIG_Q, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_NUMBER_BIG_Q, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_GARAGE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_GARAGE_WITH_CAR_MODEL, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TARGET_CAR_FOR_MISSION_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_IN_MISSION_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_FREE_BOMBS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_POWERPOINT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_ALL_TAXI_LIGHTS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_ARMED_WITH_ANY_BOMB, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_APPLY_BRAKES_TO_PLAYERS_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PLAYER_HEALTH, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_HEALTH, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_HEALTH, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_PLAYER_HEALTH, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CHAR_HEALTH, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CAR_HEALTH, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_ARMED_WITH_BOMB, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_CHANGE_CAR_COLOUR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SWITCH_PED_ROADS_ON, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SWITCH_PED_ROADS_OFF, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CHAR_LOOK_AT_CHAR_ALWAYS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CHAR_LOOK_AT_PLAYER_ALWAYS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PLAYER_LOOK_AT_CHAR_ALWAYS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_STOP_CHAR_LOOKING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_STOP_PLAYER_LOOKING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SWITCH_HELICOPTER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_GANG_ATTITUDE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_GANG_GANG_ATTITUDE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_GANG_PLAYER_ATTITUDE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_GANG_PED_MODELS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_GANG_CAR_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_GANG_WEAPONS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_RUN_TO_AREA, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_RUN_TO_COORD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_TOUCHING_OBJECT_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_TOUCHING_OBJECT_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOAD_SPECIAL_CHARACTER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_SPECIAL_CHARACTER_LOADED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_FLASH_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_FLASH_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_FLASH_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_REMOTE_MODE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_ARM_CAR_WITH_BOMB, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_PERSONALITY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CUTSCENE_OFFSET, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_ANIM_GROUP_FOR_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_ANIM_GROUP_FOR_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REQUEST_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_MODEL_LOADED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_MARK_MODEL_AS_NO_LONGER_NEEDED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GRAB_PHONE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_REPEATED_PHONE_MESSAGE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PHONE_MESSAGE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_PHONE_DISPLAYED_MESSAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_TURN_PHONE_OFF, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DRAW_CORONA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DRAW_LIGHT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_STORE_WEATHER, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_RESTORE_WEATHER, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_STORE_CLOCK, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_RESTORE_CLOCK, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_RESTART_CRITICAL_MISSION, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_PLAYING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_NO_OBJ, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_WAIT_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_FLEE_ON_FOOT_TILL_SAFE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GUARD_SPOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GUARD_AREA, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_WAIT_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_KILL_CHAR_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_KILL_PLAYER_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_KILL_CHAR_ANY_MEANS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_KILL_PLAYER_ANY_MEANS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_FLEE_CHAR_ON_FOOT_TILL_SAFE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_FLEE_PLAYER_ON_FOOT_TILL_SAFE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_FLEE_CHAR_ON_FOOT_ALWAYS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_FLEE_PLAYER_ON_FOOT_ALWAYS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GOTO_CHAR_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GOTO_PLAYER_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_LEAVE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_ENTER_CAR_AS_PASSENGER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_ENTER_CAR_AS_DRIVER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_FOLLOW_CAR_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_FIRE_AT_OBJECT_FROM_VEHICLE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_DESTROY_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_DESTROY_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GOTO_AREA_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GOTO_AREA_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_FOLLOW_CAR_ON_FOOT_WITH_OFFSET, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GUARD_ATTACK, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_FOLLOW_ROUTE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GOTO_COORD_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GOTO_COORD_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_RUN_TO_AREA, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_RUN_TO_COORD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_PEDS_IN_AREA_TO_COLL, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_PEDS_IN_VEHICLE_TO_COLL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_COLL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_COLL_IN_CARS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_COLL_ANY_MEANS_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_COLL_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_COLL_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_COLL_ANY_MEANS_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_COLL_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_STOPPED_COLL_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_COLL_ANY_MEANS_CHAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_COLL_ON_FOOT_CHAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_COLL_IN_CAR_CHAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_COLL_ANY_MEANS_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_COLL_ON_FOOT_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_COLL_IN_CAR_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_COLL_ANY_MEANS_PLAYER_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_COLL_ON_FOOT_PLAYER_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_COLL_IN_CAR_PLAYER_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_COLL_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_COLL_IN_AREA_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_COLL_IN_AREA_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_COLL_STOPPED_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_COLL_STOPPED_IN_AREA_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_COLL_STOPPED_IN_AREA_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_GET_NUMBER_OF_PEDS_IN_COLL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_HEED_THREATS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PLAYER_HEED_THREATS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CONTROLLER_MODE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAN_RESPRAY_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_TAXI, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_UNLOAD_SPECIAL_CHARACTER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_RESET_NUM_OF_MODELS_KILLED_BY_PLAYER, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_NUM_OF_MODELS_KILLED_BY_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_ACTIVATE_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SWITCH_TAXI_TIMER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_OBJECT_NO_OFFSET, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_BOAT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_GOTO_AREA_ANY_MEANS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_GOTO_AREA_ANY_MEANS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_STOPPED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_MESSAGE_WAIT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_PARTICLE_EFFECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SWITCH_WIDESCREEN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_SPRITE_BLIP_FOR_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_SPRITE_BLIP_FOR_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_SPRITE_BLIP_FOR_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_SPRITE_BLIP_FOR_CONTACT_POINT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_SPRITE_BLIP_FOR_COORD, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_ONLY_DAMAGED_BY_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_ONLY_DAMAGED_BY_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_PROOFS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_PROOFS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_ANGLED_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_ANGLED_AREA_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_ANGLED_AREA_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_ON_FOOT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_IN_CAR_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_ANGLED_AREA_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_ANGLED_AREA_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_ANGLED_AREA_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_ON_FOOT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_STOPPED_IN_ANGLED_AREA_IN_CAR_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_DEACTIVATE_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_NUMBER_OF_CARS_COLLECTED_BY_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_CAR_BEEN_TAKEN_TO_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_SWAT_REQUIRED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_FBI_REQUIRED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_ARMY_REQUIRED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_IN_WATER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CLOSEST_CHAR_NODE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CLOSEST_CAR_NODE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_CAR_GOTO_COORDINATES_ACCURATE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_START_PACMAN_RACE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_START_PACMAN_RECORD, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_NUMBER_OF_POWER_PILLS_EATEN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_PACMAN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_START_PACMAN_SCRAMBLE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_NUMBER_OF_POWER_PILLS_CARRIED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_NUMBER_OF_POWER_PILLS_CARRIED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_ON_SCREEN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_ON_SCREEN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_OBJECT_ON_SCREEN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_GOSUB_FILE, INPUT_ARGUMENTS(ARGTYPE_LABEL, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_GROUND_Z_FOR_3D_COORD, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_START_SCRIPT_FIRE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_SCRIPT_FIRE_EXTINGUISHED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_REMOVE_SCRIPT_FIRE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COMEDY_CONTROLS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_BOAT_GOTO_COORDS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_BOAT_STOP, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_SHOOTING_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_SHOOTING_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CURRENT_PLAYER_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CURRENT_CHAR_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_NUMBER_OF_POWER_PILLS_EATEN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_POWER_PILL, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_BOAT_CRUISE_SPEED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_RANDOM_CHAR_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_RANDOM_CHAR_IN_ZONE, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_TAXI, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_SHOOTING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_SHOOTING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_MONEY_PICKUP, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_ACCURACY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CAR_SPEED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_LOAD_CUTSCENE, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_CUTSCENE_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CUTSCENE_ANIM, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_START_CUTSCENE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CUTSCENE_TIME, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_CUTSCENE_FINISHED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_CUTSCENE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_RESTORE_CAMERA_JUMPCUT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_COLLECTABLE1, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLLECTABLE1_TOTAL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PROJECTILE_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_DESTROY_PROJECTILES_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DROP_MINE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DROP_NAUTICAL_MINE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOAD_SPECIAL_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_CUTSCENE_HEAD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CUTSCENE_HEAD_ANIM, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SIN, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_COS, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CAR_FORWARD_X, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CAR_FORWARD_Y, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_CHANGE_GARAGE_TYPE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ACTIVATE_CRUSHER_CRANE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_2_NUMBERS, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_2_NUMBERS_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_2_NUMBERS_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_3_NUMBERS, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_3_NUMBERS_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_3_NUMBERS_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_4_NUMBERS, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_4_NUMBERS_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_4_NUMBERS_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_5_NUMBERS, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_5_NUMBERS_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_5_NUMBERS_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_6_NUMBERS, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_6_NUMBERS_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_6_NUMBERS_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FOLLOW_CHAR_IN_FORMATION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PLAYER_MADE_PROGRESS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PROGRESS_TOTAL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_JUMP_DISTANCE, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_JUMP_HEIGHT, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_JUMP_FLIPS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_JUMP_SPINS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_JUMP_STUNT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_UNIQUE_JUMP_FOUND, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_UNIQUE_JUMPS_TOTAL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_PASSENGER_DROPPED_OFF_TAXI, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_MONEY_MADE_TAXI, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_MISSION_GIVEN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_MISSION_PASSED, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_RUNNING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REMOVE_ALL_SCRIPT_FIRES, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_FIRST_CAR_COLOUR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_SECOND_CAR_COLOUR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_CHAR_BEEN_DAMAGED_BY_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_CAR_BEEN_DAMAGED_BY_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_IN_CHARS_GROUP, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_IN_PLAYERS_GROUP, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_EXPLODE_CHAR_HEAD, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_EXPLODE_PLAYER_HEAD, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ANCHOR_BOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_ZONE_GROUP, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_START_CAR_FIRE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_START_CHAR_FIRE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_RANDOM_CAR_OF_TYPE_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_RANDOM_CAR_OF_TYPE_IN_ZONE, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_RESPRAY_HAPPENED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAMERA_ZOOM, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_PICKUP_WITH_AMMO, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_RAM_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_BLOCK_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_CATCH_TRAIN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_CATCH_TRAIN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PLAYER_NEVER_GETS_TIRED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PLAYER_FAST_RELOAD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_BLEEDING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_FUNNY_SUSPENSION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_BIG_WHEELS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_FREE_RESPRAYS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PLAYER_VISIBLE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_VISIBLE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_VISIBLE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_AREA_OCCUPIED, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_START_DRUG_RUN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_DRUG_RUN_BEEN_COMPLETED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_DRUG_PLANE_BEEN_SHOT_DOWN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SAVE_PLAYER_FROM_FIRES, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DISPLAY_TEXT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TEXT_SCALE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TEXT_COLOUR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TEXT_JUSTIFY, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TEXT_CENTRE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TEXT_WRAPX, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TEXT_CENTRE_SIZE, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TEXT_BACKGROUND, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TEXT_BACKGROUND_COLOUR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TEXT_BACKGROUND_ONLY_TEXT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TEXT_PROPORTIONAL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TEXT_FONT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_INDUSTRIAL_PASSED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_COMMERCIAL_PASSED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SUBURBAN_PASSED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ROTATE_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SLIDE_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_REMOVE_CHAR_ELEGANTLY, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_STAY_IN_SAME_PLACE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_NASTY_GAME, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_UNDRESS_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DRESS_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_START_CHASE_SCENE, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_STOP_CHASE_SCENE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_EXPLOSION_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_EXPLOSION_IN_ZONE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_START_DRUG_DROP_OFF, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_DROP_OFF_PLANE_BEEN_SHOT_DOWN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_FIND_DROP_OFF_PLANE_COORDINATES, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_FLOATING_PACKAGE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_PLACE_OBJECT_RELATIVE_TO_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_MAKE_OBJECT_TARGETTABLE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_ARMOUR_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_ARMOUR_TO_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_OPEN_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CLOSE_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_WARP_CHAR_FROM_CAR_TO_COORD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_VISIBILITY_OF_CLOSEST_OBJECT_OF_TYPE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_CHAR_SPOTTED_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_HAIL_TAXI, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_OBJECT_BEEN_DAMAGED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_START_KILL_FRENZY_HEADSHOT, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ACTIVATE_MILITARY_CRANE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_WARP_PLAYER_INTO_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_WARP_CHAR_INTO_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SWITCH_CAR_RADIO, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_AUDIO_STREAM, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_2_NUMBERS_BIG, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_3_NUMBERS_BIG, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_4_NUMBERS_BIG, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_5_NUMBERS_BIG, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_WITH_6_NUMBERS_BIG, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_WAIT_STATE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAMERA_BEHIND_PLAYER, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_MOTION_BLUR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_STRING_IN_STRING, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_RANDOM_CHAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_STEAL_ANY_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_2_REPEATED_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_2_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_3_REPEATED_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_3_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_4_REPEATED_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_4_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_SNIPER_BULLET_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_GIVE_PLAYER_DETONATOR, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_COLL_OBJ_STEAL_ANY_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_OBJECT_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_OBJECT_COLLISION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_ICECREAM_JINGLE_ON, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_STRING_IN_STRING_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_STRING_IN_STRING_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_5_REPEATED_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_5_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_6_REPEATED_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_6_PHONE_MESSAGES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_POINT_OBSCURED_BY_A_MISSION_ENTITY, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOAD_ALL_MODELS_NOW, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_TO_OBJECT_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DRAW_SPRITE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DRAW_RECT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_LOAD_SPRITE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_LOAD_TEXTURE_DICTIONARY, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REMOVE_TEXTURE_DICTIONARY, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_OBJECT_DYNAMIC, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_ANIM_SPEED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PLAY_MISSION_PASSED_TUNE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_AREA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_FREEZE_ONSCREEN_TIMER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SWITCH_CAR_SIREN, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SWITCH_PED_ROADS_ON_ANGLED, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SWITCH_PED_ROADS_OFF_ANGLED, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SWITCH_ROADS_ON_ANGLED, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SWITCH_ROADS_OFF_ANGLED, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_WATERTIGHT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_MOVING_PARTICLE_EFFECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_CANT_BE_DRAGGED_OUT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_TURN_CAR_TO_FACE_COORD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CRANE_LIFTING_CAR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_DRAW_SPHERE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_STATUS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_MALE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SCRIPT_NAME, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CHANGE_GARAGE_TYPE_WITH_CAR_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_FIND_DRUG_PLANE_COORDINATES, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SAVE_INT_TO_DEBUG_FILE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SAVE_FLOAT_TO_DEBUG_FILE, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SAVE_NEWLINE_TO_DEBUG_FILE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_POLICE_RADIO_MESSAGE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_STRONG, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REMOVE_ROUTE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SWITCH_RUBBISH, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REMOVE_PARTICLE_EFFECTS_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SWITCH_STREAMING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_GARAGE_OPEN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_GARAGE_CLOSED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_START_CATALINA_HELI, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CATALINA_HELI_TAKE_OFF, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REMOVE_CATALINA_HELI, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_CATALINA_HELI_BEEN_SHOT_DOWN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SWAP_NEAREST_BUILDING_MODEL, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SWITCH_WORLD_PROCESSING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REMOVE_ALL_PLAYER_WEAPONS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GRAB_CATALINA_HELI, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_AREA_OF_CARS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_ROTATING_GARAGE_DOOR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_SPHERE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_REMOVE_SPHERE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CATALINA_HELI_FLY_AWAY, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_EVERYONE_IGNORE_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_STORE_CAR_CHAR_IS_IN_NO_SAVE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_STORE_CAR_PLAYER_IS_IN_NO_SAVE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PHONE_DISPLAYING_MESSAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_DISPLAY_ONSCREEN_TIMER_WITH_STRING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DISPLAY_ONSCREEN_COUNTER_WITH_STRING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_RANDOM_CAR_FOR_CAR_PARK, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_COLLISION_IN_MEMORY, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_WANTED_MULTIPLIER, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAMERA_IN_FRONT_OF_PLAYER, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_VISIBLY_DAMAGED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_DOES_OBJECT_EXIST, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOAD_SCENE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_STUCK_CAR_CHECK, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REMOVE_STUCK_CAR_CHECK, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_STUCK, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOAD_MISSION_AUDIO, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_MISSION_AUDIO_LOADED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_PLAY_MISSION_AUDIO, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_MISSION_AUDIO_FINISHED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_IMPORT_GARAGE_SLOT_BEEN_FILLED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_THIS_PRINT, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_THIS_BIG_PRINT, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_MISSION_AUDIO_POSITION, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ACTIVATE_SAVE_MENU, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_SAVE_GAME_FINISHED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_NO_SPECIAL_CAMERA_FOR_THIS_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_PICKUP_OLD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_BLIP_FOR_PICKUP, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_ADD_SPRITE_BLIP_FOR_PICKUP, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PED_DENSITY_MULTIPLIER, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_FORCE_RANDOM_PED_TYPE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TEXT_DRAW_BEFORE_FADE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_COLLECTABLE1S_COLLECTED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_EL_BURRO_TIME, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_SPRITES_DRAW_BEFORE_FADE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TEXT_RIGHT_JUSTIFY, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PRINT_HELP, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_HELP, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_FLASH_HUD_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_FLASH_RADAR_BLIP, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_IN_CONTROL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_GENERATE_CARS_AROUND_CAMERA, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_SMALL_PRINTS, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_HAS_MILITARY_CRANE_COLLECTED_ALL_CARS, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_UPSIDEDOWN_CAR_NOT_DAMAGED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CAN_PLAYER_START_MISSION, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_MAKE_PLAYER_SAFE_FOR_CUTSCENE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_USE_TEXT_COMMANDS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_THREAT_FOR_PED_TYPE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_THREAT_FOR_PED_TYPE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CAR_COLOURS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_ALL_CARS_CAN_BE_DAMAGED, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_CAN_BE_DAMAGED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_MAKE_PLAYER_UNSAFE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_LOAD_COLLISION, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_BODY_CAST_HEALTH, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHARS_CHATTING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_MAKE_PLAYER_SAFE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_STAYS_IN_CURRENT_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_STAYS_IN_CURRENT_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_4X4_ONE_TIME, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_4X4_TWO_TIME, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_4X4_THREE_TIME, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_4X4_MAYHEM_TIME, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_LIFE_SAVED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_CRIMINAL_CAUGHT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_AMBULANCE_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_FIRE_EXTINGUISHED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_TURN_PHONE_ON, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_LONGEST_DODO_FLIGHT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_DEFUSE_BOMB_TIME, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TOTAL_NUMBER_OF_KILL_FRENZIES, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_BLOW_UP_RC_BUGGY, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REMOVE_CAR_FROM_CHASE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_FRENCH_GAME, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_GERMAN_GAME, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_MISSION_AUDIO, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_FADE_IN_AFTER_NEXT_ARREST, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_FADE_IN_AFTER_NEXT_DEATH, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_GANG_PED_MODEL_PREFERENCE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_USE_PEDNODE_SEEK, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SWITCH_VEHICLE_WEAPONS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_GET_OUT_OF_JAIL_FREE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_FREE_HEALTH_CARE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_DOOR_CLOSED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOAD_AND_LAUNCH_MISSION, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_LOAD_AND_LAUNCH_MISSION_INTERNAL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_OBJECT_DRAW_LAST, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_AMMO_IN_PLAYER_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_AMMO_IN_CHAR_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_KILL_FRENZY_PASSED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_SAY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_NEAR_CLIP, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_RADIO_CHANNEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_OVERRIDE_HOSPITAL_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_OVERRIDE_POLICE_STATION_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_FORCE_RAIN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DOES_GARAGE_CONTAIN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_TRACTION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ARE_MEASUREMENTS_IN_METRES, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_CONVERT_METRES_TO_FEET, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_MARK_ROADS_BETWEEN_LEVELS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_MARK_PED_ROADS_BETWEEN_LEVELS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_AVOID_LEVEL_TRANSITIONS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_AVOID_LEVEL_TRANSITIONS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_THREAT_FOR_PED_TYPE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_AREA_OF_CHARS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_TOTAL_NUMBER_OF_MISSIONS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CONVERT_METRES_TO_FEET_INT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_FASTEST_TIME, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_REGISTER_HIGHEST_SCORE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_WARP_CHAR_INTO_CAR_AS_PASSENGER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CAR_PASSENGER_SEAT_FREE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CHAR_IN_CAR_PASSENGER_SEAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_IS_CHRIS_CRIMINAL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_START_CREDITS, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_STOP_CREDITS, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ARE_CREDITS_FINISHED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_SINGLE_PARTICLE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_IGNORE_LEVEL_TRANSITIONS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CHASE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_START_BOAT_FOAM_ANIMATION, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_UPDATE_BOAT_FOAM_ANIMATION, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_MUSIC_DOES_FADE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_INTRO_IS_PLAYING, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PLAYER_HOOKER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PLAY_END_OF_GAME_TUNE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_STOP_END_OF_GAME_TUNE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CAR_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_SITTING_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_SITTING_IN_ANY_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_SCRIPT_FIRE_AUDIO, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ARE_ANY_CAR_CHEATS_ACTIVATED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_SUFFERS_CRITICAL_HITS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_LIFTING_A_PHONE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_SITTING_IN_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_SITTING_IN_ANY_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_ON_FOOT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOAD_COLLISION_WITH_SCREEN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_LOAD_SPLASH_SCREEN, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_IGNORE_LEVEL_TRANSITIONS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_MAKE_CRAIGS_CAR_A_BIT_STRONGER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_JAMES_CAR_ON_PATH_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_LOAD_END_OF_GAME_TUNE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_ENABLE_PLAYER_CONTROL_CAMERA, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), +#ifndef GTA_PS2 + REGISTER_COMMAND(COMMAND_SET_OBJECT_ROTATION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_DEBUG_CAMERA_COORDINATES, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_DEBUG_CAMERA_FRONT_VECTOR, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_TARGETTING_ANY_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_TARGETTING_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_TARGETTING_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, INPUT_ARGUMENTS(ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DISPLAY_TEXT_WITH_NUMBER, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_STRING, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DISPLAY_TEXT_WITH_2_NUMBERS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_FAIL_CURRENT_MISSION, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CLOSEST_OBJECT_OF_TYPE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_PLACE_OBJECT_RELATIVE_TO_OBJECT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_ALL_OCCUPANTS_OF_CAR_LEAVE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_INTERPOLATION_PARAMETERS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING_TOWARDS_POINT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING_AWAY_POINT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_DEBUG_CAMERA_POINT_AT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_ATTACH_CHAR_TO_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DETACH_CHAR_FROM_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_CHANGE_LANE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_CHAR_LAST_WEAPON_DAMAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CLEAR_CAR_LAST_WEAPON_DAMAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_RANDOM_COP_IN_AREA, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_RANDOM_COP_IN_ZONE, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FLEE_CAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_DRIVER_OF_CAR, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_NUMBER_OF_FOLLOWERS, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GIVE_REMOTE_CONTROLLED_MODEL_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CURRENT_PLAYER_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_CURRENT_CHAR_WEAPON, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ANY_MEANS_OBJECT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ON_FOOT_OBJECT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_IN_CAR_OBJECT_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ANY_MEANS_OBJECT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_ON_FOOT_OBJECT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_CHAR_IN_CAR_OBJECT_3D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_HANDBRAKE_TURN_LEFT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_HANDBRAKE_TURN_RIGHT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_HANDBRAKE_STOP, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_ON_ANY_BIKE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_SNIPER_BULLET_2D, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_LOCATE_SNIPER_BULLET_3D, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GET_NUMBER_OF_SEATS_IN_MODEL, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), + REGISTER_COMMAND(COMMAND_IS_PLAYER_ON_ANY_BIKE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_IS_CHAR_LYING_DOWN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_CAN_CHAR_SEE_DEAD_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_SET_ENTER_CAR_RANGE_MULTIPLIER, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), +#ifndef GTA3_1_1_PATCH + REGISTER_COMMAND(COMMAND_SET_THREAT_REACTION_RANGE_MULTIPLIER, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), +#endif +#endif +}; +#undef REGISTER_COMMAND +#undef INPUT_ARGUMENTS +#undef OUTPUT_ARGUMENTS + +static_assert(ARRAY_SIZE(commands) == LAST_SCRIPT_COMMAND, "commands array not filled"); + +#if SCRIPT_LOG_FILE_LEVEL == 1 || SCRIPT_LOG_FILE_LEVEL == 2 +static int dbg_log; +#endif + +static void PrintToLog(const char* format, ...) +{ + va_list va; + va_start(va, format); + char tmp[1024]; +#ifdef _WIN32 + vsprintf_s(tmp, 1024, format, va); +#else + vsprintf(re3_buff, format, va); +#endif + va_end(va); + + printf("%s", tmp); +#if SCRIPT_LOG_FILE_LEVEL == 1 || SCRIPT_LOG_FILE_LEVEL == 2 + CFileMgr::Write(dbg_log, tmp, strlen(tmp)); +#endif +} +#endif + const uint32 CRunningScript::nSaveStructSize = #ifdef COMPATIBLE_SAVES @@ -459,6 +1658,68 @@ void CRunningScript::CollectParameters(uint32* pIp, int16 total) } } +#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT +int CRunningScript::CollectParameterForDebug(char* buf, bool& var) +{ + float tmp; + uint16 varIndex; + char tmpstr[24]; + var = false; + switch (CTheScripts::Read1ByteFromScript(&m_nIp)) + { + case ARGUMENT_INT32: + return CTheScripts::Read4BytesFromScript(&m_nIp); + case ARGUMENT_GLOBALVAR: + varIndex = CTheScripts::Read2BytesFromScript(&m_nIp); + assert(varIndex >= 8 && varIndex < CTheScripts::GetSizeOfVariableSpace()); + var = true; + sprintf(tmpstr, " $%d", varIndex / 4); + strcat(buf, tmpstr); + return *((int32*)&CTheScripts::ScriptSpace[varIndex]); + case ARGUMENT_LOCALVAR: + varIndex = CTheScripts::Read2BytesFromScript(&m_nIp); + assert(varIndex >= 0 && varIndex < ARRAY_SIZE(m_anLocalVariables)); + var = true; + sprintf(tmpstr, " %d@", varIndex); + strcat(buf, tmpstr); + return m_anLocalVariables[varIndex]; + case ARGUMENT_INT8: + return CTheScripts::Read1ByteFromScript(&m_nIp); + case ARGUMENT_INT16: + return CTheScripts::Read2BytesFromScript(&m_nIp); + case ARGUMENT_FLOAT: + tmp = CTheScripts::ReadFloatFromScript(&m_nIp); + return *(int32*)&tmp; + default: + PrintToLog("%s - assertion failed in CollectParameterForDebug", buf); + assert(0); + break; + } + return 0; +} + +void CRunningScript::GetStoredParameterForDebug(char* buf) +{ + uint16 varIndex; + char tmpstr[24]; + switch (CTheScripts::Read1ByteFromScript(&m_nIp)) { + case ARGUMENT_GLOBALVAR: + varIndex = CTheScripts::Read2BytesFromScript(&m_nIp); + sprintf(tmpstr, " $%d", varIndex / 4); + strcat(buf, tmpstr); + break; + case ARGUMENT_LOCALVAR: + varIndex = CTheScripts::Read2BytesFromScript(&m_nIp); + sprintf(tmpstr, " %d@", varIndex); + strcat(buf, tmpstr); + break; + default: + PrintToLog("%s - assertion failed in GetStoredParameterForDebug", buf); + assert(0); + } +} +#endif + int32 CRunningScript::CollectNextParameterWithoutIncreasingPC(uint32 ip) { uint32* pIp = &ip; @@ -644,6 +1905,14 @@ void CTheScripts::Init() } for (int i = 0; i < MAX_NUM_INVISIBILITY_SETTINGS; i++) InvisibilitySettingArray[i] = nil; + +#if defined USE_ADVANCED_SCRIPT_DEBUG_OUTPUT && SCRIPT_LOG_FILE_LEVEL == 2 + CFileMgr::SetDirMyDocuments(); + dbg_log = CFileMgr::OpenFileForWriting("SCRDBG.LOG"); + static const char* init_msg = "Starting debug script log\n\n"; + PrintToLog(init_msg); + CFileMgr::SetDir("\\"); +#endif } void CRunningScript::RemoveScriptFromList(CRunningScript** ppScript) @@ -680,6 +1949,17 @@ void CTheScripts::Process() { if (CReplay::IsPlayingBack()) return; +#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT +#if SCRIPT_LOG_FILE_LEVEL == 1 + CFileMgr::SetDirMyDocuments(); + dbg_log = CFileMgr::OpenFileForWriting("SCRDBG.LOG"); + static const char* init_msg = "Starting debug script log\n\n"; + PrintToLog(init_msg); + CFileMgr::SetDir("\\"); +#endif + PrintToLog("------------------------\n"); + PrintToLog("CTheScripts::Process started, CTimer::GetTimeInMilliseconds == %u\n", CTimer::GetTimeInMilliseconds()); +#endif CommandsExecuted = 0; ScriptsUpdated = 0; float timeStep = CTimer::GetTimeStepInMilliseconds(); @@ -748,6 +2028,12 @@ void CTheScripts::Process() script = next; } DbgFlag = false; +#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT + PrintToLog("Script processing done, ScriptsUpdated: %d, CommandsExecuted: %d\n", ScriptsUpdated, CommandsExecuted); +#if SCRIPT_LOG_FILE_LEVEL == 1 + CFileMgr::CloseFile(dbg_log); +#endif +#endif } CRunningScript* CTheScripts::StartTestScript() @@ -762,6 +2048,9 @@ bool CTheScripts::IsPlayerOnAMission() void CRunningScript::Process() { +#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT + PrintToLog("\n\nProcessing script %s (id %d)\n\n", m_abScriptName, this - CTheScripts::ScriptsArray); +#endif if (m_bIsMissionScript) DoDeatharrestCheck(); if (m_bMissionFlag && CTheScripts::FailCurrentMission == 1 && m_nStackPointer == 1) @@ -786,40 +2075,114 @@ void CRunningScript::Process() int8 CRunningScript::ProcessOneCommand() { + int8 retval = -1; ++CTheScripts::CommandsExecuted; int32 command = CTheScripts::Read2BytesFromScript(&m_nIp); m_bNotFlag = (command & 0x8000); command &= 0x7FFF; - if (command < 100) - return ProcessCommands0To99(command); - if (command < 200) - return ProcessCommands100To199(command); - if (command < 300) - return ProcessCommands200To299(command); - if (command < 400) - return ProcessCommands300To399(command); - if (command < 500) - return ProcessCommands400To499(command); - if (command < 600) - return ProcessCommands500To599(command); - if (command < 700) - return ProcessCommands600To699(command); - if (command < 800) - return ProcessCommands700To799(command); - if (command < 900) - return ProcessCommands800To899(command); - if (command < 1000) - return ProcessCommands900To999(command); -#ifdef GTA_PS2 - if (command < 1200) - return ProcessCommands1000To1099(command); -#else - if (command < 1100) - return ProcessCommands1000To1099(command); - if (command < 1200) - return ProcessCommands1100To1199(command); +#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT + char commandInfo[128]; + uint32 ip = m_nIp; + if (command < ARRAY_SIZE(commands)) { + assert(commands[command].id == command); + sprintf(commandInfo, m_nIp >= SIZE_MAIN_SCRIPT ? "M<%5d> " : "<%6d> ", m_nIp >= SIZE_MAIN_SCRIPT ? m_nIp - SIZE_MAIN_SCRIPT : m_nIp); + if (m_bNotFlag) + strcat(commandInfo, "NOT "); + if (commands[command].position == -1) + strcat(commandInfo, commands[command].name + sizeof("COMMAND_") - 1); + for (int i = 0; commands[command].input[i] != ARGTYPE_NONE; i++) { + char tmp[16]; + bool var = false; + int value; + switch (commands[command].input[i]) { + case ARGTYPE_INT: + case ARGTYPE_PED_HANDLE: + case ARGTYPE_VEHICLE_HANDLE: + case ARGTYPE_OBJECT_HANDLE: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%d)" : " %d", value); break; + case ARGTYPE_FLOAT: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%.3f)" : " %.3f", *(float*)&value); break; + case ARGTYPE_STRING: sprintf(tmp, " '%s'", (const char*)&CTheScripts::ScriptSpace[m_nIp]); m_nIp += KEY_LENGTH_IN_SCRIPT; break; + case ARGTYPE_LABEL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s(%d))" : " %s(%d)", value >= 0 ? "G" : "L", abs(value)); break; + case ARGTYPE_BOOL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s)" : " %s", value ? "TRUE" : "FALSE"); break; + case ARGTYPE_ANDOR: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, " %d %ss", (value + 1) % 10, value / 10 == 0 ? "AND" : "OR"); break; + default: assert(0); + } + strcat(commandInfo, tmp); + if (commands[command].position == i) + strcat(commandInfo, commands[command].name_override); + } + uint32 t = m_nIp; + m_nIp = ip; + ip = t; + } #endif - return -1; + if (command < 100) + retval = ProcessCommands0To99(command); + else if (command < 200) + retval = ProcessCommands100To199(command); + else if (command < 300) + retval = ProcessCommands200To299(command); + else if (command < 400) + retval = ProcessCommands300To399(command); + else if (command < 500) + retval = ProcessCommands400To499(command); + else if (command < 600) + retval = ProcessCommands500To599(command); + else if (command < 700) + retval = ProcessCommands600To699(command); + else if (command < 800) + retval = ProcessCommands700To799(command); + else if (command < 900) + retval = ProcessCommands800To899(command); + else if (command < 1000) + retval = ProcessCommands900To999(command); +#ifdef GTA_PS2 + else if (command < 1200) + retval = ProcessCommands1000To1099(command); +#else + else if (command < 1100) + retval = ProcessCommands1000To1099(command); + else if (command < 1200) + retval = ProcessCommands1100To1199(command); +#endif +#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT + if (command < ARRAY_SIZE(commands)) { + if (commands[command].cond || commands[command].output[0] != ARGTYPE_NONE) { + strcat(commandInfo, " ->"); + if (commands[command].cond) + strcat(commandInfo, m_bCondResult ? " TRUE" : " FALSE"); + uint32 t = m_nIp; + m_nIp = ip; + ip = t; + for (int i = 0; commands[command].output[i] != ARGTYPE_NONE; i++) { + char tmp[16]; + switch (commands[command].output[i]) { + case ARGTYPE_INT: + case ARGTYPE_PED_HANDLE: + case ARGTYPE_VEHICLE_HANDLE: + case ARGTYPE_OBJECT_HANDLE: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%d)", ScriptParams[i]); strcat(commandInfo, tmp); break; + case ARGTYPE_FLOAT: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%8.3f)", *(float*)&ScriptParams[i]); strcat(commandInfo, tmp); break; + default: assert(0 && "Script only returns INTs and FLOATs"); + } + } + m_nIp = ip; + } + PrintToLog("%s\n", commandInfo); + if (m_bMissionFlag) { + for (int i = 0; commandInfo[i]; i++) { + if (commandInfo[i] == '_') + commandInfo[i] = ' '; + } + CDebug::DebugAddText(commandInfo); + } + } +#else + if (m_bMissionFlag) { + char tmp[128]; + sprintf(tmp, "Comm %d Cmp %d", command, m_bCondResult); + CDebug::DebugAddText(tmp); + } +#endif + return retval; } int8 CRunningScript::ProcessCommands0To99(int32 command) @@ -11261,6 +12624,19 @@ int16 CRunningScript::GetPadState(uint16 pad, uint16 button) return 0; } +void CTheScripts::PrintListSizes() +{ + int active = 0; + int idle = 0; + + for (CRunningScript* pScript = pActiveScripts; pScript; pScript = pScript->GetNext()) + active++; + for (CRunningScript* pScript = pIdleScripts; pScript; pScript = pScript->GetNext()) + idle++; + + debug("active: %d, idle: %d", active, idle); +} + uint32 DbgLineColour = 0x0000FFFF; // r = 0, g = 0, b = 255, a = 255 void CTheScripts::DrawDebugSquare(float infX, float infY, float supX, float supY) diff --git a/src/control/Script.h b/src/control/Script.h index 7964ec6c..9c4b2b6c 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -350,6 +350,7 @@ private: static bool IsPlayerStopped(CPlayerInfo*); static bool IsVehicleStopped(CVehicle*); + static void PrintListSizes(); static void ReadObjectNamesFromScript(); static void UpdateObjectIndices(); static void ReadMultiScriptFileOffsetsFromScript(); @@ -486,6 +487,11 @@ private: bool CanAllowMissionReplay(); #endif +#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT + int CollectParameterForDebug(char* buf, bool& var); + void GetStoredParameterForDebug(char* buf); +#endif + float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; } bool ThisIsAValidRandomPed(uint32 pedtype) { diff --git a/src/control/ScriptCommands.h b/src/control/ScriptCommands.h index 77cf3f0f..56908edb 100644 --- a/src/control/ScriptCommands.h +++ b/src/control/ScriptCommands.h @@ -1157,7 +1157,38 @@ enum { COMMAND_CAN_CHAR_SEE_DEAD_CHAR, COMMAND_SET_ENTER_CAR_RANGE_MULTIPLIER, #ifndef GTA3_1_1_PATCH - COMMAND_SET_THREAT_REACTION_RANGE_MULTIPLIER + COMMAND_SET_THREAT_REACTION_RANGE_MULTIPLIER, +#endif +#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT + LAST_SCRIPT_COMMAND #endif #endif -}; \ No newline at end of file +}; + +#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT + +enum eScriptArgument +{ + ARGTYPE_NONE = 0, + ARGTYPE_INT, + ARGTYPE_FLOAT, + ARGTYPE_STRING, + ARGTYPE_LABEL, + ARGTYPE_BOOL, + ARGTYPE_PED_HANDLE, + ARGTYPE_VEHICLE_HANDLE, + ARGTYPE_OBJECT_HANDLE, + ARGTYPE_ANDOR +}; + +struct tScriptCommandData +{ + int id; + const char name[64]; + eScriptArgument input[18]; + eScriptArgument output[18]; + bool cond; + int position; + const char name_override[8]; +}; +#endif \ No newline at end of file diff --git a/src/core/config.h b/src/core/config.h index 6835267d..f7efe694 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -233,6 +233,8 @@ enum Config { #define USE_PRECISE_MEASUREMENT_CONVERTION // makes game convert feet to meeters more precisely #define MISSION_REPLAY // mobile feature //#define SIMPLIER_MISSIONS // apply simplifications from mobile +#define USE_ADVANCED_SCRIPT_DEBUG_OUTPUT +#define SCRIPT_LOG_FILE_LEVEL 1 // 0 == no log, 1 == overwrite every frame, 2 == full log // Replay //#define DONT_FIX_REPLAY_BUGS // keeps various bugs in CReplay, some of which are fairly cool! From 0ab44964235f426601ebdf1592a7d41e517c3203 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 21 Jun 2020 13:51:20 +0300 Subject: [PATCH 125/133] copypaste --- src/control/Script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 4eb72915..98cd6369 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1350,7 +1350,7 @@ static void PrintToLog(const char* format, ...) #ifdef _WIN32 vsprintf_s(tmp, 1024, format, va); #else - vsprintf(re3_buff, format, va); + vsprintf(tmp, format, va); #endif va_end(va); From 3859efff42cc4399932e4b5e24bb6660c3b5e06f Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 21 Jun 2020 14:41:39 +0200 Subject: [PATCH 126/133] ps2 cam transitions done (hopefully) --- src/core/Cam.cpp | 2 +- src/core/Camera.cpp | 87 +++++++++++++++++++++++++++++++++++++++------ 2 files changed, 78 insertions(+), 11 deletions(-) diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 6ce3bcb9..ede5741e 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -3834,7 +3834,7 @@ CCam::Process_Debug(const CVector&, float, float, float) Source.y += 1.0f; GetVectorsReadyForRW(); -// CPad::GetPad(0)->DisablePlayerControls = PLAYERCONTROL_DISABLED_1; + CPad::GetPad(0)->DisablePlayerControls = PLAYERCONTROL_DISABLED_1; if(CPad::GetPad(1)->GetLeftShockJustDown() && gbBigWhiteDebugLightSwitchedOn) CShadows::StoreShadowToBeRendered(SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &Source, diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index f5497b95..af62e180 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -618,7 +618,7 @@ CCamera::Process(void) CamUp = Cams[ActiveCam].Up; FOV = Cams[ActiveCam].FOV; } - WasPreviouslyInterSyhonFollowPed = false; // unused + WasPreviouslyInterSyhonFollowPed = false; // only used on PS2 } if(m_uiTransitionState != 0) @@ -717,7 +717,7 @@ CCamera::Process(void) } m_PreviousCameraPosition = GetPosition(); - // PS2: something going on with forward vector here + // PS2 normalizes a CVector2D GetForward() here. is it used anywhere? if(Cams[ActiveCam].DirectionWasLooking != LOOKING_FORWARD && Cams[ActiveCam].Mode != CCam::MODE_TOP_DOWN_PED){ Cams[ActiveCam].Source = Cams[ActiveCam].SourceBeforeLookBehind; @@ -1366,6 +1366,7 @@ CCamera::CamControl(void) // Restore with a jump cut if(m_bRestoreByJumpCut){ + // PS2 just sets m_bCamDirectlyBehind here if(ReqMode != CCam::MODE_FOLLOWPED && ReqMode != CCam::MODE_M16_1STPERSON && ReqMode != CCam::MODE_SNIPER && @@ -1381,6 +1382,7 @@ CCamera::CamControl(void) Cams[ActiveCam].CamTargetEntity = pTargetEntity; Cams[ActiveCam].m_cvecCamFixedModeSource = m_vecFixedModeSource; Cams[ActiveCam].m_cvecCamFixedModeUpOffSet = m_vecFixedModeUpOffSet; + // PS2 sets this to m_bLookingAtVector Cams[ActiveCam].m_bCamLookingAtVector = false; Cams[ActiveCam].m_vecLastAboveWaterCamPosition = Cams[(ActiveCam+1)%2].m_vecLastAboveWaterCamPosition; m_bRestoreByJumpCut = false; @@ -1519,7 +1521,7 @@ CCamera::CamControl(void) switchByJumpCut = true; if(Cams[ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){ CVector front = Cams[ActiveCam].Source - FindPlayerPed()->GetPosition(); - front.z = 0.0f; + front.z = 0.0f; // missing on PS2 front.Normalise(); #ifdef FIX_BUGS // this is almost as bad as the bugged code @@ -1556,6 +1558,7 @@ CCamera::CamControl(void) if((m_uiTransitionState == 0 || switchByJumpCut) && ReqMode != Cams[ActiveCam].Mode){ if(switchByJumpCut){ + // PS2 just sets m_bCamDirectlyBehind here if(!m_bPlayerIsInGarage || m_bJustCameOutOfGarage){ if(ReqMode != CCam::MODE_FOLLOWPED && ReqMode != CCam::MODE_M16_1STPERSON && @@ -1594,6 +1597,8 @@ CCamera::CamControl(void) if(ReqMode == CCam::MODE_FOLLOWPED && Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM) startTransition = false; +#ifndef PS2_CAM_TRANSITION + // done in Process on PS2 if(!m_bWaitForInterpolToFinish && m_bLookingAtPlayer && m_uiTransitionState != 0){ CVector playerDist; playerDist.x = FindPlayerPed()->GetPosition().x - GetPosition().x; @@ -1606,6 +1611,7 @@ CCamera::CamControl(void) m_bWaitForInterpolToFinish = true; } } +#endif if(m_bWaitForInterpolToFinish) startTransition = false; @@ -1615,10 +1621,14 @@ CCamera::CamControl(void) Cams[ActiveCam].CamTargetEntity->RegisterReference(&Cams[ActiveCam].CamTargetEntity); } }else if(ReqMode == CCam::MODE_FIXED && pTargetEntity != Cams[ActiveCam].CamTargetEntity && m_bPlayerIsInGarage){ +#ifdef PS2_CAM_TRANSITION + StartTransitionWhenNotFinishedInter(ReqMode); +#else if(m_uiTransitionState != 0) StartTransitionWhenNotFinishedInter(ReqMode); else StartTransition(ReqMode); +#endif pTargetEntity->RegisterReference(&pTargetEntity); Cams[ActiveCam].CamTargetEntity->RegisterReference(&Cams[ActiveCam].CamTargetEntity); } @@ -2004,7 +2014,7 @@ CCamera::SetCamPositionForFixedMode(const CVector &Source, const CVector &UpOffS /* - * On PS2 the transition happens between Cams[1] and Cams[2]. + * On PS2 the transition happens between Cams[0] and Cams[1]. * On PC the whole system has been changed. */ void @@ -2042,8 +2052,10 @@ CCamera::StartTransition(int16 newMode) switchSyphonMode = true; if(Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM && newMode == CCam::MODE_FOLLOWPED) switchFromFight = true; +#ifndef PS2_CAM_TRANSITION if(Cams[ActiveCam].Mode == CCam::MODE_FIXED) switchFromFixed = true; +#endif m_bUseTransitionBeta = false; @@ -2097,12 +2109,27 @@ CCamera::StartTransition(int16 newMode) switch(newMode){ case CCam::MODE_BEHINDCAR: +#ifdef PS2_CAM_TRANSITION + Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source; + Cams[ActiveCam].Beta = Cams[(ActiveCam+1)%2].Beta; +#endif + Cams[ActiveCam].BetaSpeed = 0.0f; + break; + + case CCam::MODE_BEHINDBOAT: +#ifdef PS2_CAM_TRANSITION + Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source; + Cams[ActiveCam].Beta = Cams[(ActiveCam+1)%2].Beta; +#endif Cams[ActiveCam].BetaSpeed = 0.0f; break; case CCam::MODE_FOLLOWPED: // Getting out of vehicle normally betaOffset = DEGTORAD(55.0f); +#ifdef PS2_CAM_TRANSITION + Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source; +#endif if(m_bJustCameOutOfGarage){ m_bUseTransitionBeta = true; /* @@ -2116,13 +2143,21 @@ CCamera::StartTransition(int16 newMode) */ // this is better: if(Cams[ActiveCam].Front.x != 0.0f || Cams[ActiveCam].Front.y != 0.0f) +#ifdef PS2_CAM_TRANSITION + Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[(ActiveCam+1)%2].Front.x, Cams[(ActiveCam+1)%2].Front.y) + PI; +#else Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y) + PI; +#endif else Cams[ActiveCam].m_fTransitionBeta = 0.0f; } if(m_bTargetJustCameOffTrain) m_bCamDirectlyInFront = true; +#ifdef PS2_CAM_TRANSITION + if(Cams[(ActiveCam+1)%2].Mode != CCam::MODE_CAM_ON_A_STRING) +#else if(Cams[ActiveCam].Mode != CCam::MODE_CAM_ON_A_STRING) +#endif break; m_bUseTransitionBeta = true; vehicleVertical = false; @@ -2134,7 +2169,11 @@ CCamera::StartTransition(int16 newMode) Cams[ActiveCam].m_fTransitionBeta = 0.0f; break; } +#ifdef PS2_CAM_TRANSITION + camBeta = CGeneral::GetATanOfXY(Cams[(ActiveCam+1)%2].Front.x, Cams[(ActiveCam+1)%2].Front.y); +#else camBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y); +#endif if(((CPed*)pTargetEntity)->m_carInObjective) targetBeta = CGeneral::GetATanOfXY(((CPed*)pTargetEntity)->m_carInObjective->GetForward().x, ((CPed*)pTargetEntity)->m_carInObjective->GetForward().y); else @@ -2190,6 +2229,10 @@ CCamera::StartTransition(int16 newMode) break; case CCam::MODE_SYPHON: +#ifdef PS2_CAM_TRANSITION + Cams[ActiveCam].Beta = Cams[(ActiveCam+1)%2].Beta; + Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source; +#endif Cams[ActiveCam].Alpha = 0.0f; Cams[ActiveCam].AlphaSpeed = 0.0f; break; @@ -2197,20 +2240,29 @@ CCamera::StartTransition(int16 newMode) case CCam::MODE_CAM_ON_A_STRING: // Get into vehicle betaOffset = DEGTORAD(57.0f); +#ifdef PS2_CAM_TRANSITION + Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source; +#endif if(!m_bLookingAtPlayer || m_bJustCameOutOfGarage) break; m_bUseTransitionBeta = true; targetBeta = CGeneral::GetATanOfXY(pTargetEntity->GetForward().x, pTargetEntity->GetForward().y); +#ifdef PS2_CAM_TRANSITION + camBeta = CGeneral::GetATanOfXY(Cams[(ActiveCam+1)%2].Front.x, Cams[(ActiveCam+1)%2].Front.y); +#else camBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y); +#endif deltaBeta = targetBeta - camBeta; while(deltaBeta >= PI) deltaBeta -= 2*PI; while(deltaBeta < -PI) deltaBeta += 2*PI; deltaBeta = Abs(deltaBeta); - // switchFromFixed logic again here, skipped +#ifndef PS2_CAM_TRANSITION + switchFromFixed = Cams[ActiveCam].Mode == CCam::MODE_FIXED; if(switchFromFixed){ Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y); break; } +#endif door = FindPlayerPed()->m_vehEnterType; if(deltaBeta > HALFPI){ @@ -2238,15 +2290,23 @@ CCamera::StartTransition(int16 newMode) } break; - case CCam::MODE_BEHINDBOAT: - Cams[ActiveCam].BetaSpeed = 0.0f; - break; - case CCam::MODE_PED_DEAD_BABY: +#ifdef PS2_CAM_TRANSITION + Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source; +#endif Cams[ActiveCam].Alpha = DEGTORAD(15.0f); break; +#ifdef PS2_CAM_TRANSITION + case CCam::MODE_PLAYER_FALLEN_WATER: + Cams[ActiveCam].m_vecLastAboveWaterCamPosition = Cams[(ActiveCam+1)%2].m_vecLastAboveWaterCamPosition; + break; +#endif + case CCam::MODE_FIGHT_CAM: +#ifdef PS2_CAM_TRANSITION + Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source; +#endif Cams[ActiveCam].Beta = 0.0f; Cams[ActiveCam].BetaSpeed = 0.0f; Cams[ActiveCam].Alpha = 0.0f; @@ -2254,6 +2314,7 @@ CCamera::StartTransition(int16 newMode) break; } +#ifndef PS2_CAM_TRANSITION Cams[ActiveCam].Init(); Cams[ActiveCam].Mode = newMode; @@ -2262,7 +2323,6 @@ CCamera::StartTransition(int16 newMode) m_uiTransitionDuration = 1800; else if(switchFromFight) m_uiTransitionDuration = 750; -#ifndef PS2_CAM_TRANSITION else if(switchPedToCar){ m_fFractionInterToStopMoving = 0.2f; m_fFractionInterToStopCatchUp = 0.8f; @@ -2276,6 +2336,13 @@ CCamera::StartTransition(int16 newMode) m_uiTransitionDuration = 1; }else m_uiTransitionDuration = 1350; // already set above +#else + if(switchSyphonMode) + m_uiTransitionDuration = 1800; + else if(switchFromFight) + m_uiTransitionDuration = 750; + else + m_uiTransitionDuration = 1350; #endif m_uiTransitionState = 1; m_uiTimeTransitionStart = CTimer::GetTimeInMilliseconds(); From 98baa36f1a83362a67c46c2eb75539876b64b5b9 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 21 Jun 2020 14:50:00 +0200 Subject: [PATCH 127/133] FOV fix --- src/core/Camera.cpp | 2 +- src/core/common.h | 2 +- src/render/Draw.cpp | 6 +++--- src/render/Draw.h | 12 +++++++++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index af62e180..785a9d12 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -3561,7 +3561,7 @@ CCamera::CalculateDerivedValues(void) { m_cameraMatrix = Invert(m_matrix); - float hfov = DEGTORAD(CDraw::GetFOV()/2.0f); + float hfov = DEGTORAD(CDraw::GetScaledFOV()/2.0f); float c = cos(hfov); float s = sin(hfov); diff --git a/src/core/common.h b/src/core/common.h index ff1feb5c..196c3cd7 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -111,7 +111,7 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w) #define SCREEN_WIDTH ((float)RsGlobal.width) #define SCREEN_HEIGHT ((float)RsGlobal.height) #define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio()) -#define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetFOV() * 0.5f))) +#define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetScaledFOV() * 0.5f))) // This scales from PS2 pixel coordinates to the real resolution #define SCREEN_STRETCH_X(a) ((a) * (float) SCREEN_WIDTH / DEFAULT_SCREEN_WIDTH) diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp index b31cc624..bb37a3a3 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -6,6 +6,7 @@ #ifdef ASPECT_RATIO_SCALE float CDraw::ms_fAspectRatio = DEFAULT_ASPECT_RATIO; +float CDraw::ms_fScaledFOV = 45.0f; #endif float CDraw::ms_fNearClipZ; @@ -61,8 +62,7 @@ void CDraw::SetFOV(float fov) { #ifdef ASPECT_RATIO_SCALE - ms_fFOV = ConvertFOV(fov); -#else - ms_fFOV = fov; + ms_fScaledFOV = ConvertFOV(fov); #endif + ms_fFOV = fov; } diff --git a/src/render/Draw.h b/src/render/Draw.h index 55958a2a..5c4f95b1 100644 --- a/src/render/Draw.h +++ b/src/render/Draw.h @@ -16,14 +16,15 @@ private: static float ms_fNearClipZ; static float ms_fFarClipZ; static float ms_fFOV; -public: - static float ms_fLODDistance; // set but unused? - #ifdef ASPECT_RATIO_SCALE // we use this variable to scale a lot of 2D elements // so better cache it static float ms_fAspectRatio; + // similar thing for 3D rendering + static float ms_fScaledFOV; #endif +public: + static float ms_fLODDistance; // set but unused? static uint8 FadeValue; static uint8 FadeRed; @@ -37,6 +38,11 @@ public: static void SetFOV(float fov); static float GetFOV(void) { return ms_fFOV; } +#ifdef ASPECT_RATIO_SCALE + static float GetScaledFOV(void) { return ms_fScaledFOV; } +#else + static float GetScaledFOV(void) { return ms_fFOV; } +#endif static float FindAspectRatio(void); #ifdef ASPECT_RATIO_SCALE From 7a71a47f743b1496c069cf5c4f2765877aea412b Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 21 Jun 2020 16:00:17 +0300 Subject: [PATCH 128/133] updated player control names --- src/animation/CutsceneMgr.cpp | 4 ++-- src/control/Phones.cpp | 6 +++--- src/control/Script.cpp | 4 ++-- src/core/Cam.cpp | 6 +++++- src/core/Camera.cpp | 4 ++-- src/core/Pad.h | 14 +++++++------- src/core/PlayerInfo.cpp | 4 ++-- 7 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/animation/CutsceneMgr.cpp b/src/animation/CutsceneMgr.cpp index 230e22fb..9f76e7a1 100644 --- a/src/animation/CutsceneMgr.cpp +++ b/src/animation/CutsceneMgr.cpp @@ -230,7 +230,7 @@ CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName) pPlayerPed->m_pWanted->ClearQdCrimes(); pPlayerPed->bIsVisible = false; pPlayerPed->m_fCurrentStamina = pPlayerPed->m_fMaxStamina; - CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_80; + CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_CUTSCENE); CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(true); } @@ -365,7 +365,7 @@ CCutsceneMgr::DeleteCutsceneData(void) ms_loaded = false; FindPlayerPed()->bIsVisible = true; - CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_80; + CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CUTSCENE); CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false); if (CGeneral::faststricmp(ms_cutsceneName, "end")) { diff --git a/src/control/Phones.cpp b/src/control/Phones.cpp index 6fac3f9d..b89641f9 100644 --- a/src/control/Phones.cpp +++ b/src/control/Phones.cpp @@ -66,7 +66,7 @@ CPhoneInfo::Update(void) endAssoc->flags &= ~ASSOC_DELETEFADEDOUT; endAssoc->SetFinishCallback(PhonePutDownCB, player); } else { - CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_40; + CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PHONE); if (player->m_nPedState == PED_MAKE_CALL) player->m_nPedState = PED_IDLE; } @@ -116,7 +116,7 @@ CPhoneInfo::Update(void) player->m_fRotationDest = angleToFace; player->SetHeading(angleToFace); player->m_nPedState = PED_MAKE_CALL; - CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_40; + CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PHONE); TheCamera.SetWideScreenOn(); playerInfo->MakePlayerSafe(true); CAnimBlendAssociation *phonePickAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_PHONE_IN, 4.0f); @@ -340,7 +340,7 @@ PhonePutDownCB(CAnimBlendAssociation *assoc, void *arg) { assoc->flags |= ASSOC_DELETEFADEDOUT; assoc->blendDelta = -1000.0f; - CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_40; + CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PHONE); CPed *ped = (CPed*)arg; if (assoc->blendAmount > 0.5f) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 98cd6369..39f5a6d6 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -9958,7 +9958,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) SaveGameForPause(3); #endif CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]]; - CPad::GetPad(ScriptParams[0])->DisablePlayerControls |= PLAYERCONTROL_DISABLED_80; + CPad::GetPad(ScriptParams[0])->SetDisablePlayerControls(PLAYERCONTROL_CUTSCENE); pPlayerInfo->MakePlayerSafe(true); CCutsceneMgr::StartCutsceneProcessing(); return 0; @@ -10684,7 +10684,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) printf("End preload end of game audio\n"); return 0; case COMMAND_ENABLE_PLAYER_CONTROL_CAMERA: - CPad::GetPad(0)->DisablePlayerControls &= PLAYERCONTROL_DISABLED_1; + CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CAMERA); return 0; #ifndef GTA_PS2 // To be precise, on PS2 previous handlers were in 1000-1099 function diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index ede5741e..1194a12d 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -3834,7 +3834,11 @@ CCam::Process_Debug(const CVector&, float, float, float) Source.y += 1.0f; GetVectorsReadyForRW(); - CPad::GetPad(0)->DisablePlayerControls = PLAYERCONTROL_DISABLED_1; +#ifdef FIX_BUGS + CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_CAMERA); +#else + CPad::GetPad(0)->DisablePlayerControls = PLAYERCONTROL_CAMERA; +#endif if(CPad::GetPad(1)->GetLeftShockJustDown() && gbBigWhiteDebugLightSwitchedOn) CShadows::StoreShadowToBeRendered(SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &Source, diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index af62e180..f3f369f2 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -781,7 +781,7 @@ CCamera::CamControl(void) m_bFailedCullZoneTestPreviously = CCullZones::CamCloseInForPlayer(); if(m_bLookingAtPlayer){ - CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_1; + CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CAMERA); FindPlayerPed()->bIsVisible = true; } @@ -1049,7 +1049,7 @@ CCamera::CamControl(void) m_bFirstPersonBeingUsed = false; if(m_bFirstPersonBeingUsed){ ReqMode = CCam::MODE_1STPERSON; - CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_1; + CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_CAMERA); } // Zoom value diff --git a/src/core/Pad.h b/src/core/Pad.h index 1f29aa60..06bce073 100644 --- a/src/core/Pad.h +++ b/src/core/Pad.h @@ -2,14 +2,14 @@ enum { PLAYERCONTROL_ENABLED = 0, - PLAYERCONTROL_DISABLED_1 = 1, // used by first person camera - PLAYERCONTROL_DISABLED_2 = 2, + PLAYERCONTROL_CAMERA = 1, + PLAYERCONTROL_UNK2 = 2, PLAYERCONTROL_GARAGE = 4, - PLAYERCONTROL_DISABLED_8 = 8, - PLAYERCONTROL_DISABLED_10 = 16, - PLAYERCONTROL_DISABLED_20 = 32, // used on CPlayerInfo::MakePlayerSafe - PLAYERCONTROL_DISABLED_40 = 64, // used on phone calls - PLAYERCONTROL_DISABLED_80 = 128,// used on cutscenes + PLAYERCONTROL_UNK8 = 8, + PLAYERCONTROL_UNK10 = 16, + PLAYERCONTROL_PLAYERINFO = 32, + PLAYERCONTROL_PHONE = 64, + PLAYERCONTROL_CUTSCENE = 128, }; class CControllerState diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index c3cc0960..128b22b4 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -174,7 +174,7 @@ CPlayerInfo::MakePlayerSafe(bool toggle) CTheScripts::ResetCountdownToMakePlayerUnsafe(); m_pPed->m_pWanted->m_bIgnoredByEveryone = true; CWorld::StopAllLawEnforcersInTheirTracks(); - CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_20; + CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PLAYERINFO); CPad::StopPadsShaking(); m_pPed->bBulletProof = true; m_pPed->bFireProof = true; @@ -194,7 +194,7 @@ CPlayerInfo::MakePlayerSafe(bool toggle) } else if (!CGame::playingIntro && !CTheScripts::IsCountdownToMakePlayerUnsafeOn()) { m_pPed->m_pWanted->m_bIgnoredByEveryone = false; - CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_20; + CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PLAYERINFO); m_pPed->bBulletProof = false; m_pPed->bFireProof = false; m_pPed->bCollisionProof = false; From ba3fe38f2e8d3e174f945a9d139cdb69883d03bb Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Mon, 22 Jun 2020 14:07:19 +0300 Subject: [PATCH 129/133] fixes --- src/control/Script.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 39f5a6d6..61eacf7f 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -506,7 +506,7 @@ const tScriptCommandData commands[] = { REGISTER_COMMAND(COMMAND_CREATE_CAR_GENERATOR, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), REGISTER_COMMAND(COMMAND_SWITCH_CAR_GENERATOR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_ADD_PAGER_MESSAGE, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_DISPLAY_ONSCREEN_TIMER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DISPLAY_ONSCREEN_TIMER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_CLEAR_ONSCREEN_TIMER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_DISPLAY_ONSCREEN_COUNTER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_CLEAR_ONSCREEN_COUNTER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), @@ -1135,7 +1135,7 @@ const tScriptCommandData commands[] = { REGISTER_COMMAND(COMMAND_STORE_CAR_CHAR_IS_IN_NO_SAVE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), REGISTER_COMMAND(COMMAND_STORE_CAR_PLAYER_IS_IN_NO_SAVE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), REGISTER_COMMAND(COMMAND_IS_PHONE_DISPLAYING_MESSAGE, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), - REGISTER_COMMAND(COMMAND_DISPLAY_ONSCREEN_TIMER_WITH_STRING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_DISPLAY_ONSCREEN_TIMER_WITH_STRING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_DISPLAY_ONSCREEN_COUNTER_WITH_STRING, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_STRING,), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_CREATE_RANDOM_CAR_FOR_CAR_PARK, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_IS_COLLISION_IN_MEMORY, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), true, -1, ""), @@ -1949,17 +1949,6 @@ void CTheScripts::Process() { if (CReplay::IsPlayingBack()) return; -#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT -#if SCRIPT_LOG_FILE_LEVEL == 1 - CFileMgr::SetDirMyDocuments(); - dbg_log = CFileMgr::OpenFileForWriting("SCRDBG.LOG"); - static const char* init_msg = "Starting debug script log\n\n"; - PrintToLog(init_msg); - CFileMgr::SetDir("\\"); -#endif - PrintToLog("------------------------\n"); - PrintToLog("CTheScripts::Process started, CTimer::GetTimeInMilliseconds == %u\n", CTimer::GetTimeInMilliseconds()); -#endif CommandsExecuted = 0; ScriptsUpdated = 0; float timeStep = CTimer::GetTimeStepInMilliseconds(); @@ -2019,6 +2008,18 @@ void CTheScripts::Process() WaitForSave = 0; #endif +#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT +#if SCRIPT_LOG_FILE_LEVEL == 1 + CFileMgr::SetDirMyDocuments(); + dbg_log = CFileMgr::OpenFileForWriting("SCRDBG.LOG"); + static const char* init_msg = "Starting debug script log\n\n"; + PrintToLog(init_msg); + CFileMgr::SetDir("\\"); +#endif + PrintToLog("------------------------\n"); + PrintToLog("CTheScripts::Process started, CTimer::GetTimeInMilliseconds == %u\n", CTimer::GetTimeInMilliseconds()); +#endif + CRunningScript* script = pActiveScripts; while (script != nil){ CRunningScript* next = script->GetNext(); From cafe4d6f0cafaa431dcf4bce7a96af73fc833ef8 Mon Sep 17 00:00:00 2001 From: aap Date: Thu, 25 Jun 2020 15:12:57 +0200 Subject: [PATCH 130/133] rename attractor flag to type --- src/core/FileLoader.cpp | 2 +- src/peds/Ped.cpp | 6 +++--- src/render/2dEffect.h | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index 6e7188c5..a1fb5ace 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -977,7 +977,7 @@ CFileLoader::Load2dEffect(const char *line) &effect->attractor.dir.y, &effect->attractor.dir.z, &probability); - effect->attractor.flags = flags; + effect->attractor.type = flags; effect->attractor.probability = probability; break; } diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 254f89a6..cf254cf4 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -8644,11 +8644,11 @@ CPed::LookForInterestingNodes(void) return false; } - switch (effect->attractor.flags) { - case ATTRACTORFLAG_ICECREAM: + switch (effect->attractor.type) { + case ATTRACTORTYPE_ICECREAM: SetInvestigateEvent(EVENT_ICECREAM, CVector2D(effectPos), 0.1f, 15000, angleToFace); break; - case ATTRACTORFLAG_STARE: + case ATTRACTORTYPE_STARE: SetInvestigateEvent(EVENT_SHOPSTALL, CVector2D(effectPos), 1.0f, CGeneral::GetRandomNumberInRange(8000, 10 * effect->attractor.probability + 8500), angleToFace); diff --git a/src/render/2dEffect.h b/src/render/2dEffect.h index 2a71a8d5..4256a0ac 100644 --- a/src/render/2dEffect.h +++ b/src/render/2dEffect.h @@ -25,8 +25,8 @@ enum { }; enum { - ATTRACTORFLAG_ICECREAM, - ATTRACTORFLAG_STARE + ATTRACTORTYPE_ICECREAM, + ATTRACTORTYPE_STARE }; enum { @@ -60,7 +60,7 @@ public: }; struct Attractor { CVector dir; - uint8 flags; + int8 type; uint8 probability; }; From d6e111bb6765b5affc91f467b15f5192d49d6056 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 28 Jun 2020 11:59:20 +0300 Subject: [PATCH 131/133] script logging fixes --- src/control/Script.cpp | 803 +++++++++++++++++++++-------------------- src/core/config.h | 4 + 2 files changed, 413 insertions(+), 394 deletions(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 61eacf7f..9cb6af46 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -387,7 +387,7 @@ const tScriptCommandData commands[] = { REGISTER_COMMAND(COMMAND_WHILENOT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_ENDWHILE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_ANDOR, INPUT_ARGUMENTS(ARGTYPE_ANDOR,), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_LAUNCH_MISSION, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_LAUNCH_MISSION, INPUT_ARGUMENTS(ARGTYPE_LABEL,), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_MISSION_HAS_FINISHED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_STORE_CAR_CHAR_IS_IN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), REGISTER_COMMAND(COMMAND_STORE_CAR_PLAYER_IS_IN, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), @@ -1339,7 +1339,7 @@ const tScriptCommandData commands[] = { static_assert(ARRAY_SIZE(commands) == LAST_SCRIPT_COMMAND, "commands array not filled"); #if SCRIPT_LOG_FILE_LEVEL == 1 || SCRIPT_LOG_FILE_LEVEL == 2 -static int dbg_log; +static FILE* dbg_log; #endif static void PrintToLog(const char* format, ...) @@ -1356,11 +1356,23 @@ static void PrintToLog(const char* format, ...) printf("%s", tmp); #if SCRIPT_LOG_FILE_LEVEL == 1 || SCRIPT_LOG_FILE_LEVEL == 2 - CFileMgr::Write(dbg_log, tmp, strlen(tmp)); + fwrite(tmp, 1, strlen(tmp), dbg_log); #endif } + #endif +static void FlushLog() +{ +#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT +#if SCRIPT_LOG_FILE_LEVEL == 1 || SCRIPT_LOG_FILE_LEVEL == 2 + if (dbg_log) + fflush(dbg_log); +#endif +#endif +} + +#define script_assert(_Expression) FlushLog(); assert(_Expression); const uint32 CRunningScript::nSaveStructSize = #ifdef COMPATIBLE_SAVES @@ -1389,7 +1401,7 @@ CMissionCleanupEntity* CMissionCleanup::FindFree() if (m_sEntities[i].type == CLEANUP_UNUSED) return &m_sEntities[i]; } - assert(0); + script_assert(0); return nil; } @@ -1633,12 +1645,12 @@ void CRunningScript::CollectParameters(uint32* pIp, int16 total) break; case ARGUMENT_GLOBALVAR: varIndex = CTheScripts::Read2BytesFromScript(pIp); - assert(varIndex >= 8 && varIndex < CTheScripts::GetSizeOfVariableSpace()); + script_assert(varIndex >= 8 && varIndex < CTheScripts::GetSizeOfVariableSpace()); ScriptParams[i] = *((int32*)&CTheScripts::ScriptSpace[varIndex]); break; case ARGUMENT_LOCALVAR: varIndex = CTheScripts::Read2BytesFromScript(pIp); - assert(varIndex >= 0 && varIndex < ARRAY_SIZE(m_anLocalVariables)); + script_assert(varIndex >= 0 && varIndex < ARRAY_SIZE(m_anLocalVariables)); ScriptParams[i] = m_anLocalVariables[varIndex]; break; case ARGUMENT_INT8: @@ -1652,7 +1664,7 @@ void CRunningScript::CollectParameters(uint32* pIp, int16 total) ScriptParams[i] = *(int32*)&tmp; break; default: - assert(0); + script_assert(0); break; } } @@ -1671,14 +1683,14 @@ int CRunningScript::CollectParameterForDebug(char* buf, bool& var) return CTheScripts::Read4BytesFromScript(&m_nIp); case ARGUMENT_GLOBALVAR: varIndex = CTheScripts::Read2BytesFromScript(&m_nIp); - assert(varIndex >= 8 && varIndex < CTheScripts::GetSizeOfVariableSpace()); + script_assert(varIndex >= 8 && varIndex < CTheScripts::GetSizeOfVariableSpace()); var = true; sprintf(tmpstr, " $%d", varIndex / 4); strcat(buf, tmpstr); return *((int32*)&CTheScripts::ScriptSpace[varIndex]); case ARGUMENT_LOCALVAR: varIndex = CTheScripts::Read2BytesFromScript(&m_nIp); - assert(varIndex >= 0 && varIndex < ARRAY_SIZE(m_anLocalVariables)); + script_assert(varIndex >= 0 && varIndex < ARRAY_SIZE(m_anLocalVariables)); var = true; sprintf(tmpstr, " %d@", varIndex); strcat(buf, tmpstr); @@ -1691,8 +1703,8 @@ int CRunningScript::CollectParameterForDebug(char* buf, bool& var) tmp = CTheScripts::ReadFloatFromScript(&m_nIp); return *(int32*)&tmp; default: - PrintToLog("%s - assertion failed in CollectParameterForDebug", buf); - assert(0); + PrintToLog("%s - script assertion failed in CollectParameterForDebug", buf); + script_assert(0); break; } return 0; @@ -1714,8 +1726,8 @@ void CRunningScript::GetStoredParameterForDebug(char* buf) strcat(buf, tmpstr); break; default: - PrintToLog("%s - assertion failed in GetStoredParameterForDebug", buf); - assert(0); + PrintToLog("%s - script_assertion failed in GetStoredParameterForDebug", buf); + script_assert(0); } } #endif @@ -1740,7 +1752,7 @@ int32 CRunningScript::CollectNextParameterWithoutIncreasingPC(uint32 ip) tmp = CTheScripts::ReadFloatFromScript(pIp); return *(int32*)&tmp; default: - assert(0); + script_assert(0); } return -1; } @@ -1756,7 +1768,7 @@ void CRunningScript::StoreParameters(uint32* pIp, int16 number) m_anLocalVariables[CTheScripts::Read2BytesFromScript(pIp)] = ScriptParams[i]; break; default: - assert(0); + script_assert(0); } } } @@ -1766,13 +1778,13 @@ int32 *CRunningScript::GetPointerToScriptVariable(uint32* pIp, int16 type) switch (CTheScripts::Read1ByteFromScript(pIp)) { case ARGUMENT_GLOBALVAR: - assert(type == VAR_GLOBAL); + script_assert(type == VAR_GLOBAL); return (int32*)&CTheScripts::ScriptSpace[CTheScripts::Read2BytesFromScript(pIp)]; case ARGUMENT_LOCALVAR: - assert(type == VAR_LOCAL); + script_assert(type == VAR_LOCAL); return &m_anLocalVariables[CTheScripts::Read2BytesFromScript(pIp)]; default: - assert(0); + script_assert(0); } return nil; } @@ -1908,7 +1920,9 @@ void CTheScripts::Init() #if defined USE_ADVANCED_SCRIPT_DEBUG_OUTPUT && SCRIPT_LOG_FILE_LEVEL == 2 CFileMgr::SetDirMyDocuments(); - dbg_log = CFileMgr::OpenFileForWriting("SCRDBG.LOG"); + if (dbg_log) + fclose(dbg_log); + dbg_log = fopen("SCRDBG.LOG", "w"); static const char* init_msg = "Starting debug script log\n\n"; PrintToLog(init_msg); CFileMgr::SetDir("\\"); @@ -1937,7 +1951,7 @@ void CRunningScript::AddScriptToList(CRunningScript** ppScript) CRunningScript* CTheScripts::StartNewScript(uint32 ip) { CRunningScript* pNew = pIdleScripts; - assert(pNew); + script_assert(pNew); pNew->RemoveScriptFromList(&pIdleScripts); pNew->Init(); pNew->SetIP(ip); @@ -2011,7 +2025,7 @@ void CTheScripts::Process() #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT #if SCRIPT_LOG_FILE_LEVEL == 1 CFileMgr::SetDirMyDocuments(); - dbg_log = CFileMgr::OpenFileForWriting("SCRDBG.LOG"); + dbg_log = fopen("SCRDBG.LOG", "w"); static const char* init_msg = "Starting debug script log\n\n"; PrintToLog(init_msg); CFileMgr::SetDir("\\"); @@ -2032,7 +2046,8 @@ void CTheScripts::Process() #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT PrintToLog("Script processing done, ScriptsUpdated: %d, CommandsExecuted: %d\n", ScriptsUpdated, CommandsExecuted); #if SCRIPT_LOG_FILE_LEVEL == 1 - CFileMgr::CloseFile(dbg_log); + fclose(dbg_log); + dbg_log = nil; #endif #endif } @@ -2085,7 +2100,7 @@ int8 CRunningScript::ProcessOneCommand() char commandInfo[128]; uint32 ip = m_nIp; if (command < ARRAY_SIZE(commands)) { - assert(commands[command].id == command); + script_assert(commands[command].id == command); sprintf(commandInfo, m_nIp >= SIZE_MAIN_SCRIPT ? "M<%5d> " : "<%6d> ", m_nIp >= SIZE_MAIN_SCRIPT ? m_nIp - SIZE_MAIN_SCRIPT : m_nIp); if (m_bNotFlag) strcat(commandInfo, "NOT "); @@ -2105,7 +2120,7 @@ int8 CRunningScript::ProcessOneCommand() case ARGTYPE_LABEL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s(%d))" : " %s(%d)", value >= 0 ? "G" : "L", abs(value)); break; case ARGTYPE_BOOL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s)" : " %s", value ? "TRUE" : "FALSE"); break; case ARGTYPE_ANDOR: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, " %d %ss", (value + 1) % 10, value / 10 == 0 ? "AND" : "OR"); break; - default: assert(0); + default: script_assert(0); } strcat(commandInfo, tmp); if (commands[command].position == i) @@ -2162,7 +2177,7 @@ int8 CRunningScript::ProcessOneCommand() case ARGTYPE_VEHICLE_HANDLE: case ARGTYPE_OBJECT_HANDLE: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%d)", ScriptParams[i]); strcat(commandInfo, tmp); break; case ARGTYPE_FLOAT: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%8.3f)", *(float*)&ScriptParams[i]); strcat(commandInfo, tmp); break; - default: assert(0 && "Script only returns INTs and FLOATs"); + default: script_assert(0 && "Script only returns INTs and FLOATs"); } } m_nIp = ip; @@ -2176,7 +2191,7 @@ int8 CRunningScript::ProcessOneCommand() CDebug::DebugAddText(commandInfo); } } -#else +#elif defined USE_BASIC_SCRIPT_DEBUG_OUTPUT if (m_bMissionFlag) { char tmp[128]; sprintf(tmp, "Comm %d Cmp %d", command, m_bCondResult); @@ -2691,7 +2706,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) case COMMAND_START_NEW_SCRIPT: { CollectParameters(&m_nIp, 1); - assert(ScriptParams[0] >= 0); + script_assert(ScriptParams[0] >= 0); CRunningScript* pNew = CTheScripts::StartNewScript(ScriptParams[0]); int8 type = CTheScripts::Read1ByteFromScript(&m_nIp); float tmp; @@ -2724,12 +2739,12 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) } case COMMAND_GOSUB: CollectParameters(&m_nIp, 1); - assert(m_nStackPointer < MAX_STACK_DEPTH); + script_assert(m_nStackPointer < MAX_STACK_DEPTH); m_anStack[m_nStackPointer++] = m_nIp; SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : SIZE_MAIN_SCRIPT - ScriptParams[0]); return 0; case COMMAND_RETURN: - assert(m_nStackPointer > 0); /* No more SSU */ + script_assert(m_nStackPointer > 0); /* No more SSU */ SetIP(m_anStack[--m_nStackPointer]); return 0; case COMMAND_LINE: @@ -2740,7 +2755,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) { CollectParameters(&m_nIp, 4); int32 index = ScriptParams[0]; - assert(index < 1); /* Constant? Also no more double player glitch */ + script_assert(index < 1); /* Constant? Also no more double player glitch */ printf("&&&&&&&&&&&&&Creating player: %d\n", index); if (!CStreaming::HasModelLoaded(MI_PLAYER)) { CStreaming::RequestSpecialModel(MI_PLAYER, "player", STREAMFLAGS_DONT_REMOVE | STREAMFLAGS_DEPENDENCY); @@ -2885,7 +2900,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) *fScriptVar1 -= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; default: - assert(0); + script_assert(0); break; } return -1; @@ -3277,7 +3292,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { CollectParameters(&m_nIp, 2); CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(ped); + script_assert(ped); ped->ClearAll(); int8 path = ScriptParams[1]; if (ScriptParams[1] < 0 || ScriptParams[1] > 7) @@ -3292,7 +3307,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { CollectParameters(&m_nIp, 4); CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(ped); + script_assert(ped); CVector pos = *(CVector*)&ScriptParams[1]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); @@ -3304,7 +3319,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { CollectParameters(&m_nIp, 1); CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(ped); + script_assert(ped); ped->bScriptObjectiveCompleted = false; ped->SetObjective(OBJECTIVE_IDLE); return 0; @@ -3313,7 +3328,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { CollectParameters(&m_nIp, 1); CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(ped); + script_assert(ped); CVehicle* vehicle; CVector pos; /* Seems a bit clumsy but I'll leave original flow */ @@ -3333,7 +3348,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { CollectParameters(&m_nIp, 4); CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(ped); + script_assert(ped); CVehicle* vehicle; if (ped->bInVehicle) vehicle = ped->m_pMyVehicle; @@ -3368,7 +3383,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) * * CollectParameters(&m_nIp, 4); * CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); - * assert(ped); + * script_assert(ped); * CEntity* entityToMove = ped->bInVehicle ? ped->m_pMyVehicle : ped; * CVector pos = *(CVector*)&ScriptParams[1]; * if (pos.z <= MAP_Z_LOW_LIMIT) @@ -3391,7 +3406,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { CollectParameters(&m_nIp, 6); CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(ped); + script_assert(ped); CVehicle* vehicle; if (ped->bInVehicle) vehicle = ped->m_pMyVehicle; @@ -3416,7 +3431,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { CollectParameters(&m_nIp, 8); CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(ped); + script_assert(ped); CVehicle* vehicle; if (ped->bInVehicle) vehicle = ped->m_pMyVehicle; @@ -3506,7 +3521,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { CollectParameters(&m_nIp, 4); CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(car); + script_assert(car); CVector pos = *(CVector*)&ScriptParams[1]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); @@ -3525,7 +3540,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(car); + script_assert(car); CCarCtrl::JoinCarWithRoadSystem(car); car->AutoPilot.m_nCarMission = MISSION_CRUISE; car->bEngineOn = true; @@ -3537,7 +3552,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(car); + script_assert(car); car->AutoPilot.m_nCarMission = MISSION_NONE; return 0; } @@ -3545,7 +3560,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(car); + script_assert(car); *(CVector*)&ScriptParams[0] = car->GetPosition(); StoreParameters(&m_nIp, 3); return 0; @@ -3554,7 +3569,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { CollectParameters(&m_nIp, 4); CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(car); + script_assert(car); CVector pos = *(CVector*)&ScriptParams[1]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); @@ -3612,7 +3627,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(car); + script_assert(car); #if defined MISSION_REPLAY && defined SIMPLIER_MISSIONS car->AutoPilot.m_nCruiseSpeed = *(float*)&ScriptParams[1]; if (missionRetryScriptIndex == 40 && car->GetModelIndex() == MI_CHEETAH) // Turismo @@ -3627,7 +3642,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(car); + script_assert(car); car->AutoPilot.m_nDrivingStyle = (eCarDrivingStyle)ScriptParams[1]; return 0; } @@ -3635,7 +3650,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(car); + script_assert(car); car->AutoPilot.m_nCarMission = (eCarMission)ScriptParams[1]; car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); car->bEngineOn = true; @@ -3645,7 +3660,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { CollectParameters(&m_nIp, 6); CVehicle* vehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(vehicle); + script_assert(vehicle); float x1 = *(float*)&ScriptParams[1]; float y1 = *(float*)&ScriptParams[2]; float x2 = *(float*)&ScriptParams[3]; @@ -3662,7 +3677,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { CollectParameters(&m_nIp, 8); CVehicle* vehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(vehicle); + script_assert(vehicle); float x1 = *(float*)&ScriptParams[1]; float y1 = *(float*)&ScriptParams[2]; float z1 = *(float*)&ScriptParams[3]; @@ -3685,7 +3700,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) case COMMAND_SPECIAL_5: case COMMAND_SPECIAL_6: case COMMAND_SPECIAL_7: - assert(0); + script_assert(0); return 0; case COMMAND_PRINT_BIG: { @@ -3765,7 +3780,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) case COMMAND_VAR_INT: */ default: - assert(0); + script_assert(0); break; } return -1; @@ -3802,7 +3817,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) m_bCondResult = false; m_nAndOrState++; }else{ - assert(0 && "COMMAND_ANDOR: invalid ANDOR state"); + script_assert(0 && "COMMAND_ANDOR: invalid ANDOR state"); } return 0; case COMMAND_LAUNCH_MISSION: @@ -3825,12 +3840,12 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) { CollectParameters(&m_nIp, 1); CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(ped); + script_assert(ped); CVehicle* pCurrent = nil; if (ped->bInVehicle) { pCurrent = ped->m_pMyVehicle; } - assert(pCurrent); // GetIndex(0) doesn't look good + script_assert(pCurrent); // GetIndex(0) doesn't look good int handle = CPools::GetVehiclePool()->GetIndex(pCurrent); if (handle != CTheScripts::StoreVehicleIndex && m_bIsMissionScript){ CVehicle* pOld = CPools::GetVehiclePool()->GetAt(CTheScripts::StoreVehicleIndex); @@ -3877,11 +3892,11 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) { CollectParameters(&m_nIp, 1); CPed* ped = CWorld::Players[ScriptParams[0]].m_pPed; - assert(ped); + script_assert(ped); if (!ped->bInVehicle) return 0; // No value written to output variable CVehicle* pCurrent = ped->m_pMyVehicle; - assert(pCurrent); // Here pCurrent shouldn't be NULL anyway + script_assert(pCurrent); // Here pCurrent shouldn't be NULL anyway int handle = CPools::GetVehiclePool()->GetIndex(pCurrent); if (handle != CTheScripts::StoreVehicleIndex && m_bIsMissionScript) { CVehicle* pOld = CPools::GetVehiclePool()->GetAt(CTheScripts::StoreVehicleIndex); @@ -4132,7 +4147,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) { CollectParameters(&m_nIp, 3); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->GrantAmmo((eWeaponType)ScriptParams[1], ScriptParams[2]); return 0; } @@ -4162,7 +4177,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->m_fearFlags |= ScriptParams[1]; return 0; } @@ -4173,7 +4188,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bScriptObjectiveCompleted = false; pPed->ClearObjective(); return 0; @@ -4209,7 +4224,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->OurPedCanSeeThisOne(CWorld::Players[ScriptParams[1]].m_pPed)); return 0; } @@ -4221,7 +4236,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bScriptObjectiveCompleted); return 0; } @@ -4233,7 +4248,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) { CollectParameters(&m_nIp, 3); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); switch (ScriptParams[2]) { case MI_COP: if (ScriptParams[1] == PEDTYPE_COP) @@ -4276,7 +4291,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) pPed->SetOrientation(0.0f, 0.0f, 0.0f); pPed->SetPedState(PED_DRIVING); CPopulation::ms_nTotalMissionPeds++; - assert(!pVehicle->pDriver); + script_assert(!pVehicle->pDriver); pVehicle->pDriver = pPed; pVehicle->pDriver->RegisterReference((CEntity**)&pVehicle->pDriver); pPed->m_pMyVehicle = pVehicle; @@ -4310,7 +4325,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); if (pPlayer->m_pPed->bInVehicle){ - assert(pPlayer->m_pPed->m_pMyVehicle); + script_assert(pPlayer->m_pPed->m_pMyVehicle); if (pPlayer->m_pPed->m_pMyVehicle->bIsBus) pPlayer->m_pPed->bRenderPedInCar = true; if (pPlayer->m_pPed->m_pMyVehicle->pDriver == pPlayer->m_pPed){ @@ -4345,7 +4360,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) case COMMAND_MAKE_CHAR_DO_NOTHING: */ default: - assert(0); + script_assert(0); break; } return -1; @@ -4374,7 +4389,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->m_nDoorLock = (eCarLock)ScriptParams[1]; return 0; } @@ -4389,7 +4404,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); UpdateCompareFlag(pVehicle->GetModelIndex() == ScriptParams[1]); return 0; } @@ -4402,7 +4417,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 6); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); float x1 = *(float*)&ScriptParams[1]; float y1 = *(float*)&ScriptParams[2]; float x2 = *(float*)&ScriptParams[3]; @@ -4420,7 +4435,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 8); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); float x1 = *(float*)&ScriptParams[1]; float y1 = *(float*)&ScriptParams[2]; float z1 = *(float*)&ScriptParams[3]; @@ -4488,21 +4503,21 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) } case COMMAND_DISPLAY_ONSCREEN_TIMER: { - assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR); + script_assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR); m_nIp++; CUserDisplay::OnscnTimer.AddClock(CTheScripts::Read2BytesFromScript(&m_nIp), nil); return 0; } case COMMAND_CLEAR_ONSCREEN_TIMER: { - assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR); + script_assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR); m_nIp++; CUserDisplay::OnscnTimer.ClearClock(CTheScripts::Read2BytesFromScript(&m_nIp)); return 0; } case COMMAND_DISPLAY_ONSCREEN_COUNTER: { - assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR); + script_assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR); m_nIp++; int32 counter = CTheScripts::Read2BytesFromScript(&m_nIp); CollectParameters(&m_nIp, 1); @@ -4511,7 +4526,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) } case COMMAND_CLEAR_ONSCREEN_COUNTER: { - assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR); + script_assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR); m_nIp++; CUserDisplay::OnscnTimer.ClearCounter(CTheScripts::Read2BytesFromScript(&m_nIp)); return 0; @@ -4540,7 +4555,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); char label[12]; CTheScripts::ReadTextLabelFromScript(&m_nIp, label); int zone = CTheZones::FindZoneByLabelAndReturnIndex(label); @@ -4589,7 +4604,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 3); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); TheCamera.TakeControl(pVehicle, ScriptParams[1], ScriptParams[2], CAMCONTROL_SCRIPT); return 0; } @@ -4597,7 +4612,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 3); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); TheCamera.TakeControl(pPed, ScriptParams[1], ScriptParams[2], CAMCONTROL_SCRIPT); return 0; } @@ -4630,7 +4645,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle && pVehicle->IsCar()); + script_assert(pVehicle && pVehicle->IsCar()); CAutomobile* pCar = (CAutomobile*)pVehicle; UpdateCompareFlag(pCar->GetAllWheelsOffGround()); return 0; @@ -4656,7 +4671,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 3); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); // Useless call. CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); ScriptParams[0] = CRadar::SetEntityBlip(BLIP_CAR, ScriptParams[0], ScriptParams[1], (eBlipDisplay)ScriptParams[2]); @@ -4667,7 +4682,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 3); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); // Useless call. CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); ScriptParams[0] = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], ScriptParams[1], (eBlipDisplay)ScriptParams[2]); @@ -4678,7 +4693,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 3); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); // Useless call. CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); ScriptParams[0] = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], ScriptParams[1], (eBlipDisplay)ScriptParams[2]); @@ -4791,7 +4806,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) CollectParameters(&m_nIp, 2); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; if (pPed->bInVehicle){ - // Is assertion required? + // Is script_assertion required? return 0; } pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(*(float*)&ScriptParams[1]); @@ -4802,7 +4817,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); float angle = pPed->bInVehicle ? pPed->m_pMyVehicle->GetForward().Heading() : pPed->GetForward().Heading(); *(float*)&ScriptParams[0] = CGeneral::LimitAngle(RADTODEG(angle)); StoreParameters(&m_nIp, 1); @@ -4812,9 +4827,9 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); if (pPed->bInVehicle) { - // Is assertion required? + // Is script_assertion required? return 0; } pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(*(float*)&ScriptParams[1]); @@ -4825,7 +4840,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); float angle = pVehicle->GetForward().Heading(); *(float*)&ScriptParams[0] = CGeneral::LimitAngle(RADTODEG(angle)); StoreParameters(&m_nIp, 1); @@ -4835,7 +4850,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->SetHeading(DEGTORAD(*(float*)&ScriptParams[1])); return 0; } @@ -4843,7 +4858,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 1); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); float angle = pObject->GetForward().Heading(); *(float*)&ScriptParams[0] = CGeneral::LimitAngle(RADTODEG(angle)); StoreParameters(&m_nIp, 1); @@ -4853,7 +4868,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 2); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); CWorld::Remove(pObject); pObject->SetHeading(DEGTORAD(*(float*)&ScriptParams[1])); pObject->GetMatrix().UpdateRW(); @@ -4866,7 +4881,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) CollectParameters(&m_nIp, 2); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]); - assert(pObject); + script_assert(pObject); CPhysical* pEntityToTest = pPed->bInVehicle ? (CPhysical*)pPed->m_pMyVehicle : pPed; UpdateCompareFlag(pEntityToTest->GetHasCollidedWith(pObject)); return 0; @@ -4875,9 +4890,9 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]); - assert(pObject); + script_assert(pObject); CPhysical* pEntityToTest = pPed->bInVehicle ? (CPhysical*)pPed->m_pMyVehicle : pPed; UpdateCompareFlag(pEntityToTest->GetHasCollidedWith(pObject)); return 0; @@ -4923,7 +4938,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->m_fHealth > ScriptParams[1]); return 0; } @@ -4931,7 +4946,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); UpdateCompareFlag(pVehicle->m_fHealth > ScriptParams[1]); return 0; } @@ -4939,7 +4954,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); // Useless call. CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); int handle = CRadar::SetEntityBlip(BLIP_CAR, ScriptParams[0], 0, BLIP_DISPLAY_BOTH); @@ -4952,7 +4967,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); // Useless call. CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); int handle = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], 1, BLIP_DISPLAY_BOTH); @@ -4965,7 +4980,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 1); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); // Useless call. CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); int handle = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], 6, BLIP_DISPLAY_BOTH); @@ -5073,12 +5088,12 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); UpdateCompareFlag(CTheScripts::UpsideDownCars.HasCarBeenUpsideDownForAWhile(ScriptParams[0])); return 0; } default: - assert(0); + script_assert(0); } return -1; } @@ -5090,7 +5105,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); CTheScripts::UpsideDownCars.AddCarToCheck(ScriptParams[0]); return 0; } @@ -5098,7 +5113,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); CTheScripts::UpsideDownCars.RemoveCarFromCheck(ScriptParams[0]); return 0; } @@ -5106,7 +5121,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_IDLE); return 0; @@ -5115,7 +5130,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE); return 0; @@ -5124,7 +5139,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 4); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVector pos = *(CVector*)&ScriptParams[1]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); @@ -5136,7 +5151,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 5); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); float infX = *(float*)&ScriptParams[1]; float infY = *(float*)&ScriptParams[2]; float supX = *(float*)&ScriptParams[3]; @@ -5162,7 +5177,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_WAIT_IN_CAR); return 0; @@ -5205,7 +5220,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 3); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); pPed->m_nSelectedWepSlot = pPed->GiveWeapon((eWeaponType)ScriptParams[1], ScriptParams[2]); return 0; } @@ -5213,7 +5228,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 3); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->SetCurrentWeapon(pPed->GiveWeapon((eWeaponType)ScriptParams[1], ScriptParams[2])); if (pPed->bInVehicle) pPed->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(pPed->m_weapons[pPed->m_currentWeapon].m_eWeaponType)->m_nModelId); @@ -5280,7 +5295,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 1); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); *(CVector*)&ScriptParams[0] = pObject->GetPosition(); StoreParameters(&m_nIp, 3); return 0; @@ -5289,7 +5304,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 4); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); CVector pos = *(CVector*)&ScriptParams[1]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); @@ -5305,7 +5320,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 4); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVehicle* pVehicle; CVector pos; if (pPed->bInVehicle) @@ -5331,7 +5346,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 4); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); CVehicle* pVehicle; CVector pos; if (pPed->bInVehicle) @@ -5357,7 +5372,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 1); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); ScriptParams[0] = pPed->m_pWanted->m_nWantedLevel; StoreParameters(&m_nIp, 1); return 0; @@ -5366,7 +5381,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); UpdateCompareFlag(CTheScripts::IsVehicleStopped(pVehicle)); return 0; } @@ -5401,7 +5416,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR); return 0; } @@ -5409,7 +5424,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR); return 0; } @@ -5417,7 +5432,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 1); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT); return 0; } @@ -5425,7 +5440,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 4); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); switch (ScriptParams[2]) { case MI_COP: if (ScriptParams[1] == PEDTYPE_COP) @@ -5497,7 +5512,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, pTarget); @@ -5507,7 +5522,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed; pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, pTarget); @@ -5517,7 +5532,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_KILL_CHAR_ANY_MEANS, pTarget); @@ -5527,7 +5542,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed; pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_KILL_CHAR_ANY_MEANS, pTarget); @@ -5537,7 +5552,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pTarget); @@ -5547,7 +5562,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed; pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pTarget); @@ -5557,7 +5572,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pTarget); @@ -5567,7 +5582,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed; pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pTarget); @@ -5577,7 +5592,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_GOTO_CHAR_ON_FOOT, pTarget); @@ -5587,7 +5602,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed; pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_GOTO_CHAR_ON_FOOT, pTarget); @@ -5597,7 +5612,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_LEAVE_VEHICLE, pVehicle); @@ -5607,7 +5622,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, pVehicle); @@ -5617,7 +5632,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle); @@ -5632,7 +5647,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_DESTROY_CAR, pVehicle); @@ -5642,7 +5657,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 5); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); float infX = *(float*)&ScriptParams[1]; float infY = *(float*)&ScriptParams[2]; float supX = *(float*)&ScriptParams[3]; @@ -5673,7 +5688,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]); pPed->SetObjective(OBJECTIVE_SET_LEADER, pTarget); return 0; @@ -5682,7 +5697,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed; pPed->SetObjective(OBJECTIVE_SET_LEADER, pTarget); return 0; @@ -5691,7 +5706,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->ClearLeader(); return 0; } @@ -5699,7 +5714,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 3); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_FOLLOW_ROUTE, ScriptParams[1], ScriptParams[2]); return 0; @@ -5786,7 +5801,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); ScriptParams[0] = pVehicle->m_nNumPassengers; StoreParameters(&m_nIp, 1); return 0; @@ -5795,7 +5810,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); ScriptParams[0] = pVehicle->m_nNumMaxPassengers; StoreParameters(&m_nIp, 1); return 0; @@ -5810,7 +5825,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->bIsHeavy = (ScriptParams[1] != 0); return 0; } @@ -5818,7 +5833,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->m_fearFlags = 0; return 0; } @@ -5863,12 +5878,12 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); UpdateCompareFlag(pVehicle->m_nCollisionRecords == 0); return 0; } default: - assert(0); + script_assert(0); } return -1; } @@ -5880,7 +5895,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); UpdateCompareFlag(pVehicle->GetUp().z <= -0.97f); return 0; } @@ -5888,7 +5903,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 1); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed); StoreParameters(&m_nIp, 1); return 0; @@ -5900,7 +5915,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); if (ScriptParams[1]) { pPed->m_pWanted->m_bIgnoredByCops = true; CWorld::StopAllLawEnforcersInTheirTracks(); @@ -5970,7 +5985,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->m_nDoorLock = (eCarLock)ScriptParams[1]; return 0; } @@ -5978,7 +5993,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->BlowUpCar(nil); return 0; } @@ -5991,7 +6006,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); UpdateCompareFlag(pVehicle->GetUp().z >= 0.0f); return 0; } @@ -6053,7 +6068,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 3); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVector target; target.x = *(float*)&ScriptParams[1]; target.y = *(float*)&ScriptParams[2]; @@ -6090,8 +6105,8 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); - assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); + script_assert(pVehicle); + script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); ((CAutomobile*)pVehicle)->SetTaxiLight(ScriptParams[1] != 0); return 0; } @@ -6166,7 +6181,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) CVehicle* pTarget; if (ScriptParams[1] >= 0) { pTarget = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); - assert(pTarget); + script_assert(pTarget); } else { pTarget = nil; @@ -6225,8 +6240,8 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 1); CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pCar); - assert(pCar->m_vehType == VEHICLE_TYPE_CAR); + script_assert(pCar); + script_assert(pCar->m_vehType == VEHICLE_TYPE_CAR); UpdateCompareFlag(pCar->m_bombType != 0); //TODO: enum return 0; } @@ -6238,7 +6253,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); pPed->m_fHealth = ScriptParams[1]; return 0; } @@ -6246,7 +6261,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); if (ScriptParams[1]) { pPed->m_fHealth = ScriptParams[1]; } @@ -6264,7 +6279,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->m_fHealth = ScriptParams[1]; return 0; } @@ -6272,7 +6287,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); ScriptParams[0] = pPed->m_fHealth; // correct cast float to int StoreParameters(&m_nIp, 1); return 0; @@ -6281,7 +6296,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); ScriptParams[0] = pPed->m_fHealth; // correct cast float to int StoreParameters(&m_nIp, 1); return 0; @@ -6290,7 +6305,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); ScriptParams[0] = pVehicle->m_fHealth; // correct cast float to int StoreParameters(&m_nIp, 1); return 0; @@ -6299,8 +6314,8 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pCar); - assert(pCar->m_vehType == VEHICLE_TYPE_CAR); + script_assert(pCar); + script_assert(pCar->m_vehType == VEHICLE_TYPE_CAR); UpdateCompareFlag(pCar->m_bombType == ScriptParams[1]); //TODO: enum return 0; } @@ -6366,9 +6381,9 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pSourcePed); + script_assert(pSourcePed); CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); - assert(pTargetPed); + script_assert(pTargetPed); pSourcePed->SetLookFlag(pTargetPed, true); pSourcePed->SetLookTimer(60000); return 0; @@ -6377,9 +6392,9 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pSourcePed); + script_assert(pSourcePed); CPed* pTargetPed = CWorld::Players[ScriptParams[1]].m_pPed; - assert(pTargetPed); + script_assert(pTargetPed); pSourcePed->SetLookFlag(pTargetPed, true); pSourcePed->SetLookTimer(60000); return 0; @@ -6388,9 +6403,9 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CPed* pSourcePed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pSourcePed); + script_assert(pSourcePed); CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); - assert(pTargetPed); + script_assert(pTargetPed); pSourcePed->SetLookFlag(pTargetPed, true); pSourcePed->SetLookTimer(60000); return 0; @@ -6399,7 +6414,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 1); CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pSourcePed); + script_assert(pSourcePed); pSourcePed->ClearLookFlag(); pSourcePed->bKeepTryingToLook = false; if (pSourcePed->GetPedState() == PED_LOOK_HEADING || pSourcePed->GetPedState() == PED_LOOK_ENTITY) @@ -6410,7 +6425,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 1); CPed* pSourcePed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pSourcePed); + script_assert(pSourcePed); pSourcePed->ClearLookFlag(); pSourcePed->bKeepTryingToLook = false; if (pSourcePed->GetPedState() == PED_LOOK_HEADING || pSourcePed->GetPedState() == PED_LOOK_ENTITY) @@ -6438,7 +6453,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 5); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); float infX = *(float*)&ScriptParams[1]; float infY = *(float*)&ScriptParams[2]; float supX = *(float*)&ScriptParams[3]; @@ -6464,7 +6479,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 3); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVector pos; pos.x = *(float*)&ScriptParams[1]; pos.y = *(float*)&ScriptParams[2]; @@ -6477,7 +6492,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]); bool isTouching = false; if (pPed->bInVehicle) @@ -6491,7 +6506,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]); bool isTouching = false; if (pPed->InVehicle()) @@ -6522,7 +6537,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->bHasBlip = (ScriptParams[1] != 0); return 0; } @@ -6530,7 +6545,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bHasBlip = (ScriptParams[1] != 0); return 0; } @@ -6538,7 +6553,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); pObject->bHasBlip = (ScriptParams[1] != 0); return 0; } @@ -6550,8 +6565,8 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); - assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); + script_assert(pVehicle); + script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); ((CAutomobile*)pVehicle)->m_bombType = ScriptParams[1]; ((CAutomobile*)pVehicle)->m_pBombRigger = FindPlayerPed(); return 0; @@ -6560,7 +6575,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->SetPedStats((ePedStats)ScriptParams[1]); return 0; } @@ -6572,7 +6587,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->m_animGroup = (AssocGroupId)ScriptParams[1]; return 0; } @@ -6580,7 +6595,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); pPed->m_animGroup = (AssocGroupId)ScriptParams[1]; return 0; } @@ -6695,7 +6710,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) } //case COMMAND_SET_COLL_OBJ_NO_OBJ: default: - assert(0); + script_assert(0); } return -1; } @@ -6766,7 +6781,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bRespondsToThreats = (ScriptParams[1] != 0); return 0; } @@ -6774,7 +6789,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); pPed->bRespondsToThreats = (ScriptParams[1] != 0); return 0; } @@ -6790,8 +6805,8 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); - assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); + script_assert(pVehicle); + script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); ((CAutomobile*)pVehicle)->bFixedColour = (ScriptParams[1] == 0); return 0; } @@ -6799,7 +6814,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); int mi = pVehicle->GetModelIndex(); UpdateCompareFlag(mi == MI_TAXI || mi == MI_CABBIE || mi == MI_BORGNINE); return 0; @@ -6856,7 +6871,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); UpdateCompareFlag(pVehicle->m_vehType == VEHICLE_TYPE_BOAT); return 0; } @@ -6864,7 +6879,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) { CollectParameters(&m_nIp, 5); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); float infX = *(float*)&ScriptParams[1]; float infY = *(float*)&ScriptParams[2]; float supX = *(float*)&ScriptParams[3]; @@ -6927,7 +6942,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); int id = CRadar::SetEntityBlip(BLIP_CAR, ScriptParams[0], 0, BLIP_DISPLAY_BOTH); CRadar::SetBlipSprite(id, ScriptParams[1]); @@ -6939,7 +6954,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); int id = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], 1, BLIP_DISPLAY_BOTH); CRadar::SetBlipSprite(id, ScriptParams[1]); @@ -6951,7 +6966,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) { CollectParameters(&m_nIp, 2); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); int id = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], 6, BLIP_DISPLAY_BOTH); CRadar::SetBlipSprite(id, ScriptParams[1]); @@ -6989,7 +7004,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bOnlyDamagedByPlayer = (ScriptParams[1] != 0); return 0; } @@ -6997,7 +7012,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->bOnlyDamagedByPlayer = (ScriptParams[1] != 0); return 0; } @@ -7005,7 +7020,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) { CollectParameters(&m_nIp, 6); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bBulletProof = (ScriptParams[1] != 0); pPed->bFireProof = (ScriptParams[2] != 0); pPed->bExplosionProof = (ScriptParams[3] != 0); @@ -7017,7 +7032,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) { CollectParameters(&m_nIp, 6); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->bBulletProof = (ScriptParams[1] != 0); pVehicle->bFireProof = (ScriptParams[2] != 0); pVehicle->bExplosionProof = (ScriptParams[3] != 0); @@ -7053,7 +7068,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) UpdateCompareFlag(CGarages::HasThisCarBeenCollected(ScriptParams[0], ScriptParams[1] - 1)); return 0; default: - assert(0); + script_assert(0); } return -1; } @@ -7106,7 +7121,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 4); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); CVector pos = *(CVector*)&ScriptParams[1]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); @@ -7155,7 +7170,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); UpdateCompareFlag(TheCamera.IsSphereVisible(pVehicle->GetBoundCentre(), pVehicle->GetBoundRadius())); return 0; } @@ -7163,7 +7178,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(TheCamera.IsSphereVisible(pPed->GetBoundCentre(), pPed->GetBoundRadius())); return 0; } @@ -7171,14 +7186,14 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 1); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); UpdateCompareFlag(TheCamera.IsSphereVisible(pObject->GetBoundCentre(), pObject->GetBoundRadius())); return 0; } case COMMAND_GOSUB_FILE: { CollectParameters(&m_nIp, 2); - assert(m_nStackPointer < MAX_STACK_DEPTH); + script_assert(m_nStackPointer < MAX_STACK_DEPTH); m_anStack[m_nStackPointer++] = m_nIp; SetIP(ScriptParams[0]); // ScriptParams[1] == filename @@ -7215,7 +7230,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->bComedyControls = (ScriptParams[1] != 0); return 0; } @@ -7223,8 +7238,8 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 4); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); - assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT); + script_assert(pVehicle); + script_assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT); CBoat* pBoat = (CBoat*)pVehicle; CVector pos = *(CVector*)&ScriptParams[1]; if (pos.z <= MAP_Z_LOW_LIMIT) @@ -7240,8 +7255,8 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); - assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT); + script_assert(pVehicle); + script_assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT); CBoat* pBoat = (CBoat*)pVehicle; pBoat->AutoPilot.m_nCarMission = MISSION_NONE; pBoat->SetStatus(STATUS_PHYSICS); @@ -7253,7 +7268,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 6); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); float x1 = *(float*)&ScriptParams[1]; float y1 = *(float*)&ScriptParams[2]; float x2 = *(float*)&ScriptParams[3]; @@ -7270,7 +7285,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 6); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); float x1 = *(float*)&ScriptParams[1]; float y1 = *(float*)&ScriptParams[2]; float x2 = *(float*)&ScriptParams[3]; @@ -7287,7 +7302,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); UpdateCompareFlag(ScriptParams[1] == pPed->m_weapons[pPed->m_currentWeapon].m_eWeaponType); return 0; } @@ -7295,7 +7310,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(ScriptParams[1] == pPed->m_weapons[pPed->m_currentWeapon].m_eWeaponType); return 0; } @@ -7315,8 +7330,8 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); - assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT); + script_assert(pVehicle); + script_assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT); CBoat* pBoat = (CBoat*)pVehicle; pBoat->AutoPilot.m_nCruiseSpeed = *(float*)&ScriptParams[1]; return 0; @@ -7422,7 +7437,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->IsTaxi()); return 0; } @@ -7430,7 +7445,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bIsShooting); return 0; } @@ -7438,7 +7453,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bIsShooting); return 0; } @@ -7457,7 +7472,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->m_wepAccuracy = ScriptParams[1]; return 0; } @@ -7465,7 +7480,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); *(float*)&ScriptParams[0] = pVehicle->GetSpeed().Magnitude() * GAME_SPEED_TO_METERS_PER_SECOND; StoreParameters(&m_nIp, 1); return 0; @@ -7491,7 +7506,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CollectParameters(&m_nIp, 1); char name[KEY_LENGTH_IN_SCRIPT]; CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); m_nIp += KEY_LENGTH_IN_SCRIPT; CCutsceneMgr::SetCutsceneAnim(name, pObject); @@ -7600,7 +7615,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(ScriptParams[1] == pPed->GetModelIndex()); return 0; } @@ -7619,7 +7634,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 2); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); CCutsceneHead* pCutHead = CCutsceneMgr::AddCutsceneHead(pObject, ScriptParams[1]); ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pCutHead); StoreParameters(&m_nIp, 1); @@ -7629,7 +7644,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 1); CObject* pCutHead = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pCutHead); + script_assert(pCutHead); char name[KEY_LENGTH_IN_SCRIPT]; strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); m_nIp += KEY_LENGTH_IN_SCRIPT; @@ -7800,7 +7815,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 3); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_FOLLOW_PED_IN_FORMATION, pTargetPed); @@ -7866,7 +7881,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bIsRunning = (ScriptParams[1] != 0); return 0; } @@ -7877,7 +7892,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); UpdateCompareFlag(pVehicle->m_currentColour1 == ScriptParams[1]); return 0; } @@ -7885,7 +7900,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); UpdateCompareFlag(pVehicle->m_currentColour2 == ScriptParams[1]); return 0; } @@ -7912,13 +7927,13 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pLeader = CPools::GetPedPool()->GetAt(ScriptParams[1]); - assert(pPed); - assert(pLeader); + script_assert(pPed); + script_assert(pLeader); UpdateCompareFlag(pPed->m_leader == pLeader); return 0; } default: - assert(0); + script_assert(0); } return -1; } @@ -7931,8 +7946,8 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pLeader = CWorld::Players[ScriptParams[1]].m_pPed; - assert(pPed); - assert(pLeader); + script_assert(pPed); + script_assert(pLeader); UpdateCompareFlag(pPed->m_leader == pLeader); return 0; } @@ -7940,7 +7955,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); if (pPed->m_nPedState == PED_DRIVING) { pPed->SetDead(); if (!pPed->IsPlayer()) @@ -7958,7 +7973,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); if (CGame::nastyGame) { pPed->ApplyHeadShot(WEAPONTYPE_SNIPERRIFLE, pPed->GetNodePosition(PED_HEAD), true); } @@ -7971,7 +7986,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 2); CBoat* pBoat = (CBoat*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pBoat && pBoat->m_vehType == VEHICLE_TYPE_BOAT); + script_assert(pBoat && pBoat->m_vehType == VEHICLE_TYPE_BOAT); pBoat->m_bIsAnchored = (ScriptParams[1] == 0); return 0; } @@ -7993,7 +8008,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); ScriptParams[0] = gFireManager.StartScriptFire(pVehicle->GetPosition(), pVehicle, 0.8f, 1); StoreParameters(&m_nIp, 1); return 0; @@ -8002,7 +8017,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); ScriptParams[0] = gFireManager.StartScriptFire(pPed->GetPosition(), pPed, 0.8f, 1); StoreParameters(&m_nIp, 1); return 0; @@ -8102,9 +8117,9 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); CVehicle* pTarget = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); - assert(pTarget); + script_assert(pTarget); CCarAI::TellCarToRamOtherCar(pVehicle, pTarget); return 0; } @@ -8112,9 +8127,9 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); CVehicle* pTarget = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); - assert(pTarget); + script_assert(pTarget); CCarAI::TellCarToBlockOtherCar(pVehicle, pTarget); return 0; } @@ -8122,7 +8137,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_CATCH_TRAIN); return 0; @@ -8146,7 +8161,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bPedIsBleeding = (ScriptParams[1] != 0); return 0; } @@ -8154,7 +8169,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); // no action return 0; } @@ -8162,8 +8177,8 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); - assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); + script_assert(pVehicle); + script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); CAutomobile* pCar = (CAutomobile*)pVehicle; pCar->bBigWheels = (ScriptParams[1] != 0); return 0; @@ -8176,7 +8191,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); pPed->bIsVisible = (ScriptParams[1] != 0); return 0; } @@ -8184,7 +8199,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bIsVisible = (ScriptParams[1] != 0); return 0; } @@ -8192,7 +8207,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->bIsVisible = (ScriptParams[1] != 0); return 0; } @@ -8334,7 +8349,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 4); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); float heading = LimitAngleOnCircle( RADTODEG(Atan2(-pObject->GetForward().x, pObject->GetForward().y))); float headingTarget = *(float*)&ScriptParams[1]; @@ -8388,7 +8403,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 8); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); CVector pos = pObject->GetPosition(); CVector posTarget = *(CVector*)&ScriptParams[1]; #ifdef FIX_BUGS @@ -8479,7 +8494,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bKindaStayInSamePlace = (ScriptParams[1] != 0); return 0; } @@ -8490,7 +8505,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); char name[KEY_LENGTH_IN_SCRIPT]; CTheScripts::ReadTextLabelFromScript(&m_nIp, name); for (int i = 0; i < KEY_LENGTH_IN_SCRIPT; i++) @@ -8508,7 +8523,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); int mi = pPed->GetModelIndex(); pPed->m_modelIndex = -1; pPed->SetModelIndex(mi); @@ -8590,9 +8605,9 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 5); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); - assert(pVehicle); + script_assert(pVehicle); CVector offset = *(CVector*)&ScriptParams[2]; CPhysical::PlacePhysicalRelativeToOtherPhysical(pVehicle, pObject, offset); return 0; @@ -8601,9 +8616,9 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 1); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); CPlayerPed* pPlayerPed = CWorld::Players[CWorld::PlayerInFocus].m_pPed; - assert(pPlayerPed); + script_assert(pPlayerPed); pPlayerPed->MakeObjectTargettable(ScriptParams[0]); return 0; } @@ -8611,7 +8626,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 2); CPlayerPed* pPlayerPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPlayerPed); + script_assert(pPlayerPed); pPlayerPed->m_fArmour = clamp(pPlayerPed->m_fArmour + ScriptParams[1], 0.0f, 100.0f); return 0; } @@ -8619,7 +8634,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->m_fArmour = clamp(pPed->m_fArmour + ScriptParams[1], 0.0f, 100.0f); return 0; } @@ -8639,7 +8654,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 4); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVector pos = *(CVector*)&ScriptParams[1]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); @@ -8710,9 +8725,9 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]); - assert(pTarget); + script_assert(pTarget); UpdateCompareFlag(pPed->OurPedCanSeeThisOne(pTarget)); return 0; } @@ -8720,7 +8735,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_HAIL_TAXI); return 0; @@ -8729,7 +8744,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 1); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); UpdateCompareFlag(pObject->bRenderDamaged || !pObject->bIsVisible); return 0; } @@ -8767,9 +8782,9 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); - assert(pVehicle); + script_assert(pVehicle); pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle); pPed->WarpPedIntoCar(pVehicle); return 0; @@ -8778,9 +8793,9 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); - assert(pVehicle); + script_assert(pVehicle); pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle); pPed->WarpPedIntoCar(pVehicle); return 0; @@ -8826,7 +8841,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 3); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->SetWaitState((eWaitState)ScriptParams[1], ScriptParams[2] >= 0 ? &ScriptParams[2] : nil); return 0; } @@ -8887,7 +8902,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_STEAL_ANY_CAR); return 0; @@ -8978,7 +8993,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 4); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); pObject->SetMoveSpeed(*(CVector*)&ScriptParams[1] * METERS_PER_SECOND_TO_GAME_SPEED); return 0; } @@ -8986,7 +9001,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 2); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); pObject->bUsesCollision = (ScriptParams[1] != 0); return 0; } @@ -8994,16 +9009,16 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); // Adding this check to correspond to command name. // All original game scripts always assume that the vehicle is actually Mr. Whoopee, // but maybe there are mods that use it as "is alarm activated"? - assert(pVehicle->GetModelIndex() == MI_MRWHOOP); + script_assert(pVehicle->GetModelIndex() == MI_MRWHOOP); UpdateCompareFlag(pVehicle->m_bSirenOrAlarm); return 0; } default: - assert(0); + script_assert(0); } return -1; } @@ -9106,7 +9121,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 4); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); pObject->SetMoveSpeed(pObject->GetMoveSpeed() + METERS_PER_SECOND_TO_GAME_SPEED * *(CVector*)&ScriptParams[1]); return 0; } @@ -9170,7 +9185,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 2); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); if (ScriptParams[1]) { if (pObject->bIsStatic) { pObject->bIsStatic = false; @@ -9189,7 +9204,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CAnimBlendAssociation* pAssoc = RpAnimBlendClumpGetFirstAssociation(pPed->GetClump()); if (pAssoc) pAssoc->speed = *(float*)&ScriptParams[1]; @@ -9219,7 +9234,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->m_bSirenOrAlarm = ScriptParams[1] != 0; return 0; } @@ -9249,8 +9264,8 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); - assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); + script_assert(pVehicle); + script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); CAutomobile* pCar = (CAutomobile*)pVehicle; pCar->bWaterTight = ScriptParams[1] != 0; return 0; @@ -9280,7 +9295,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bDontDragMeOutCar = ScriptParams[1] != 0; return 0; } @@ -9288,7 +9303,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 3); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); const CVector& pos = pVehicle->GetPosition(); float heading = CGeneral::GetATanOfXY(pos.y - *(float*)&ScriptParams[2], pos.x - *(float*)&ScriptParams[1]) + HALFPI; if (heading > TWOPI) @@ -9318,7 +9333,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->SetStatus((eEntityStatus)ScriptParams[1]); return 0; } @@ -9326,7 +9341,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->m_nPedType != PEDTYPE_CIVFEMALE && pPed->m_nPedType != PEDTYPE_PROSTITUTE); return 0; } @@ -9366,7 +9381,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->bTakeLessDamage = ScriptParams[1] != 0; return 0; } @@ -9469,7 +9484,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); pPed->ClearWeapons(); return 0; } @@ -9531,7 +9546,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 2); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); if (ScriptParams[1]) { pPed->m_pWanted->m_bIgnoredByEveryone = true; CWorld::StopAllLawEnforcersInTheirTracks(); @@ -9545,7 +9560,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVehicle* pVehicle = pPed->bInVehicle ? pPed->m_pMyVehicle : nil; ScriptParams[0] = CPools::GetVehiclePool()->GetIndex(pVehicle); StoreParameters(&m_nIp, 1); @@ -9555,7 +9570,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); CVehicle* pVehicle = pPed->bInVehicle ? pPed->m_pMyVehicle : nil; ScriptParams[0] = CPools::GetVehiclePool()->GetIndex(pVehicle); StoreParameters(&m_nIp, 1); @@ -9567,7 +9582,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) return 0; case COMMAND_DISPLAY_ONSCREEN_TIMER_WITH_STRING: { - assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR); + script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR); int16 var = CTheScripts::Read2BytesFromScript(&m_nIp); wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ??? strncpy(onscreen_str, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); @@ -9577,7 +9592,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) } case COMMAND_DISPLAY_ONSCREEN_COUNTER_WITH_STRING: { - assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR); + script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR); int16 var = CTheScripts::Read2BytesFromScript(&m_nIp); CollectParameters(&m_nIp, 1); wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ??? @@ -9602,7 +9617,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) continue; // desperatly want to believe this was inlined :| CBaseModelInfo* pInfo = CModelInfo::GetModelInfo(model); - assert(pInfo->GetModelType() == MITYPE_VEHICLE); + script_assert(pInfo->GetModelType() == MITYPE_VEHICLE); CVehicleModelInfo* pVehicleInfo = (CVehicleModelInfo*)pInfo; if (pVehicleInfo->m_vehicleType != VEHICLE_TYPE_CAR) { switch (model) { @@ -9725,7 +9740,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); UpdateCompareFlag(pVehicle->bIsDamaged); return 0; } @@ -9746,7 +9761,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 3); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); CTheScripts::StuckCars.AddCarToCheck(ScriptParams[0], *(float*)&ScriptParams[1], ScriptParams[2]); return 0; } @@ -9904,7 +9919,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) CHud::m_ItemToFlash = ScriptParams[0]; return 0; default: - assert(0); + script_assert(0); } return -1; } @@ -9937,8 +9952,8 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); - assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); + script_assert(pVehicle); + script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); CAutomobile* pCar = (CAutomobile*)pVehicle; pCar->bNotDamagedUpsideDown = (ScriptParams[1] != 0); return 0; @@ -9947,7 +9962,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 1); CPlayerPed* pPlayerPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPlayerPed); + script_assert(pPlayerPed); UpdateCompareFlag(pPlayerPed->IsPedInControl() || pPlayerPed->m_nPedState == PED_DRIVING); return 0; } @@ -9980,7 +9995,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); ScriptParams[0] = pVehicle->m_currentColour1; ScriptParams[1] = pVehicle->m_currentColour2; StoreParameters(&m_nIp, 2); @@ -10024,7 +10039,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CollectParameters(&m_nIp, 3); CPed* pPed1 = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed2 = CPools::GetPedPool()->GetAt(ScriptParams[1]); - assert(pPed1 && pPed2); + script_assert(pPed1 && pPed2); pPed1->SetChat(pPed2, ScriptParams[2]); pPed2->SetChat(pPed1, ScriptParams[2]); return 0; @@ -10034,7 +10049,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); if (ScriptParams[1]) pVehicle->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pVehicle->GetPosition()); else @@ -10045,7 +10060,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); if (ScriptParams[1]) pPed->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pPed->GetPosition()); else @@ -10129,7 +10144,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); if (ScriptParams[1]) pPed->m_pNextPathNode = nil; pPed->bUsePedNodeSeek = !!ScriptParams[1]; @@ -10139,7 +10154,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->bGunSwitchedOff = !ScriptParams[1]; return 0; } @@ -10155,7 +10170,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); UpdateCompareFlag(!pVehicle->IsDoorMissing((eDoors)ScriptParams[1]) && pVehicle->IsDoorClosed((eDoors)ScriptParams[1])); return 0; } @@ -10187,7 +10202,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); pObject->bDrawLast = !!ScriptParams[1]; return 0; } @@ -10195,7 +10210,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); CWeapon* pWeaponSlot = &pPed->m_weapons[ScriptParams[1]]; if (pWeaponSlot->m_eWeaponType == (eWeaponType)ScriptParams[1]) ScriptParams[0] = pWeaponSlot->m_nAmmoTotal; @@ -10208,7 +10223,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CWeapon* pWeaponSlot = &pPed->m_weapons[ScriptParams[1]]; if (pWeaponSlot->m_eWeaponType == (eWeaponType)ScriptParams[1]) ScriptParams[0] = pWeaponSlot->m_nAmmoTotal; @@ -10272,7 +10287,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); - assert(pVehicle); + script_assert(pVehicle); UpdateCompareFlag(CGarages::IsThisCarWithinGarageArea(ScriptParams[0], pVehicle)); return 0; } @@ -10281,7 +10296,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); float fTraction = *(float*)&ScriptParams[1]; - assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR || pVehicle->m_vehType == VEHICLE_TYPE_BIKE); + script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR || pVehicle->m_vehType == VEHICLE_TYPE_BIKE); if (pVehicle->m_vehType == VEHICLE_TYPE_CAR) ((CAutomobile*)pVehicle)->m_fTraction = fTraction; else @@ -10358,7 +10373,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->AutoPilot.m_bStayInCurrentLevel = !!ScriptParams[1]; return 0; } @@ -10366,7 +10381,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); - assert(pPed); + script_assert(pPed); // not implemented return 0; } @@ -10421,8 +10436,8 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); - assert(ScriptParams[1] >= 0 && ScriptParams[1] < ARRAY_SIZE(pVehicle->pPassengers)); + script_assert(pVehicle); + script_assert(ScriptParams[1] >= 0 && ScriptParams[1] < ARRAY_SIZE(pVehicle->pPassengers)); CPed* pPassenger = pVehicle->pPassengers[ScriptParams[1]]; ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPassenger); StoreParameters(&m_nIp, 1); @@ -10432,7 +10447,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bChrisCriminal = !!ScriptParams[1]; return 0; } @@ -10454,7 +10469,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); if (ScriptParams[1]) pPed->m_nZoneLevel = LEVEL_IGNORE; else @@ -10478,7 +10493,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 1); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); CSpecialParticleStuff::UpdateBoatFoamAnimation(&pObject->GetMatrix()); return 0; } @@ -10510,7 +10525,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) pPlayerInfo->m_nNextSexMoneyUpdateTime = 0; } else { CPed* pHooker = CPools::GetPedPool()->GetAt(ScriptParams[1]); - assert(pHooker); + script_assert(pHooker); pPlayerInfo->m_pHooker = (CCivilianPed*)pHooker; pPlayerInfo->m_nNextSexFrequencyUpdateTime = CTimer::GetTimeInMilliseconds() + 1000; pPlayerInfo->m_nNextSexMoneyUpdateTime = CTimer::GetTimeInMilliseconds() + 3000; @@ -10528,7 +10543,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); ScriptParams[0] = pVehicle->GetModelIndex(); StoreParameters(&m_nIp, 1); return 0; @@ -10537,9 +10552,9 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); - assert(pVehicle); + script_assert(pVehicle); UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING && pPed->m_pMyVehicle == pVehicle); return 0; } @@ -10547,7 +10562,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 1); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING); return 0; } @@ -10562,7 +10577,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->bNoCriticalHits = (ScriptParams[0] == 0); return 0; } @@ -10570,7 +10585,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 1); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->GetPedState() == PED_MAKE_CALL); return 0; } @@ -10578,9 +10593,9 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); - assert(pVehicle); + script_assert(pVehicle); UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING && pPed->m_pMyVehicle == pVehicle); return 0; } @@ -10588,7 +10603,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING); return 0; } @@ -10596,7 +10611,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 1); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); UpdateCompareFlag(!pPed->bInVehicle && pPed->m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER && pPed->m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER); return 0; @@ -10605,14 +10620,14 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(!pPed->bInVehicle && pPed->m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER && pPed->m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER); return 0; } #ifndef GTA_PS2 default: - assert(0); + script_assert(0); } return -1; } @@ -10653,7 +10668,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); if (ScriptParams[1]) pVehicle->m_nZoneLevel = LEVEL_IGNORE; else @@ -10664,8 +10679,8 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); - assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); + script_assert(pVehicle); + script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); CAutomobile* pCar = (CAutomobile*)pVehicle; pCar->bMoreResistantToDamage = ScriptParams[1]; return 0; @@ -10674,7 +10689,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); CCarCtrl::JoinCarWithRoadSystemGotoCoors(pVehicle, FindPlayerCoors(), false); return 0; } @@ -10694,7 +10709,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 4); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); CWorld::Remove(pObject); pObject->SetOrientation( DEGTORAD(*(float*)&ScriptParams[1]), @@ -10717,7 +10732,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); CEntity* pTarget = pPed->m_pPointGunAt; UpdateCompareFlag(pTarget && pTarget->IsPed()); return 0; @@ -10726,9 +10741,9 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 2); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); CPed* pTestedPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); - assert(pTestedPed); + script_assert(pTestedPed); CEntity* pTarget = pPed->m_pPointGunAt; UpdateCompareFlag(pTarget && pTarget->IsPed() && pTarget == pTestedPed); return 0; @@ -10737,9 +10752,9 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 2); CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); CObject* pTestedObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]); - assert(pTestedObject); + script_assert(pTestedObject); CEntity* pTarget = pPed->m_pPointGunAt; UpdateCompareFlag(pTarget && pTarget->IsObject() && pTarget == pTestedObject); return 0; @@ -10822,7 +10837,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) pClosestEntity = nil; } if (pClosestEntity) { - assert(pClosestEntity->IsObject()); + script_assert(pClosestEntity->IsObject()); CObject* pObject = (CObject*)pClosestEntity; pObject->ObjectCreatedBy = MISSION_OBJECT; ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObject); @@ -10836,9 +10851,9 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 5); CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - assert(pObject); + script_assert(pObject); CObject* pTarget = CPools::GetObjectPool()->GetAt(ScriptParams[1]); - assert(pTarget); + script_assert(pTarget); CVector offset = *(CVector*)&ScriptParams[2]; CPhysical::PlacePhysicalRelativeToOtherPhysical(pTarget, pObject, offset); return 0; @@ -10847,7 +10862,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); if (pVehicle->pDriver) { pVehicle->pDriver->bScriptObjectiveCompleted = false; pVehicle->pDriver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, pVehicle); @@ -10909,7 +10924,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->AutoPilot.m_bStayInFastLane = !ScriptParams[1]; return 0; } @@ -10917,7 +10932,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); pPed->m_lastWepDam = -1; return 0; } @@ -11025,9 +11040,9 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); - assert(pVehicle); + script_assert(pVehicle); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_FLEE_CAR, pVehicle); return 0; @@ -11036,7 +11051,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); CPed* pDriver = pVehicle->pDriver; if (pDriver) ScriptParams[0] = CPools::GetPedPool()->GetIndex(pDriver); @@ -11049,7 +11064,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CPed* pLeader = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pLeader); + script_assert(pLeader); int total = 0; int i = CPools::GetPedPool()->GetSize(); while (--i) { @@ -11076,7 +11091,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); ScriptParams[0] = pPed->m_weapons[pPed->m_currentWeapon].m_eWeaponType; StoreParameters(&m_nIp, 1); return 0; @@ -11085,7 +11100,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); ScriptParams[0] = pPed->m_weapons[pPed->m_currentWeapon].m_eWeaponType; StoreParameters(&m_nIp, 1); return 0; @@ -11102,7 +11117,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->AutoPilot.m_nTempAction = TEMPACT_HANDBRAKETURNLEFT; pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + ScriptParams[1]; return 0; @@ -11111,7 +11126,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->AutoPilot.m_nTempAction = TEMPACT_HANDBRAKETURNRIGHT; pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + ScriptParams[1]; return 0; @@ -11120,7 +11135,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); pVehicle->AutoPilot.m_nTempAction = TEMPACT_HANDBRAKESTRAIGHT; pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + ScriptParams[1]; return 0; @@ -11129,7 +11144,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bInVehicle&& pPed->m_pMyVehicle->m_vehType == VEHICLE_TYPE_BIKE); return 0; } @@ -11146,7 +11161,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->m_vehType == VEHICLE_TYPE_BIKE); return 0; } @@ -11154,7 +11169,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 1); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); UpdateCompareFlag(pPed->bFallenDown); return 0; } @@ -11162,7 +11177,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) { CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); int pedtype = ScriptParams[1]; bool can = false; for (int i = 0; i < pPed->m_numNearPeds; i++) { @@ -11193,7 +11208,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) return 0; #endif default: - assert(0); + script_assert(0); } return -1; } @@ -11213,7 +11228,7 @@ int32 CTheScripts::GetActualScriptSphereIndex(int32 index) return -1; uint16 check = (uint32)index >> 16; uint16 array_idx = index & (0xFFFF); - assert(array_idx < ARRAY_SIZE(ScriptSphereArray)); + script_assert(array_idx < ARRAY_SIZE(ScriptSphereArray)); if (check != ScriptSphereArray[array_idx].m_Index) return -1; return array_idx; @@ -11451,7 +11466,7 @@ void CRunningScript::LocatePlayerCommand(int32 command, uint32* pIp) result = pPlayerInfo->m_pPed->bInVehicle; break; default: - assert(false); + script_assert(false); break; } } @@ -11484,7 +11499,7 @@ void CRunningScript::LocatePlayerCharCommand(int32 command, uint32* pIp) CollectParameters(pIp, b3D ? 6 : 5); CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]]; CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]); - assert(pTarget); + script_assert(pTarget); CVector pos = pPlayerInfo->GetPos(); if (pTarget->bInVehicle) { X = pTarget->m_pMyVehicle->GetPosition().x; @@ -11535,7 +11550,7 @@ void CRunningScript::LocatePlayerCharCommand(int32 command, uint32* pIp) result = pPlayerInfo->m_pPed->bInVehicle; break; default: - assert(false); + script_assert(false); break; } } @@ -11571,7 +11586,7 @@ void CRunningScript::LocatePlayerCarCommand(int32 command, uint32* pIp) CollectParameters(pIp, b3D ? 6 : 5); CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]]; CVehicle* pTarget = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); - assert(pTarget); + script_assert(pTarget); CVector pos = pPlayerInfo->GetPos(); X = pTarget->GetPosition().x; Y = pTarget->GetPosition().y; @@ -11616,7 +11631,7 @@ void CRunningScript::LocatePlayerCarCommand(int32 command, uint32* pIp) result = pPlayerInfo->m_pPed->bInVehicle; break; default: - assert(false); + script_assert(false); break; } } @@ -11650,7 +11665,7 @@ void CRunningScript::LocateCharCommand(int32 command, uint32* pIp) } CollectParameters(pIp, b3D ? 8 : 6); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition(); switch (command) { case COMMAND_LOCATE_STOPPED_CHAR_ANY_MEANS_2D: @@ -11719,7 +11734,7 @@ void CRunningScript::LocateCharCommand(int32 command, uint32* pIp) result = pPed->bInVehicle; break; default: - assert(false); + script_assert(false); break; } } @@ -11751,9 +11766,9 @@ void CRunningScript::LocateCharCharCommand(int32 command, uint32* pIp) } CollectParameters(pIp, b3D ? 6 : 5); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]); - assert(pTarget); + script_assert(pTarget); CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition(); if (pTarget->bInVehicle) { X = pTarget->m_pMyVehicle->GetPosition().x; @@ -11805,7 +11820,7 @@ void CRunningScript::LocateCharCharCommand(int32 command, uint32* pIp) result = pPed->bInVehicle; break; default: - assert(false); + script_assert(false); break; } } @@ -11840,9 +11855,9 @@ void CRunningScript::LocateCharCarCommand(int32 command, uint32* pIp) } CollectParameters(pIp, b3D ? 6 : 5); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVehicle* pTarget = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); - assert(pTarget); + script_assert(pTarget); CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition(); X = pTarget->GetPosition().x; Y = pTarget->GetPosition().y; @@ -11887,7 +11902,7 @@ void CRunningScript::LocateCharCarCommand(int32 command, uint32* pIp) result = pPed->bInVehicle; break; default: - assert(false); + script_assert(false); break; } } @@ -11918,9 +11933,9 @@ void CRunningScript::LocateCharObjectCommand(int32 command, uint32* pIp) } CollectParameters(pIp, b3D ? 6 : 5); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CObject* pTarget = CPools::GetObjectPool()->GetAt(ScriptParams[1]); - assert(pTarget); + script_assert(pTarget); CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition(); X = pTarget->GetPosition().x; Y = pTarget->GetPosition().y; @@ -11965,7 +11980,7 @@ void CRunningScript::LocateCharObjectCommand(int32 command, uint32* pIp) result = pPed->bInVehicle; break; default: - assert(false); + script_assert(false); break; } } @@ -11995,7 +12010,7 @@ void CRunningScript::LocateCarCommand(int32 command, uint32* pIp) } CollectParameters(pIp, b3D ? 8 : 6); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); CVector pos = pVehicle->GetPosition(); switch (command) { case COMMAND_LOCATE_STOPPED_CAR_2D: @@ -12192,7 +12207,7 @@ void CRunningScript::PlayerInAreaCheckCommand(int32 command, uint32* pIp) result = pPlayerInfo->m_pPed->bInVehicle; break; default: - assert(false); + script_assert(false); break; } } @@ -12314,7 +12329,7 @@ void CRunningScript::PlayerInAngledAreaCheckCommand(int32 command, uint32* pIp) result = pPlayerInfo->m_pPed->bInVehicle; break; default: - assert(false); + script_assert(false); break; } } @@ -12352,7 +12367,7 @@ void CRunningScript::CharInAreaCheckCommand(int32 command, uint32* pIp) } CollectParameters(pIp, b3D ? 8 : 6); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - assert(pPed); + script_assert(pPed); CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition(); switch (command) { case COMMAND_IS_CHAR_STOPPED_IN_AREA_3D: @@ -12435,7 +12450,7 @@ void CRunningScript::CharInAreaCheckCommand(int32 command, uint32* pIp) result = pPed->bInVehicle; break; default: - assert(false); + script_assert(false); break; } } @@ -12466,7 +12481,7 @@ void CRunningScript::CarInAreaCheckCommand(int32 command, uint32* pIp) } CollectParameters(pIp, b3D ? 8 : 6); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - assert(pVehicle); + script_assert(pVehicle); CVector pos = pVehicle->GetPosition(); switch (command) { case COMMAND_IS_CAR_STOPPED_IN_AREA_3D: @@ -12533,7 +12548,7 @@ void CRunningScript::CarInAreaCheckCommand(int32 command, uint32* pIp) result = true; break; default: - assert(false); + script_assert(false); break; } } @@ -12564,7 +12579,7 @@ void CRunningScript::DoDeatharrestCheck() if (CanAllowMissionReplay()) AllowMissionReplay = 1; #endif - assert(m_nStackPointer > 0); + script_assert(m_nStackPointer > 0); while (m_nStackPointer > 1) --m_nStackPointer; m_nIp = m_anStack[--m_nStackPointer]; @@ -12844,7 +12859,7 @@ INITSAVEBUF uint32 varSpace = ReadSaveBuf(buf); for (uint32 i = 0; i < varSpace; i++) ScriptSpace[i] = ReadSaveBuf(buf); - assert(ReadSaveBuf(buf) == SCRIPT_DATA_SIZE); + script_assert(ReadSaveBuf(buf) == SCRIPT_DATA_SIZE); OnAMissionFlag = ReadSaveBuf(buf); for (uint32 i = 0; i < MAX_NUM_CONTACTS; i++) { OnAMissionForContactFlag[i] = ReadSaveBuf(buf); @@ -12867,7 +12882,7 @@ INITSAVEBUF BuildingSwapArray[i].m_pBuilding = CPools::GetBuildingPool()->GetSlot(handle - 1); break; default: - assert(false); + script_assert(false); } BuildingSwapArray[i].m_nNewModel = ReadSaveBuf(buf); BuildingSwapArray[i].m_nOldModel = ReadSaveBuf(buf); @@ -12894,17 +12909,17 @@ INITSAVEBUF InvisibilitySettingArray[i] = CPools::GetDummyPool()->GetSlot(handle - 1); break; default: - assert(false); + script_assert(false); } if (InvisibilitySettingArray[i]) InvisibilitySettingArray[i]->bIsVisible = false; } - assert(ReadSaveBuf(buf) == bUsingAMultiScriptFile); + script_assert(ReadSaveBuf(buf) == bUsingAMultiScriptFile); ReadSaveBuf(buf); ReadSaveBuf(buf); - assert(ReadSaveBuf(buf) == MainScriptSize); - assert(ReadSaveBuf(buf) == LargestMissionScriptSize); - assert(ReadSaveBuf(buf) == NumberOfMissionScripts); + script_assert(ReadSaveBuf(buf) == MainScriptSize); + script_assert(ReadSaveBuf(buf) == LargestMissionScriptSize); + script_assert(ReadSaveBuf(buf) == NumberOfMissionScripts); ReadSaveBuf(buf); uint32 runningScripts = ReadSaveBuf(buf); for (uint32 i = 0; i < runningScripts; i++) diff --git a/src/core/config.h b/src/core/config.h index f7efe694..98f031b3 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -236,6 +236,10 @@ enum Config { #define USE_ADVANCED_SCRIPT_DEBUG_OUTPUT #define SCRIPT_LOG_FILE_LEVEL 1 // 0 == no log, 1 == overwrite every frame, 2 == full log +#ifndef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT +#define USE_BASIC_SCRIPT_DEBUG_OUTPUT +#endif + // Replay //#define DONT_FIX_REPLAY_BUGS // keeps various bugs in CReplay, some of which are fairly cool! //#define USE_BETA_REPLAY_MODE // adds another replay mode, a few seconds slomo (caution: buggy!) From 418bee9c2207b7f362e7a6360e77184d0cdbc35c Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 28 Jun 2020 12:05:31 +0200 Subject: [PATCH 132/133] renamed 2dfx shadowRange to Size --- src/core/FileLoader.cpp | 2 +- src/entities/Entity.cpp | 10 +++++----- src/render/2dEffect.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index a1fb5ace..3c4ed040 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -945,7 +945,7 @@ CFileLoader::Load2dEffect(const char *line) &effect->light.dist, &effect->light.range, &effect->light.size, - &effect->light.shadowRange, + &effect->light.shadowSize, &shadowIntens, &lightType, &roadReflection, &flare, &flags); effect->light.corona = RwTextureRead(corona, nil); effect->light.shadow = RwTextureRead(shadow, nil); diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp index a9b6b2b8..31da489f 100644 --- a/src/entities/Entity.cpp +++ b/src/entities/Entity.cpp @@ -803,12 +803,12 @@ CEntity::ProcessLightsForEntity(void) } // Light shadow - if(effect->light.shadowRange != 0.0f){ + if(effect->light.shadowSize != 0.0f){ if(lightOn){ CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE, effect->light.shadow, &pos, - effect->light.shadowRange, 0.0f, - 0.0f, -effect->light.shadowRange, + effect->light.shadowSize, 0.0f, + 0.0f, -effect->light.shadowSize, 128, effect->col.r*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, effect->col.g*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, @@ -817,8 +817,8 @@ CEntity::ProcessLightsForEntity(void) }else if(lightFlickering){ CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE, effect->light.shadow, &pos, - effect->light.shadowRange, 0.0f, - 0.0f, -effect->light.shadowRange, + effect->light.shadowSize, 0.0f, + 0.0f, -effect->light.shadowSize, 0, 0.0f, 0.0f, 0.0f, 15.0f, 1.0f, 40.0f, false, 0.0f); } diff --git a/src/render/2dEffect.h b/src/render/2dEffect.h index 4256a0ac..628d64c2 100644 --- a/src/render/2dEffect.h +++ b/src/render/2dEffect.h @@ -44,7 +44,7 @@ public: float dist; float range; // of pointlight float size; - float shadowRange; + float shadowSize; uint8 lightType; // LIGHT_ uint8 roadReflection; uint8 flareType; From 920bc0a1bf883ffdf6564bab47cd3949777e664b Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 28 Jun 2020 16:24:09 +0300 Subject: [PATCH 133/133] fix --- src/control/Script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 9cb6af46..934571ef 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -2097,7 +2097,7 @@ int8 CRunningScript::ProcessOneCommand() m_bNotFlag = (command & 0x8000); command &= 0x7FFF; #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT - char commandInfo[128]; + char commandInfo[1024]; uint32 ip = m_nIp; if (command < ARRAY_SIZE(commands)) { script_assert(commands[command].id == command);