diff --git a/src/openloco/objects/objectmgr.cpp b/src/openloco/objects/objectmgr.cpp index 3427b57e..ce790c01 100644 --- a/src/openloco/objects/objectmgr.cpp +++ b/src/openloco/objects/objectmgr.cpp @@ -7,40 +7,40 @@ namespace openloco::objectmgr { loco_global_array object_repository; - loco_global_array _interfaceObjects; - loco_global_array _soundObjects; - loco_global_array _currencyObjects; - loco_global_array _steamObjects; - loco_global_array _rockObjects; - loco_global_array _waterObjects; - loco_global_array _landObjects; - loco_global_array _townNamesObjects; - loco_global_array _cargoObjects; - loco_global_array _wallObjects; - loco_global_array _trainSignalObjects; - loco_global_array _levelCrossingObjects; - loco_global_array _streetLightObjects; - loco_global_array _tunnelObjects; - loco_global_array _bridgeObjects; - loco_global_array _trainStationObjects; - loco_global_array _trackExtraObjects; - loco_global_array _trackObjects; - loco_global_array _roadStationObjects; - loco_global_array _roadExtraObjects; - loco_global_array _roadObjects; - loco_global_array _airportObjects; - loco_global_array _dockObjects; - loco_global_array _vehicleObjects; - loco_global_array _treeObjects; - loco_global_array _snowObjects; - loco_global_array _climateObjects; - loco_global_array _hillShapeObjects; - loco_global_array _buildingObjects; - loco_global_array _scaffoldingObjects; - loco_global_array _industryObjects; - loco_global_array _regionObjects; - loco_global_array _competitorsObjects; - loco_global_array _scenarioTextObjects; + loco_global_array _interfaceObjects; + loco_global_array _soundObjects; + loco_global_array _currencyObjects; + loco_global_array _steamObjects; + loco_global_array _rockObjects; + loco_global_array _waterObjects; + loco_global_array _landObjects; + loco_global_array _townNamesObjects; + loco_global_array _cargoObjects; + loco_global_array _wallObjects; + loco_global_array _trainSignalObjects; + loco_global_array _levelCrossingObjects; + loco_global_array _streetLightObjects; + loco_global_array _tunnelObjects; + loco_global_array _bridgeObjects; + loco_global_array _trainStationObjects; + loco_global_array _trackExtraObjects; + loco_global_array _trackObjects; + loco_global_array _roadStationObjects; + loco_global_array _roadExtraObjects; + loco_global_array _roadObjects; + loco_global_array _airportObjects; + loco_global_array _dockObjects; + loco_global_array _vehicleObjects; + loco_global_array _treeObjects; + loco_global_array _snowObjects; + loco_global_array _climateObjects; + loco_global_array _hillShapeObjects; + loco_global_array _buildingObjects; + loco_global_array _scaffoldingObjects; + loco_global_array _industryObjects; + loco_global_array _regionObjects; + loco_global_array _competitorsObjects; + loco_global_array _scenarioTextObjects; // 0x00470F3C void load_index() @@ -53,49 +53,48 @@ namespace openloco::objectmgr return _cargoObjects[id]; } - vehicle_object * get_vehicle_object(size_t id) + vehicle_object* get_vehicle_object(size_t id) { return _vehicleObjects[id]; } size_t get_max_objects(object_type type) { - static size_t counts[] = - { - 1, // interface, - 128, // sound, - 1, // currency, - 32, // steam, - 8, // rock, - 1, // water, - 32, // surface, - 1, // town_names, - 32, // cargo, - 32, // wall, - 16, // train_signal, - 4, // level_crossing, - 1, // street_light, - 16, // tunnel, - 8, // bridge, - 16, // train_station, - 8, // track_extra, - 8, // track, - 16, // road_station, - 4, // road_extra, - 8, // road, - 8, // airport, - 8, // dock, - 224, // vehicle, - 64, // tree, - 1, // snow, - 1, // climate, - 1, // hill_shapes, - 128, // building, - 1, // scaffolding, - 16, // industry, - 1, // region, - 32, // competitors, - 1 // scenario_text, + static size_t counts[] = { + 1, // interface, + 128, // sound, + 1, // currency, + 32, // steam, + 8, // rock, + 1, // water, + 32, // surface, + 1, // town_names, + 32, // cargo, + 32, // wall, + 16, // train_signal, + 4, // level_crossing, + 1, // street_light, + 16, // tunnel, + 8, // bridge, + 16, // train_station, + 8, // track_extra, + 8, // track, + 16, // road_station, + 4, // road_extra, + 8, // road, + 8, // airport, + 8, // dock, + 224, // vehicle, + 64, // tree, + 1, // snow, + 1, // climate, + 1, // hill_shapes, + 128, // building, + 1, // scaffolding, + 16, // industry, + 1, // region, + 32, // competitors, + 1 // scenario_text, }; return counts[(size_t)type]; }; diff --git a/src/openloco/objects/objectmgr.h b/src/openloco/objects/objectmgr.h index 72c6999f..c75564a3 100644 --- a/src/openloco/objects/objectmgr.h +++ b/src/openloco/objects/objectmgr.h @@ -1,7 +1,7 @@ #pragma once -#include #include +#include namespace openloco { @@ -54,7 +54,7 @@ namespace openloco struct water_object; struct land_object; struct town_names_object; - struct wall_object; + struct wall_object; struct train_signal_object; struct level_crossing_object; struct street_light_object; @@ -82,8 +82,8 @@ namespace openloco struct object_repository_item { - object * objects; - uint32_t * object_entry_extendeds; + object* objects; + uint32_t* object_entry_extendeds; }; } @@ -92,5 +92,5 @@ namespace openloco::objectmgr void load_index(); cargo_object* get_cargo_object(size_t id); size_t get_max_objects(object_type type); - vehicle_object * get_vehicle_object(size_t id); + vehicle_object* get_vehicle_object(size_t id); } diff --git a/src/openloco/objects/vehicle_object.h b/src/openloco/objects/vehicle_object.h index 3abff739..2139d494 100644 --- a/src/openloco/objects/vehicle_object.h +++ b/src/openloco/objects/vehicle_object.h @@ -6,61 +6,61 @@ namespace openloco { struct vehicle_object_unk { - uint8_t length; // 0x00 + uint8_t length; // 0x00 uint8_t pad_01[0x04 - 0x01]; - uint8_t sprite_ind; // 0x04 + uint8_t sprite_ind; // 0x04 uint8_t var_05; }; struct vehicle_object_sprite { - uint8_t num_dir; // 0x00 + uint8_t num_dir; // 0x00 uint8_t pad_01[0x03 - 0x01]; - uint8_t vehicle_type; // 0x03 - uint8_t num_units; // 0x04 + uint8_t vehicle_type; // 0x03 + uint8_t num_units; // 0x04 uint8_t pad_05; uint8_t bogey_position; // 0x06 uint8_t flags; // 0x07 uint8_t pad_08[0x0E - 0x08]; - uint8_t sprite_num; // 0x0E + uint8_t sprite_num; // 0x0E uint8_t pad_0F[0x1E - 0xF]; }; struct vehicle_object { - string_id name; // 0x00 probably not confirmed - uint8_t vehicle_class; // 0x02 - uint8_t type; // 0x03 + string_id name; // 0x00 probably not confirmed + uint8_t vehicle_class; // 0x02 + uint8_t type; // 0x03 uint8_t pad_04[0x6 - 0x4]; - uint8_t num_mods; // 0x06 - uint8_t cost_ind; // 0x07 - int16_t cost_fact; // 0x08 - uint8_t reliability; // 0x0A - uint8_t run_cost_ind; // 0x0B - int16_t run_cost_fact; // 0x0C - uint8_t colour_type; // 0x0E - uint8_t num_compat; // 0x0F + uint8_t num_mods; // 0x06 + uint8_t cost_ind; // 0x07 + int16_t cost_fact; // 0x08 + uint8_t reliability; // 0x0A + uint8_t run_cost_ind; // 0x0B + int16_t run_cost_fact; // 0x0C + uint8_t colour_type; // 0x0E + uint8_t num_compat; // 0x0F uint8_t pad_10[0x24 - 0x10]; vehicle_object_unk var_24[4]; - vehicle_object_sprite sprites[4]; // 0x3C + vehicle_object_sprite sprites[4]; // 0x3C uint8_t pad_B4[0xD8 - 0xB4]; - uint16_t power; // 0xD8 - uint16_t speed; // 0xDA - uint16_t rack_speed; // 0xDC - uint16_t weight; // 0xDE - uint16_t flags; // 0xE0 + uint16_t power; // 0xD8 + uint16_t speed; // 0xDA + uint16_t rack_speed; // 0xDC + uint16_t weight; // 0xDE + uint16_t flags; // 0xE0 uint8_t pad_E1[0x10E - 0xE1]; - uint8_t vis_fx_height; // 0x10E - uint8_t vis_fx_type; // 0x10F + uint8_t vis_fx_height; // 0x10E + uint8_t vis_fx_type; // 0x10F uint8_t pad_110[0x112 - 0x110]; - uint8_t wake_fx_type; // 0x112 + uint8_t wake_fx_type; // 0x112 uint8_t pad_113; - uint16_t designed; // 0x114 - uint16_t obsolete; // 0x116 + uint16_t designed; // 0x114 + uint16_t obsolete; // 0x116 uint8_t pad_118; - uint8_t startsnd_type; // 0x119 + uint8_t startsnd_type; // 0x119 uint8_t pad_11A[0x15A - 0x11A]; - uint8_t numsnd; // 0x15A + uint8_t numsnd; // 0x15A uint8_t pad_15B[0x15E - 0x15B]; }; } diff --git a/src/openloco/things/thing.cpp b/src/openloco/things/thing.cpp index d4448f35..baa8cecf 100644 --- a/src/openloco/things/thing.cpp +++ b/src/openloco/things/thing.cpp @@ -1,8 +1,8 @@ -#include +#include "thing.h" #include "../graphics/gfx.h" #include "../interop/interop.hpp" #include "../viewportmgr.h" -#include "thing.h" +#include using namespace openloco; using namespace openloco::interop; diff --git a/src/openloco/things/thing.h b/src/openloco/things/thing.h index e24eac53..42cbed9b 100644 --- a/src/openloco/things/thing.h +++ b/src/openloco/things/thing.h @@ -34,31 +34,31 @@ namespace openloco int16_t z; // 0x12 uint8_t var_14; uint8_t var_15; - int16_t sprite_left; // 0x16 - int16_t sprite_top; // 0x18 - int16_t sprite_right; // 0x1A - int16_t sprite_bottom; // 0x1C + int16_t sprite_left; // 0x16 + int16_t sprite_top; // 0x18 + int16_t sprite_right; // 0x1A + int16_t sprite_bottom; // 0x1C uint8_t pad_1E[0x28 - 0x1E]; uint16_t var_28; uint8_t pad_2A[0x38 - 0x2A]; uint8_t var_38; uint8_t pad_39; - thing_id_t next_car_id; // 0x3A + thing_id_t next_car_id; // 0x3A uint8_t pad_3C[0x40 - 0x3C]; uint16_t object_type; uint8_t var_42; uint8_t pad_43[0x4C - 0x43]; - uint8_t cargo_type; // 0x4C + uint8_t cargo_type; // 0x4C uint8_t pad_4D; uint16_t cargo_origin; // 0x4E uint8_t pad_50; - uint8_t cargo_quantity; // 0x51 + uint8_t cargo_quantity; // 0x51 uint8_t pad_52[0x54 - 0x52]; uint8_t var_54; uint8_t pad_55[0x5D - 0x55]; uint8_t var_5D; uint8_t var_5E; - uint8_t var_5F; // 0x5F (bit 1 = can break down) + uint8_t var_5F; // 0x5F (bit 1 = can break down) uint8_t pad_60[0x6A - 0x60]; uint8_t var_6A; uint8_t pad_6B[0x73 - 0x6B]; diff --git a/src/openloco/things/vehicle.cpp b/src/openloco/things/vehicle.cpp index a0ec1541..570e94d5 100644 --- a/src/openloco/things/vehicle.cpp +++ b/src/openloco/things/vehicle.cpp @@ -1,28 +1,28 @@ #include "vehicle.h" -#include #include "../audio/audio.h" #include "../config.h" #include "../graphics/gfx.h" #include "../interop/interop.hpp" -#include "../openloco.h" -#include "../objects/vehicle_object.h" #include "../objects/objectmgr.h" +#include "../objects/vehicle_object.h" +#include "../openloco.h" #include "../utility/numeric.hpp" #include "../viewportmgr.h" #include "thingmgr.h" +#include using namespace openloco; using namespace openloco::interop; using namespace openloco::objectmgr; -loco_global vehicle_1136118; -loco_global vehicle_1136124; -loco_global vehicle_1136128; +loco_global vehicle_1136118; +loco_global vehicle_1136124; +loco_global vehicle_1136128; loco_global vehicle_var_1136130; loco_global vehicle_var_1136237; // var_28 related? loco_global vehicle_var_1136238; // var_28 related? -vehicle * vehicle::next_vehicle() +vehicle* vehicle::next_vehicle() { return thingmgr::get(next_thing_id); } @@ -175,7 +175,7 @@ int32_t openloco::vehicle::sub_4AA1D0() if (vehicle_var_1136237 | vehicle_var_1136238) { invalidate_sprite(); - vehicle * veh = vehicle_1136124; + vehicle* veh = vehicle_1136124; regs.ebx = (int32_t)veh; veh = vehicle_1136128; regs.edi = (int32_t)veh; @@ -204,11 +204,11 @@ void openloco::vehicle::sub_4AAC4E() if (var_38 & (1 << 4)) return; - vehicle * veh = vehicle_1136118; + vehicle* veh = vehicle_1136118; if ((veh->var_5D == 8) || (veh->var_5D == 9)) return; - vehicle_object * vehicleObject = get_vehicle_object(object_type); + vehicle_object* vehicleObject = get_vehicle_object(object_type); registers regs; regs.esi = (int32_t)this; regs.bl = vehicleObject->var_24[var_54].var_05; @@ -221,28 +221,28 @@ void openloco::vehicle::sub_4AAC4E() regs.ebx -= 0x80; switch (vehicleObject->vis_fx_type) { - case 0: - call(0x004AB655, regs); - break; - case 1: - case 2: - case 3: - call(0x004AACA5, regs); - break; - case 4: - call(0x004AAFFA, regs); - break; - case 5: - call(0x004AB3CA, regs); - break; - case 6: - call(0x004AB4E0, regs); - break; - case 7: - call(0x004AB177, regs); - break; - case 8: - call(0x004AB2A7, regs); - break; + case 0: + call(0x004AB655, regs); + break; + case 1: + case 2: + case 3: + call(0x004AACA5, regs); + break; + case 4: + call(0x004AAFFA, regs); + break; + case 5: + call(0x004AB3CA, regs); + break; + case 6: + call(0x004AB4E0, regs); + break; + case 7: + call(0x004AB177, regs); + break; + case 8: + call(0x004AB2A7, regs); + break; } } diff --git a/src/openloco/viewportmgr.cpp b/src/openloco/viewportmgr.cpp index fd0ff4bc..14610528 100644 --- a/src/openloco/viewportmgr.cpp +++ b/src/openloco/viewportmgr.cpp @@ -1,15 +1,15 @@ -#include +#include "viewportmgr.h" #include "interop/interop.hpp" #include "ui.h" #include "window.h" -#include "viewportmgr.h" +#include using namespace openloco::ui; using namespace openloco::interop; namespace openloco::ui::viewportmgr { - loco_global_array _viewports; + loco_global_array _viewports; std::array viewports() { diff --git a/src/openloco/window.h b/src/openloco/window.h index 97035755..a1d44709 100644 --- a/src/openloco/window.h +++ b/src/openloco/window.h @@ -44,17 +44,17 @@ namespace openloco::ui struct viewport { - int16_t width; // 0x00 - int16_t height; // 0x02 - int16_t x; // 0x04 - int16_t y; // 0x06 - int16_t view_x; // 0x08 - int16_t view_y; // 0x0A - int16_t view_width; // 0x0C - int16_t view_height; // 0x0E - uint8_t zoom; // 0x10 + int16_t width; // 0x00 + int16_t height; // 0x02 + int16_t x; // 0x04 + int16_t y; // 0x06 + int16_t view_x; // 0x08 + int16_t view_y; // 0x0A + int16_t view_width; // 0x0C + int16_t view_height; // 0x0E + uint8_t zoom; // 0x10 uint8_t pad_11; - uint16_t var_12; // 0x12, maybe flags + uint16_t var_12; // 0x12, maybe flags }; - #pragma pack(pop) +#pragma pack(pop) }