mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Updated docs for art_frame_data script function
Minor code edits: type name, indentation/alignment, unified messages
This commit is contained in:
@@ -1690,11 +1690,11 @@
|
|||||||
- name: art_frame_data
|
- name: art_frame_data
|
||||||
detail: array art_frame_data(string/int artFile/artId, int frame, int rotation)
|
detail: array art_frame_data(string/int artFile/artId, int frame, int rotation)
|
||||||
doc: |
|
doc: |
|
||||||
- returns dimensions of a given PCX or FRM frame as temp array in form: [width, height]
|
- returns the dimensions of a given PCX or FRM frame as a temp array in the form **[width, height]**
|
||||||
- artFile/artId: path to the PCX/FRM file (e.g. `art\\inven\\5mmap.frm`), or its FRM ID number (e.g. `0x7000026`, see specification of the FID format)
|
- `artFile/artId`: path to the PCX/FRM file (e.g. `art\\inven\\5mmap.frm`), or its FRM ID number (e.g. `0x7000026`, see specification of the FID format)
|
||||||
optional arguments:
|
optional arguments:
|
||||||
- `frame`: frame number, the first frame starts from zero
|
- `frame`: frame number, the first frame starts from zero
|
||||||
- `rotation`: rotation to get the frame for, useful when reading FRM file by path
|
- `rotation`: rotation to get the frame for, useful when reading FRM files by path
|
||||||
macro: sfall.h
|
macro: sfall.h
|
||||||
|
|
||||||
- name: interface_art_draw
|
- name: interface_art_draw
|
||||||
@@ -1806,7 +1806,7 @@
|
|||||||
doc: |
|
doc: |
|
||||||
Fills the rectangle area of the currently selected script window with the specified color, or clears the window with transparent (index 0) color (call the function without arguments).
|
Fills the rectangle area of the currently selected script window with the specified color, or clears the window with transparent (index 0) color (call the function without arguments).
|
||||||
- `color`: the color index in the game palette (from 0 to 255)
|
- `color`: the color index in the game palette (from 0 to 255)
|
||||||
- name: nterface_overlay
|
- name: interface_overlay
|
||||||
detail: sfall_func2("interface_overlay", int winType, int mode)
|
detail: sfall_func2("interface_overlay", int winType, int mode)
|
||||||
doc: |
|
doc: |
|
||||||
Alternative form: `int sfall_func6("interface_overlay", int winType, 2, int x, int y, int width, int height)`.
|
Alternative form: `int sfall_func6("interface_overlay", int winType, 2, int x, int y, int width, int height)`.
|
||||||
|
|||||||
@@ -1139,6 +1139,16 @@ sfall_funcX metarule functions
|
|||||||
`void sfall_func0("signal_close_game")`
|
`void sfall_func0("signal_close_game")`
|
||||||
- Works in a similar way to vanilla function: `metarule(METARULE_SIGNAL_END_GAME, 0)`, but it will then close the game instead of only returning the player to the main menu
|
- Works in a similar way to vanilla function: `metarule(METARULE_SIGNAL_END_GAME, 0)`, but it will then close the game instead of only returning the player to the main menu
|
||||||
|
|
||||||
|
----
|
||||||
|
#### art_frame_data
|
||||||
|
`array sfall_func3("art_frame_data", string/int artFile/artId, int frame, int rotation)`
|
||||||
|
- Returns the dimensions of a given PCX or FRM frame as a temp array in the form **[width, height]**
|
||||||
|
- `artFile/artId`: path to the PCX/FRM file (e.g. `art\\inven\\5mmap.frm`), or its FRM ID number (e.g. `0x7000026`, see specification of the FID format)
|
||||||
|
|
||||||
|
**Optional arguments:**
|
||||||
|
- `frame`: frame number, the first frame starts from zero
|
||||||
|
- `rotation`: rotation to get the frame for, useful when reading FRM files by path
|
||||||
|
|
||||||
|
|
||||||
****
|
****
|
||||||
_See other documentation files (arrays.md, hookscripts.md) for related functions reference._
|
_See other documentation files (arrays.md, hookscripts.md) for related functions reference._
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ WRAP_WATCOM_FUNC1(long, critter_kill_count_type, fo::GameObject*, critter)
|
|||||||
WRAP_WATCOM_FUNC1(const char*, critter_name, fo::GameObject*, critter) // Returns the name of the critter
|
WRAP_WATCOM_FUNC1(const char*, critter_name, fo::GameObject*, critter) // Returns the name of the critter
|
||||||
WRAP_WATCOM_FUNC1(void, critter_pc_set_name, const char*, newName) // Change the name of playable character
|
WRAP_WATCOM_FUNC1(void, critter_pc_set_name, const char*, newName) // Change the name of playable character
|
||||||
WRAP_WATCOM_FUNC1(long, critterIsOverloaded, fo::GameObject*, critter)
|
WRAP_WATCOM_FUNC1(long, critterIsOverloaded, fo::GameObject*, critter)
|
||||||
WRAP_WATCOM_FUNC4(void, datafileConvertData, unsigned char*, data, unsigned char*, palette, long, width, long, height)
|
WRAP_WATCOM_FUNC4(void, datafileConvertData, BYTE*, data, BYTE*, palette, long, width, long, height)
|
||||||
WRAP_WATCOM_FUNC1(void, display_print, const char*, msg) // Displays message in main UI console window
|
WRAP_WATCOM_FUNC1(void, display_print, const char*, msg) // Displays message in main UI console window
|
||||||
WRAP_WATCOM_FUNC0(void, display_stats)
|
WRAP_WATCOM_FUNC0(void, display_stats)
|
||||||
WRAP_WATCOM_FUNC2(void, endgame_load_palette, long, artType, long, fid)
|
WRAP_WATCOM_FUNC2(void, endgame_load_palette, long, artType, long, fid)
|
||||||
@@ -177,8 +177,8 @@ WRAP_WATCOM_FUNC1(long, item_w_secondary_mp_cost, fo::GameObject*, item)
|
|||||||
WRAP_WATCOM_FUNC2(long, item_w_subtype, fo::GameObject*, item, long, hitMode)
|
WRAP_WATCOM_FUNC2(long, item_w_subtype, fo::GameObject*, item, long, hitMode)
|
||||||
WRAP_WATCOM_FUNC1(long, item_weight, fo::GameObject*, item)
|
WRAP_WATCOM_FUNC1(long, item_weight, fo::GameObject*, item)
|
||||||
WRAP_WATCOM_FUNC2(long, light_get_tile, long, elevation, long, tileNum) // Returns light level at given tile
|
WRAP_WATCOM_FUNC2(long, light_get_tile, long, elevation, long, tileNum) // Returns light level at given tile
|
||||||
WRAP_WATCOM_FUNC2(long, load_frame, const char*, filename, fo::FrmFile**, frmPtr)
|
WRAP_WATCOM_FUNC2(long, load_frame, const char*, fileName, fo::FrmFile**, frmPtr)
|
||||||
WRAP_WATCOM_FUNC4(unsigned char*, loadPCX, const char*, fileName, long*, width, long*, height, unsigned char*, palette)
|
WRAP_WATCOM_FUNC4(BYTE*, loadPCX, const char*, fileName, long*, width, long*, height, BYTE*, palette)
|
||||||
WRAP_WATCOM_FUNC1(fo::Program*, loadProgram, const char*, fileName)
|
WRAP_WATCOM_FUNC1(fo::Program*, loadProgram, const char*, fileName)
|
||||||
WRAP_WATCOM_FUNC1(const char*, map_get_short_name, long, mapID)
|
WRAP_WATCOM_FUNC1(const char*, map_get_short_name, long, mapID)
|
||||||
WRAP_WATCOM_FUNC2(void, MapDirErase, const char*, folder, const char*, ext)
|
WRAP_WATCOM_FUNC2(void, MapDirErase, const char*, folder, const char*, ext)
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ VAR_(optionsButtonUp1, DWORD)
|
|||||||
VAR_(optionsButtonUpKey, DWORD)
|
VAR_(optionsButtonUpKey, DWORD)
|
||||||
VARC(optnwin, DWORD)
|
VARC(optnwin, DWORD)
|
||||||
VAR_(outlined_object, fo::GameObject*)
|
VAR_(outlined_object, fo::GameObject*)
|
||||||
VARA(pal, unsigned char, 0x300)
|
VARA(pal, BYTE, 0x300)
|
||||||
VAR_(partyMemberAIOptions, DWORD)
|
VAR_(partyMemberAIOptions, DWORD)
|
||||||
VAR_(partyMemberCount, DWORD)
|
VAR_(partyMemberCount, DWORD)
|
||||||
VAR_(partyMemberLevelUpInfoList, DWORD*)
|
VAR_(partyMemberLevelUpInfoList, DWORD*)
|
||||||
@@ -273,9 +273,8 @@ VAR_(YellowColor, BYTE)
|
|||||||
|
|
||||||
#undef VAR_
|
#undef VAR_
|
||||||
#undef VARC
|
#undef VARC
|
||||||
#undef VARP
|
|
||||||
#undef VARA
|
#undef VARA
|
||||||
#undef VAR2
|
#undef VAR2
|
||||||
#undef VAR3
|
#undef VAR3
|
||||||
#undef VARD
|
#undef VARD
|
||||||
#undef VARF
|
#undef VARP
|
||||||
|
|||||||
@@ -482,7 +482,7 @@ void mf_set_window_flag(OpcodeContext& ctx) {
|
|||||||
|
|
||||||
// raw frame data loaded from FRM or PCX
|
// raw frame data loaded from FRM or PCX
|
||||||
struct FrameData {
|
struct FrameData {
|
||||||
unsigned char* pixelData = nullptr;
|
BYTE* pixelData = nullptr;
|
||||||
short width = 0;
|
short width = 0;
|
||||||
short height = 0;
|
short height = 0;
|
||||||
short xOffset = 0;
|
short xOffset = 0;
|
||||||
@@ -502,7 +502,7 @@ struct FrameData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Data from PCX file.
|
// Data from PCX file.
|
||||||
FrameData(unsigned char* data, long w, long h) {
|
FrameData(BYTE* data, long w, long h) {
|
||||||
pixelData = data;
|
pixelData = data;
|
||||||
width = (short)w;
|
width = (short)w;
|
||||||
height = (short)h;
|
height = (short)h;
|
||||||
@@ -549,7 +549,7 @@ static FrameData LoadFrameDataCached(const char* file, long frame, long directio
|
|||||||
}
|
}
|
||||||
frmFileCache.emplace(file, frmPtr);
|
frmFileCache.emplace(file, frmPtr);
|
||||||
}
|
}
|
||||||
return frmPtr != nullptr
|
return (frmPtr != nullptr)
|
||||||
? FrameData(frmPtr, direction, frame)
|
? FrameData(frmPtr, direction, frame)
|
||||||
: FrameData();
|
: FrameData();
|
||||||
}
|
}
|
||||||
@@ -593,8 +593,8 @@ static long GetArtFIDFile(long fid, char* outFilePath) {
|
|||||||
struct ArtCacheLock {
|
struct ArtCacheLock {
|
||||||
DWORD entryPtr = 0;
|
DWORD entryPtr = 0;
|
||||||
|
|
||||||
ArtCacheLock() { }
|
ArtCacheLock() {}
|
||||||
ArtCacheLock(DWORD _lock) : entryPtr(_lock) { }
|
ArtCacheLock(DWORD _lock) : entryPtr(_lock) {}
|
||||||
~ArtCacheLock() {
|
~ArtCacheLock() {
|
||||||
if (entryPtr != 0) {
|
if (entryPtr != 0) {
|
||||||
fo::func::art_ptr_unlock(entryPtr);
|
fo::func::art_ptr_unlock(entryPtr);
|
||||||
@@ -607,7 +607,7 @@ static FrameData LockFrameData(unsigned long fid, ArtCacheLock& lock, long direc
|
|||||||
long objType = (fid >> 24) & 0xF;
|
long objType = (fid >> 24) & 0xF;
|
||||||
if (direction < 0) {
|
if (direction < 0) {
|
||||||
// If direction is not specified, take it from FID.
|
// If direction is not specified, take it from FID.
|
||||||
direction = objType == fo::OBJ_TYPE_CRITTER
|
direction = (objType == fo::OBJ_TYPE_CRITTER)
|
||||||
? (fid >> 28)
|
? (fid >> 28)
|
||||||
: 0;
|
: 0;
|
||||||
} else if (objType == fo::OBJ_TYPE_CRITTER) {
|
} else if (objType == fo::OBJ_TYPE_CRITTER) {
|
||||||
@@ -633,7 +633,7 @@ static long DrawImage(OpcodeContext& ctx, bool isScaled) {
|
|||||||
|
|
||||||
frm = LockFrameData(fid, cacheLock, -1, frame);
|
frm = LockFrameData(fid, cacheLock, -1, frame);
|
||||||
if (frm.pixelData == nullptr) {
|
if (frm.pixelData == nullptr) {
|
||||||
ctx.printOpcodeError("%s() - cannot find art by FID %d", ctx.getMetaruleName(), fid);
|
ctx.printOpcodeError("%s() - cannot load art by FID: %d", ctx.getMetaruleName(), fid);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user