mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Merge branch 'feature/extra_msg' of https://github.com/Vennor/sfall into Vennor-feature/extra_msg
# Conflicts: # sfall/Message.cpp # sfall/Message.h
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
#include "HeroAppearance.h"
|
#include "HeroAppearance.h"
|
||||||
#include "Message.h"
|
#include "Message.h"
|
||||||
#include "ScriptExtender.h"
|
#include "ScriptExtender.h"
|
||||||
|
#include "Message.h"
|
||||||
|
|
||||||
bool AppModEnabled=false; //check if Appearance mod enabled for script fuctions
|
bool AppModEnabled=false; //check if Appearance mod enabled for script fuctions
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "SuperSave.h"
|
#include "SuperSave.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
#include "Message.h"
|
||||||
|
|
||||||
#define MAX_GLOBAL_SIZE (MaxGlobalVars*12 + 4)
|
#define MAX_GLOBAL_SIZE (MaxGlobalVars*12 + 4)
|
||||||
|
|
||||||
@@ -276,6 +277,7 @@ end:
|
|||||||
retn;
|
retn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void NewGame2() {
|
static void NewGame2() {
|
||||||
ResetState(0);
|
ResetState(0);
|
||||||
|
|
||||||
@@ -311,11 +313,17 @@ static void __declspec(naked) NewGame() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ReadExtraGameMsgFilesIfNeeded() {
|
||||||
|
if (gExtraGameMsgLists.empty())
|
||||||
|
ReadExtraGameMsgFiles();
|
||||||
|
}
|
||||||
|
|
||||||
static void __declspec(naked) MainMenu() {
|
static void __declspec(naked) MainMenu() {
|
||||||
__asm {
|
__asm {
|
||||||
pushad;
|
pushad;
|
||||||
push 0;
|
push 0;
|
||||||
call ResetState;
|
call ResetState;
|
||||||
|
call ReadExtraGameMsgFilesIfNeeded;
|
||||||
call LoadHeroAppearance;
|
call LoadHeroAppearance;
|
||||||
popad;
|
popad;
|
||||||
call main_menu_loop_;
|
call main_menu_loop_;
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* sfall
|
* sfall
|
||||||
|
<<<<<<< HEAD
|
||||||
* Copyright (C) 2008-2016 The sfall team
|
* Copyright (C) 2008-2016 The sfall team
|
||||||
|
=======
|
||||||
|
* Copyright (C) 2009, 2010 Mash (Matt Wells, mashw at bigpond dot net dot au)
|
||||||
|
>>>>>>> c3e489424351eadbc1d5f36772da89b586872eb9
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,10 +20,18 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
#include "FalloutEngine.h"
|
#include "FalloutEngine.h"
|
||||||
#include "Message.h"
|
#include "Message.h"
|
||||||
|
=======
|
||||||
|
#include <string>
|
||||||
|
#include "Message.h"
|
||||||
|
#include "FalloutEngine.h"
|
||||||
|
|
||||||
|
std::tr1::unordered_map<int, MSGList*> gExtraGameMsgLists;
|
||||||
|
>>>>>>> c3e489424351eadbc1d5f36772da89b586872eb9
|
||||||
|
|
||||||
int LoadMsgList(MSGList *MsgList, char *MsgFilePath) {
|
int LoadMsgList(MSGList *MsgList, char *MsgFilePath) {
|
||||||
int retVal;
|
int retVal;
|
||||||
@@ -42,6 +54,7 @@ int DestroyMsgList(MSGList *MsgList) {
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
/*
|
/*
|
||||||
bool GetMsg(MSGList *MsgList, MSGNode *MsgNode, DWORD msgRef) {
|
bool GetMsg(MSGList *MsgList, MSGNode *MsgNode, DWORD msgRef) {
|
||||||
bool retVal=FALSE;
|
bool retVal=FALSE;
|
||||||
@@ -59,6 +72,23 @@ EndFunc:
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
=======
|
||||||
|
//bool GetMsg(MSGList *MsgList, MSGNode *MsgNode, DWORD msgRef) {
|
||||||
|
// bool retVal=FALSE;
|
||||||
|
// MsgNode->ref=msgRef;
|
||||||
|
//
|
||||||
|
// __asm {
|
||||||
|
// mov edx, MsgNode
|
||||||
|
// mov eax, MsgList
|
||||||
|
// call message_search_
|
||||||
|
// cmp eax, 1
|
||||||
|
// jne EndFunc
|
||||||
|
// mov retVal, 1
|
||||||
|
// EndFunc:
|
||||||
|
// }
|
||||||
|
// return retVal;
|
||||||
|
//}
|
||||||
|
>>>>>>> c3e489424351eadbc1d5f36772da89b586872eb9
|
||||||
|
|
||||||
MSGNode *GetMsgNode(MSGList *MsgList, DWORD msgRef) {
|
MSGNode *GetMsgNode(MSGList *MsgList, DWORD msgRef) {
|
||||||
|
|
||||||
@@ -95,3 +125,54 @@ char* GetMsg(MSGList *MsgList, DWORD msgRef, int msgNum) {
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
|
||||||
|
void ReadExtraGameMsgFiles() {
|
||||||
|
int read;
|
||||||
|
std::string names;
|
||||||
|
|
||||||
|
names.resize(256);
|
||||||
|
|
||||||
|
while ((read = GetPrivateProfileStringA("Misc", "ExtraGameMsgFileList", "",
|
||||||
|
(LPSTR)names.data(), names.size(), ".\\ddraw.ini")) == names.size() - 1)
|
||||||
|
names.resize(names.size() + 256);
|
||||||
|
|
||||||
|
if (names.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
names.resize(names.find_first_of('\0'));
|
||||||
|
names.append(",");
|
||||||
|
|
||||||
|
int begin = 0;
|
||||||
|
int end;
|
||||||
|
int length;
|
||||||
|
|
||||||
|
while ((end = names.find_first_of(',', begin)) != std::string::npos) {
|
||||||
|
length = end - begin;
|
||||||
|
|
||||||
|
if (length > 0) {
|
||||||
|
std::string path = "game\\" + names.substr(begin, length) + ".msg";
|
||||||
|
MSGList* list = new MSGList;
|
||||||
|
|
||||||
|
if (LoadMsgList(list, (char*)path.data()) == 1)
|
||||||
|
gExtraGameMsgLists.insert(std::make_pair(0x2000 + gExtraGameMsgLists.size(), list));
|
||||||
|
else
|
||||||
|
delete list;
|
||||||
|
}
|
||||||
|
|
||||||
|
begin = end + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClearReadExtraGameMsgFiles() {
|
||||||
|
std::tr1::unordered_map<int, MSGList*>::iterator it;
|
||||||
|
|
||||||
|
for (it = gExtraGameMsgLists.begin(); it != gExtraGameMsgLists.end(); ++it) {
|
||||||
|
DestroyMsgList(it->second);
|
||||||
|
delete it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
gExtraGameMsgLists.clear();
|
||||||
|
}
|
||||||
|
>>>>>>> c3e489424351eadbc1d5f36772da89b586872eb9
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
|
<<<<<<< HEAD
|
||||||
* sfall
|
* sfall
|
||||||
* Copyright (C) 2008-2016 The sfall team
|
* Copyright (C) 2008-2016 The sfall team
|
||||||
*
|
*
|
||||||
@@ -18,6 +19,30 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
=======
|
||||||
|
* sfall
|
||||||
|
* Copyright (C) 2008, 2009 The sfall team
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <unordered_map>
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
>>>>>>> c3e489424351eadbc1d5f36772da89b586872eb9
|
||||||
//for holding a message
|
//for holding a message
|
||||||
typedef struct MSGNode {
|
typedef struct MSGNode {
|
||||||
DWORD ref;
|
DWORD ref;
|
||||||
@@ -44,8 +69,18 @@ typedef struct MSGList {
|
|||||||
}
|
}
|
||||||
} MSGList;
|
} MSGList;
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
extern std::tr1::unordered_map<int, MSGList*> gExtraGameMsgLists;
|
||||||
|
|
||||||
|
>>>>>>> c3e489424351eadbc1d5f36772da89b586872eb9
|
||||||
int LoadMsgList(MSGList *MsgList, char *MsgFilePath);
|
int LoadMsgList(MSGList *MsgList, char *MsgFilePath);
|
||||||
int DestroyMsgList(MSGList *MsgList);
|
int DestroyMsgList(MSGList *MsgList);
|
||||||
//bool GetMsg(MSGList *MsgList, MSGNode *MsgNode, DWORD msgRef);
|
//bool GetMsg(MSGList *MsgList, MSGNode *MsgNode, DWORD msgRef);
|
||||||
MSGNode *GetMsgNode(MSGList *MsgList, DWORD msgRef);
|
MSGNode *GetMsgNode(MSGList *MsgList, DWORD msgRef);
|
||||||
char* GetMsg(MSGList *MsgList, DWORD msgRef, int msgNum);
|
char* GetMsg(MSGList *MsgList, DWORD msgRef, int msgNum);
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
void ReadExtraGameMsgFiles();
|
||||||
|
void ClearReadExtraGameMsgFiles();
|
||||||
|
>>>>>>> c3e489424351eadbc1d5f36772da89b586872eb9
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "ScriptArrays.hpp"
|
#include "ScriptArrays.hpp"
|
||||||
#include "FileSystem.h"
|
#include "FileSystem.h"
|
||||||
#include "Arrays.h"
|
#include "Arrays.h"
|
||||||
|
#include "Message.h"
|
||||||
|
|
||||||
static void __declspec(naked) funcSqrt() {
|
static void __declspec(naked) funcSqrt() {
|
||||||
__asm {
|
__asm {
|
||||||
@@ -861,22 +862,28 @@ static const DWORD* proto_msg_files = (DWORD*)0x006647AC;
|
|||||||
|
|
||||||
static void _stdcall op_message_str_game2() {
|
static void _stdcall op_message_str_game2() {
|
||||||
DWORD fileId = opArgs[0];
|
DWORD fileId = opArgs[0];
|
||||||
|
const char* msg = 0;
|
||||||
|
|
||||||
if (IsOpArgInt(0) && IsOpArgInt(1)) {
|
if (IsOpArgInt(0) && IsOpArgInt(1)) {
|
||||||
int msgId = GetOpArgInt(1);
|
int msgId = GetOpArgInt(1);
|
||||||
const char* msg;
|
|
||||||
if (fileId < 20) { // main msg files
|
if (fileId < 20) { // main msg files
|
||||||
msg = GetMessageStr(game_msg_files[fileId], msgId);
|
msg = GetMessageStr(game_msg_files[fileId], msgId);
|
||||||
}
|
}
|
||||||
else if (fileId >= 0x1000 && fileId <= 0x1005) { // proto msg files
|
else if (fileId >= 0x1000 && fileId <= 0x1005) { // proto msg files
|
||||||
msg = GetMessageStr((DWORD)&proto_msg_files[2*(fileId - 0x1000)], msgId);
|
msg = GetMessageStr((DWORD)&proto_msg_files[2*(fileId - 0x1000)], msgId);
|
||||||
}
|
}
|
||||||
if (msg != 0)
|
else if (fileId >= 0x2000) { // Extra game message files.
|
||||||
SetOpReturn(msg);
|
std::tr1::unordered_map<int, MSGList*>::iterator it = gExtraGameMsgLists.find(fileId);
|
||||||
else
|
|
||||||
SetOpReturn(0, DATATYPE_INT);
|
if (it != gExtraGameMsgLists.end())
|
||||||
} else {
|
msg = GetMsg(it->second, msgId, 2);
|
||||||
SetOpReturn(0, DATATYPE_INT);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (msg == 0)
|
||||||
|
msg = "Error";
|
||||||
|
|
||||||
|
SetOpReturn(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __declspec(naked) op_message_str_game() {
|
static void __declspec(naked) op_message_str_game() {
|
||||||
|
|||||||
@@ -60,6 +60,7 @@
|
|||||||
#include "Tiles.h"
|
#include "Tiles.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
#include "Message.h"
|
||||||
|
|
||||||
bool IsDebug = false;
|
bool IsDebug = false;
|
||||||
|
|
||||||
@@ -1550,6 +1551,7 @@ static void DllMain2() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void _stdcall OnExit() {
|
static void _stdcall OnExit() {
|
||||||
|
ClearReadExtraGameMsgFiles();
|
||||||
ConsoleExit();
|
ConsoleExit();
|
||||||
AnimationsAtOnceExit();
|
AnimationsAtOnceExit();
|
||||||
HeroAppearanceModExit();
|
HeroAppearanceModExit();
|
||||||
|
|||||||
Reference in New Issue
Block a user