Extend message_str_game function to support all pro_*.msg files as well.

This commit is contained in:
VladislavKolosovsky
2015-07-07 00:16:25 +07:00
parent 302789a948
commit cafa0158a7
3 changed files with 11 additions and 2 deletions
+1
View File
@@ -67,6 +67,7 @@ const DWORD obj_move_to_tile_ = 0x48A568; // int aObj<eax>, int aTile<edx>, int
const DWORD obj_find_first_at_tile_ = 0x48B5A8; // <eax>(int elevation<eax>, int tile<edx>)
const DWORD obj_find_next_at_tile_ = 0x48B608; // no args
const DWORD critter_is_dead_ = 0x42DD18; // eax - critter
const DWORD tile_coord_ = 0x4B1674; // eax - tilenum, edx (int*) - x, ebx (int*) - y
// ANIMATION
const DWORD tile_refresh_rect_ = 0x4B12C0; // (int elevation<edx>, unkown<ecx>)
+1
View File
@@ -72,6 +72,7 @@ extern const DWORD obj_move_to_tile_; // int aObj<eax>, int aTile<edx>, int aEl
extern const DWORD obj_find_first_at_tile_; // <eax>(int elevation<eax>, int tile<edx>)
extern const DWORD obj_find_next_at_tile_; // no args
extern const DWORD critter_is_dead_; // eax - critter
extern const DWORD tile_coord_; // eax - tilenum, edx (int*) - x, ebx (int*) - y
// Animation
extern const DWORD tile_refresh_rect_; // (int elevation<edx>, unkown<ecx>)
+9 -2
View File
@@ -857,12 +857,19 @@ static const DWORD game_msg_files[] =
, 0x66BE38 // TRAIT
, 0x672FB0 }; // WORLDMAP
static const DWORD* proto_msg_files = (DWORD*)0x006647AC;
static void _stdcall op_message_str_game2() {
DWORD fileId = opArgs[0];
if (IsOpArgInt(0) && IsOpArgInt(1) && fileId < 20) {
if (IsOpArgInt(0) && IsOpArgInt(1)) {
int msgId = GetOpArgInt(1);
const char* msg = GetMessageStr(game_msg_files[fileId], msgId);
const char* msg;
if (fileId < 20) { // main msg files
msg = GetMessageStr(game_msg_files[fileId], msgId);
}
else if (fileId >= 0x1000 && fileId <= 0x1005) { // proto msg files
msg = GetMessageStr((DWORD)&proto_msg_files[2*(fileId - 0x1000)], msgId);
}
if (msg != 0)
SetOpReturn(msg);
else