fix(battle): restore LocalMP Ground Arcade air events
Copy allowedKillStreaks and set useKillStreaks for Ground Arcade in battle-mission-settings.ts, and add a dedicated dynamic native module (local_mp_air_events) that preserves MissionSettings.useKillStreaks across prepare_local_mission, credits local player AI kills toward native killstreak counters, delivers UnitRespawn (0xf030) to the LocalMP host via shared unit_on_event, and recovers invalid surface poses from gameplay.blk spawnPos parameters for the match rank. Based on PR #3 by Rivfflot, who diagnosed the LocalMP Ground Arcade air-event gaps and verified the fix in-game; refactored here onto patches/native dynamic resolution for cross-version and MSVC build compatibility. Checked: root and launcher typecheck, MSVC native/wto-net/build.ps1, native resolution across 2.61.0.37 and 2.61.0.58 (12/12 modules), 2.61.0.58 check-patches (14/14), and temporary 2.61.0.58 copy build all passed. Pending in-game acceptance on the refactored module. Co-authored-by: Alem Bek <[email protected]>
This commit is contained in:
1 parent
4999c7f5a3
commit
e8122d7c6b
12 files changed
+743
-20
No files matched your search
@@ -23,7 +23,7 @@ New-Item -ItemType Directory -Force $obj | Out-Null
|
||||
$sources = @(
|
||||
"$src\dll_main.c", "$src\hook_config.c", "$src\redirect_rules.c", "$src\resolver_hooks.c", "$src\connection_hooks.c",
|
||||
"$src\local_mp_core.c", "$src\local_mp_values.c", "$src\local_mp_players.c", "$src\local_mp_loadout.c", "$src\local_mp_actions.c", "$src\local_mp_awards.c", "$src\local_mp_kills.c", "$src\local_mp_events.c", "$src\local_mp_scores.c", "$src\local_mp_nuke.c", "$src\local_mp_support.c",
|
||||
"$src\local_mp_damage_notifications.c",
|
||||
"$src\local_mp_damage_notifications.c", "$src\local_mp_air_events.c",
|
||||
"$mh\src\hook.c", "$mh\src\buffer.c", "$mh\src\trampoline.c", "$mh\src\hde\hde64.c"
|
||||
) | ForEach-Object { '"' + (Resolve-Path $_) + '"' }
|
||||
|
||||
|
||||
@@ -0,0 +1,323 @@
|
||||
/*
|
||||
* Ground Arcade air events (fighter/attacker/bomber killstreaks) on a LocalMP host.
|
||||
*
|
||||
* Four gaps keep stock Ground Arcade air events from running in LocalMP:
|
||||
* 1. prepare_local_mission clears MissionSettings.useKillStreaks during LocalMP setup.
|
||||
* 2. Local AI kills go through local_mp_kills.c and do not advance native killstreak counters.
|
||||
* 3. BombingKillStreakEvent::switchPlayerUnit spawns the aircraft only by broadcasting
|
||||
* UnitRespawn (0xf030) through mpi::sendto, which has no local receiver on a LocalMP host.
|
||||
* 4. If a LocalMP air-event respawn ever supplies a ground-level pose, we rebuild an airborne
|
||||
* approach using the stock gameplay.blk spawnPos parameters for the match rank.
|
||||
*/
|
||||
#include "hooks.h"
|
||||
#include "hook_config.h"
|
||||
#include "local_mp_internal.h"
|
||||
#include "local_mp_offsets.h"
|
||||
#include "local_mp_values.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <math.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct LocalMpAirSpawn {
|
||||
double position[3];
|
||||
float orientation[4];
|
||||
float velocity[3];
|
||||
uint8_t options[0x14];
|
||||
} LocalMpAirSpawn;
|
||||
|
||||
C_ASSERT(offsetof(LocalMpAirSpawn, orientation) == 0x18);
|
||||
C_ASSERT(offsetof(LocalMpAirSpawn, velocity) == 0x28);
|
||||
C_ASSERT(sizeof(LocalMpAirSpawn) == 0x48);
|
||||
|
||||
typedef void (__fastcall *PrepareLocalMissionFn)(void *mission);
|
||||
typedef void (__fastcall *AddKillStreakPointsFn)(uint8_t *player, uint32_t rule, int32_t points, int32_t related_rule);
|
||||
typedef void (__fastcall *SwitchPlayerUnitFn)(void *event_mgr, void *participant, uint8_t to_air);
|
||||
typedef void (__fastcall *SendUnitRespawnFn)(uint8_t *unit, const LocalMpAirSpawn *spawn);
|
||||
typedef void (__fastcall *MpiSendToFn)(void *message, uint8_t recipient);
|
||||
typedef uint64_t (__fastcall *UnitOnEventFn)(void *unit, const void *event, void *arg3, void *arg4);
|
||||
typedef void (__fastcall *GetBattleCenterFn)(float center[2]);
|
||||
typedef uint8_t (__fastcall *GetTerrainHeightFn)(const void *terrain, float x, float z, float *height,
|
||||
void *normal, void *material);
|
||||
typedef void (__fastcall *GetOrientationFn)(float quaternion[4], const float transform[12]);
|
||||
|
||||
static PrepareLocalMissionFn orig_prepare_local_mission;
|
||||
static SwitchPlayerUnitFn orig_switch_player_unit;
|
||||
static SendUnitRespawnFn orig_send_unit_respawn;
|
||||
static MpiSendToFn orig_mpi_sendto;
|
||||
|
||||
static __declspec(thread) int g_in_air_event_switch;
|
||||
static __declspec(thread) uint8_t *g_respawn_unit;
|
||||
static int g_air_events_active;
|
||||
static int g_credit_log_count;
|
||||
|
||||
enum { AIR_EVENT_CREDIT_LOG_LIMIT = 12 };
|
||||
|
||||
static int ground_arcade_air_events_enabled(void)
|
||||
{
|
||||
const uint8_t *settings = g_local_mp_mission_settings;
|
||||
const char *mode;
|
||||
|
||||
if (!g_air_events_active || settings == NULL || !local_mp_is_host())
|
||||
return 0;
|
||||
if (*g_lmp.use_kill_streaks != 1)
|
||||
return 0;
|
||||
mode = *(const char *const *)(settings + LMP_MIS_OFF_MODE_NAME);
|
||||
return mode != NULL && strcmp(mode, "tank_event_in_random_battles_arcade") == 0;
|
||||
}
|
||||
|
||||
/* Resolve a killstreak tag id through Dagor's FastNameMap string table layout. */
|
||||
static const char *kill_streak_rule_tag(uint32_t id)
|
||||
{
|
||||
const uint8_t *nm = g_lmp.kill_streak_name_map;
|
||||
const uint64_t *entries;
|
||||
uint32_t count, packed, page, page_count;
|
||||
unsigned shift;
|
||||
const uint8_t *pages, *page_slot;
|
||||
const char *strings;
|
||||
|
||||
if (nm == NULL)
|
||||
return NULL;
|
||||
entries = *(const uint64_t *const *)(nm + LMP_NAMEMAP_OFF_ENTRIES);
|
||||
count = *(const uint32_t *)(nm + LMP_NAMEMAP_OFF_COUNT);
|
||||
shift = nm[LMP_NAMEMAP_OFF_SHIFT];
|
||||
if (entries == NULL || id >= count || shift >= 32u)
|
||||
return NULL;
|
||||
packed = (uint32_t)entries[id];
|
||||
page = packed >> shift;
|
||||
page_count = *(const uint32_t *)(nm + LMP_NAMEMAP_OFF_PAGE_COUNT);
|
||||
pages = *(const uint8_t *const *)(nm + LMP_NAMEMAP_OFF_PAGES);
|
||||
if (page == page_count)
|
||||
page_slot = nm + LMP_NAMEMAP_OFF_TAIL_PAGE;
|
||||
else if (page < page_count && pages != NULL)
|
||||
page_slot = pages + (size_t)page * 16u;
|
||||
else
|
||||
return NULL;
|
||||
strings = *(const char *const *)page_slot;
|
||||
return strings != NULL ? strings + (packed & ((1u << shift) - 1u)) : NULL;
|
||||
}
|
||||
|
||||
static int is_air_event_tag(const char *tag)
|
||||
{
|
||||
return tag != NULL && (strcmp(tag, "fighter") == 0 || strcmp(tag, "attacker") == 0 || strcmp(tag, "bomber") == 0);
|
||||
}
|
||||
|
||||
static float surface_height(const void *terrain, float x, float z)
|
||||
{
|
||||
float height = 0.0f;
|
||||
GetTerrainHeightFn query = (GetTerrainHeightFn)g_lmp.air_event_terrain_height;
|
||||
|
||||
if (query != NULL && query(terrain, x, z, &height, NULL, NULL) && isfinite(height) && height > 0.0f)
|
||||
return height;
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
/* Read stock spawn distance, altitude and speed from gameplay.blk's spawnPos table for this rank. */
|
||||
static int lookup_stock_spawn_params(float *out_dist, float *out_alt, float *out_speed_mps)
|
||||
{
|
||||
const uint8_t *gameplay = g_lmp.gameplay ? *(const uint8_t *const *)g_lmp.gameplay : NULL;
|
||||
const uint8_t *rules;
|
||||
uint32_t rule_count, i;
|
||||
int32_t rank;
|
||||
|
||||
if (gameplay == NULL || g_lmp.mission_max_rank == NULL || LMP_KS_SPAWN_POS_STRIDE < 0x50u)
|
||||
return 0;
|
||||
rules = *(const uint8_t *const *)(gameplay + LMP_GP_OFF_KS_RULES);
|
||||
rule_count = *(const uint32_t *)(gameplay + LMP_GP_OFF_KS_RULE_COUNT);
|
||||
rank = *(const int32_t *)g_lmp.mission_max_rank;
|
||||
if (rules == NULL || rule_count > 256u)
|
||||
return 0;
|
||||
for (i = 0; i < rule_count; i++) {
|
||||
const uint8_t *rule = rules + (size_t)i * LMP_KS_RULE_STRIDE;
|
||||
const char *tag = kill_streak_rule_tag(*(const uint32_t *)(rule + LMP_KS_RULE_OFF_TAG));
|
||||
const uint8_t *table;
|
||||
uint32_t count, j;
|
||||
|
||||
if (tag == NULL || (strcmp(tag, "attacker") != 0 && strcmp(tag, "bomber") != 0))
|
||||
continue;
|
||||
table = *(const uint8_t *const *)(rule + LMP_KS_RULE_OFF_SPAWN_POS);
|
||||
count = *(const uint32_t *)(rule + LMP_KS_RULE_OFF_SPAWN_POS_CNT);
|
||||
if (table == NULL || count > 64u)
|
||||
continue;
|
||||
for (j = 0; j < count; j++) {
|
||||
const uint8_t *row = table + (size_t)j * LMP_KS_SPAWN_POS_STRIDE;
|
||||
int32_t min_r = *(const int32_t *)(row + LMP_KS_SP_OFF_MIN_RANK);
|
||||
int32_t max_r = *(const int32_t *)(row + LMP_KS_SP_OFF_MAX_RANK);
|
||||
if (rank >= min_r && rank <= max_r) {
|
||||
float dist = *(const float *)(row + LMP_KS_SP_OFF_INIT_DIST);
|
||||
float alt = *(const float *)(row + LMP_KS_SP_OFF_INIT_ALT);
|
||||
float kmh = *(const float *)(row + LMP_KS_SP_OFF_INIT_SPEED_KMH);
|
||||
if (isfinite(dist) && dist > 100.0f && isfinite(alt) && alt > 100.0f && isfinite(kmh) && kmh > 50.0f) {
|
||||
*out_dist = dist;
|
||||
*out_alt = alt;
|
||||
*out_speed_mps = kmh / 3.6f;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Rebuild an airborne pose from stock gameplay.blk spawnPos only when LocalMP supplied a surface pose. */
|
||||
static int repair_air_spawn_if_invalid(LocalMpAirSpawn *spawn)
|
||||
{
|
||||
const uint8_t *app = g_local_mp_app ? *g_local_mp_app : NULL;
|
||||
const void *terrain = app ? *(const void *const *)(app + LMP_APP_OFF_TERRAIN) : NULL;
|
||||
float x = (float)spawn->position[0], y = (float)spawn->position[1], z = (float)spawn->position[2];
|
||||
float dx = spawn->velocity[0], dz = spawn->velocity[2];
|
||||
float speed = sqrtf(dx * dx + dz * dz);
|
||||
int valid_speed = isfinite(speed) && speed >= 25.0f;
|
||||
float center[2], approach, alt, stock_speed, highest = 0.0f;
|
||||
float transform[12];
|
||||
unsigned i;
|
||||
|
||||
if (terrain == NULL || *(const void *const *)(app + LMP_APP_OFF_SCORE_RULES) == NULL)
|
||||
return 0;
|
||||
if (valid_speed && fabsf(x) < 1e7f && fabsf(z) < 1e7f && isfinite(y) &&
|
||||
y >= surface_height(terrain, x, z) + 100.0f)
|
||||
return 0;
|
||||
if (!lookup_stock_spawn_params(&approach, &alt, &stock_speed))
|
||||
return 0;
|
||||
((GetBattleCenterFn)g_lmp.air_event_battle_center)(center);
|
||||
if (!isfinite(center[0]) || !isfinite(center[1]))
|
||||
return 0;
|
||||
|
||||
dx = valid_speed ? dx / speed : 1.0f;
|
||||
dz = valid_speed ? dz / speed : 0.0f;
|
||||
for (i = 0; i <= 14u; i++) {
|
||||
float d = approach * (float)i / 14.0f;
|
||||
float h = surface_height(terrain, center[0] - dx * d, center[1] - dz * d);
|
||||
if (h > highest)
|
||||
highest = h;
|
||||
}
|
||||
x = center[0] - dx * approach;
|
||||
y = highest + alt;
|
||||
z = center[1] - dz * approach;
|
||||
speed = valid_speed ? speed : stock_speed;
|
||||
memset(transform, 0, sizeof(transform));
|
||||
transform[0] = dx; transform[2] = dz; transform[4] = 1.0f;
|
||||
transform[6] = -dz; transform[8] = dx;
|
||||
transform[9] = x; transform[10] = y; transform[11] = z;
|
||||
((GetOrientationFn)g_lmp.air_event_orientation)(spawn->orientation, transform);
|
||||
spawn->position[0] = x;
|
||||
spawn->position[1] = y;
|
||||
spawn->position[2] = z;
|
||||
spawn->velocity[0] = dx * speed;
|
||||
spawn->velocity[1] = 0.0f;
|
||||
spawn->velocity[2] = dz * speed;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void __fastcall hook_prepare_local_mission(void *mission)
|
||||
{
|
||||
int restore = ground_arcade_air_events_enabled();
|
||||
|
||||
orig_prepare_local_mission(mission);
|
||||
if (restore && local_mp_is_host()) {
|
||||
*g_lmp.use_kill_streaks = 1;
|
||||
log_line("local_mp: preserved MissionSettings.useKillStreaks for Ground Arcade");
|
||||
}
|
||||
}
|
||||
|
||||
static void __fastcall hook_switch_player_unit(void *event_mgr, void *participant, uint8_t to_air)
|
||||
{
|
||||
int previous = g_in_air_event_switch;
|
||||
|
||||
if (to_air != 0 && ground_arcade_air_events_enabled())
|
||||
g_in_air_event_switch = 1;
|
||||
orig_switch_player_unit(event_mgr, participant, to_air);
|
||||
g_in_air_event_switch = previous;
|
||||
}
|
||||
|
||||
static void __fastcall hook_send_unit_respawn(uint8_t *unit, const LocalMpAirSpawn *spawn)
|
||||
{
|
||||
uint8_t *previous;
|
||||
__declspec(align(16)) LocalMpAirSpawn recovered;
|
||||
|
||||
if (!g_in_air_event_switch || unit == NULL || spawn == NULL || !ground_arcade_air_events_enabled()) {
|
||||
orig_send_unit_respawn(unit, spawn);
|
||||
return;
|
||||
}
|
||||
previous = g_respawn_unit;
|
||||
g_respawn_unit = unit;
|
||||
recovered = *spawn;
|
||||
if (repair_air_spawn_if_invalid(&recovered)) {
|
||||
log_line("local_mp: rebuilt Ground Arcade air spawn from (%.1f, %.1f, %.1f) to (%.1f, %.1f, %.1f)",
|
||||
spawn->position[0], spawn->position[1], spawn->position[2],
|
||||
recovered.position[0], recovered.position[1], recovered.position[2]);
|
||||
spawn = &recovered;
|
||||
}
|
||||
orig_send_unit_respawn(unit, spawn);
|
||||
g_respawn_unit = previous;
|
||||
}
|
||||
|
||||
static void __fastcall hook_mpi_sendto(void *message, uint8_t recipient)
|
||||
{
|
||||
uint8_t *unit = g_respawn_unit;
|
||||
const uint8_t *packet = (const uint8_t *)message;
|
||||
|
||||
if (unit == NULL || recipient != 0xffu || packet == NULL ||
|
||||
*(uint8_t *const *)(packet + LMP_MPI_MSG_OFF_OBJ) != unit ||
|
||||
*(const uint16_t *)(packet + LMP_MPI_MSG_OFF_ID) != LMP_MPI_MSG_UNIT_RESPAWN) {
|
||||
orig_mpi_sendto(message, recipient);
|
||||
return;
|
||||
}
|
||||
/* Clear scope while delivering so nested messages follow the normal mpi::sendto path. */
|
||||
g_respawn_unit = NULL;
|
||||
((UnitOnEventFn)g_lmp.unit_on_event)(unit, message, NULL, NULL);
|
||||
g_respawn_unit = unit;
|
||||
}
|
||||
|
||||
void local_mp_credit_air_event_kill(uint8_t *player, int aircraft_victim)
|
||||
{
|
||||
const uint8_t *gameplay, *rules, *progress;
|
||||
uint32_t rule_count, player_rule_count, i;
|
||||
AddKillStreakPointsFn add_points = (AddKillStreakPointsFn)g_lmp.add_kill_streak_points;
|
||||
|
||||
if (add_points == NULL || player == NULL || !ground_arcade_air_events_enabled())
|
||||
return;
|
||||
gameplay = *(const uint8_t *const *)g_lmp.gameplay;
|
||||
progress = *(const uint8_t *const *)(player + LMP_MP_OFF_KS_PROGRESS + LMP_TAB_OFF_DATA);
|
||||
player_rule_count = *(const uint32_t *)(player + LMP_MP_OFF_KS_PROGRESS + LMP_TAB_OFF_COUNT);
|
||||
if (gameplay == NULL || progress == NULL || player_rule_count == 0u)
|
||||
return;
|
||||
rules = *(const uint8_t *const *)(gameplay + LMP_GP_OFF_KS_RULES);
|
||||
rule_count = *(const uint32_t *)(gameplay + LMP_GP_OFF_KS_RULE_COUNT);
|
||||
if (rules == NULL || rule_count > 256u || player_rule_count > rule_count)
|
||||
return;
|
||||
|
||||
for (i = 0; i < player_rule_count; i++) {
|
||||
const uint8_t *rule = rules + (size_t)i * LMP_KS_RULE_STRIDE;
|
||||
const char *tag = kill_streak_rule_tag(*(const uint32_t *)(rule + LMP_KS_RULE_OFF_TAG));
|
||||
int32_t points;
|
||||
|
||||
if (!is_air_event_tag(tag))
|
||||
continue;
|
||||
points = *(const int32_t *)(rule + (aircraft_victim ? LMP_KS_RULE_OFF_AIR_AI_MULT : LMP_KS_RULE_OFF_GROUND_AI_MULT));
|
||||
if (points > 0) {
|
||||
add_points(player, i, points, -1);
|
||||
if (g_credit_log_count < AIR_EVENT_CREDIT_LOG_LIMIT) {
|
||||
++g_credit_log_count;
|
||||
log_line("local_mp: Ground Arcade air event %s +%d (counter %u)", tag, (int)points,
|
||||
(unsigned)progress[(size_t)i * LMP_KS_PROGRESS_STRIDE]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int install_local_mp_air_event_hooks(void)
|
||||
{
|
||||
const LocalMpHookSpec hooks[] = {
|
||||
{ "prepare_local_mission", g_lmp.prepare_local_mission, (void *)&hook_prepare_local_mission, (void **)&orig_prepare_local_mission },
|
||||
{ "air_event_switch_unit", g_lmp.air_event_switch_unit, (void *)&hook_switch_player_unit, (void **)&orig_switch_player_unit },
|
||||
{ "send_unit_respawn", g_lmp.send_unit_respawn, (void *)&hook_send_unit_respawn, (void **)&orig_send_unit_respawn },
|
||||
{ "mpi_sendto", g_lmp.mpi_sendto, (void *)&hook_mpi_sendto, (void **)&orig_mpi_sendto },
|
||||
};
|
||||
|
||||
if (!local_mp_queue_hooks("local_mp_air_events", hooks, sizeof(hooks) / sizeof(hooks[0])))
|
||||
return 0;
|
||||
g_air_events_active = 1;
|
||||
return 1;
|
||||
}
|
||||
@@ -142,6 +142,7 @@ static const LocalMpModule MODULES[] = {
|
||||
{ "local_mp_nuke", install_local_mp_nuke_hooks },
|
||||
{ "local_mp_support", install_local_mp_support_hooks },
|
||||
{ "local_mp_damage_notifications", install_local_mp_damage_notification_hooks },
|
||||
{ "local_mp_air_events", install_local_mp_air_event_hooks },
|
||||
};
|
||||
|
||||
static void use_core_values(void)
|
||||
|
||||
@@ -68,6 +68,7 @@ void local_mp_report_airfield_spawn(const char *unit_name, int32_t base_id);
|
||||
/* A destroyed unit that is some player's mission support unit: its reference is freed once the
|
||||
* player has been given back control (local_mp_support.c). */
|
||||
void local_mp_support_unit_dead(const uint8_t *victim);
|
||||
void local_mp_credit_air_event_kill(uint8_t *player, int aircraft_victim);
|
||||
const char *local_mp_unit_exp_class(const uint8_t *unit);
|
||||
|
||||
/* Mission scores of combat events from the mission settings (local_mp_scores.c). */
|
||||
@@ -104,3 +105,4 @@ int install_local_mp_score_reader(void);
|
||||
int install_local_mp_nuke_hooks(void);
|
||||
int install_local_mp_support_hooks(void);
|
||||
int install_local_mp_damage_notification_hooks(void);
|
||||
int install_local_mp_air_event_hooks(void);
|
||||
@@ -95,6 +95,8 @@ static void record_enemy_kill(uint8_t *killer_mp, uint8_t *victim, int is_pvp)
|
||||
|
||||
if (local_mp_is_local_mplayer(killer_mp)) {
|
||||
LocalMpAwardEvent award = { ev, victim, is_pvp, 0, own_sev ? "from_severe_damage" : NULL, 0 };
|
||||
if (!is_ship && !is_human)
|
||||
local_mp_credit_air_event_kill(killer_mp, is_air);
|
||||
local_mp_report_award_event(&award);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
#define LMP_MP_MGR_OFF_CHAT_HOST (g_lmp.mp_chat_host)
|
||||
|
||||
/* App and the economic state */
|
||||
#define LMP_APP_OFF_TERRAIN (g_lmp.app_terrain)
|
||||
#define LMP_APP_OFF_SCORE_RULES (g_lmp.app_score_rules)
|
||||
#define LMP_APP_OFF_ECON_HOLDER (g_lmp.app_econ_holder)
|
||||
#define LMP_ECON_HOLDER_OFF_STATE (g_lmp.econ_state)
|
||||
@@ -77,6 +78,7 @@
|
||||
#define LMP_REQ_OFF_SLOT_ID (g_lmp.req_slot_id)
|
||||
|
||||
/* MissionSettings and the matching info */
|
||||
#define LMP_MIS_OFF_MODE_NAME (g_lmp.mis_mode_name)
|
||||
#define LMP_MIS_OFF_AXIS_COUNTRY (g_lmp.mis_axis_country)
|
||||
#define LMP_MIS_OFF_ALLIES_COUNTRY (g_lmp.mis_allies_country)
|
||||
#define LMP_MIS_OFF_ARCADE_COUNTRY (g_lmp.mis_arcade_country)
|
||||
@@ -173,3 +175,31 @@
|
||||
|
||||
/* GameSaveData HUD script event queue */
|
||||
#define LMP_GSD_OFF_HUD_QUEUE (g_lmp.gsd_hud_queue)
|
||||
|
||||
/* Ground Arcade air events: DagorEngine library layouts (mpi::Message, FastNameMap) and captured
|
||||
* gameplay/MPlayer killstreak fields (local_mp_air_events.c). */
|
||||
#define LMP_MPI_MSG_OFF_OBJ 0x08u
|
||||
#define LMP_MPI_MSG_OFF_ID 0x20u
|
||||
#define LMP_MPI_MSG_UNIT_RESPAWN 0xf030u
|
||||
#define LMP_NAMEMAP_OFF_ENTRIES 0x00u
|
||||
#define LMP_NAMEMAP_OFF_COUNT 0x08u
|
||||
#define LMP_NAMEMAP_OFF_TAIL_PAGE 0x10u
|
||||
#define LMP_NAMEMAP_OFF_PAGES 0x20u
|
||||
#define LMP_NAMEMAP_OFF_PAGE_COUNT 0x28u
|
||||
#define LMP_NAMEMAP_OFF_SHIFT 0x32u
|
||||
#define LMP_KS_RULE_STRIDE 0x90u
|
||||
#define LMP_KS_PROGRESS_STRIDE 0x10u
|
||||
#define LMP_KS_SP_OFF_MIN_RANK 0x00u
|
||||
#define LMP_KS_SP_OFF_MAX_RANK 0x04u
|
||||
#define LMP_KS_SP_OFF_INIT_DIST 0x08u
|
||||
#define LMP_KS_SP_OFF_INIT_ALT 0x0cu
|
||||
#define LMP_KS_SP_OFF_INIT_SPEED_KMH 0x48u
|
||||
#define LMP_GP_OFF_KS_RULES (g_lmp.gp_ks_rules)
|
||||
#define LMP_GP_OFF_KS_RULE_COUNT (g_lmp.gp_ks_rule_count)
|
||||
#define LMP_KS_RULE_OFF_TAG (g_lmp.ks_rule_tag)
|
||||
#define LMP_KS_RULE_OFF_AIR_AI_MULT (g_lmp.ks_rule_air_ai_mult)
|
||||
#define LMP_KS_RULE_OFF_GROUND_AI_MULT (g_lmp.ks_rule_ground_ai_mult)
|
||||
#define LMP_KS_RULE_OFF_SPAWN_POS (g_lmp.ks_rule_spawn_pos)
|
||||
#define LMP_KS_RULE_OFF_SPAWN_POS_CNT (g_lmp.ks_rule_spawn_pos_count)
|
||||
#define LMP_KS_SPAWN_POS_STRIDE (g_lmp.ks_spawn_pos_stride)
|
||||
#define LMP_MP_OFF_KS_PROGRESS (g_lmp.mp_ks_progress)
|
||||
@@ -40,6 +40,7 @@ typedef struct LmpValueSpec {
|
||||
#define NUKE "local_mp_nuke"
|
||||
#define SUPPORT "local_mp_support"
|
||||
#define DAMAGE_NOTICES "local_mp_damage_notifications"
|
||||
#define AIR_EVENTS "local_mp_air_events"
|
||||
|
||||
static const LmpValueSpec SPECS[] = {
|
||||
A(CORE, "do_respawn_player", do_respawn_player), O(CORE, "do_respawn_player.app_score_rules", app_score_rules),
|
||||
@@ -65,6 +66,7 @@ static const LmpValueSpec SPECS[] = {
|
||||
O(CORE, "unit_info_name.unit_info", unit_info), O(CORE, "unit_info_name.info_name", unit_info_name),
|
||||
O(CORE, "unit_mplayer.unit_mplayer", unit_mplayer), O(CORE, "mission_custom_bots.custom_bots", mis_custom_bots),
|
||||
O(CORE, "mplayer_unit_eid.unit_eid", mp_unit_eid),
|
||||
A(CORE, "unit_on_event", unit_on_event),
|
||||
|
||||
A(PLAYERS, "mplayer_init_matching", mplayer_init_matching), A(PLAYERS, "is_slot_ready_at_host", is_slot_ready_at_host),
|
||||
O(PLAYERS, "mplayer_gui_state.gui_state", mp_gui_state), O(PLAYERS, "mplayer_used_spares.used_spares", mp_used_spares),
|
||||
@@ -151,11 +153,35 @@ static const LmpValueSpec SPECS[] = {
|
||||
A(DAMAGE_NOTICES, "hud_damage_deliver", hud_damage_deliver),
|
||||
A(DAMAGE_NOTICES, "avionics_damage", avionics_damage), O(DAMAGE_NOTICES, "avionics_damage.unit", avionics_unit),
|
||||
A(DAMAGE_NOTICES, "avionics_exit_optic.call", avionics_exit_optic),
|
||||
A(DAMAGE_NOTICES, "unit_on_event", unit_on_event), O(DAMAGE_NOTICES, "hit_event_offender.offender", hit_event_offender),
|
||||
O(DAMAGE_NOTICES, "hit_event_offender.offender", hit_event_offender),
|
||||
A(DAMAGE_NOTICES, "hit_watched_hero.watched_hero", watched_hero),
|
||||
A(DAMAGE_NOTICES, "hit_parts_feedback.enqueue_enemy_parts", enqueue_enemy_parts),
|
||||
A(DAMAGE_NOTICES, "hit_parts_feedback.hit_cam_important", hit_cam_important),
|
||||
A(DAMAGE_NOTICES, "hit_parts_feedback.naval_hit_state", naval_hit_state),
|
||||
|
||||
O(AIR_EVENTS, "mission_mode_name.mode_name", mis_mode_name),
|
||||
A(AIR_EVENTS, "prepare_local_mission", prepare_local_mission),
|
||||
A(AIR_EVENTS, "prepare_local_mission_clear.use_kill_streaks", use_kill_streaks),
|
||||
A(AIR_EVENTS, "kill_streak_rules.gameplay", gameplay),
|
||||
O(AIR_EVENTS, "kill_streak_rules.rule_count", gp_ks_rule_count),
|
||||
O(AIR_EVENTS, "kill_streak_rules.rules", gp_ks_rules),
|
||||
O(AIR_EVENTS, "kill_streak_rules.rule_tag", ks_rule_tag),
|
||||
A(AIR_EVENTS, "kill_streak_rules.name_map", kill_streak_name_map),
|
||||
A(AIR_EVENTS, "add_kill_streak_points", add_kill_streak_points),
|
||||
O(AIR_EVENTS, "mplayer_streak_progress.progress", mp_ks_progress),
|
||||
O(AIR_EVENTS, "kill_streak_ai_mults.air_ai_mult", ks_rule_air_ai_mult),
|
||||
O(AIR_EVENTS, "kill_streak_ai_mults.ground_ai_mult", ks_rule_ground_ai_mult),
|
||||
A(AIR_EVENTS, "air_event_spawn_table.battle_center", air_event_battle_center),
|
||||
O(AIR_EVENTS, "air_event_spawn_table.spawn_pos_count", ks_rule_spawn_pos_count),
|
||||
A(AIR_EVENTS, "air_event_spawn_table.max_rank", mission_max_rank),
|
||||
O(AIR_EVENTS, "air_event_spawn_table.spawn_pos", ks_rule_spawn_pos),
|
||||
O(AIR_EVENTS, "air_event_spawn_table.spawn_pos_stride", ks_spawn_pos_stride),
|
||||
O(AIR_EVENTS, "air_event_terrain.app_terrain", app_terrain),
|
||||
A(AIR_EVENTS, "air_event_terrain.terrain_height", air_event_terrain_height),
|
||||
A(AIR_EVENTS, "air_event_switch_unit", air_event_switch_unit),
|
||||
A(AIR_EVENTS, "air_event_orientation.call", air_event_orientation),
|
||||
A(AIR_EVENTS, "send_unit_respawn", send_unit_respawn),
|
||||
A(AIR_EVENTS, "send_unit_respawn_broadcast.mpi_sendto", mpi_sendto),
|
||||
};
|
||||
|
||||
static void store(const LmpValueSpec *spec, int64_t value, uint8_t *base)
|
||||
|
||||
@@ -17,7 +17,7 @@ typedef struct LmpValues {
|
||||
/* local_mp_core */
|
||||
uint8_t *do_respawn_player, *get_player_country, *refl_dtor, *aircraft_change_result, *set_player_gui_state;
|
||||
uint8_t *get_unit_by_eid, *set_owning_mplayer, *iground_on_dead, *datablock_get_str, *datablock_set_from;
|
||||
uint8_t *mp_construct_local, *gui_state_update, *unit_change_aircraft, *dagmem_alloc;
|
||||
uint8_t *mp_construct_local, *gui_state_update, *unit_change_aircraft, *dagmem_alloc, *unit_on_event;
|
||||
uint8_t *multiplayer, *app, *local_mplayer, *hero, *mission_settings, *stdmem, *player_count, *player_table;
|
||||
size_t mp_is_host, mp_is_local_mp, mp_chat_host, mp_pid, mp_user_id, mp_team, mp_broken_slots, mp_unit_eid;
|
||||
size_t match_team, app_score_rules, app_econ_holder, econ_state, econ_change_req;
|
||||
@@ -77,8 +77,15 @@ typedef struct LmpValues {
|
||||
/* local_mp_damage_notifications */
|
||||
uint8_t *barrel_damage, *breech_fire_update, *barrel_notice_deliver, *breech_notice_deliver, *mplayer_controlled_unit;
|
||||
uint8_t *hud_damage_deliver, *avionics_damage, *avionics_exit_optic;
|
||||
uint8_t *unit_on_event, *watched_hero, *enqueue_enemy_parts, *hit_cam_important, *naval_hit_state;
|
||||
uint8_t *watched_hero, *enqueue_enemy_parts, *hit_cam_important, *naval_hit_state;
|
||||
size_t barrel_unit_ref, breech_unit, barrel_notice_id, breech_notice_id, avionics_unit, hit_event_offender;
|
||||
|
||||
/* local_mp_air_events */
|
||||
uint8_t *prepare_local_mission, *use_kill_streaks, *gameplay, *kill_streak_name_map, *add_kill_streak_points;
|
||||
uint8_t *air_event_battle_center, *mission_max_rank, *air_event_terrain_height, *air_event_switch_unit;
|
||||
uint8_t *air_event_orientation, *send_unit_respawn, *mpi_sendto;
|
||||
size_t mis_mode_name, gp_ks_rules, gp_ks_rule_count, ks_rule_tag, ks_rule_air_ai_mult, ks_rule_ground_ai_mult;
|
||||
size_t ks_rule_spawn_pos, ks_rule_spawn_pos_count, ks_spawn_pos_stride, mp_ks_progress, app_terrain;
|
||||
} LmpValues;
|
||||
|
||||
extern LmpValues g_lmp;
|
||||
|
||||
Reference in new issue
Block a user