diff --git a/game_compatibility.md b/game_compatibility.md index e60a100..d39eb44 100644 --- a/game_compatibility.md +++ b/game_compatibility.md @@ -73,7 +73,7 @@ issues, please let me know or open a pull request to update this table. | Rance 02 -The Rebellious Maidens- (Fan TL) | Supported | | | Rance 02 -The Rebellious Maidens- (MangaGamer) | Supported | | | しゃーまんず・さんくちゅあり-巫女の聖域- | Unknown | | -| 大帝国 | Unknown | | +| 大帝国 | Supported | | | ランス・クエスト | Unsupported | | | 母娘乱館 | Unknown | | | パステルチャイム3 バインドシーカー | Unsupported | | diff --git a/include/gfx/gfx.h b/include/gfx/gfx.h index 332069b..46e81db 100644 --- a/include/gfx/gfx.h +++ b/include/gfx/gfx.h @@ -161,6 +161,7 @@ void gfx_copy_rot_zoom2(Texture *dst, float cx, float cy, Texture *src, float sc void gfx_copy_reverse_LR(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h); void gfx_copy_reverse_UD(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h); void gfx_copy_reverse_amap_LR(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h); +void gfx_copy_reverse_LR_with_alpha_map(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h); void gfx_copy_rotate_y(Texture *dst, Texture *front, Texture *back, int sx, int sy, int w, int h, float rot, float mag); void gfx_copy_rotate_y_use_amap(Texture *dst, Texture *front, Texture *back, int sx, int sy, int w, int h, float rot, float mag); void gfx_copy_rotate_x(Texture *dst, Texture *front, Texture *back, int sx, int sy, int w, int h, float rot, float mag); diff --git a/src/draw.c b/src/draw.c index 48c8b4e..ae0a131 100644 --- a/src/draw.c +++ b/src/draw.c @@ -788,6 +788,7 @@ void gfx_copy_rot_zoom_use_amap(Texture *dst, Texture *src, int sx, int sy, int void gfx_copy_rot_zoom2(Texture *dst, float cx, float cy, Texture *src, float scx, float scy, float rot, float mag) { gfx_fill_amap(dst, 0, 0, dst->w, dst->h, 0); + glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ONE, GL_ZERO); // 1. scale src vertices to texture size // 2. translate so that center point of copy region is at origin @@ -805,7 +806,8 @@ void gfx_copy_rot_zoom2(Texture *dst, float cx, float cy, Texture *src, float sc mat4 wv_transform = WV_TRANSFORM(dst->w, dst->h); struct copy_data data = ROTATE_DATA(dst, 0, 0, src->w, src->h); - run_draw_shader(&hitbox_noblend_shader.s, dst, src, mw_transform, wv_transform, &data); + run_draw_shader(&hitbox_shader.s, dst, src, mw_transform, wv_transform, &data); + restore_blend_mode(); } static void copy_rotate_y(Texture *dst, Texture *front, Texture *back, int sx, int sy, int w, int h, float rot, float mag, Shader *shader) @@ -935,6 +937,23 @@ void gfx_copy_reverse_amap_LR(Texture *dst, int dx, int dy, Texture *src, int sx restore_blend_mode(); } +void gfx_copy_reverse_LR_with_alpha_map(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h) +{ + mat4 mw_transform = MAT4( + -src->w, 0, 0, sx + w, + 0, src->h, 0, -sy, + 0, 0, 1, 0, + 0, 0, 0, 1); + mat4 wv_transform = WV_TRANSFORM(w, h); + + glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ONE, GL_ZERO); + + struct copy_data data = COPY_DATA(dx, dy, sx, sy, w, h); + run_draw_shader(©_shader.s, dst, src, mw_transform, wv_transform, &data); + + restore_blend_mode(); +} + void gfx_copy_width_blur(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h, int blur) { GLfloat f_rate = 1.0 / (blur * 2 + 1); diff --git a/src/hll/DrawGraph.c b/src/hll/DrawGraph.c index 65f8c62..f787255 100644 --- a/src/hll/DrawGraph.c +++ b/src/hll/DrawGraph.c @@ -375,6 +375,13 @@ static void DrawGraph_CopyReverseAMapLR(int dst, int dx, int dy, int src, int sx //void DrawGraph_CopyReverseAMapUD(int dst, int dx, int dy, int src, int sx, int sy, int w, int h); +static void DrawGraph_CopyReverseLRWithAMap(int dst, int dx, int dy, int src, int sx, int sy, int w, int h) +{ + gfx_copy_reverse_LR_with_alpha_map(DTEX(dst), dx, dy, STEX(src), sx, sy, w, h); +} + +//void DrawGraph_CopyReverseUDWithAMap(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight); + static void DrawGraph_CopyWidthBlur(int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int blur) { gfx_copy_width_blur(DTEX(dst), dx, dy, STEX(src), sx, sy, w, h, blur); @@ -549,6 +556,8 @@ HLL_LIBRARY(DrawGraph, HLL_EXPORT(CopyReverseUD, DrawGraph_CopyReverseUD), HLL_EXPORT(CopyReverseAMapLR, DrawGraph_CopyReverseAMapLR), //HLL_EXPORT(CopyReverseAMapUD, DrawGraph_CopyReverseAMapUD), + HLL_EXPORT(CopyReverseLRWithAMap, DrawGraph_CopyReverseLRWithAMap), + HLL_TODO_EXPORT(CopyReverseUDWithAMap, DrawGraph_CopyReverseUDWithAMap), HLL_EXPORT(CopyWidthBlur, DrawGraph_CopyWidthBlur), HLL_EXPORT(CopyHeightBlur, DrawGraph_CopyHeightBlur), HLL_EXPORT(CopyAMapWidthBlur, DrawGraph_CopyAMapWidthBlur), diff --git a/src/hll/FileOperation.c b/src/hll/FileOperation.c index 608f6ca..3672697 100644 --- a/src/hll/FileOperation.c +++ b/src/hll/FileOperation.c @@ -30,7 +30,15 @@ #include "vm/page.h" #include "hll.h" -//bool FileOperation_ExistFile(string FileName); +static bool FileOperation_ExistFile(struct string *file_name) +{ + char *path = unix_path(file_name->text); + ustat s; + bool result = stat_utf8(path, &s) == 0 && S_ISREG(s.st_mode); + free(path); + return result; +} + //bool FileOperation_DeleteFile(string FileName); static bool FileOperation_CopyFile(struct string *dest_file_name, struct string *src_file_name) @@ -46,7 +54,25 @@ static bool FileOperation_CopyFile(struct string *dest_file_name, struct string //bool FileOperation_GetFileCreationTime(string FileName, ref int nYear, ref int nMonth, ref int nDay, ref int nWeek, ref int nHour, ref int nMin, ref int nSecond); //bool FileOperation_GetFileLastAccessTime(string FileName, ref int nYear, ref int nMonth, ref int nDay, ref int nWeek, ref int nHour, ref int nMin, ref int nSecond); //bool FileOperation_GetFileLastWriteTime(string FileName, ref int nYear, ref int nMonth, ref int nDay, ref int nWeek, ref int nHour, ref int nMin, ref int nSecond); -//bool FileOperation_GetFileSize(string FileName, ref int nSize); + +static bool FileOperation_GetFileSize(struct string *file_name, int *size) +{ + char *path = unix_path(file_name->text); + ustat s; + if (stat_utf8(path, &s) < 0) { + WARNING("stat(\"%s\"): %s", display_utf0(path), strerror(errno)); + free(path); + return false; + } + if (!S_ISREG(s.st_mode)) { + WARNING("stat(\"%s\"): not a regular file", display_utf0(path)); + free(path); + return false; + } + *size = s.st_size; + free(path); + return true; +} static bool FileOperation_ExistFolder(struct string *folder_name) { @@ -190,13 +216,13 @@ static bool FileOperation_GetFolderList(struct string *folder_name, struct page } HLL_LIBRARY(FileOperation, - HLL_TODO_EXPORT(ExistFile, FileOperation_ExistFile), + HLL_EXPORT(ExistFile, FileOperation_ExistFile), HLL_TODO_EXPORT(DeleteFile, FileOperation_DeleteFile), HLL_EXPORT(CopyFile, FileOperation_CopyFile), HLL_TODO_EXPORT(GetFileCreationTime, FileOperation_GetFileCreationTime), HLL_TODO_EXPORT(GetFileLastAccessTime, FileOperation_GetFileLastAccessTime), HLL_TODO_EXPORT(GetFileLastWriteTime, FileOperation_GetFileLastWriteTime), - HLL_TODO_EXPORT(GetFileSize, FileOperation_GetFileSize), + HLL_EXPORT(GetFileSize, FileOperation_GetFileSize), HLL_EXPORT(ExistFolder, FileOperation_ExistFolder), HLL_EXPORT(CreateFolder, FileOperation_CreateFolder), HLL_EXPORT(DeleteFolder, FileOperation_DeleteFolder),