From fe09a9c09c4cd5fc4039ea0c40caa8e814ac179f Mon Sep 17 00:00:00 2001 From: Nipun Garg Date: Sun, 14 Jul 2019 00:26:37 +0530 Subject: [PATCH] HDB: Initialize Weapon variables --- engines/hdb/ai-init.cpp | 1 + engines/hdb/ai-player.cpp | 68 +++++++++++++-------------------------- 2 files changed, 24 insertions(+), 45 deletions(-) diff --git a/engines/hdb/ai-init.cpp b/engines/hdb/ai-init.cpp index f4b96ce0c84..64de429d72a 100644 --- a/engines/hdb/ai-init.cpp +++ b/engines/hdb/ai-init.cpp @@ -1153,6 +1153,7 @@ void AI::restartSystem() { _playerEmerging = false; _weaponSelected = AI_NONE; + _weaponGfx = NULL; _weaponSelGfx = NULL; // Clear Cinematic System diff --git a/engines/hdb/ai-player.cpp b/engines/hdb/ai-player.cpp index a0508922051..7dbb1e86be8 100644 --- a/engines/hdb/ai-player.cpp +++ b/engines/hdb/ai-player.cpp @@ -55,56 +55,34 @@ void aiPlayerInit(AIEntity *e) { void aiPlayerInit2(AIEntity *e) { if (!g_hdb->_ai->_clubUpGfx[0]) { - warning("STUB: weapon_sel_gfx uninitialized"); - g_hdb->_ai->_clubUpGfx[0] = new Picture; - g_hdb->_ai->_clubUpGfx[0]->load(g_hdb->_fileMan->findFirstData("clubup1", TYPE_PIC)); - g_hdb->_ai->_clubUpGfx[1] = new Picture; - g_hdb->_ai->_clubUpGfx[1]->load(g_hdb->_fileMan->findFirstData("clubup2", TYPE_PIC)); - g_hdb->_ai->_clubUpGfx[2] = new Picture; - g_hdb->_ai->_clubUpGfx[2]->load(g_hdb->_fileMan->findFirstData("clubup3", TYPE_PIC)); - g_hdb->_ai->_clubUpGfx[3] = new Picture; - g_hdb->_ai->_clubUpGfx[3]->load(g_hdb->_fileMan->findFirstData("clubup3", TYPE_PIC)); + g_hdb->_ai->_weaponSelGfx = g_hdb->_gfx->loadTile(TILE_WEAPON_EQUIPPED); + g_hdb->_ai->_clubUpGfx[0] = g_hdb->_gfx->loadPic(CLUBUP1); + g_hdb->_ai->_clubUpGfx[1] = g_hdb->_gfx->loadPic(CLUBUP2); + g_hdb->_ai->_clubUpGfx[2] = g_hdb->_gfx->loadPic(CLUBUP3); + g_hdb->_ai->_clubUpGfx[3] = g_hdb->_gfx->loadPic(CLUBUP3); - g_hdb->_ai->_clubDownGfx[0] = new Picture; - g_hdb->_ai->_clubDownGfx[0]->load(g_hdb->_fileMan->findFirstData("clubdown1", TYPE_PIC)); - g_hdb->_ai->_clubDownGfx[1] = new Picture; - g_hdb->_ai->_clubDownGfx[1]->load(g_hdb->_fileMan->findFirstData("clubdown2", TYPE_PIC)); - g_hdb->_ai->_clubDownGfx[2] = new Picture; - g_hdb->_ai->_clubDownGfx[2]->load(g_hdb->_fileMan->findFirstData("clubdown3", TYPE_PIC)); - g_hdb->_ai->_clubDownGfx[3] = new Picture; - g_hdb->_ai->_clubDownGfx[3]->load(g_hdb->_fileMan->findFirstData("clubdown3", TYPE_PIC)); + g_hdb->_ai->_clubDownGfx[0] = g_hdb->_gfx->loadPic(CLUBDOWN1); + g_hdb->_ai->_clubDownGfx[1] = g_hdb->_gfx->loadPic(CLUBDOWN2); + g_hdb->_ai->_clubDownGfx[2] = g_hdb->_gfx->loadPic(CLUBDOWN3); + g_hdb->_ai->_clubDownGfx[3] = g_hdb->_gfx->loadPic(CLUBDOWN3); - g_hdb->_ai->_clubLeftGfx[0] = new Picture; - g_hdb->_ai->_clubLeftGfx[0]->load(g_hdb->_fileMan->findFirstData("clubleft1", TYPE_PIC)); - g_hdb->_ai->_clubLeftGfx[1] = new Picture; - g_hdb->_ai->_clubLeftGfx[1]->load(g_hdb->_fileMan->findFirstData("clubleft2", TYPE_PIC)); - g_hdb->_ai->_clubLeftGfx[2] = new Picture; - g_hdb->_ai->_clubLeftGfx[2]->load(g_hdb->_fileMan->findFirstData("clubleft3", TYPE_PIC)); - g_hdb->_ai->_clubLeftGfx[3] = new Picture; - g_hdb->_ai->_clubLeftGfx[3]->load(g_hdb->_fileMan->findFirstData("clubleft3", TYPE_PIC)); + g_hdb->_ai->_clubLeftGfx[0] = g_hdb->_gfx->loadPic(CLUBLEFT1); + g_hdb->_ai->_clubLeftGfx[1] = g_hdb->_gfx->loadPic(CLUBLEFT2); + g_hdb->_ai->_clubLeftGfx[2] = g_hdb->_gfx->loadPic(CLUBLEFT3); + g_hdb->_ai->_clubLeftGfx[3] = g_hdb->_gfx->loadPic(CLUBLEFT3); - g_hdb->_ai->_clubRightGfx[0] = new Picture; - g_hdb->_ai->_clubRightGfx[0]->load(g_hdb->_fileMan->findFirstData("clubright1", TYPE_PIC)); - g_hdb->_ai->_clubRightGfx[1] = new Picture; - g_hdb->_ai->_clubRightGfx[1]->load(g_hdb->_fileMan->findFirstData("clubright2", TYPE_PIC)); - g_hdb->_ai->_clubRightGfx[2] = new Picture; - g_hdb->_ai->_clubRightGfx[2]->load(g_hdb->_fileMan->findFirstData("clubright3", TYPE_PIC)); - g_hdb->_ai->_clubRightGfx[3] = new Picture; - g_hdb->_ai->_clubRightGfx[3]->load(g_hdb->_fileMan->findFirstData("clubright3", TYPE_PIC)); + g_hdb->_ai->_clubRightGfx[0] = g_hdb->_gfx->loadPic(CLUBRIGHT1); + g_hdb->_ai->_clubRightGfx[1] = g_hdb->_gfx->loadPic(CLUBRIGHT2); + g_hdb->_ai->_clubRightGfx[2] = g_hdb->_gfx->loadPic(CLUBRIGHT3); + g_hdb->_ai->_clubRightGfx[3] = g_hdb->_gfx->loadPic(CLUBRIGHT3); - g_hdb->_ai->_clubUpFrames = 4; - g_hdb->_ai->_clubDownFrames = 4; - g_hdb->_ai->_clubLeftFrames = 4; - g_hdb->_ai->_clubRightFrames = 4; + g_hdb->_ai->_clubUpFrames = g_hdb->_ai->_clubDownFrames = + g_hdb->_ai->_clubLeftFrames = g_hdb->_ai->_clubRightFrames = 4; - g_hdb->_ai->_slugAttackGfx[0] = new Picture; - g_hdb->_ai->_slugAttackGfx[0]->load(g_hdb->_fileMan->findFirstData("slug_shot1", TYPE_PIC)); - g_hdb->_ai->_slugAttackGfx[1] = new Picture; - g_hdb->_ai->_slugAttackGfx[1]->load(g_hdb->_fileMan->findFirstData("slug_shot2", TYPE_PIC)); - g_hdb->_ai->_slugAttackGfx[2] = new Picture; - g_hdb->_ai->_slugAttackGfx[2]->load(g_hdb->_fileMan->findFirstData("slug_shot3", TYPE_PIC)); - g_hdb->_ai->_slugAttackGfx[3] = new Picture; - g_hdb->_ai->_slugAttackGfx[3]->load(g_hdb->_fileMan->findFirstData("slug_shot4", TYPE_PIC)); + g_hdb->_ai->_slugAttackGfx[0] = g_hdb->_gfx->loadPic(SLUG_SHOT1); + g_hdb->_ai->_slugAttackGfx[1] = g_hdb->_gfx->loadPic(SLUG_SHOT2); + g_hdb->_ai->_slugAttackGfx[2] = g_hdb->_gfx->loadPic(SLUG_SHOT3); + g_hdb->_ai->_slugAttackGfx[3] = g_hdb->_gfx->loadPic(SLUG_SHOT4); int32 size = g_hdb->_fileMan->getLength("shock_spark_sit01", TYPE_TILE32); g_hdb->_ai->_stunLightningGfx[0] = g_hdb->_gfx->getTileGfx("shock_spark_sit01", size);