mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed and improved AllowLargeTiles option (#367)
Removed the unspent skill points limit.
This commit is contained in:
+5
-5
@@ -148,7 +148,7 @@ OverrideMusicDir=1
|
|||||||
UseScrollWheel=1
|
UseScrollWheel=1
|
||||||
|
|
||||||
;The mouse Z position is divided by this modifier to calculate the number of inventory
|
;The mouse Z position is divided by this modifier to calculate the number of inventory
|
||||||
;slots to scroll. My mouse moves 120 pixel in the z direction for one click of the mouse
|
;slots to scroll. My mouse moves 120 pixels in the z direction for one click of the mouse
|
||||||
;wheel, but this may vary depending on your mouse manufacturer and windows settings.
|
;wheel, but this may vary depending on your mouse manufacturer and windows settings.
|
||||||
;Set to 0 to only ever scroll 1 click
|
;Set to 0 to only ever scroll 1 click
|
||||||
ScrollMod=0
|
ScrollMod=0
|
||||||
@@ -444,13 +444,13 @@ AIBestWeaponFix=0
|
|||||||
|
|
||||||
;Set to 1 to fix NPCs not taking chem_primary_desire in AI.txt as drug use preference when using drugs in their inventory
|
;Set to 1 to fix NPCs not taking chem_primary_desire in AI.txt as drug use preference when using drugs in their inventory
|
||||||
;Set to 2 to allow NPCs to use only the drugs listed in chem_primary_desire and healing drugs (stimpaks and healing powder)
|
;Set to 2 to allow NPCs to use only the drugs listed in chem_primary_desire and healing drugs (stimpaks and healing powder)
|
||||||
;Note: chem_primary_desire w/o fixes prevents the specified item PID from being consumed if all three PIDs in the list are the same
|
;Note: chem_primary_desire w/o fixes prevents the specified item PID from being consumed if all three values in the list are the same PID
|
||||||
;chem_primary_desire also works as a priority list of drug items the NPC will try to pick up in combat when they are on the ground
|
;chem_primary_desire also works as a priority list of drug items the NPC will try to pick up in combat when they are on the ground
|
||||||
AIDrugUsePerfFix=0
|
AIDrugUsePerfFix=0
|
||||||
|
|
||||||
;Allows the use of tiles over 80x36 in size. sfall will just split and resave them at startup
|
;Allows the use of tiles over 80x36 in size. sfall will just split and resave them to art\tiles\zzz####.frm at startup
|
||||||
;Set to 1 to check all tiles on started (slow)
|
;Set to 1 to check all tiles on started (slow, but can also be useful for checking the correct size of your new tiles)
|
||||||
;Set to 2 if you provide a XLtiles.lst file in art\tiles\ containing a list of the tile IDs that need checking
|
;Set to 2 if you provide a XLtiles.lst file in art\tiles\ containing a list of the tile indexes that need checking
|
||||||
AllowLargeTiles=0
|
AllowLargeTiles=0
|
||||||
|
|
||||||
;Set to 1 to boost the maximum number of tile FRMs from 4096 to 16383
|
;Set to 1 to boost the maximum number of tile FRMs from 4096 to 16383
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -573,7 +573,7 @@ static bool LoadFrmFrame(fo::UnlistedFrm::Frame *frame, fo::DbFile* frmStream) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
frame->indexBuff = new BYTE[frame->size];
|
frame->indexBuff = new BYTE[frame->size];
|
||||||
if (fo::func::db_fread(frame->indexBuff, frame->size, 1, frmStream) != 1)
|
if (fo::func::db_fread(frame->indexBuff, 1, frame->size, frmStream) != frame->size)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -86,32 +86,6 @@ WRAP_WATCOM_FUNC1(long, critter_is_dead, 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)
|
||||||
/* Database functions */
|
|
||||||
WRAP_WATCOM_FUNC1(bool, db_access, const char*, fileName) // Checks if given file exists in DB
|
|
||||||
WRAP_WATCOM_FUNC1(long, db_fclose, fo::DbFile*, file)
|
|
||||||
WRAP_WATCOM_FUNC2(fo::DbFile*, db_fopen, const char*, path, const char*, mode)
|
|
||||||
WRAP_WATCOM_FUNC1(long, db_fgetc, fo::DbFile*, file)
|
|
||||||
WRAP_WATCOM_FUNC3(char*, db_fgets, char*, buf, long, max_count, fo::DbFile*, file)
|
|
||||||
WRAP_WATCOM_FUNC4(long, db_fread, void*, buf, long, elsize, long, count, fo::DbFile*, file)
|
|
||||||
WRAP_WATCOM_FUNC3(long, db_fseek, fo::DbFile*, file, long, pos, long, origin)
|
|
||||||
WRAP_WATCOM_FUNC2(void, db_free_file_list, char***, fileList, DWORD, arg2) // Destroys filelist array created by db_get_file_list
|
|
||||||
WRAP_WATCOM_FUNC2(long, db_freadByte, fo::DbFile*, file, BYTE*, _out)
|
|
||||||
WRAP_WATCOM_FUNC2(long, db_freadShort, fo::DbFile*, file, WORD*, _out)
|
|
||||||
WRAP_WATCOM_FUNC2(long, db_freadInt, fo::DbFile*, file, DWORD*, _out)
|
|
||||||
WRAP_WATCOM_FUNC3(long, db_freadByteCount, fo::DbFile*, file, BYTE*, cptr, long, count)
|
|
||||||
WRAP_WATCOM_FUNC3(long, db_freadShortCount, fo::DbFile*, file, WORD*, dest, long, count)
|
|
||||||
WRAP_WATCOM_FUNC3(long, db_freadIntCount, fo::DbFile*, file, DWORD*, dest, long, count)
|
|
||||||
WRAP_WATCOM_FUNC2(long, db_fwriteByte, fo::DbFile*, file, long, value)
|
|
||||||
WRAP_WATCOM_FUNC2(long, db_fwriteInt, fo::DbFile*, file, long, value)
|
|
||||||
WRAP_WATCOM_FUNC3(long, db_fwriteByteCount, fo::DbFile*, file, const BYTE*, cptr, long, count)
|
|
||||||
WRAP_WATCOM_FUNC2(long, 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, db_get_file_list, const char*, searchMask, char***, fileList) // Returns number of elements in *fileList
|
|
||||||
WRAP_WATCOM_FUNC2(long, db_init, const char*, path_dat, const char*, path_patches)
|
|
||||||
WRAP_WATCOM_FUNC1(void*, dbase_open, const char*, fileName)
|
|
||||||
WRAP_WATCOM_FUNC1(void, dbase_close, void*, dbPtr)
|
|
||||||
////////////////////////
|
|
||||||
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_FUNC1(void, EndLoad, fo::DbFile*, file)
|
WRAP_WATCOM_FUNC1(void, EndLoad, fo::DbFile*, file)
|
||||||
@@ -284,5 +258,34 @@ WRAP_WATCOM_FUNC0(long, windowWidth)
|
|||||||
WRAP_WATCOM_FUNC1(void, wmCarUseGas, long, gasAmount)
|
WRAP_WATCOM_FUNC1(void, wmCarUseGas, long, gasAmount)
|
||||||
WRAP_WATCOM_FUNC0(void, wmPartyWalkingStep)
|
WRAP_WATCOM_FUNC0(void, wmPartyWalkingStep)
|
||||||
WRAP_WATCOM_FUNC1(void, wmRefreshInterfaceOverlay, long, isRedraw)
|
WRAP_WATCOM_FUNC1(void, wmRefreshInterfaceOverlay, long, isRedraw)
|
||||||
|
|
||||||
|
/* Database functions */
|
||||||
|
WRAP_WATCOM_FUNC1(bool, db_access, const char*, fileName) // Checks if given file exists in DB
|
||||||
|
WRAP_WATCOM_FUNC1(long, db_fclose, fo::DbFile*, file)
|
||||||
|
WRAP_WATCOM_FUNC2(fo::DbFile*, db_fopen, const char*, path, const char*, mode)
|
||||||
|
//WRAP_WATCOM_FUNC1(long, db_fgetc, fo::DbFile*, file)
|
||||||
|
WRAP_WATCOM_FUNC3(char*, db_fgets, char*, buf, long, max_count, fo::DbFile*, file)
|
||||||
|
WRAP_WATCOM_FFUNC4(long, db_fread, void*, buf, long, elsize, long, count, fo::DbFile*, file)
|
||||||
|
WRAP_WATCOM_FFUNC3(long, db_fseek, fo::DbFile*, file, long, pos, long, origin)
|
||||||
|
WRAP_WATCOM_FUNC2(void, db_free_file_list, char***, fileList, DWORD, arg2) // Destroys filelist array created by db_get_file_list
|
||||||
|
WRAP_WATCOM_FUNC2(long, db_freadByte, fo::DbFile*, file, BYTE*, _out)
|
||||||
|
WRAP_WATCOM_FUNC2(long, db_freadShort, fo::DbFile*, file, WORD*, _out)
|
||||||
|
WRAP_WATCOM_FUNC2(long, db_freadInt, fo::DbFile*, file, DWORD*, _out)
|
||||||
|
WRAP_WATCOM_FFUNC3(long, db_freadByteCount, fo::DbFile*, file, BYTE*, dest, long, count)
|
||||||
|
WRAP_WATCOM_FFUNC3(long, db_freadShortCount, fo::DbFile*, file, WORD*, dest, long, count)
|
||||||
|
WRAP_WATCOM_FFUNC3(long, db_freadIntCount, fo::DbFile*, file, DWORD*, dest, long, count)
|
||||||
|
//WRAP_WATCOM_FFUNC3(long, db_freadLongCount, fo::DbFile*, file, DWORD*, dest, long, count)
|
||||||
|
WRAP_WATCOM_FUNC2(long, db_fwriteByte, fo::DbFile*, file, long, value)
|
||||||
|
WRAP_WATCOM_FUNC2(long, db_fwriteInt, fo::DbFile*, file, long, value)
|
||||||
|
WRAP_WATCOM_FFUNC3(long, db_fwriteByteCount, fo::DbFile*, file, const BYTE*, cptr, long, count)
|
||||||
|
//WRAP_WATCOM_FFUNC3(long, db_fwriteLongCount, fo::DbFile*, file, DWORD*, dest, long, count)
|
||||||
|
WRAP_WATCOM_FUNC2(long, 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, db_get_file_list, const char*, searchMask, char***, fileList) // Returns number of elements in *fileList
|
||||||
|
WRAP_WATCOM_FUNC2(long, db_init, const char*, path_dat, const char*, path_patches)
|
||||||
|
WRAP_WATCOM_FUNC1(void*, dbase_open, const char*, fileName)
|
||||||
|
WRAP_WATCOM_FUNC1(void, dbase_close, void*, dbPtr)
|
||||||
|
|
||||||
WRAP_WATCOM_FUNC2(fo::DbFile*, xfopen, const char*, fileName, const char*, flags)
|
WRAP_WATCOM_FUNC2(fo::DbFile*, xfopen, const char*, fileName, const char*, flags)
|
||||||
WRAP_WATCOM_FUNC3(long, xfseek, fo::DbFile*, file, long, fOffset, long, origin)
|
WRAP_WATCOM_FFUNC3(long, xfseek, fo::DbFile*, file, long, fOffset, long, origin)
|
||||||
|
|||||||
@@ -434,6 +434,8 @@ struct FrmFile { // sizeof 2954
|
|||||||
BYTE pixels[80 * 36]; // for tiles FRM
|
BYTE pixels[80 * 36]; // for tiles FRM
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FrmFile() {};
|
||||||
|
|
||||||
// Returns a pointer to the data of the frame in the direction
|
// Returns a pointer to the data of the frame in the direction
|
||||||
FrmFrameData* GetFrameData(long dir, long frame) {
|
FrmFrameData* GetFrameData(long dir, long frame) {
|
||||||
BYTE* offsDirectionFrame = (BYTE*)&frameData;
|
BYTE* offsDirectionFrame = (BYTE*)&frameData;
|
||||||
|
|||||||
@@ -540,7 +540,7 @@ DWORD __stdcall FScopy(const char* path, const char* source) {
|
|||||||
DWORD fsize;
|
DWORD fsize;
|
||||||
sFile* file;
|
sFile* file;
|
||||||
|
|
||||||
const char* mode = "r";
|
const char* mode = "rb"; // was 'r'
|
||||||
__asm {
|
__asm {
|
||||||
mov eax, source;
|
mov eax, source;
|
||||||
mov edx, mode;
|
mov edx, mode;
|
||||||
|
|||||||
@@ -322,6 +322,9 @@ void Skills::init() {
|
|||||||
SafeWrite8(0x4ABC67, 0x89); // mov [esp + 0x54], eax
|
SafeWrite8(0x4ABC67, 0x89); // mov [esp + 0x54], eax
|
||||||
SafeWrite32(0x4ABC6B, 0x90909090);
|
SafeWrite32(0x4ABC6B, 0x90909090);
|
||||||
|
|
||||||
|
// Remove the unspent skill points limit
|
||||||
|
SafeWrite8(0x43C2B9, CodeType::JumpShort); // UpdateLevel_
|
||||||
|
|
||||||
// Add an additional 'Energy Weapon' flag to the weapon flags (offset 0x0018)
|
// Add an additional 'Energy Weapon' flag to the weapon flags (offset 0x0018)
|
||||||
// Weapon Flags:
|
// Weapon Flags:
|
||||||
// 0x00000400 - Energy Weapon (forces weapon to use Energy Weapons skill)
|
// 0x00000400 - Energy Weapon (forces weapon to use Energy Weapons skill)
|
||||||
|
|||||||
+99
-71
@@ -21,7 +21,8 @@
|
|||||||
|
|
||||||
#include "..\main.h"
|
#include "..\main.h"
|
||||||
#include "..\FalloutEngine\Fallout2.h"
|
#include "..\FalloutEngine\Fallout2.h"
|
||||||
#include "FileSystem.h"
|
#include "..\Utils.h"
|
||||||
|
//#include "FileSystem.h"
|
||||||
|
|
||||||
#include "Tiles.h"
|
#include "Tiles.h"
|
||||||
|
|
||||||
@@ -58,114 +59,133 @@ struct TilesData {
|
|||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
struct OverrideEntry {
|
struct OverrideEntry {
|
||||||
DWORD xtiles;
|
DWORD xTiles;
|
||||||
DWORD ytiles;
|
DWORD yTiles;
|
||||||
DWORD replacementid;
|
DWORD replacementID;
|
||||||
|
|
||||||
OverrideEntry(DWORD _xtiles, DWORD _ytiles, DWORD _repid)
|
OverrideEntry(DWORD xtiles, DWORD ytiles, DWORD repid)
|
||||||
: xtiles(_xtiles), ytiles(_ytiles), replacementid(_repid) {
|
: xTiles(xtiles), yTiles(ytiles), replacementID(repid) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static OverrideEntry** overrides;
|
static OverrideEntry** overrides = nullptr;
|
||||||
static DWORD origTileCount = 0;
|
static DWORD origTileCount = 0;
|
||||||
static DWORD tileMode;
|
static DWORD tileMode;
|
||||||
static BYTE* mask;
|
static BYTE* mask;
|
||||||
|
|
||||||
static void CreateMask() {
|
static bool LoadMask() {
|
||||||
|
fo::DbFile* file = fo::func::db_fopen("art\\tiles\\gridmask.frm", "rb"); // same as grid000.frm from HRP
|
||||||
|
if (!file) {
|
||||||
|
dlogr("AllowLargeTiles: Failed to open gridmask.frm file.", DL_INIT);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
mask = new BYTE[80 * 36];
|
mask = new BYTE[80 * 36];
|
||||||
fo::DbFile* file = fo::func::db_fopen("art\\tiles\\grid000.frm", "r");
|
|
||||||
fo::func::db_fseek(file, 0x4A, 0);
|
fo::func::db_fseek(file, 0x4A, SEEK_SET);
|
||||||
fo::func::db_freadByteCount(file, mask, 80 * 36);
|
fo::func::db_freadByteCount(file, mask, 80 * 36);
|
||||||
fo::func::db_fclose(file);
|
fo::func::db_fclose(file);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static WORD ByteSwapW(WORD w) {
|
static int ProcessTile(fo::Art* tiles, int tile, int listPos) {
|
||||||
return ((w & 0xFF) << 8) | ((w & 0xFF00) >> 8);
|
char buf[32] = "art\\tiles\\";
|
||||||
}
|
strncpy_s(&buf[10], 22, &tiles->names[13 * tile], _TRUNCATE);
|
||||||
|
|
||||||
static DWORD ByteSwapD(DWORD w) {
|
fo::DbFile* artFile = fo::func::db_fopen(buf, "rb");
|
||||||
return ((w & 0xFF) << 24) | ((w & 0xFF00) << 8) | ((w & 0xFF0000) >> 8) | ((w & 0xFF000000) >> 24);
|
if (!artFile) return 0;
|
||||||
}
|
|
||||||
|
|
||||||
static int ProcessTile(fo::Art* tiles, int tile, int listpos) {
|
fo::func::db_fseek(artFile, 0x3E, SEEK_SET); // frameData
|
||||||
char buf[32];
|
|
||||||
//sprintf_s(buf, "art\\tiles\\%s", &tiles->names[13*tile]);
|
|
||||||
strcpy_s(buf, "art\\tiles\\");
|
|
||||||
strcat_s(buf, &tiles->names[13 * tile]);
|
|
||||||
|
|
||||||
fo::DbFile* art = fo::func::db_fopen(buf, "r");
|
|
||||||
if (!art) return 0;
|
|
||||||
fo::func::db_fseek(art, 0x3E, 0);
|
|
||||||
WORD width;
|
WORD width;
|
||||||
fo::func::db_freadShort(art, &width); //80;
|
fo::func::db_freadShort(artFile, &width);
|
||||||
if (width == 80) {
|
if (width <= 80) goto exit;
|
||||||
fo::func::db_fclose(art);
|
|
||||||
|
WORD height;
|
||||||
|
fo::func::db_freadShort(artFile, &height);
|
||||||
|
if (height < 36) goto exit;
|
||||||
|
|
||||||
|
float newWidth = (float)(width - (width % 8));
|
||||||
|
float newHeight = (float)(height - (height % 12));
|
||||||
|
|
||||||
|
// Number of tiles horizontally and vertically
|
||||||
|
// the calculation is unstable if the large tile is not proportional to the size of 80x36 (aspect ratio)
|
||||||
|
int xSize = std::lroundf(((newWidth / 32.0f) - (newHeight / 24.0f)) - 0.01f);
|
||||||
|
int ySize = std::lroundf(((newHeight / 16.0f) - (newWidth / 64.0f)) - 0.01f);
|
||||||
|
if (xSize <= 0 || ySize <= 0) goto exit;
|
||||||
|
|
||||||
|
long bytes = width * height;
|
||||||
|
BYTE* pixelData = new BYTE[bytes];
|
||||||
|
|
||||||
|
// Read pixels data
|
||||||
|
if (fo::func::db_fseek(artFile, 0x4A, SEEK_SET) ||
|
||||||
|
fo::func::db_fread(pixelData, 1, bytes, artFile) != bytes)
|
||||||
|
{
|
||||||
|
delete[] pixelData;
|
||||||
|
exit:
|
||||||
|
fo::func::db_fclose(artFile);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
WORD height;
|
long listID = listPos - tiles->total;
|
||||||
fo::func::db_freadShort(art, &height); //36
|
|
||||||
fo::func::db_fseek(art, 0x4A, 0);
|
fo::FrmFile frame;
|
||||||
BYTE* pixeldata = new BYTE[width * height];
|
fo::func::db_fseek(artFile, 0, SEEK_SET);
|
||||||
fo::func::db_freadByteCount(art, pixeldata, width * height);
|
fo::func::db_freadByteCount(artFile, (BYTE*)&frame, 74);
|
||||||
DWORD listid = listpos - tiles->total;
|
|
||||||
float newwidth = (float)(width - width % 8);
|
frame.height = ByteSwapW(36);
|
||||||
float newheight = (float)(height - height % 12);
|
frame.width = ByteSwapW(80);
|
||||||
int xsize = (int)floor(newwidth / 32.0f - newheight / 24.0f);
|
frame.frameSize = ByteSwapD(80 * 36);
|
||||||
int ysize = (int)floor(newheight / 16.0f - newwidth / 64.0f);
|
frame.frameAreaSize = ByteSwapD(80 * 36 + 12);
|
||||||
for (int y = 0; y < ysize; y++) {
|
|
||||||
for (int x = 0; x < xsize; x++) {
|
for (int y = 0; y < ySize; y++) {
|
||||||
fo::FrmFile frame;
|
for (int x = 0; x < xSize; x++) {
|
||||||
fo::func::db_fseek(art, 0, 0);
|
// offset relative to the top-left corner
|
||||||
fo::func::db_freadByteCount(art, (BYTE*)&frame, 0x4a);
|
int xOffset = x * 48 + (ySize - (y + 1)) * 32;
|
||||||
frame.height = ByteSwapW(36);
|
int yOffset = height - (36 + x * 12 + y * 24);
|
||||||
frame.width = ByteSwapW(80);
|
|
||||||
frame.frameSize = ByteSwapD(80 * 36);
|
for (int pY = 0; pY < 36; pY++) {
|
||||||
frame.frameAreaSize = ByteSwapD(80 * 36 + 12);
|
for (int pX = 0; pX < 80; pX++) {
|
||||||
int xoffset = x * 48 + (ysize - (y + 1)) * 32;
|
int point = (80 * pY) + pX;
|
||||||
int yoffset = height - (36 + x * 12 + y * 24);
|
if (mask[point]) {
|
||||||
for (int y2 = 0; y2 < 36; y2++) {
|
frame.pixels[point] = pixelData[(width * (yOffset + pY)) + xOffset + pX];
|
||||||
for (int x2 = 0; x2 < 80; x2++) {
|
|
||||||
if (mask[y2 * 80 + x2]) {
|
|
||||||
frame.pixels[y2 * 80 + x2] = pixeldata[(yoffset + y2) * width + xoffset + x2];
|
|
||||||
} else {
|
} else {
|
||||||
frame.pixels[y2 * 80 + x2] = 0;
|
frame.pixels[point] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sprintf_s(&buf[10], 22, "zzz%04d.frm", listID++);
|
||||||
sprintf_s(buf, 32, "art\\tiles\\zzz%04d.frm", listid++);
|
|
||||||
//FScreateFromData(buf, &frame, sizeof(frame));
|
//FScreateFromData(buf, &frame, sizeof(frame));
|
||||||
fo::DbFile* file = fo::func::db_fopen(buf, "w");
|
fo::DbFile* file = fo::func::db_fopen(buf, "wb");
|
||||||
fo::func::db_fwriteByteCount(file, (BYTE*)&frame, sizeof(frame));
|
fo::func::db_fwriteByteCount(file, (BYTE*)&frame, sizeof(frame));
|
||||||
fo::func::db_fclose(file);
|
fo::func::db_fclose(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
overrides[tile] = new OverrideEntry(xsize, ysize, listpos);
|
overrides[tile] = new OverrideEntry(xSize, ySize, listPos);
|
||||||
fo::func::db_fclose(art);
|
|
||||||
delete[] pixeldata;
|
fo::func::db_fclose(artFile);
|
||||||
return xsize * ysize;
|
delete[] pixelData;
|
||||||
|
|
||||||
|
return xSize * ySize; // number of tiles added
|
||||||
}
|
}
|
||||||
|
|
||||||
static const functype art_init = (functype)fo::funcoffs::art_init_;
|
static const functype art_init = (functype)fo::funcoffs::art_init_;
|
||||||
|
|
||||||
static int __stdcall ArtInitHook() {
|
static int __stdcall ArtInitHook() {
|
||||||
if (art_init()) return -1;
|
if (art_init()) return -1;
|
||||||
|
if (!LoadMask()) return 0;
|
||||||
CreateMask();
|
|
||||||
|
|
||||||
fo::Art* tiles = &fo::var::art[4];
|
fo::Art* tiles = &fo::var::art[4];
|
||||||
char buf[32];
|
|
||||||
DWORD listpos = tiles->total;
|
long listpos = origTileCount = tiles->total;
|
||||||
origTileCount = listpos;
|
overrides = new OverrideEntry*[listpos]();
|
||||||
overrides = new OverrideEntry*[listpos];
|
|
||||||
ZeroMemory(overrides, 4 * (listpos - 1));
|
|
||||||
|
|
||||||
if (tileMode == 2) {
|
if (tileMode == 2) {
|
||||||
fo::DbFile* file = fo::func::db_fopen("art\\tiles\\xltiles.lst", "rt");
|
fo::DbFile* file = fo::func::db_fopen("art\\tiles\\xltiles.lst", "rt");
|
||||||
if (!file) return 0;
|
if (!file) return 0;
|
||||||
|
|
||||||
|
char buf[32];
|
||||||
DWORD id;
|
DWORD id;
|
||||||
char* comment;
|
char* comment;
|
||||||
|
|
||||||
while (fo::func::db_fgets(buf, 31, file) > 0) {
|
while (fo::func::db_fgets(buf, 31, file) > 0) {
|
||||||
if (comment = strchr(buf, ';')) *comment = 0;
|
if (comment = strchr(buf, ';')) *comment = 0;
|
||||||
id = atoi(buf);
|
id = atoi(buf);
|
||||||
@@ -177,7 +197,7 @@ static int __stdcall ArtInitHook() {
|
|||||||
}
|
}
|
||||||
if (listpos != tiles->total) {
|
if (listpos != tiles->total) {
|
||||||
tiles->names = (char*)fo::func::mem_realloc(tiles->names, listpos * 13);
|
tiles->names = (char*)fo::func::mem_realloc(tiles->names, listpos * 13);
|
||||||
for (DWORD i = tiles->total; i < listpos; i++) {
|
for (long i = tiles->total; i < listpos; i++) {
|
||||||
sprintf_s(&tiles->names[i * 13], 12, "zzz%04d.frm", i - tiles->total);
|
sprintf_s(&tiles->names[i * 13], 12, "zzz%04d.frm", i - tiles->total);
|
||||||
}
|
}
|
||||||
tiles->total = listpos;
|
tiles->total = listpos;
|
||||||
@@ -199,14 +219,15 @@ static void __declspec(naked) iso_init_hook() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static long __fastcall SquareLoadCheck(TilesData* data) {
|
static long __fastcall SquareLoadCheck(TilesData* data) {
|
||||||
|
if (!overrides) return 0;
|
||||||
for (DWORD y = 0; y < 100; y++) {
|
for (DWORD y = 0; y < 100; y++) {
|
||||||
for (DWORD x = 0; x < 100; x++) {
|
for (DWORD x = 0; x < 100; x++) {
|
||||||
for (DWORD z = 0; z < 2; z++) {
|
for (DWORD z = 0; z < 2; z++) {
|
||||||
DWORD tile = data[y * 100 + x].tile[z];
|
DWORD tile = data[y * 100 + x].tile[z];
|
||||||
if (tile > 1 && tile < origTileCount && overrides[tile]) {
|
if (tile > 1 && tile < origTileCount && overrides[tile]) {
|
||||||
DWORD newtile = overrides[tile]->replacementid - 1;
|
DWORD newtile = overrides[tile]->replacementID - 1;
|
||||||
for (DWORD y2 = 0; y2 < overrides[tile]->ytiles; y2++) {
|
for (DWORD y2 = 0; y2 < overrides[tile]->yTiles; y2++) {
|
||||||
for (DWORD x2 = 0; x2 < overrides[tile]->xtiles; x2++) {
|
for (DWORD x2 = 0; x2 < overrides[tile]->xTiles; x2++) {
|
||||||
newtile++;
|
newtile++;
|
||||||
if (x - x2 < 0 || y - y2 < 0) continue;
|
if (x - x2 < 0 || y - y2 < 0) continue;
|
||||||
data[(y - y2) * 100 + x - x2].tile[z] = (short)newtile;
|
data[(y - y2) * 100 + x - x2].tile[z] = (short)newtile;
|
||||||
@@ -285,4 +306,11 @@ void Tiles::init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Tiles::exit() {
|
||||||
|
if (overrides) {
|
||||||
|
for (size_t i = 0; i < origTileCount; i++) delete overrides[i]; // free OverrideEntry
|
||||||
|
delete[] overrides;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class Tiles : public Module {
|
|||||||
public:
|
public:
|
||||||
const char* name() { return "Tiles"; }
|
const char* name() { return "Tiles"; }
|
||||||
void init();
|
void init();
|
||||||
|
void exit() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,14 @@
|
|||||||
namespace sfall
|
namespace sfall
|
||||||
{
|
{
|
||||||
|
|
||||||
|
WORD ByteSwapW(WORD w) {
|
||||||
|
return ((w & 0xFF) << 8) | ((w & 0xFF00) >> 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD ByteSwapD(DWORD dw) {
|
||||||
|
return ((dw & 0xFF) << 24) | ((dw & 0xFF00) << 8) | ((dw & 0xFF0000) >> 8) | ((dw & 0xFF000000) >> 24);
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::string> split(const std::string &s, char delim) {
|
std::vector<std::string> split(const std::string &s, char delim) {
|
||||||
std::vector<std::string> elems;
|
std::vector<std::string> elems;
|
||||||
split(s, delim, std::back_inserter(elems));
|
split(s, delim, std::back_inserter(elems));
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ void split(const std::string &s, char delim, T result, size_t limit = -1) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WORD ByteSwapW(WORD w);
|
||||||
|
DWORD ByteSwapD(DWORD dw);
|
||||||
|
|
||||||
// Splits a string by given delimiter
|
// Splits a string by given delimiter
|
||||||
std::vector<std::string> split(const std::string &s, char delim);
|
std::vector<std::string> split(const std::string &s, char delim);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user