From c87f3199f82c5166a680f1ce9952777e8b4a6068 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 23 May 2009 00:05:16 +0000 Subject: Reserve opcode array entries beforehand, should save some reallocation and copying. svn-id: r40798 --- engines/kyra/script_hof.cpp | 3 +++ engines/kyra/script_lok.cpp | 1 + engines/kyra/script_lol.cpp | 4 ++++ engines/kyra/script_mr.cpp | 5 ++++- 4 files changed, 12 insertions(+), 1 deletion(-) (limited to 'engines/kyra') diff --git a/engines/kyra/script_hof.cpp b/engines/kyra/script_hof.cpp index 2a55dfa484..0327516b2e 100644 --- a/engines/kyra/script_hof.cpp +++ b/engines/kyra/script_hof.cpp @@ -1482,6 +1482,7 @@ typedef Common::Functor2Mem TIMO void KyraEngine_HoF::setupOpcodeTable() { Common::Array *table = 0; + _opcodes.reserve(176); SetOpcodeTable(_opcodes); // 0x00 Opcode(o2_setCharacterFacingRefresh); @@ -1705,6 +1706,7 @@ void KyraEngine_HoF::setupOpcodeTable() { Opcode(o2_demoFinale); Opcode(o2_dummy); + _opcodesAnimation.reserve(6); SetOpcodeTable(_opcodesAnimation); // 0x00 @@ -1718,6 +1720,7 @@ void KyraEngine_HoF::setupOpcodeTable() { // ---- TIM opcodes + _timOpcodes.reserve(4); // 0x00 OpcodeTim(t2_initChat); OpcodeTim(t2_updateSceneAnim); diff --git a/engines/kyra/script_lok.cpp b/engines/kyra/script_lok.cpp index 5eb86519a8..6d8c27fadc 100644 --- a/engines/kyra/script_lok.cpp +++ b/engines/kyra/script_lok.cpp @@ -1773,6 +1773,7 @@ typedef Common::Functor1Mem OpcodeV1; void KyraEngine_LoK::setupOpcodeTable() { Common::Array *table = 0; + _opcodes.reserve(157); SetOpcodeTable(_opcodes); // 0x00 Opcode(o1_magicInMouseItem); diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index 886869fb79..a7b3d573b2 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -2250,6 +2250,7 @@ typedef Common::Functor2Mem TIMOpco void LoLEngine::setupOpcodeTable() { Common::Array *table = 0; + _opcodes.reserve(192); SetOpcodeTable(_opcodes); // 0x00 Opcode(olol_setWallType); @@ -2540,6 +2541,8 @@ void LoLEngine::setupOpcodeTable() { OpcodeUnImpl(); Common::Array *timTable = 0; + + _timIntroOpcodes.reserve(8); SetTimOpcodeTable(_timIntroOpcodes); // 0x00 @@ -2554,6 +2557,7 @@ void LoLEngine::setupOpcodeTable() { OpcodeTimUnImpl(); OpcodeTimUnImpl(); + _timIngameOpcodes.reserve(17); SetTimOpcodeTable(_timIngameOpcodes); // 0x00 diff --git a/engines/kyra/script_mr.cpp b/engines/kyra/script_mr.cpp index 8eb703e38d..768a93b6ca 100644 --- a/engines/kyra/script_mr.cpp +++ b/engines/kyra/script_mr.cpp @@ -1149,6 +1149,7 @@ typedef Common::Functor1Mem OpcodeV3; void KyraEngine_MR::setupOpcodeTable() { Common::Array *table = 0; + _opcodes.reserve(176); SetOpcodeTable(_opcodes); // 0x00 Opcode(o3_getMalcolmShapes); @@ -1371,18 +1372,20 @@ void KyraEngine_MR::setupOpcodeTable() { OpcodeUnImpl(); Opcode(o3_dummy); + _opcodesAnimation.reserve(8); SetOpcodeTable(_opcodesAnimation); // 0x00 Opcode(o2a_setAnimationShapes); Opcode(o3a_setCharacterFrame); Opcode(o3_playSoundEffect); Opcode(o3_dummy); - // 0x0a + // 0x04 Opcode(o2a_setResetFrame); Opcode(o1_getRand); Opcode(o3_getMalcolmShapes); Opcode(o3_dummy); + _opcodesDialog.reserve(5); SetOpcodeTable(_opcodesDialog); // 0x00 Opcode(o3d_updateAnim); -- cgit v1.2.3