Start implementing vehicle update.
Label all object array addresss
This commit is contained in:
parent
e684b74553
commit
dd3101d279
|
@ -5,7 +5,42 @@ using namespace openloco::interop;
|
|||
|
||||
namespace openloco::objectmgr
|
||||
{
|
||||
loco_global_array<cargo_object*, 32, 0x0050C700> _cargoObjects;
|
||||
loco_global_array<object_repository_item, 64, 0x4FE0B8> object_repository;
|
||||
// Array sizes to be confirmed
|
||||
loco_global_array<interface_object *, 1, 0x0050C3D0> _interfaceObjects;
|
||||
loco_global_array<sound_object *, 1, 0x0050C3D4> _soundObjects;
|
||||
loco_global_array<currency_object *, 1, 0x0050C5D4> _currencyObjects;
|
||||
loco_global_array<steam_object *, 1, 0x0050C5D8> _steamObjects;
|
||||
loco_global_array<rocks_object *, 1, 0x0050C658> _rockObjects;
|
||||
loco_global_array<water_object *, 1, 0x0050C678> _waterObjects;
|
||||
loco_global_array<surface_object *, 1, 0x0050C67C> _surfaceObjects;
|
||||
loco_global_array<town_name_object *, 1, 0x0050C6FC> _townNameObjects;
|
||||
loco_global_array<cargo_object *, 32, 0x0050C700> _cargoObjects;
|
||||
loco_global_array<wall_object *, 1, 0x0050C780> _wallObjects;
|
||||
loco_global_array<train_signal_object *, 1, 0x0050C800> _trainSignalObjects;
|
||||
loco_global_array<level_crossing_object *, 1, 0x0050C840> _levlCrossingObjects;
|
||||
loco_global_array<street_light_object *, 1, 0x0050C850> _streetLightObjects;
|
||||
loco_global_array<tunnel_object *, 1, 0x0050C854> _tunnelObjects;
|
||||
loco_global_array<bridge_object *, 1, 0x0050C894> _bridgeObjects;
|
||||
loco_global_array<train_station_object *, 1, 0x0050C8B4> _trainStationObjects;
|
||||
loco_global_array<track_extra_object *, 1, 0x0050C8F4> _trackExtraObjects;
|
||||
loco_global_array<track_object *, 1, 0x0050C914> _trackObjects;
|
||||
loco_global_array<road_station_object *, 1, 0x0050C934> _roadStationObjects;
|
||||
loco_global_array<road_extra_object *, 1, 0x0050C974> _roadExtraObjects;
|
||||
loco_global_array<road_object *, 1, 0x0050C984> _roadObjects;
|
||||
loco_global_array<airport_object *, 1, 0x0050C9A4> _airportObjects;
|
||||
loco_global_array<dock_object *, 1, 0x0050C9C4> _dockObjects;
|
||||
loco_global_array<vehicle_object *, 1, 0x0050C9E4> _vehicleObjects;
|
||||
loco_global_array<tree_object *, 1, 0x0050CD64> _treeObjects;
|
||||
loco_global_array<snow_object *, 1, 0x0050CE64> _snowObjects;
|
||||
loco_global_array<climate_object *, 1, 0x0050CE68> _cliamteObjects;
|
||||
loco_global_array<hill_shapes_object *, 1, 0x0050CE6C> _hillShapeObjects;
|
||||
loco_global_array<building_object *, 1, 0x0050CE70> _buildingObjects;
|
||||
loco_global_array<scaffolding_object *, 1, 0x0050D070> _scaffoldingObjects;
|
||||
loco_global_array<industry_object *, 1, 0x0050D074> _industryObjects;
|
||||
loco_global_array<region_object *, 1, 0x0050D0B4> _regionObjects;
|
||||
loco_global_array<competitors_object *, 1, 0x0050D0B8> _competitorsObjects;
|
||||
loco_global_array<scenario_text_object *, 1, 0x0050D138> _scenarioTextObjects;
|
||||
|
||||
// 0x00470F3C
|
||||
void load_index()
|
||||
|
@ -18,6 +53,11 @@ namespace openloco::objectmgr
|
|||
return _cargoObjects[id];
|
||||
}
|
||||
|
||||
vehicle_object * get_vehicle_object(size_t id)
|
||||
{
|
||||
return _vehicleObjects[id];
|
||||
}
|
||||
|
||||
size_t get_max_objects(object_type type)
|
||||
{
|
||||
static size_t counts[] = {
|
||||
|
|
|
@ -42,7 +42,48 @@ namespace openloco
|
|||
scenario_text,
|
||||
};
|
||||
|
||||
struct object;
|
||||
struct object_entry_extended;
|
||||
struct cargo_object;
|
||||
struct interface_object;
|
||||
struct sound_object;
|
||||
struct currency_object;
|
||||
struct steam_object;
|
||||
struct rocks_object;
|
||||
struct water_object;
|
||||
struct surface_object;
|
||||
struct town_name_object;
|
||||
struct wall_object;
|
||||
struct train_signal_object;
|
||||
struct level_crossing_object;
|
||||
struct street_light_object;
|
||||
struct tunnel_object;
|
||||
struct bridge_object;
|
||||
struct train_station_object;
|
||||
struct track_extra_object;
|
||||
struct track_object;
|
||||
struct road_station_object;
|
||||
struct road_extra_object;
|
||||
struct road_object;
|
||||
struct airport_object;
|
||||
struct dock_object;
|
||||
struct vehicle_object;
|
||||
struct tree_object;
|
||||
struct snow_object;
|
||||
struct climate_object;
|
||||
struct hill_shapes_object;
|
||||
struct building_object;
|
||||
struct scaffolding_object;
|
||||
struct industry_object;
|
||||
struct region_object;
|
||||
struct competitors_object;
|
||||
struct scenario_text_object;
|
||||
|
||||
struct object_repository_item
|
||||
{
|
||||
object * objects;
|
||||
uint32_t * object_entry_extendeds;
|
||||
};
|
||||
}
|
||||
|
||||
namespace openloco::objectmgr
|
||||
|
@ -50,4 +91,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);
|
||||
}
|
||||
|
|
|
@ -36,15 +36,22 @@ namespace openloco
|
|||
uint8_t var_15;
|
||||
uint8_t pad_16[0x28 - 0x16];
|
||||
uint16_t var_28;
|
||||
uint8_t pad_2A[0x3A - 0x2A];
|
||||
thing_id_t next_car_id; // 0x3A
|
||||
uint8_t pad_3C[0x4C - 0x3C];
|
||||
uint8_t cargo_type; // 0x4C
|
||||
uint8_t pad_2A[0x38 - 0x2A];
|
||||
uint8_t var_38;
|
||||
uint8_t pad_39;
|
||||
thing_id_t next_car_id; // 0x3A
|
||||
uint8_t pad_3C[0x40 - 0x3C];
|
||||
uint16_t var_40;
|
||||
uint8_t var_42;
|
||||
uint8_t pad_43[0x4C - 0x43];
|
||||
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 pad_52[0x5D - 0x52];
|
||||
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 pad_5E;
|
||||
uint8_t var_5F; // 0x5F (bit 1 = can break down)
|
||||
|
|
|
@ -3,11 +3,15 @@
|
|||
#include "../config.h"
|
||||
#include "../interop/interop.hpp"
|
||||
#include "../openloco.h"
|
||||
#include "../objects/objectmgr.h"
|
||||
#include "../utility/numeric.hpp"
|
||||
#include "thingmgr.h"
|
||||
|
||||
using namespace openloco;
|
||||
using namespace openloco::interop;
|
||||
using namespace openloco::objectmgr;
|
||||
|
||||
loco_global<vehicle, 0x01136118> vehicle_1136118;
|
||||
|
||||
vehicle* vehicle::next_vehicle()
|
||||
{
|
||||
|
@ -53,7 +57,7 @@ bool vehicle::update()
|
|||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
result = call(0x004AA1D0, regs);
|
||||
result = sub_4AA1D0();
|
||||
break;
|
||||
case 6:
|
||||
result = call(0x004AA24A, regs);
|
||||
|
@ -146,3 +150,35 @@ void vehicle::sub_4BAA76()
|
|||
regs.esi = (int32_t)this;
|
||||
call(0x004BAA76, regs);
|
||||
}
|
||||
|
||||
// 0x004AA1D0
|
||||
int32_t openloco::vehicle::sub_4AA1D0()
|
||||
{
|
||||
registers regs;
|
||||
regs.esi = (int32_t)this;
|
||||
|
||||
if (var_42 == 2 || var_42 == 3)
|
||||
{
|
||||
call(0x004AAC4E, regs);
|
||||
return 0;
|
||||
}
|
||||
//0x4AA1DC
|
||||
}
|
||||
|
||||
void openloco::vehicle::sub_4AAC4E()
|
||||
{
|
||||
if (var_38 & (1 << 4))
|
||||
return;
|
||||
|
||||
if ((vehicle_1136118->var_5D == 8) || (vehicle_1136118->var_5D == 9))
|
||||
return;
|
||||
|
||||
vehicle_object * vehicleObject = get_vehicle_object(var_40);
|
||||
|
||||
if ((vehicleObject + var_54 * 6 + 41) == 0)
|
||||
{
|
||||
call(0x004AB655, regs);
|
||||
return;
|
||||
}
|
||||
//0x4AAC91
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ namespace openloco
|
|||
private:
|
||||
bool update();
|
||||
void sub_4BAA76();
|
||||
int32_t sub_4AA1D0();
|
||||
void sub_4AAC4E();
|
||||
};
|
||||
#pragma pack(pop)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue