feat(battle): wire Nuclear Escalation launch and airfield cooldowns

Connect Air Realistic sub-mode 103 (Nuclear Escalation) mission launch
settings and LocalMP respawn/airfield-cooldown handling:

- Server: support mode-level maxRespawns (UNLIMITED_RESPAWNS = -2) and
  per-mode missionRuleKeys so Nuclear Escalation forwards customHUD,
  stage thresholds, useSpawnDelay, afterRespawnDelaySec, and battle
  display flags from the stock missions; reject queues when no candidate
  mode is eligible for the lineup; disable spares and emit
  wtoUnlimitedRespawns for unlimited-respawn modes.
- Native: keep slots usable when wtoUnlimitedRespawns is set and emit
  wtoLocalMpAirfieldSpawn with the unit name and spawn base ID when the
  local player actually enters pilot control.
- GUI patches: track confirmed LocalMP airfield departures in
  scripts/respawn/respawnbases.nut and feed the computed per-base delays
  into scripts/respawn/respawn.nut slot countdowns and spawn checks.

Stage-unlocked dedicated event aircraft allocation by faction and room
BR is not yet wired and remains pending research. Verified with root and
launcher typechecks, check-patches and check-gui on 2.61.0.37 and
2.61.0.58, and native wto_ws.dll build; pending in-game verification.
This commit is contained in:
N0VAN0M4LY committed 2026-12-02 21:35:17 +08:00
1 parent 646be7afb9
commit f1ec034994
24 files changed
+240 -24

No files matched your search

+16 -1
View File
@@ -1,5 +1,5 @@
/*
* Reports the local player's combat events to the GUI scripts.
* Reports the local player's combat events and confirmed airfield departures to the GUI scripts.
*
* Online, the battle server prices every combat event and sends it to the client
* (packet 0xb03d -> GameSaveData::addScoreMessage), which raises the HUD script event
@@ -95,6 +95,21 @@ void local_mp_report_nuclear_strike(void)
fn_blk_dtor(blk);
}
void local_mp_report_airfield_spawn(const char *unit_name, int32_t base_id)
{
__declspec(align(16)) uint8_t blk[LMP_BLK_SIZE];
uint8_t *gsd = g_game_save_data ? *g_game_save_data : NULL;
if (gsd == NULL || fn_hud_notify_script == NULL || unit_name == NULL || base_id < 0)
return;
memset(blk, 0, sizeof(blk));
fn_blk_ctor(blk);
fn_blk_set_str(blk, "unitName", unit_name);
blk_set_int(blk, "baseId", base_id);
fn_hud_notify_script(gsd + LMP_GSD_OFF_HUD_QUEUE, "wtoLocalMpAirfieldSpawn", blk);
fn_blk_dtor(blk);
}
int install_local_mp_award_hooks(void)
{
g_game_save_data = (uint8_t **)g_lmp.game_save_data;
+1 -1
View File
@@ -132,10 +132,10 @@ typedef struct LocalMpModule {
} LocalMpModule;
static const LocalMpModule MODULES[] = {
{ "local_mp_awards", install_local_mp_award_hooks },
{ "local_mp_players", install_local_mp_player_hooks },
{ "local_mp_loadout", install_local_mp_loadout_hooks },
{ "local_mp_actions", install_local_mp_action_hooks },
{ "local_mp_awards", install_local_mp_award_hooks },
{ "local_mp_scores", install_local_mp_score_reader },
{ "local_mp_kills", install_local_mp_kill_hooks },
{ "local_mp_events", install_local_mp_event_hooks },
+3 -2
View File
@@ -58,11 +58,12 @@ char *local_mp_strdup(const char *s);
const char *local_mp_unit_name(const uint8_t *unit);
/* Player state & slot tracking notifications shared with loadout module. */
void local_mp_players_queue_spawn(int32_t slot_id, int32_t spare_type, int is_silent);
void local_mp_players_queue_spawn(int32_t slot_id, int32_t spare_type, int32_t base_id, int is_silent);
/* Combat event reporting to the GUI scripts (local_mp_awards.c). */
/* Local player events sent to the GUI scripts (local_mp_awards.c). */
void local_mp_report_award_event(const LocalMpAwardEvent *ev);
void local_mp_report_nuclear_strike(void);
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). */
+1 -1
View File
@@ -189,7 +189,7 @@ static void __fastcall hook_sem_change_aircraft_send(
mplayer[LMP_MP_OFF_GUI_STATE] != LMP_GUI_STATE_CA_READY)
g_lmp_set_player_gui_state((int32_t)mplayer[LMP_MP_OFF_PID], LMP_GUI_STATE_CA_READY);
local_mp_players_queue_spawn(req_slot_id, req_spare_type, is_silent);
local_mp_players_queue_spawn(req_slot_id, req_spare_type, req_base_id, is_silent);
log_line("local_mp: configured unit='%s' weapon='%s' slot=%d silent=%d",
unit_name ? unit_name : "", weapon_name ? weapon_name : "", (int)req_slot_id, is_silent);
}
+21 -5
View File
@@ -25,12 +25,14 @@ static int g_accept_pending = 0;
static int g_respawn_dispatched = 0;
static int32_t g_pending_slot_id = -1;
static int32_t g_pending_spare_type = -1;
static int32_t g_pending_base_id = -1;
void local_mp_players_queue_spawn(int32_t slot_id, int32_t spare_type, int is_silent)
void local_mp_players_queue_spawn(int32_t slot_id, int32_t spare_type, int32_t base_id, int is_silent)
{
if (!is_silent || g_pending_slot_id < 0) {
g_pending_slot_id = slot_id;
g_pending_spare_type = spare_type;
g_pending_base_id = base_id;
}
if (!is_silent)
g_respawn_dispatched = 0;
@@ -113,7 +115,17 @@ static void __fastcall hook_mplayer_init_from_matching(uint8_t *mplayer, uint8_t
orig_mplayer_init_matching(mplayer, info, uid);
}
static void consume_pending_slot_if_spawned(uint8_t *mplayer)
static int has_unlimited_respawns(void)
{
const char *value;
if (g_local_mp_mission_settings == NULL || g_lmp_datablock_get_str == NULL)
return 0;
value = g_lmp_datablock_get_str(g_local_mp_mission_settings + LMP_MIS_OFF_CUSTOM_BOTS, "wtoUnlimitedRespawns", "0");
return value != NULL && strcmp(value, "1") == 0;
}
static void finish_pending_spawn(uint8_t *mplayer)
{
const char *hero_name;
@@ -131,7 +143,9 @@ static void consume_pending_slot_if_spawned(uint8_t *mplayer)
if (g_pending_slot_id >= 0 && g_pending_slot_id < 32) {
uint32_t bit = 1u << (uint32_t)g_pending_slot_id;
if (g_pending_spare_type < 0)
if (has_unlimited_respawns())
local_mp_report_airfield_spawn(hero_name, g_pending_base_id);
else if (g_pending_spare_type < 0)
*(uint32_t *)(mplayer + LMP_MP_OFF_BROKEN_SLOTS_MASK) |= bit;
else
*(uint32_t *)(mplayer + LMP_MP_OFF_USED_SPARES_MASK) |= bit;
@@ -140,6 +154,7 @@ static void consume_pending_slot_if_spawned(uint8_t *mplayer)
*(uint32_t *)(mplayer + LMP_MP_OFF_BROKEN_SLOTS_MASK),
*(uint32_t *)(mplayer + LMP_MP_OFF_USED_SPARES_MASK));
g_pending_slot_id = -1;
g_pending_base_id = -1;
}
}
@@ -153,12 +168,13 @@ static void __fastcall hook_gui_state_update(uint8_t *gui_state_obj, float dt)
g_accept_pending = 0;
g_respawn_dispatched = 0;
g_pending_slot_id = -1;
g_pending_base_id = -1;
return;
}
bind_ai_mplayer_units();
mplayer = g_local_mp_mplayer ? *g_local_mp_mplayer : NULL;
consume_pending_slot_if_spawned(mplayer);
finish_pending_spawn(mplayer);
if (g_accept_pending && gui_state_obj != NULL) {
uint8_t *econ_state = local_mp_econ_state();
@@ -185,7 +201,7 @@ static int64_t __fastcall hook_do_respawn_player(void *app)
g_respawn_dispatched = 1;
result = orig_do_respawn(app);
consume_pending_slot_if_spawned(mplayer);
finish_pending_spawn(mplayer);
bind_ai_mplayer_units();
return result;
}