mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Moved all engine function defines to new FalloutFuncs_def.h
(similar to the way how 4.x handles engine functions) Added the ability to get Automap window pointer. Reorganized some code to prepare for later commits.
This commit is contained in:
+2
-2
@@ -37,6 +37,8 @@ struct ChanceModifier {
|
||||
}
|
||||
};
|
||||
|
||||
extern long Combat_determineHitChance;
|
||||
|
||||
void CombatInit();
|
||||
void Combat_OnGameLoad();
|
||||
|
||||
@@ -50,5 +52,3 @@ void __stdcall KnockbackRemoveMod(TGameObj* object, DWORD mode);
|
||||
void __stdcall SetNoBurstMode(TGameObj* critter, bool on);
|
||||
void __stdcall DisableAimedShots(DWORD pid);
|
||||
void __stdcall ForceAimedShots(DWORD pid);
|
||||
|
||||
extern long Combat_determineHitChance;
|
||||
|
||||
+91
-787
File diff suppressed because it is too large
Load Diff
+72
-191
@@ -706,6 +706,7 @@ extern const DWORD game_help_;
|
||||
extern const DWORD game_set_global_var_;
|
||||
extern const DWORD game_time_;
|
||||
extern const DWORD game_time_date_;
|
||||
extern const DWORD gdDestroyHeadWindow_;
|
||||
extern const DWORD gdialog_barter_cleanup_tables_;
|
||||
extern const DWORD gdialog_barter_pressed_;
|
||||
extern const DWORD gdialogActive_;
|
||||
@@ -1137,6 +1138,11 @@ void DevPrintf(const char* fmt, ...);
|
||||
void DevPrintf(...);
|
||||
#endif
|
||||
|
||||
/*
|
||||
Add functions here if they have non-trivial wrapper implementation (like vararg functions or too many arguments, etc.)
|
||||
Otherwise use FalloutFuncs_def.h file (much easier).
|
||||
*/
|
||||
|
||||
// prints message to debug.log file
|
||||
void __declspec() DebugPrintf(const char* fmt, ...);
|
||||
|
||||
@@ -1165,203 +1171,80 @@ void __fastcall WindowDisplayBuf(long x, long width, long y, long height, void*
|
||||
// draws an image in the window and scales it to fit the window
|
||||
void __fastcall DisplayInWindow(long w_here, long width, long height, void* data);
|
||||
|
||||
void __fastcall TransCscale(long i_width, long i_height, long s_width, long s_height, long xy_shift, long w_width, void* data);
|
||||
// draws an image to the buffer of the active script window
|
||||
void __fastcall WindowTransCscale(long i_width, long i_height, long s_width, long s_height, long xy_shift, long w_width, void* data);
|
||||
|
||||
// buf_to_buf_ function with pure MMX implementation
|
||||
void __cdecl BufToBuf(void* src, long width, long height, long src_width, void* dst, long dst_width);
|
||||
|
||||
long __fastcall GetGameConfigString(const char* outValue, const char* section, const char* param);
|
||||
|
||||
/* stdcall */
|
||||
bool __stdcall ArtExists(long artFid);
|
||||
void __stdcall ArtFlush();
|
||||
const char* __stdcall ArtGetName(long artFID);
|
||||
long __stdcall ArtId(long artType, long lstIndex, long animCode, long weaponCode, long directionCode);
|
||||
BYTE* __stdcall ArtFrameData(FrmHeaderData* frm, long frameNum, long rotation);
|
||||
long __stdcall ArtFrameWidth(FrmHeaderData* frm, long frameNum, long rotation);
|
||||
long __stdcall ArtFrameLength(FrmHeaderData* frm, long frameNum, long rotation);
|
||||
FrmHeaderData* __stdcall ArtPtrLock(long frmId, DWORD* lockPtr);
|
||||
BYTE* __stdcall ArtPtrLockData(long frmId, long frameNum, long rotation, DWORD* lockPtr);
|
||||
BYTE* __stdcall ArtLock(long frmId, DWORD* lockPtr, long* widthOut, long* heightOut);
|
||||
long __stdcall ArtPtrUnlock(DWORD lockId);
|
||||
long __stdcall BarterComputeValue(TGameObj* source, TGameObj* target);
|
||||
long __stdcall BlockForTocks(long ticks);
|
||||
const char* __stdcall CritterName(TGameObj* critter); // Returns the name of the critter
|
||||
void __stdcall CritterPcSetName(const char* newName); // Change the name of playable character
|
||||
/* Database functions */
|
||||
bool __stdcall DbAccess(const char* fileName); // Checks if given file exists in DB
|
||||
long __stdcall DbFClose(DbFile* file);
|
||||
DbFile* __stdcall DbFOpen(const char* path, const char* mode);
|
||||
long __stdcall DbFGetc(DbFile* file);
|
||||
char* __stdcall DbFGets(char* buf, long max_count, DbFile* file);
|
||||
long __stdcall DbFRead(void* buf, long elsize, long count, DbFile* file);
|
||||
long __stdcall DbFSeek(DbFile* file, long pos, long origin);
|
||||
void __stdcall DbFreeFileList(char*** fileList, DWORD arg2); // Destroys filelist array created by DbGetFileList
|
||||
long __stdcall DbFReadByte(DbFile* file, BYTE* rout);
|
||||
long __stdcall DbFReadShort(DbFile* file, WORD* rout);
|
||||
long __stdcall DbFReadInt(DbFile* file, DWORD* rout);
|
||||
long __stdcall DbFReadByteCount(DbFile* file, BYTE* cptr, long count);
|
||||
long __stdcall DbFReadShortCount(DbFile* file, WORD* dest, long count);
|
||||
long __stdcall DbFReadIntCount(DbFile* file, DWORD* dest, long count);
|
||||
long __stdcall DbFWriteByte(DbFile* file, long value);
|
||||
long __stdcall DbFWriteInt(DbFile* file, long value);
|
||||
long __stdcall DbFWriteByteCount(DbFile* file, const BYTE* cptr, long count);
|
||||
long __stdcall DbDirEntry(const char *fileName, DWORD *sizeOut); // Check fallout file and get file size (result 0 - file exists)
|
||||
// Searches files in DB by given path/filename mask and stores result in fileList
|
||||
// fileList is a pointer to a variable, that will be assigned with an address of an array of char* strings
|
||||
long __stdcall DbGetFileList(const char* searchMask, char*** fileList); // Returns number of elements in *fileList
|
||||
long __stdcall DbInit(const char* path_dat, const char* path_patches);
|
||||
void* __stdcall DbaseOpen(const char* fileName);
|
||||
void __stdcall DbaseClose(void* dbPtr);
|
||||
////////////////////////
|
||||
void __stdcall DisplayPrint(const char* msg); // Displays message in main UI console window
|
||||
void __stdcall DisplayStats();
|
||||
long __stdcall CritterIsDead(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)
|
||||
void __stdcall ExecuteProcedure(TProgram* sptr, long procNum);
|
||||
const char* __stdcall FindCurrentProc(TProgram* program); // Returns the name of current procedure by program pointer
|
||||
long __stdcall FMtextWidth(const char* text);
|
||||
long __stdcall GetInputBtn();
|
||||
// Searches for message ID in given message file and places result in result argument
|
||||
const char* __stdcall Getmsg(const MSGList* fileAddr, MSGNode* result, long messageId);
|
||||
long __stdcall Gmouse3dGetMode();
|
||||
void __stdcall Gmouse3dSetMode(long mode);
|
||||
long __stdcall GmouseSetCursor(long picNum);
|
||||
long __stdcall GsoundBackgroundVolumeGetSet(long setVolume);
|
||||
void __stdcall GsoundPlaySfxFile(const char* name); // Plays SFX sound with given name
|
||||
WINinfo* __stdcall GNWFind(long winRef);
|
||||
long __stdcall Interpret(TProgram* program, long arg2);
|
||||
// Finds procedure ID for given script program pointer and procedure name
|
||||
long __stdcall InterpretFindProcedure(TProgram* scriptPtr, const char* procName);
|
||||
DWORD __stdcall InterpretPopShort(TProgram* scriptPtr); // Pops value type from Data stack (must be followed by InterpretPopLong)
|
||||
DWORD __stdcall InterpretPopLong(TProgram* scriptPtr); // Pops value from Data stack (must be preceded by InterpretPopShort)
|
||||
long __stdcall IntfaceGetAttack(DWORD* hitMode, DWORD* isSecondary);
|
||||
long __stdcall IntfaceIsHidden();
|
||||
void __stdcall IntfaceRedraw(); // Redraws the main game interface windows (useful after changing some data like active hand, etc.)
|
||||
void __stdcall IntfaceToggleItemState();
|
||||
void __stdcall IntfaceUpdateAc(long animate);
|
||||
void __stdcall IntfaceUpdateMovePoints(long ap, long freeAP);
|
||||
void __stdcall IntfaceUseItem();
|
||||
TGameObj* __stdcall InvenLeftHand(TGameObj* critter); // Item in critter's left hand slot
|
||||
TGameObj* __stdcall InvenRightHand(TGameObj* critter); // Item in critter's right hand slot
|
||||
TGameObj* __stdcall InvenPidIsCarriedPtr(TGameObj* invenObj, long pid);
|
||||
long __stdcall InvenUnwield(TGameObj* critter, long slot);
|
||||
TGameObj* __stdcall InvenWorn(TGameObj* critter); // Critter worn item (armor)
|
||||
long __stdcall IsPartyMember(TGameObj* obj);
|
||||
long __stdcall IsWithinPerception(TGameObj* source, TGameObj* target);
|
||||
long __stdcall ItemCCurrSize(TGameObj* critter);
|
||||
long __stdcall ItemCapsTotal(TGameObj* object);
|
||||
long __stdcall ItemGetType(TGameObj* item);
|
||||
long __stdcall ItemMDecCharges(TGameObj* item); // Returns 0 on success, -1 if the item has no charges
|
||||
long __stdcall ItemSize(TGameObj* item);
|
||||
long __stdcall ItemTotalCost(TGameObj* object);
|
||||
long __stdcall ItemTotalWeight(TGameObj* object);
|
||||
long __stdcall ItemWAnimWeap(TGameObj* item, DWORD hitMode);
|
||||
long __stdcall ItemWComputeAmmoCost(TGameObj* item, DWORD* rounds);
|
||||
long __stdcall ItemWCurrAmmo(TGameObj* item);
|
||||
long __stdcall ItemWMaxAmmo(TGameObj* item);
|
||||
long __stdcall ItemWRange(TGameObj* critter, long hitMode);
|
||||
long __stdcall ItemWReload(TGameObj* weapon, TGameObj* ammo);
|
||||
long __stdcall ItemWRounds(TGameObj* item);
|
||||
long __stdcall ItemWeight(TGameObj* item);
|
||||
long __stdcall LightGetTile(long elevation, long tileNum); // Returns light level at given tile
|
||||
long __stdcall LoadFrame(const char* filename, FrmFile** frmPtr);
|
||||
TProgram* __stdcall LoadProgram(const char* fileName);
|
||||
const char* __stdcall MapGetShortName(long mapID);
|
||||
void __stdcall MapDirErase(const char* folder, const char* ext);
|
||||
void __stdcall MemFree(void* mem);
|
||||
void* __stdcall MemRealloc(void* lpmem, DWORD msize);
|
||||
long __stdcall MessageExit(MSGList* msgList); // Destroys message list
|
||||
long __stdcall MessageLoad(MSGList* msgList, const char* msgFilePath); // Loads MSG file into given MessageList
|
||||
long __stdcall MessageSearch(const MSGList* file, MSGNode* msg);
|
||||
void __stdcall MouseGetPosition(long* outX, long* outY);
|
||||
void __stdcall MouseShow();
|
||||
void __stdcall MouseHide();
|
||||
// Calculates path and returns it's length
|
||||
long __stdcall MakePathFunc(TGameObj* objectFrom, long tileFrom, long tileTo, char* pathDataBuffer, long arg5, void* blockingFunc);
|
||||
long __stdcall NewObjId();
|
||||
void __stdcall ObjBound(TGameObj* object, BoundRect* boundRect); // Calculates bounding box (rectangle) for a given object
|
||||
long __stdcall ObjDestroy(TGameObj* object);
|
||||
long __stdcall ObjDist(TGameObj* obj_src, TGameObj* obj_trg);
|
||||
long __stdcall ObjEraseObject(TGameObj* object, BoundRect* boundRect);
|
||||
TGameObj* __stdcall ObjFindFirst();
|
||||
TGameObj* __stdcall ObjFindNext();
|
||||
TGameObj* __stdcall ObjFindFirstAtTile(long elevation, long tileNum);
|
||||
TGameObj* __stdcall ObjFindNextAtTile();
|
||||
long __stdcall ObjPidNew(TGameObj* object, long pid);
|
||||
long __stdcall ObjLockIsJammed(TGameObj* object); // Checks/unjams jammed locks
|
||||
void __stdcall ObjUnjamLock(TGameObj* object);
|
||||
long __stdcall PartyMemberGetCurrentLevel(TGameObj* obj);
|
||||
long __stdcall PerkCanAdd(TGameObj* critter, long perkId);
|
||||
long __stdcall PerkLevel(TGameObj* critter, long perkId);
|
||||
long __stdcall PickDeath(TGameObj* attacker, TGameObj* target, TGameObj* weapon, long amount, long anim, long hitFromBack);
|
||||
void __stdcall ProcessBk();
|
||||
void __stdcall ProtoDudeUpdateGender();
|
||||
long* __stdcall QueueFindFirst(TGameObj* object, long qType);
|
||||
long* __stdcall QueueFindNext(TGameObj* object, long qType);
|
||||
long __stdcall RegisterObjectAnimateAndHide(TGameObj* object, long anim, long delay);
|
||||
long __stdcall RegisterObjectChangeFid(TGameObj* object, long artFid, long delay);
|
||||
long __stdcall RegisterObjectLight(TGameObj* object, long lightRadius, long delay);
|
||||
long __stdcall RegisterObjectMustErase(TGameObj* object);
|
||||
long __stdcall RegisterObjectTakeOut(TGameObj* object, long holdFrameId, long nothing);
|
||||
long __stdcall RegisterObjectTurnTowards(TGameObj* object, long tileNum, long nothing);
|
||||
long __stdcall RollRandom(long minValue, long maxValue);
|
||||
long* __stdcall RunProgram(TProgram* progPtr);
|
||||
TScript* __stdcall ScrFindFirstAt(long elevation);
|
||||
TScript* __stdcall ScrFindNextAt();
|
||||
TGameObj* __stdcall ScrFindObjFromProgram(TProgram* program);
|
||||
long __stdcall ScrNew(long* scriptID, long sType);
|
||||
// Saves pointer to script object into scriptPtr using scriptID
|
||||
long __stdcall ScrPtr(long scriptId, TScript** scriptPtr); // Returns 0 on success, -1 on failure
|
||||
long __stdcall ScrRemove(long scriptID);
|
||||
void __stdcall SetFocusFunc(void* func);
|
||||
long __stdcall SkillIsTagged(long skill);
|
||||
long __stdcall StatGetBaseDirect(TGameObj* critter, long statID);
|
||||
long __stdcall StatLevel(TGameObj* critter, long statId);
|
||||
long __stdcall TextFont(long fontNum);
|
||||
long __stdcall TileDist(long scrTile, long dstTile);
|
||||
long __stdcall TileDir(long scrTile, long dstTile);
|
||||
void __stdcall TileRefreshDisplay(); // Redraws the whole screen
|
||||
void __stdcall TileRefreshRect(BoundRect* boundRect, long elevation); // Redraws the given rectangle on screen
|
||||
long __stdcall TraitLevel(long traitID);
|
||||
long __stdcall WinAdd(long x, long y, long width, long height, long bgColorIndex, long flags);
|
||||
void __stdcall WinShow(DWORD winRef);
|
||||
void __stdcall WinHide(DWORD winRef);
|
||||
BYTE* __stdcall WinGetBuf(DWORD winRef);
|
||||
void __stdcall WinDraw(DWORD winRef);
|
||||
void __stdcall WinDrawRect(DWORD winRef, RECT* rect);
|
||||
void __stdcall WinDelete(DWORD winRef);
|
||||
long __stdcall WindowWidth();
|
||||
void __stdcall WmRefreshInterfaceOverlay(long isRedraw);
|
||||
DbFile* __stdcall XFOpen(const char* fileName, const char* flags);
|
||||
long __stdcall XFSeek(DbFile* file, long fOffset, long origin);
|
||||
// X-Macro for wrapper functions.
|
||||
#define WRAP_WATCOM_FUNC0(retType, name, funcoff) \
|
||||
retType __stdcall name();
|
||||
|
||||
/* fastcall */
|
||||
long __fastcall WordWrap(const char* text, int maxWidth, DWORD* buf, BYTE* count);
|
||||
void __fastcall CheckForDeath(TGameObj* critter, long amountDamage, long* flags);
|
||||
void __fastcall CorrectFidForRemovedItem(TGameObj* critter, TGameObj* item, long slotFlag);
|
||||
long __fastcall CreateWindowFunc(const char* winName, DWORD x, DWORD y, DWORD width, DWORD height, long color, long flags);
|
||||
long __fastcall DetermineToHit(TGameObj* source, TGameObj* target, long bodyPart, long hitMode);
|
||||
void __fastcall DisplayInventory(long inventoryOffset, long visibleOffset, long mode);
|
||||
void __fastcall DisplayTargetInventory(long inventoryOffset, long visibleOffset, DWORD* targetInventory, long mode);
|
||||
FrmFrameData* __fastcall FramePtr(FrmHeaderData* frm, long frame, long direction);
|
||||
void __fastcall GNWWinRefresh(WINinfo* win, BoundRect* rect, long* buffer);
|
||||
void __fastcall IntfaceUpdateItems(long animate, long modeLeft, long modeRight);
|
||||
TGameObj* __fastcall InvenFindType(TGameObj* critter, long itemType, DWORD* buf);
|
||||
long __fastcall ItemAddForce(TGameObj* critter, TGameObj* item, long count);
|
||||
long __fastcall ItemWMpCost(TGameObj* source, long hitMode, long isCalled);
|
||||
void __fastcall MakeStraightPathFunc(TGameObj* objFrom, DWORD tileFrom, DWORD tileTo, void* rotationPtr, DWORD* result, long flags, void* func);
|
||||
long __fastcall MessageFind(DWORD* msgFile, long msgNumber, DWORD* outBuf);
|
||||
long __fastcall MouseClickIn(long x, long y, long x_end, long y_end);
|
||||
TGameObj* __fastcall ObjBlockingAt(TGameObj* object, long tile, long elevation);
|
||||
long __fastcall ObjNewSidInst(TGameObj* object, long sType, long scriptIndex);
|
||||
long __fastcall ObjectUnderMouse(long crSwitch, long inclDude, long elevation);
|
||||
void __fastcall RegisterObjectCall(long* target, long* source, void* func, long delay);
|
||||
long __fastcall ScrGetLocalVar(long sid, long varId, long* value);
|
||||
long __fastcall ScrSetLocalVar(long sid, long varId, long value);
|
||||
long __fastcall TileNumInDirection(long tile, long rotation, long distance);
|
||||
#define WRAP_WATCOM_FUNC1(retType, name, funcoff, arg1t, arg1) \
|
||||
retType __stdcall name(arg1t arg1);
|
||||
|
||||
const char* __fastcall InterpretGetString(TProgram* scriptPtr, DWORD dataType, DWORD strId);
|
||||
#define WRAP_WATCOM_FUNC2(retType, name, funcoff, arg1t, arg1, arg2t, arg2) \
|
||||
retType __stdcall name(arg1t arg1, arg2t arg2);
|
||||
|
||||
#define WRAP_WATCOM_FUNC3(retType, name, funcoff, arg1t, arg1, arg2t, arg2, arg3t, arg3) \
|
||||
retType __stdcall name(arg1t arg1, arg2t arg2, arg3t arg3);
|
||||
|
||||
#define WRAP_WATCOM_FUNC4(retType, name, funcoff, arg1t, arg1, arg2t, arg2, arg3t, arg3, arg4t, arg4) \
|
||||
retType __stdcall name(arg1t arg1, arg2t arg2, arg3t arg3, arg4t arg4);
|
||||
|
||||
#define WRAP_WATCOM_FUNC5(retType, name, funcoff, arg1t, arg1, arg2t, arg2, arg3t, arg3, arg4t, arg4, arg5t, arg5) \
|
||||
retType __stdcall name(arg1t arg1, arg2t arg2, arg3t arg3, arg4t arg4, arg5t arg5);
|
||||
|
||||
#define WRAP_WATCOM_FUNC6(retType, name, funcoff, arg1t, arg1, arg2t, arg2, arg3t, arg3, arg4t, arg4, arg5t, arg5, arg6t, arg6) \
|
||||
retType __stdcall name(arg1t arg1, arg2t arg2, arg3t arg3, arg4t arg4, arg5t arg5, arg6t arg6);
|
||||
|
||||
|
||||
#define WRAP_WATCOM_FFUNC1(retType, name, funcoff, arg1t, arg1) \
|
||||
retType __fastcall name(arg1t arg1);
|
||||
|
||||
#define WRAP_WATCOM_FFUNC2(retType, name, funcoff, arg1t, arg1, arg2t, arg2) \
|
||||
retType __fastcall name(arg1t arg1, arg2t arg2);
|
||||
|
||||
#define WRAP_WATCOM_FFUNC3(retType, name, funcoff, arg1t, arg1, arg2t, arg2, arg3t, arg3) \
|
||||
retType __fastcall name(arg1t arg1, arg2t arg2, arg3t arg3);
|
||||
|
||||
#define WRAP_WATCOM_FFUNC4(retType, name, funcoff, arg1t, arg1, arg2t, arg2, arg3t, arg3, arg4t, arg4) \
|
||||
retType __fastcall name(arg1t arg1, arg2t arg2, arg3t arg3, arg4t arg4);
|
||||
|
||||
#define WRAP_WATCOM_FFUNC5(retType, name, funcoff, arg1t, arg1, arg2t, arg2, arg3t, arg3, arg4t, arg4, arg5t, arg5) \
|
||||
retType __fastcall name(arg1t arg1, arg2t arg2, arg3t arg3, arg4t arg4, arg5t arg5);
|
||||
|
||||
#define WRAP_WATCOM_FFUNC6(retType, name, funcoff, arg1t, arg1, arg2t, arg2, arg3t, arg3, arg4t, arg4, arg5t, arg5, arg6t, arg6) \
|
||||
retType __fastcall name(arg1t arg1, arg2t arg2, arg3t arg3, arg4t arg4, arg5t arg5, arg6t arg6);
|
||||
|
||||
#define WRAP_WATCOM_FFUNC7(retType, name, funcoff, arg1t, arg1, arg2t, arg2, arg3t, arg3, arg4t, arg4, arg5t, arg5, arg6t, arg6, arg7t, arg7) \
|
||||
retType __fastcall name(arg1t arg1, arg2t arg2, arg3t arg3, arg4t arg4, arg5t arg5, arg6t arg6, arg7t arg7);
|
||||
|
||||
#define WRAP_WATCOM_FFUNC8(retType, name, funcoff, arg1t, arg1, arg2t, arg2, arg3t, arg3, arg4t, arg4, arg5t, arg5, arg6t, arg6, arg7t, arg7, arg8t, arg8) \
|
||||
retType __fastcall name(arg1t arg1, arg2t arg2, arg3t arg3, arg4t arg4, arg5t arg5, arg6t arg6, arg7t arg7, arg8t arg8);
|
||||
|
||||
#include "FalloutFuncs_def.h"
|
||||
|
||||
#undef WRAP_WATCOM_FUNC0
|
||||
#undef WRAP_WATCOM_FUNC1
|
||||
#undef WRAP_WATCOM_FUNC2
|
||||
#undef WRAP_WATCOM_FUNC3
|
||||
#undef WRAP_WATCOM_FUNC4
|
||||
#undef WRAP_WATCOM_FUNC5
|
||||
#undef WRAP_WATCOM_FUNC6
|
||||
//#undef WRAP_WATCOM_FUNC7
|
||||
|
||||
#undef WRAP_WATCOM_FFUNC1
|
||||
#undef WRAP_WATCOM_FFUNC2
|
||||
#undef WRAP_WATCOM_FFUNC3
|
||||
#undef WRAP_WATCOM_FFUNC4
|
||||
#undef WRAP_WATCOM_FFUNC5
|
||||
#undef WRAP_WATCOM_FFUNC6
|
||||
#undef WRAP_WATCOM_FFUNC7
|
||||
#undef WRAP_WATCOM_FFUNC8
|
||||
|
||||
///////////////////////////////// ENGINE UTILS /////////////////////////////////
|
||||
|
||||
@@ -1401,8 +1284,6 @@ long GetScriptLocalVars(long sid);
|
||||
|
||||
long __fastcall GetTopWindowID(long xPos, long yPos);
|
||||
|
||||
WINinfo* GetUIWindow(long winType);
|
||||
|
||||
// Returns an array of objects within the specified radius from the source tile
|
||||
void GetObjectsTileRadius(std::vector<TGameObj*> &objs, long sourceTile, long radius, long elev, long type = -1);
|
||||
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
/**
|
||||
X-Macro for defining engine function wrappers.
|
||||
|
||||
Add one line for every function you want to call from C++ code.
|
||||
|
||||
Format:
|
||||
WRAP_WATCOM_FUNCX(retType, name, funcoff, argType1, argName1, ...)
|
||||
- X - number of arguments
|
||||
- retType - function return type
|
||||
- name - function name (without trailing underscore)
|
||||
- funcoff - engine function offset
|
||||
- argType - type of argument
|
||||
- argName - name of argument (repeat for all of X arguments)
|
||||
|
||||
NOTES: be careful not to use reserved words, including ASM instructions (push, pop, mov, div, etc.)
|
||||
*/
|
||||
|
||||
/*
|
||||
For functions that have 3 or more arguments, it is preferable to use the fastcall calling convention
|
||||
because the compiler builds the better/optimized code when calling the engine functions
|
||||
*/
|
||||
WRAP_WATCOM_FFUNC4(long, WordWrap, _word_wrap_, const char*, text, int, maxWidth, DWORD*, buf, BYTE*, count)
|
||||
WRAP_WATCOM_FFUNC3(void, CheckForDeath, check_for_death_, TGameObj*, critter, long, amountDamage, long*, flags)
|
||||
WRAP_WATCOM_FFUNC3(void, CorrectFidForRemovedItem, correctFidForRemovedItem_, TGameObj*, critter, TGameObj*, item, long, slotFlag)
|
||||
WRAP_WATCOM_FFUNC7(long, CreateWindowFunc, createWindow_, const char*, winName, DWORD, x, DWORD, y, DWORD, width, DWORD, height, long, color, long, flags)
|
||||
WRAP_WATCOM_FFUNC4(long, DetermineToHit, determine_to_hit_, TGameObj*, source, TGameObj*, target, long, bodyPart, long, hitMode)
|
||||
WRAP_WATCOM_FFUNC3(void, DisplayInventory, display_inventory_, long, inventoryOffset, long, visibleOffset, long, mode)
|
||||
WRAP_WATCOM_FFUNC4(void, DisplayTargetInventory, display_target_inventory_, long, inventoryOffset, long, visibleOffset, DWORD*, targetInventory, long, mode)
|
||||
WRAP_WATCOM_FFUNC3(FrmFrameData*, FramePtr, frame_ptr_, FrmHeaderData*, frm, long, frame, long, direction)
|
||||
WRAP_WATCOM_FFUNC3(void, GNWWinRefresh, GNW_win_refresh_, WINinfo*, win, BoundRect*, rect, long*, buffer)
|
||||
WRAP_WATCOM_FFUNC3(void, IntfaceUpdateItems, intface_update_items_, long, animate, long, modeLeft, long, modeRight)
|
||||
WRAP_WATCOM_FFUNC3(TGameObj*, InvenFindType, inven_find_type_, TGameObj*, critter, long, itemType, DWORD*, buf)
|
||||
WRAP_WATCOM_FFUNC3(long, ItemAddForce, item_add_force_, TGameObj*, critter, TGameObj*, item, long, count)
|
||||
WRAP_WATCOM_FFUNC3(long, ItemWMpCost, item_w_mp_cost_, TGameObj*, source, long, hitMode, long, isCalled)
|
||||
WRAP_WATCOM_FFUNC7(void, MakeStraightPathFunc, make_straight_path_func_, TGameObj*, objFrom, DWORD, tileFrom, DWORD, tileTo, void*, rotationPtr, DWORD*, result, long, flags, void*, func)
|
||||
WRAP_WATCOM_FFUNC3(long, MessageFind, message_find_, DWORD*, msgFile, long, msgNumber, DWORD*, outBuf)
|
||||
WRAP_WATCOM_FFUNC4(long, MouseClickIn, mouse_click_in_, long, x, long, y, long, x_end, long, y_end)
|
||||
WRAP_WATCOM_FFUNC3(TGameObj*, ObjBlockingAt, obj_blocking_at_, TGameObj*, object, long, tile, long, elevation)
|
||||
WRAP_WATCOM_FFUNC3(long, ObjNewSidInst, obj_new_sid_inst_, TGameObj*, object, long, sType, long, scriptIndex)
|
||||
WRAP_WATCOM_FFUNC3(long, ObjectUnderMouse, object_under_mouse_, long, crSwitch, long, inclDude, long, elevation)
|
||||
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_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, pitch, void*, toBuff, long, toWidth, long, toHeight, long, toPitch)
|
||||
|
||||
WRAP_WATCOM_FFUNC3(const char*, InterpretGetString, interpretGetString_, TProgram*, scriptPtr, DWORD, dataType, DWORD, strId)
|
||||
|
||||
/* stdcall */
|
||||
WRAP_WATCOM_FUNC1(bool, ArtExists, art_exists_, long, artFid)
|
||||
WRAP_WATCOM_FUNC0(void, ArtFlush, art_flush_)
|
||||
WRAP_WATCOM_FUNC1(const char*, ArtGetName, art_get_name_, long, artFID)
|
||||
WRAP_WATCOM_FUNC5(long, ArtId, art_id_, long, artType, long, lstIndex, long, animCode, long, weaponCode, long, directionCode)
|
||||
WRAP_WATCOM_FUNC3(BYTE*, ArtFrameData, art_frame_data_, FrmHeaderData*, frm, long, frameNum, long, rotation)
|
||||
WRAP_WATCOM_FUNC3(long, ArtFrameWidth, art_frame_width_, FrmHeaderData*, frm, long, frameNum, long, rotation)
|
||||
WRAP_WATCOM_FUNC3(long, ArtFrameLength, art_frame_length_, FrmHeaderData*, frm, long, frameNum, long, rotation)
|
||||
WRAP_WATCOM_FUNC2(FrmHeaderData*, ArtPtrLock, art_ptr_lock_, long, frmId, DWORD*, lockPtr)
|
||||
WRAP_WATCOM_FUNC4(BYTE*, ArtPtrLockData, art_ptr_lock_data_, long, frmId, long, frameNum, long, rotation, DWORD*, lockPtr)
|
||||
WRAP_WATCOM_FUNC4(BYTE*, ArtLock, art_lock_, long, frmId, DWORD*, lockPtr, long*, widthOut, long*, heightOut)
|
||||
WRAP_WATCOM_FUNC1(long, ArtPtrUnlock, art_ptr_unlock_, DWORD, lockId)
|
||||
WRAP_WATCOM_FUNC2(long, BarterComputeValue, barter_compute_value_, TGameObj*, source, TGameObj*, target)
|
||||
WRAP_WATCOM_FUNC1(long, BlockForTocks, block_for_tocks_, long, ticks)
|
||||
WRAP_WATCOM_FUNC1(const char*, CritterName, critter_name_, TGameObj*, critter) // Returns the name of the critter
|
||||
WRAP_WATCOM_FUNC1(void, CritterPcSetName, critter_pc_set_name_, const char*, newName) // Change the name of playable character
|
||||
/* Database functions */
|
||||
WRAP_WATCOM_FUNC1(bool, DbAccess, db_access_, const char*, fileName) // Checks if given file exists in DB
|
||||
WRAP_WATCOM_FUNC1(long, DbFClose, db_fclose_, DbFile*, file)
|
||||
WRAP_WATCOM_FUNC2(DbFile*, DbFOpen, db_fopen_, const char*, path, const char*, mode)
|
||||
WRAP_WATCOM_FUNC1(long, DbFGetc, db_fgetc_, DbFile*, file)
|
||||
WRAP_WATCOM_FUNC3(char*, DbFGets, db_fgets_, char*, buf, long, max_count, DbFile*, file)
|
||||
WRAP_WATCOM_FUNC4(long, DbFRead, db_fread_, void*, buf, long, elsize, long, count, DbFile*, file)
|
||||
WRAP_WATCOM_FUNC3(long, DbFSeek, db_fseek_, DbFile*, file, long, pos, long, origin)
|
||||
WRAP_WATCOM_FUNC2(void, DbFreeFileList, db_free_file_list_, char***, fileList, DWORD, arg2) // Destroys filelist array created by DbGetFileList
|
||||
WRAP_WATCOM_FUNC2(long, DbFReadByte, db_freadByte_, DbFile*, file, BYTE*, rout)
|
||||
WRAP_WATCOM_FUNC2(long, DbFReadShort, db_freadShort_, DbFile*, file, WORD*, rout)
|
||||
WRAP_WATCOM_FUNC2(long, DbFReadInt, db_freadInt_, DbFile*, file, DWORD*, rout)
|
||||
WRAP_WATCOM_FUNC3(long, DbFReadByteCount, db_freadByteCount_, DbFile*, file, BYTE*, cptr, long, count)
|
||||
WRAP_WATCOM_FUNC3(long, DbFReadShortCount, db_freadShortCount_, DbFile*, file, WORD*, dest, long, count)
|
||||
WRAP_WATCOM_FUNC3(long, DbFReadIntCount, db_freadIntCount_, DbFile*, file, DWORD*, dest, long, count)
|
||||
WRAP_WATCOM_FUNC2(long, DbFWriteByte, db_fwriteByte_, DbFile*, file, long, value)
|
||||
WRAP_WATCOM_FUNC2(long, DbFWriteInt, db_fwriteInt_, DbFile*, file, long, value)
|
||||
WRAP_WATCOM_FUNC3(long, DbFWriteByteCount, db_fwriteByteCount_, DbFile*, file, const BYTE*, cptr, long, count)
|
||||
WRAP_WATCOM_FUNC2(long, DbDirEntry, db_dir_entry_, const char*, fileName, DWORD*, sizeOut) // Check fallout file and get file size (result 0 - file exists)
|
||||
// Searches files in DB by given path/filename mask and stores result in fileList
|
||||
// fileList is a pointer to a variable, that will be assigned with an address of an array of char* strings
|
||||
WRAP_WATCOM_FUNC2(long, DbGetFileList, db_get_file_list_, const char*, searchMask, char***, fileList) // Returns number of elements in *fileList
|
||||
WRAP_WATCOM_FUNC2(long, DbInit, db_init_, const char*, path_dat, const char*, path_patches)
|
||||
WRAP_WATCOM_FUNC1(void*, DbaseOpen, dbase_open_, const char*, fileName)
|
||||
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, 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)
|
||||
WRAP_WATCOM_FUNC1(const char*, FindCurrentProc, findCurrentProc_, TProgram*, program) // Returns the name of current procedure by program pointer
|
||||
WRAP_WATCOM_FUNC1(long, FMtextWidth, FMtext_width_, const char*, text)
|
||||
WRAP_WATCOM_FUNC0(long, GetInputBtn, get_input_)
|
||||
// Searches for message ID in given message file and places result in result argument
|
||||
WRAP_WATCOM_FUNC3(const char*, Getmsg, getmsg_, const MSGList*, fileAddr, MSGNode*, result, long, messageId)
|
||||
WRAP_WATCOM_FUNC0(long, Gmouse3dGetMode, gmouse_3d_get_mode_)
|
||||
WRAP_WATCOM_FUNC1(void, Gmouse3dSetMode, gmouse_3d_set_mode_, long, mode)
|
||||
WRAP_WATCOM_FUNC1(long, GmouseSetCursor, gmouse_set_cursor_, long, picNum)
|
||||
WRAP_WATCOM_FUNC1(long, GsoundBackgroundVolumeGetSet, gsound_background_volume_get_set_, long, setVolume)
|
||||
WRAP_WATCOM_FUNC1(void, GsoundPlaySfxFile, gsound_play_sfx_file_, const char*, name) // Plays SFX sound with given name
|
||||
WRAP_WATCOM_FUNC1(WINinfo*, GNWFind, GNW_find_, long, winRef)
|
||||
WRAP_WATCOM_FUNC2(long, Interpret, interpret_, TProgram*, program, long, arg2)
|
||||
// Finds procedure ID for given script program pointer and procedure name
|
||||
WRAP_WATCOM_FUNC2(long, InterpretFindProcedure, interpretFindProcedure_, TProgram*, scriptPtr, const char*, procName)
|
||||
WRAP_WATCOM_FUNC1(DWORD, InterpretPopShort, interpretPopShort_, TProgram*, scriptPtr) // Pops value type from Data stack (must be followed by InterpretPopLong)
|
||||
WRAP_WATCOM_FUNC1(DWORD, InterpretPopLong, interpretPopLong_, TProgram*, scriptPtr) // Pops value from Data stack (must be preceded by InterpretPopShort)
|
||||
WRAP_WATCOM_FUNC2(long, IntfaceGetAttack, intface_get_attack_, DWORD*, hitMode, DWORD*, isSecondary)
|
||||
WRAP_WATCOM_FUNC0(long, IntfaceIsHidden, intface_is_hidden_)
|
||||
WRAP_WATCOM_FUNC0(void, IntfaceRedraw, intface_redraw_) // Redraws the main game interface windows (useful after changing some data like active hand, etc.)
|
||||
WRAP_WATCOM_FUNC0(void, IntfaceToggleItemState, intface_toggle_item_state_)
|
||||
WRAP_WATCOM_FUNC1(void, IntfaceUpdateAc, intface_update_ac_, long, animate)
|
||||
WRAP_WATCOM_FUNC2(void, IntfaceUpdateMovePoints, intface_update_move_points_, long, ap, long, freeAP)
|
||||
WRAP_WATCOM_FUNC0(void, IntfaceUseItem, intface_use_item_)
|
||||
WRAP_WATCOM_FUNC1(TGameObj*, InvenLeftHand, inven_left_hand_, TGameObj*, critter) // Item in critter's left hand slot
|
||||
WRAP_WATCOM_FUNC1(TGameObj*, InvenRightHand, inven_right_hand_, TGameObj*, critter) // Item in critter's right hand slot
|
||||
WRAP_WATCOM_FUNC2(TGameObj*, InvenPidIsCarriedPtr, inven_pid_is_carried_ptr_, TGameObj*, invenObj, long, pid)
|
||||
WRAP_WATCOM_FUNC2(long, InvenUnwield, inven_unwield_, TGameObj*, critter, long, slot)
|
||||
WRAP_WATCOM_FUNC1(TGameObj*, InvenWorn, inven_worn_, TGameObj*, critter) // Critter worn item (armor)
|
||||
WRAP_WATCOM_FUNC1(long, IsPartyMember, isPartyMember_, TGameObj*, obj)
|
||||
WRAP_WATCOM_FUNC2(long, IsWithinPerception, is_within_perception_, TGameObj*, source, TGameObj*, target)
|
||||
WRAP_WATCOM_FUNC1(long, ItemCCurrSize, item_c_curr_size_, TGameObj*, critter)
|
||||
WRAP_WATCOM_FUNC1(long, ItemCapsTotal, item_caps_total_, TGameObj*, object)
|
||||
WRAP_WATCOM_FUNC1(long, ItemGetType, item_get_type_, TGameObj*, item)
|
||||
WRAP_WATCOM_FUNC1(long, ItemMDecCharges, item_m_dec_charges_, TGameObj*, item) // Returns 0 on success, -1 if the item has no charges
|
||||
WRAP_WATCOM_FUNC1(long, ItemSize, item_size_, TGameObj*, item)
|
||||
WRAP_WATCOM_FUNC1(long, ItemTotalCost, item_total_cost_, TGameObj*, object)
|
||||
WRAP_WATCOM_FUNC1(long, ItemTotalWeight, item_total_weight_, TGameObj*, object)
|
||||
WRAP_WATCOM_FUNC2(long, ItemWAnimWeap, item_w_anim_weap_, TGameObj*, item, DWORD, hitMode)
|
||||
WRAP_WATCOM_FUNC2(long, ItemWComputeAmmoCost, item_w_compute_ammo_cost_, TGameObj*, item, DWORD*, rounds)
|
||||
WRAP_WATCOM_FUNC1(long, ItemWCurrAmmo, item_w_curr_ammo_, TGameObj*, item)
|
||||
WRAP_WATCOM_FUNC1(long, ItemWMaxAmmo, item_w_max_ammo_, TGameObj*, item)
|
||||
WRAP_WATCOM_FUNC2(long, ItemWRange, item_w_range_, TGameObj*, critter, long, hitMode)
|
||||
WRAP_WATCOM_FUNC2(long, ItemWReload, item_w_reload_, TGameObj*, weapon, TGameObj*, ammo)
|
||||
WRAP_WATCOM_FUNC1(long, ItemWRounds, item_w_rounds_, TGameObj*, item)
|
||||
WRAP_WATCOM_FUNC1(long, ItemWeight, item_weight_, TGameObj*, item)
|
||||
WRAP_WATCOM_FUNC2(long, LightGetTile, light_get_tile_, long, elevation, long, tileNum) // Returns light level at given tile
|
||||
WRAP_WATCOM_FUNC2(long, LoadFrame, load_frame_, const char*, filename, FrmFile**, frmPtr)
|
||||
WRAP_WATCOM_FUNC1(TProgram*, LoadProgram, loadProgram_, const char*, fileName)
|
||||
WRAP_WATCOM_FUNC1(const char*, MapGetShortName, map_get_short_name_, long, mapID)
|
||||
WRAP_WATCOM_FUNC2(void, MapDirErase, MapDirErase_, const char*, folder, const char*, ext)
|
||||
WRAP_WATCOM_FUNC1(void, MemFree, mem_free_, void*, mem)
|
||||
WRAP_WATCOM_FUNC2(void*, MemRealloc, mem_realloc_, void*, lpmem, DWORD, msize)
|
||||
WRAP_WATCOM_FUNC1(long, MessageExit, message_exit_, MSGList*, msgList) // Destroys message list
|
||||
WRAP_WATCOM_FUNC2(long, MessageLoad, message_load_, MSGList*, msgList, const char*, msgFilePath) // Loads MSG file into given MessageList
|
||||
WRAP_WATCOM_FUNC2(long, MessageSearch, message_search_, const MSGList*, file, MSGNode*, msg)
|
||||
WRAP_WATCOM_FUNC2(void, MouseGetPosition, mouse_get_position_, long*, outX, long*, outY)
|
||||
WRAP_WATCOM_FUNC0(void, MouseShow, mouse_show_)
|
||||
WRAP_WATCOM_FUNC0(void, MouseHide, mouse_hide_)
|
||||
// Calculates path and returns it's length
|
||||
WRAP_WATCOM_FUNC6(long, MakePathFunc, make_path_func_, TGameObj*, objectFrom, long, tileFrom, long, tileTo, char*, pathDataBuffer, long, arg5, void*, blockingFunc)
|
||||
WRAP_WATCOM_FUNC0(long, NewObjId, new_obj_id_)
|
||||
WRAP_WATCOM_FUNC2(void, ObjBound, obj_bound_, TGameObj*, object, BoundRect*, boundRect) // Calculates bounding box (rectangle) for a given object
|
||||
WRAP_WATCOM_FUNC1(long, ObjDestroy, obj_destroy_, TGameObj*, object)
|
||||
WRAP_WATCOM_FUNC2(long, ObjDist, obj_dist_, TGameObj*, obj_src, TGameObj*, obj_trg)
|
||||
WRAP_WATCOM_FUNC2(long, ObjEraseObject, obj_erase_object_, TGameObj*, object, BoundRect*, boundRect)
|
||||
WRAP_WATCOM_FUNC0(TGameObj*, ObjFindFirst, obj_find_first_)
|
||||
WRAP_WATCOM_FUNC0(TGameObj*, ObjFindNext, obj_find_next_)
|
||||
WRAP_WATCOM_FUNC2(TGameObj*, ObjFindFirstAtTile, obj_find_first_at_tile_, long, elevation, long, tileNum)
|
||||
WRAP_WATCOM_FUNC0(TGameObj*, ObjFindNextAtTile, obj_find_next_at_tile_)
|
||||
WRAP_WATCOM_FUNC2(long, ObjPidNew, obj_pid_new_, TGameObj*, object, long, pid)
|
||||
WRAP_WATCOM_FUNC1(long, ObjLockIsJammed, obj_lock_is_jammed_, TGameObj*, object) // Checks/unjams jammed locks
|
||||
WRAP_WATCOM_FUNC1(void, ObjUnjamLock, obj_unjam_lock_, TGameObj*, object)
|
||||
WRAP_WATCOM_FUNC1(long, PartyMemberGetCurrentLevel, partyMemberGetCurLevel_, TGameObj*, obj)
|
||||
WRAP_WATCOM_FUNC2(long, PerkCanAdd, perk_can_add_, TGameObj*, critter, long, perkId)
|
||||
WRAP_WATCOM_FUNC2(long, PerkLevel, perk_level_, TGameObj*, critter, long, perkId)
|
||||
WRAP_WATCOM_FUNC6(long, PickDeath, pick_death_, TGameObj*, attacker, TGameObj*, target, TGameObj*, weapon, long, amount, long, anim, long, hitFromBack)
|
||||
WRAP_WATCOM_FUNC0(void, ProcessBk, process_bk_)
|
||||
WRAP_WATCOM_FUNC0(void, ProtoDudeUpdateGender, proto_dude_update_gender_)
|
||||
WRAP_WATCOM_FUNC2(long*, QueueFindFirst, queue_find_first_, TGameObj*, object, long, qType)
|
||||
WRAP_WATCOM_FUNC2(long*, QueueFindNext, queue_find_next_, TGameObj*, object, long, qType)
|
||||
WRAP_WATCOM_FUNC3(long, RegisterObjectAnimateAndHide, register_object_animate_and_hide_, TGameObj*, object, long, anim, long, delay)
|
||||
WRAP_WATCOM_FUNC3(long, RegisterObjectChangeFid, register_object_change_fid_, TGameObj*, object, long, artFid, long, delay)
|
||||
WRAP_WATCOM_FUNC3(long, RegisterObjectLight, register_object_light_, TGameObj*, object, long, lightRadius, long, delay)
|
||||
WRAP_WATCOM_FUNC1(long, RegisterObjectMustErase, register_object_must_erase_, TGameObj*, object)
|
||||
WRAP_WATCOM_FUNC3(long, RegisterObjectTakeOut, register_object_take_out_, TGameObj*, object, long, holdFrameId, long, nothing)
|
||||
WRAP_WATCOM_FUNC3(long, RegisterObjectTurnTowards, register_object_turn_towards_, TGameObj*, object, long, tileNum, long, nothing)
|
||||
WRAP_WATCOM_FUNC2(long, RollRandom, roll_random_, long, minValue, long, maxValue)
|
||||
WRAP_WATCOM_FUNC1(long*, RunProgram, runProgram_, TProgram*, progPtr)
|
||||
WRAP_WATCOM_FUNC1(TScript*, ScrFindFirstAt, scr_find_first_at_, long, elevation)
|
||||
WRAP_WATCOM_FUNC0(TScript*, ScrFindNextAt, scr_find_next_at_)
|
||||
WRAP_WATCOM_FUNC1(TGameObj*, ScrFindObjFromProgram, scr_find_obj_from_program_, TProgram*, program)
|
||||
WRAP_WATCOM_FUNC2(long, ScrNew, scr_new_, long*, scriptID, long, sType)
|
||||
// Saves pointer to script object into scriptPtr using scriptID
|
||||
WRAP_WATCOM_FUNC2(long, ScrPtr, scr_ptr_, long, scriptId, TScript**, scriptPtr) // Returns 0 on success, -1 on failure
|
||||
WRAP_WATCOM_FUNC1(long, ScrRemove, scr_remove_, long, scriptID)
|
||||
WRAP_WATCOM_FUNC1(void, SetFocusFunc, set_focus_func_, void*, func)
|
||||
WRAP_WATCOM_FUNC1(long, SkillIsTagged, skill_is_tagged_, long, skill)
|
||||
WRAP_WATCOM_FUNC2(long, StatGetBaseDirect, stat_get_base_direct_, TGameObj*, critter, long, statID)
|
||||
WRAP_WATCOM_FUNC2(long, StatLevel, stat_level_, TGameObj*, critter, long, statId)
|
||||
WRAP_WATCOM_FUNC1(long, TextFont, text_font_, long, fontNum)
|
||||
WRAP_WATCOM_FUNC2(long, TileDist, tile_dist_, long, scrTile, long, dstTile)
|
||||
WRAP_WATCOM_FUNC2(long, TileDir, tile_dir_, long, scrTile, long, dstTile)
|
||||
WRAP_WATCOM_FUNC0(void, TileRefreshDisplay, tile_refresh_display_) // Redraws the whole screen
|
||||
WRAP_WATCOM_FUNC2(void, TileRefreshRect, tile_refresh_rect_, BoundRect*, boundRect, long, elevation) // Redraws the given rectangle on screen
|
||||
WRAP_WATCOM_FUNC1(long, TraitLevel, trait_level_, long, traitID)
|
||||
WRAP_WATCOM_FUNC6(long, WinAdd, win_add_, long, x, long, y, long, width, long, height, long, bgColorIndex, long, flags)
|
||||
WRAP_WATCOM_FUNC1(void, WinShow, win_show_, DWORD, winRef)
|
||||
WRAP_WATCOM_FUNC1(void, WinHide, win_hide_, DWORD, winRef)
|
||||
WRAP_WATCOM_FUNC1(BYTE*, WinGetBuf, win_get_buf_, DWORD, winRef)
|
||||
WRAP_WATCOM_FUNC1(void, WinDraw, win_draw_, DWORD, winRef)
|
||||
WRAP_WATCOM_FUNC2(void, WinDrawRect, win_draw_rect_, DWORD, winRef, RECT*, rect)
|
||||
WRAP_WATCOM_FUNC1(void, WinDelete, win_delete_, DWORD, winRef)
|
||||
WRAP_WATCOM_FUNC0(long, WindowWidth, windowWidth_)
|
||||
WRAP_WATCOM_FUNC1(void, WmRefreshInterfaceOverlay, wmRefreshInterfaceOverlay_, long, isRedraw)
|
||||
WRAP_WATCOM_FUNC2(DbFile*, XFOpen, xfopen_, const char*, fileName, const char*, flags)
|
||||
WRAP_WATCOM_FUNC3(long, XFSeek, xfseek_, DbFile*, file, long, fOffset, long, origin)
|
||||
@@ -437,7 +437,10 @@ struct ScriptListInfoItem {
|
||||
struct WINinfo {
|
||||
long wID;
|
||||
long flags;
|
||||
RECT wRect;
|
||||
union {
|
||||
RECT wRect;
|
||||
BoundRect rect;
|
||||
};
|
||||
long width;
|
||||
long height;
|
||||
long clearColour;
|
||||
|
||||
+54
-1
@@ -20,9 +20,62 @@
|
||||
|
||||
#include "main.h"
|
||||
#include "FalloutEngine.h"
|
||||
#include "LoadGameHook.h"
|
||||
#include "Utils.h"
|
||||
#include "Worldmap.h"
|
||||
|
||||
long Interface_ActiveInterfaceWID() {
|
||||
return LoadGameHook_interfaceWID;
|
||||
}
|
||||
|
||||
enum WinNameType {
|
||||
WINTYPE_Inventory = 0, // any inventory window (player/loot/use/barter)
|
||||
WINTYPE_Dialog = 1,
|
||||
WINTYPE_PipBoy = 2,
|
||||
WINTYPE_WorldMap = 3,
|
||||
WINTYPE_IfaceBar = 4, // the interface bar
|
||||
WINTYPE_Character = 5,
|
||||
WINTYPE_Skilldex = 6,
|
||||
WINTYPE_EscMenu = 7, // escape menu
|
||||
WINTYPE_Automap = 8,
|
||||
};
|
||||
|
||||
WINinfo* Interface_GetWindow(long winType) {
|
||||
long winID = 0;
|
||||
switch (winType) {
|
||||
case WINTYPE_Inventory:
|
||||
if (GetLoopFlags() & INVENTORY) winID = *ptr_i_wid;
|
||||
break;
|
||||
case WINTYPE_Dialog:
|
||||
if (GetLoopFlags() & DIALOG) winID = *ptr_dialogueBackWindow;
|
||||
break;
|
||||
case WINTYPE_PipBoy:
|
||||
if (GetLoopFlags() & PIPBOY) winID = *ptr_pip_win;
|
||||
break;
|
||||
case WINTYPE_WorldMap:
|
||||
if (GetLoopFlags() & WORLDMAP) winID = *ptr_wmBkWin;
|
||||
break;
|
||||
case WINTYPE_IfaceBar:
|
||||
winID = *ptr_interfaceWindow;
|
||||
break;
|
||||
case WINTYPE_Character:
|
||||
if (GetLoopFlags() & CHARSCREEN) winID = *ptr_edit_win;
|
||||
break;
|
||||
case WINTYPE_Skilldex:
|
||||
if (GetLoopFlags() & SKILLDEX) winID = *ptr_skldxwin;
|
||||
break;
|
||||
case WINTYPE_EscMenu:
|
||||
if (GetLoopFlags() & ESCMENU) winID = *ptr_optnwin;
|
||||
break;
|
||||
case WINTYPE_Automap:
|
||||
if (GetLoopFlags() & AUTOMAP) winID = Interface_ActiveInterfaceWID();
|
||||
break;
|
||||
default:
|
||||
return (WINinfo*)(-1);
|
||||
}
|
||||
return (winID > 0) ? GNWFind(winID) : nullptr;
|
||||
}
|
||||
|
||||
static long costAP = -1;
|
||||
static void __declspec(naked) intface_redraw_items_hack0() {
|
||||
__asm {
|
||||
@@ -482,7 +535,7 @@ static long gmouse_handle_event_hook() {
|
||||
|
||||
for (int n = 1; n < countWin; n++) {
|
||||
win = ptr_window[n];
|
||||
if ((win->wID == ifaceWin || (win->flags & WinFlags::ScriptWindow && !(win->flags & WinFlags::Transparent))) // also check scripted windows
|
||||
if ((win->wID == ifaceWin || (win->flags & WinFlags::ScriptWindow && !(win->flags & WinFlags::Transparent))) // also check the script windows
|
||||
&& !(win->flags & WinFlags::Hidden)) {
|
||||
RECT *rect = &win->wRect;
|
||||
if (MouseClickIn(rect->left, rect->top, rect->right, rect->bottom)) return 0; // 0 - block clicking in the window area
|
||||
|
||||
@@ -4,3 +4,6 @@ void InterfaceInit();
|
||||
void InterfaceExit();
|
||||
void Interface_OnGameLoad();
|
||||
void InterfaceGmouseHandleHook();
|
||||
|
||||
long Interface_ActiveInterfaceWID();
|
||||
WINinfo* Interface_GetWindow(long winType);
|
||||
|
||||
+21
-8
@@ -56,6 +56,8 @@ static bool gameLoaded = false;
|
||||
static bool disableHorrigan = false;
|
||||
static bool pipBoyAvailableAtGameStart = false;
|
||||
|
||||
long LoadGameHook_interfaceWID = -1;
|
||||
|
||||
// True if game was started, false when on the main menu
|
||||
bool IsGameLoaded() {
|
||||
return gameLoaded;
|
||||
@@ -489,7 +491,7 @@ static void __declspec(naked) DialogHook_Start() {
|
||||
static void __declspec(naked) DialogHook_End() {
|
||||
__asm {
|
||||
and inLoop, (-1 ^ DIALOG);
|
||||
jmp gdialogFreeSpeech_;
|
||||
jmp gdDestroyHeadWindow_;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -583,15 +585,26 @@ static void __declspec(naked) BarterInventoryHook() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) AutomapHook() {
|
||||
static void __declspec(naked) AutomapHook_Start() {
|
||||
__asm {
|
||||
call gmouse_set_cursor_;
|
||||
test edx, edx;
|
||||
jnz skip;
|
||||
mov LoadGameHook_interfaceWID, ebp;
|
||||
or inLoop, AUTOMAP;
|
||||
call automap_;
|
||||
and inLoop, (-1 ^ AUTOMAP);
|
||||
skip:
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) AutomapHook_End() {
|
||||
__asm {
|
||||
and inLoop, (-1 ^ AUTOMAP);
|
||||
mov LoadGameHook_interfaceWID, -1
|
||||
jmp win_delete_;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) DialogReviewInitHook() {
|
||||
__asm {
|
||||
call gdReviewInit_;
|
||||
@@ -677,8 +690,8 @@ void LoadGameHookInit() {
|
||||
HookCall(0x443A50, HelpMenuHook); // game_handle_input_
|
||||
HookCall(0x443320, CharacterHook); // 0x4A73EB, 0x4A740A for character creation
|
||||
|
||||
MakeCall(0x445285, DialogHook_Start); // gdialogInitFromScript_
|
||||
HookCall(0x4452CD, DialogHook_End); // gdialogExitFromScript_ (old 0x445748)
|
||||
MakeCall(0x445285, DialogHook_Start); // gdialogInitFromScript_ (old 0x445748)
|
||||
HookCall(0x445317, DialogHook_End); // gdialogExitFromScript_
|
||||
|
||||
const DWORD pipboyHkStartAddr[] = {0x49767F, 0x4977EF, 0x49780D}; // StartPipboy_ (old 0x443463, 0x443605)
|
||||
HookCalls(PipboyHook_Start, pipboyHkStartAddr);
|
||||
@@ -698,8 +711,8 @@ void LoadGameHookInit() {
|
||||
|
||||
HookCall(0x4466C7, BarterInventoryHook); // gdProcess_
|
||||
|
||||
const DWORD automapHkAddr[] = {0x44396D, 0x479519};
|
||||
HookCalls(AutomapHook, automapHkAddr);
|
||||
HookCall(0x41BAB6, AutomapHook_Start); // automap_
|
||||
HookCall(0x41BCDB, AutomapHook_End); // automap_
|
||||
|
||||
HookCall(0x445CA7, DialogReviewInitHook);
|
||||
HookCall(0x445D30, DialogReviewExitHook);
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
extern long LoadGameHook_interfaceWID;
|
||||
|
||||
void LoadGameHookInit();
|
||||
|
||||
// True if game was started, false when on the main menu
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "main.h"
|
||||
|
||||
#include "InputFuncs.h"
|
||||
#include "Interface.h"
|
||||
#include "LoadGameHook.h"
|
||||
#include "ScriptExtender.h"
|
||||
|
||||
@@ -524,6 +525,42 @@ static void mf_set_window_flag() {
|
||||
}
|
||||
}
|
||||
|
||||
static long GetArtFIDFile(long fid, const char* &file) {
|
||||
long direction = 0;
|
||||
long _fid = fid & 0xFFFFFFF;
|
||||
file = ArtGetName(_fid); // .frm
|
||||
if (_fid >> 24 == OBJ_TYPE_CRITTER) {
|
||||
direction = (fid >> 28);
|
||||
if (direction && !DbAccess(file)) {
|
||||
file = ArtGetName(fid); // .fr#
|
||||
}
|
||||
}
|
||||
return direction;
|
||||
}
|
||||
|
||||
static FrmFile* LoadArtFile(const char* file, long frameno, long direction, FrmFrameData* &framePtr) {
|
||||
FrmFile* frmPtr = nullptr;
|
||||
if (LoadFrame(file, &frmPtr)) {
|
||||
return nullptr;
|
||||
}
|
||||
framePtr = (FrmFrameData*)&frmPtr->width;
|
||||
if (direction > 0 && direction < 6) {
|
||||
BYTE* offsOriFrame = (BYTE*)framePtr;
|
||||
offsOriFrame += frmPtr->oriFrameOffset[direction];
|
||||
framePtr = (FrmFrameData*)offsOriFrame;
|
||||
}
|
||||
if (frameno > 0) {
|
||||
int maxFrames = frmPtr->frames - 1;
|
||||
if (frameno > maxFrames) frameno = maxFrames;
|
||||
while (frameno-- > 0) {
|
||||
BYTE* offsFrame = (BYTE*)framePtr;
|
||||
offsFrame += framePtr->size + (sizeof(FrmFrameData) - 1);
|
||||
framePtr = (FrmFrameData*)offsFrame;
|
||||
}
|
||||
}
|
||||
return frmPtr;
|
||||
}
|
||||
|
||||
static void mf_draw_image() {
|
||||
if (*(DWORD*)_currentWindow == -1) {
|
||||
opHandler.printOpcodeError("draw_image() - no created/selected window for the image.");
|
||||
@@ -538,29 +575,10 @@ static void mf_draw_image() {
|
||||
opHandler.setReturn(-1);
|
||||
return;
|
||||
}
|
||||
long _fid = fid & 0xFFFFFFF;
|
||||
file = ArtGetName(_fid); // .frm
|
||||
if (_fid >> 24 == OBJ_TYPE_CRITTER) {
|
||||
direction = (fid >> 28);
|
||||
if (direction && !DbAccess(file)) {
|
||||
file = ArtGetName(fid); // .fr#
|
||||
}
|
||||
}
|
||||
direction = GetArtFIDFile(fid, file);
|
||||
} else {
|
||||
file = opHandler.arg(0).strValue(); // path to frm/pcx file
|
||||
}
|
||||
FrmFile* frmPtr = nullptr;
|
||||
if (LoadFrame(file, &frmPtr)) {
|
||||
opHandler.printOpcodeError("draw_image() - cannot open the file: %s", file);
|
||||
opHandler.setReturn(-1);
|
||||
return;
|
||||
}
|
||||
FrmFrameData* framePtr = (FrmFrameData*)&frmPtr->width;
|
||||
if (direction > 0 && direction < 6) {
|
||||
BYTE* offsOriFrame = (BYTE*)framePtr;
|
||||
offsOriFrame += frmPtr->oriFrameOffset[direction];
|
||||
framePtr = (FrmFrameData*)offsOriFrame;
|
||||
}
|
||||
// initialize other args
|
||||
int frameno = 0, x = 0, y = 0, noTrans = 0;
|
||||
switch (opHandler.numArgs()) {
|
||||
@@ -573,6 +591,19 @@ static void mf_draw_image() {
|
||||
case 2:
|
||||
frameno = opHandler.arg(1).rawValue();
|
||||
}
|
||||
|
||||
FrmFile* frmPtr = nullptr;
|
||||
if (LoadFrame(file, &frmPtr)) {
|
||||
opHandler.printOpcodeError("draw_image() - cannot open the file: %s", file);
|
||||
opHandler.setReturn(-1);
|
||||
return;
|
||||
}
|
||||
FrmFrameData* framePtr = (FrmFrameData*)&frmPtr->width;
|
||||
if (direction > 0 && direction < 6) {
|
||||
BYTE* offsOriFrame = (BYTE*)framePtr;
|
||||
offsOriFrame += frmPtr->oriFrameOffset[direction];
|
||||
framePtr = (FrmFrameData*)offsOriFrame;
|
||||
}
|
||||
if (frameno > 0) {
|
||||
int maxFrames = frmPtr->frames - 1;
|
||||
if (frameno > maxFrames) frameno = maxFrames;
|
||||
@@ -602,29 +633,10 @@ static void mf_draw_image_scaled() {
|
||||
opHandler.setReturn(-1);
|
||||
return;
|
||||
}
|
||||
long _fid = fid & 0xFFFFFFF;
|
||||
file = ArtGetName(_fid); // .frm
|
||||
if (_fid >> 24 == OBJ_TYPE_CRITTER) {
|
||||
direction = (fid >> 28);
|
||||
if (direction && !DbAccess(file)) {
|
||||
file = ArtGetName(fid); // .fr#
|
||||
}
|
||||
}
|
||||
direction = GetArtFIDFile(fid, file);
|
||||
} else {
|
||||
file = opHandler.arg(0).strValue(); // path to frm/pcx file
|
||||
}
|
||||
FrmFile* frmPtr = nullptr;
|
||||
if (LoadFrame(file, &frmPtr)) {
|
||||
opHandler.printOpcodeError("draw_image_scaled() - cannot open the file: %s", file);
|
||||
opHandler.setReturn(-1);
|
||||
return;
|
||||
}
|
||||
FrmFrameData* framePtr = (FrmFrameData*)&frmPtr->width;
|
||||
if (direction > 0 && direction < 6) {
|
||||
BYTE* offsOriFrame = (BYTE*)framePtr;
|
||||
offsOriFrame += frmPtr->oriFrameOffset[direction];
|
||||
framePtr = (FrmFrameData*)offsOriFrame;
|
||||
}
|
||||
// initialize other args
|
||||
int frameno = 0, x = 0, y = 0, wsize = 0;
|
||||
switch (opHandler.numArgs()) {
|
||||
@@ -638,6 +650,19 @@ static void mf_draw_image_scaled() {
|
||||
case 2:
|
||||
frameno = opHandler.arg(1).rawValue();
|
||||
}
|
||||
|
||||
FrmFile* frmPtr = nullptr;
|
||||
if (LoadFrame(file, &frmPtr)) {
|
||||
opHandler.printOpcodeError("draw_image_scaled() - cannot open the file: %s", file);
|
||||
opHandler.setReturn(-1);
|
||||
return;
|
||||
}
|
||||
FrmFrameData* framePtr = (FrmFrameData*)&frmPtr->width;
|
||||
if (direction > 0 && direction < 6) {
|
||||
BYTE* offsOriFrame = (BYTE*)framePtr;
|
||||
offsOriFrame += frmPtr->oriFrameOffset[direction];
|
||||
framePtr = (FrmFrameData*)offsOriFrame;
|
||||
}
|
||||
if (frameno > 0) {
|
||||
int maxFrames = frmPtr->frames - 1;
|
||||
if (frameno > maxFrames) frameno = maxFrames;
|
||||
@@ -672,7 +697,7 @@ static void mf_draw_image_scaled() {
|
||||
|
||||
long w_width = WindowWidth();
|
||||
long xy_pos = (y * w_width) + x;
|
||||
TransCscale(framePtr->width, framePtr->height, s_width, s_height, xy_pos, w_width, framePtr->data); // custom scaling
|
||||
WindowTransCscale(framePtr->width, framePtr->height, s_width, s_height, xy_pos, w_width, framePtr->data); // custom scaling
|
||||
}
|
||||
MemFree(frmPtr);
|
||||
opHandler.setReturn(1);
|
||||
@@ -744,7 +769,7 @@ static void mf_get_window_attribute() {
|
||||
long attr = 0;
|
||||
if (opHandler.numArgs() > 1) attr = opHandler.arg(1).rawValue();
|
||||
|
||||
WINinfo* win = GetUIWindow(opHandler.arg(0).rawValue());
|
||||
WINinfo* win = Interface_GetWindow(opHandler.arg(0).rawValue());
|
||||
if (win == nullptr) {
|
||||
if (attr != 0) {
|
||||
opHandler.printOpcodeError("get_window_attribute() - failed to get the interface window.");
|
||||
|
||||
@@ -291,6 +291,7 @@
|
||||
<ClInclude Include="Elevators.h" />
|
||||
<ClInclude Include="Explosions.h" />
|
||||
<ClInclude Include="FalloutEngine.h" />
|
||||
<ClInclude Include="FalloutFuncs_def.h" />
|
||||
<ClInclude Include="FalloutStructs.h" />
|
||||
<ClInclude Include="FileSystem.h" />
|
||||
<ClInclude Include="Graphics.h" />
|
||||
|
||||
@@ -226,6 +226,9 @@
|
||||
<ClInclude Include="MetaruleExtender.h">
|
||||
<Filter>Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FalloutFuncs_def.h">
|
||||
<Filter>Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>Headers</Filter>
|
||||
</ClInclude>
|
||||
|
||||
Reference in New Issue
Block a user