From 4010fc1aa78e05442e10fc7371c275af540674db Mon Sep 17 00:00:00 2001
From: Christoph Oelckers <coelckers@users.noreply.github.com>
Date: Sun, 30 Apr 2023 09:30:59 +0200
Subject: [PATCH] - Duke: init the animation arrays early.

app_init is too late for having the data set up during script compilation.
---
 source/games/duke/src/game.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/source/games/duke/src/game.cpp b/source/games/duke/src/game.cpp
index a1203aff7..e002a5c8d 100644
--- a/source/games/duke/src/game.cpp
+++ b/source/games/duke/src/game.cpp
@@ -305,6 +305,11 @@ void GameInterface::loadPalette()
 {
 	paletteLoadFromDisk();
 	genspriteremaps();
+
+	// Not exactly palette stuff, but this needs to be done before the LoadScripts call and here's a convenient place for that.
+	moves.Push({});		// make sure the first entry in 'moves' is a null move.
+	actions.Push({});	// make sure the first entry in 'actions' is a null action.
+	ais.Push({});	// make sure the first entry in 'actions' is a null action.
 }
 
 int GameInterface::GetCurrentSkill()
@@ -405,9 +410,6 @@ void GameInterface::app_init()
 	ud.m_monsters_off = userConfig.nomonsters;
 	ps[0].aim_mode = 1;
 	ud.cameraactor = nullptr;
-	moves.Push({});		// make sure the first entry in 'moves' is a null move.
-	actions.Push({});	// make sure the first entry in 'actions' is a null action.
-	ais.Push({});	// make sure the first entry in 'actions' is a null action.
 
 	if (fileSystem.FileExists("DUKESW.BIN"))
 		g_gameType |= GAMEFLAG_SHAREWARE;