Added some functions/variables for future use

This commit is contained in:
NovaRain
2021-01-22 14:19:35 +08:00
parent 8e66b82f76
commit e5b110d7ce
8 changed files with 39 additions and 3 deletions
+1 -1
View File
@@ -3593,7 +3593,7 @@ void BugFixes_Init()
// Fix broken Print() script function
HookCall(0x461AD4, (void*)windowOutput_);
// Fix for the flags of non-door objects being set/unset when opening/closing objects (e.g. using obj_close/open functions)
// Fix for the flags of non-door objects being set/unset when using obj_close/open functions
MakeCall(0x49CBF7, check_door_state_hack_close, 2);
MakeCall(0x49CB30, check_door_state_hack_open, 1);
}
+14
View File
@@ -136,6 +136,7 @@ DWORD* ptr_max = reinterpret_cast<DWORD*>(_max);
long* ptr_maxScriptNum = reinterpret_cast<long*>(_maxScriptNum);
bool* ptr_Meet_Frank_Horrigan = reinterpret_cast<bool*>(_Meet_Frank_Horrigan);
const char** ptr_movie_list = reinterpret_cast<const char**>(_movie_list); // array of 17 char*
DWORD* ptr_mouse_buttons = reinterpret_cast<DWORD*>(_mouse_buttons);
DWORD* ptr_mouse_hotx = reinterpret_cast<DWORD*>(_mouse_hotx);
DWORD* ptr_mouse_hoty = reinterpret_cast<DWORD*>(_mouse_hoty);
DWORD* ptr_mouse_is_hidden = reinterpret_cast<DWORD*>(_mouse_is_hidden);
@@ -236,6 +237,7 @@ DWORD* ptr_trait_data = reinterpret_cast<DWORD*>(_trait_data);
DWORD* ptr_view_page = reinterpret_cast<DWORD*>(_view_page);
DWORD* ptr_wd_obj = reinterpret_cast<DWORD*>(_wd_obj);
WINinfo** ptr_window = reinterpret_cast<WINinfo**>(_window); // array of 50 WINinfo*
DWORD* ptr_window_index = reinterpret_cast<DWORD*>(_window_index); // array of 50 DWORD
BYTE* ptr_WhiteColor = reinterpret_cast<BYTE*>(_WhiteColor);
DWORD* ptr_wmAreaInfoList = reinterpret_cast<DWORD*>(_wmAreaInfoList);
const DWORD* ptr_wmBkWin = reinterpret_cast<DWORD*>(_wmBkWin);
@@ -1583,6 +1585,11 @@ void DrawToSurface(long width, long height, long fromX, long fromY, long fromWid
}
}
//void TranslucentDarkFill(BYTE* surface, long x, long y, long width, long height, long surfWidth) {
// BYTE* surf = surface + (y * surfWidth) + x;
// WMInterfaceDrawSubTileRectFogged(surf, width, height, surfWidth);
//}
// Fills the specified interface window with index color
void WinFillRect(long winID, long x, long y, long width, long height, BYTE indexColor) {
WINinfo* win = GNWFind(winID);
@@ -1605,6 +1612,13 @@ void ClearWindow(long winID, bool refresh) {
}
//---------------------------------------------------------
void PrintFloatText(TGameObj* object, const char* text, long colorText, long colorOutline, long font) {
BoundRect rect;
if (!TextObjectCreate(object, text, font, colorText, colorOutline, &rect)) {
TileRefreshRect(&rect, object->elevation);
}
}
// print text to surface
void __stdcall PrintText(char* displayText, BYTE colorIndex, DWORD xPos, DWORD yPos, DWORD txtWidth, DWORD toWidth, BYTE* toSurface) {
DWORD posOffset = yPos * toWidth + xPos;
+7 -1
View File
@@ -180,13 +180,14 @@
#define _maxScriptNum 0x51C7CC
#define _Meet_Frank_Horrigan 0x672E04
#define _Move_on_Car 0x672E64
#define _movie_list 0x518DA0
#define _mouse_buttons 0x6AC7B0
#define _mouse_hotx 0x6AC7D0
#define _mouse_hoty 0x6AC7CC
#define _mouse_is_hidden 0x6AC790
#define _mouse_x_ 0x6AC7A8
#define _mouse_y 0x664450
#define _mouse_y_ 0x6AC7A4
#define _movie_list 0x518DA0
#define _Mutate_ 0x5708B4
#define _name_color 0x56D744
#define _name_font 0x56D74C
@@ -290,6 +291,7 @@
#define _view_page 0x664520
#define _wd_obj 0x59E98C
#define _window 0x6ADE58
#define _window_index 0x6ADD90
#define _wmAreaInfoList 0x51DDF8
#define _wmBkWin 0x51DE14
#define _wmBkWinBuf 0x51DE24
@@ -441,6 +443,7 @@ extern DWORD* ptr_max;
extern long* ptr_maxScriptNum;
extern bool* ptr_Meet_Frank_Horrigan;
extern const char** ptr_movie_list; // array of 17 char*
extern DWORD* ptr_mouse_buttons;
extern DWORD* ptr_mouse_hotx;
extern DWORD* ptr_mouse_hoty;
extern DWORD* ptr_mouse_is_hidden;
@@ -541,6 +544,7 @@ extern DWORD* ptr_trait_data;
extern DWORD* ptr_view_page;
extern DWORD* ptr_wd_obj;
extern WINinfo** ptr_window; // array of 50 WINinfo*
extern DWORD* ptr_window_index; // array of 50 DWORD
extern BYTE* ptr_WhiteColor;
extern DWORD* ptr_wmAreaInfoList;
extern const DWORD* ptr_wmBkWin;
@@ -1358,6 +1362,8 @@ void WinFillRect(long winID, long x, long y, long width, long height, BYTE index
// Fills the specified interface window with index color 0 (black color)
void ClearWindow(long winID, bool refresh = true);
void PrintFloatText(TGameObj* object, const char* text, long colorText, long colorOutline = 207, long font = 101);
// Print text to surface
void __stdcall PrintText(char* displayText, BYTE colorIndex, DWORD xPos, DWORD yPos, DWORD txtWidth, DWORD toWidth, BYTE* toSurface);
void __stdcall PrintTextFM(const char* displayText, BYTE colorIndex, DWORD xPos, DWORD yPos, DWORD txtWidth, DWORD toWidth, BYTE* toSurface);
+2
View File
@@ -45,6 +45,7 @@ WRAP_WATCOM_FFUNC4(long, QueueAdd, queue_add_, long, time, TGameObj*, object, vo
WRAP_WATCOM_FFUNC4(void, RegisterObjectCall, register_object_call_, long*, target, long*, source, void*, func, long, delay)
WRAP_WATCOM_FFUNC3(long, ScrGetLocalVar, scr_get_local_var_, long, sid, long, varId, long*, value)
WRAP_WATCOM_FFUNC3(long, ScrSetLocalVar, scr_set_local_var_, long, sid, long, varId, long, value)
WRAP_WATCOM_FFUNC6(long, TextObjectCreate, text_object_create_, TGameObj*, object, const char*, text, long, font, long, colorText, long, colorOutline, BoundRect*, rect)
WRAP_WATCOM_FFUNC3(long, TileNumInDirection, tile_num_in_direction_, long, tile, long, rotation, long, distance)
WRAP_WATCOM_FFUNC8(void, TransCscale, trans_cscale_, void*, fromBuff, long, width, long, height, long, fromPitch, void*, toBuff, long, toWidth, long, toHeight, long, toPitch)
WRAP_WATCOM_FFUNC3(void, WinClip, win_clip_, WINinfo*, window, RectList**, rects, void*, buffer)
@@ -97,6 +98,7 @@ WRAP_WATCOM_FUNC1(void, DbaseClose, dbase_close_, void*, dbPtr)
////////////////////////
WRAP_WATCOM_FUNC1(void, DisplayPrint, display_print_, const char*, msg) // Displays message in main UI console window
WRAP_WATCOM_FUNC0(void, DisplayStats, display_stats_)
WRAP_WATCOM_FUNC1(long, CritterBodyType, critter_body_type_, TGameObj*, critter)
WRAP_WATCOM_FUNC1(long, CritterIsDead, critter_is_dead_, TGameObj*, critter)
// Execute script proc by internal proc number (from script's proc table, basically a sequential number of a procedure as defined in code, starting from 1)
WRAP_WATCOM_FUNC2(void, ExecuteProcedure, executeProcedure_, TProgram*, sptr, long, procNum)
+5
View File
@@ -65,3 +65,8 @@ void StrNormalizePath(char* path) {
if (*path == '/') *path = '\\';
} while (*(++path) != 0);
}
// max range 0-32767
long GetRandom(long min, long max) {
return (min + (std::rand() % (max - (min - 1))));
}
+2
View File
@@ -32,3 +32,5 @@ void strtrim(char* str);
const char* strfind(const char* source, const char* word);
void StrNormalizePath(char* path);
long GetRandom(long min, long max);
+5
View File
@@ -134,6 +134,10 @@ std::vector<std::string> GetConfigList(const char* section, const char* setting,
return GetIniList(section, setting, defaultValue, bufSize, ',', ini);
}
std::vector<std::string> TranslateList(const char* section, const char* setting, const char* defaultValue, char delimiter, size_t bufSize) {
return GetIniList(section, setting, defaultValue, bufSize, delimiter, translationIni);
}
std::string Translate(const char* section, const char* setting, const char* defaultValue, size_t bufSize) {
return GetIniString(section, setting, defaultValue, bufSize, translationIni);
}
@@ -480,6 +484,7 @@ defaultIni:
}
}
}
std::srand(GetTickCount());
DllMain2();
}
+3 -1
View File
@@ -1,6 +1,6 @@
/*
* sfall
* Copyright (C) 2010 The sfall team
* Copyright (C) 2008-2016 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
@@ -100,6 +100,8 @@ size_t GetConfigString(const char* section, const char* setting, const char* def
// Parses the comma-separated list from the settings from Sfall configuration INI file.
std::vector<std::string> GetConfigList(const char* section, const char* setting, const char* defaultValue, size_t bufSize = 128);
std::vector<std::string> TranslateList(const char* section, const char* setting, const char* defaultValue, char delimiter, size_t bufSize = 256);
// Translates given string using Sfall translation INI file.
std::string Translate(const char* section, const char* setting, const char* defaultValue, size_t bufSize = 128);