mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-22 10:01:46 +00:00
fix autogen texinfo get
This commit is contained in:
parent
98ff007818
commit
73db1b0345
8 changed files with 53 additions and 62 deletions
|
|
@ -776,8 +776,8 @@ def build_param(fid, param, i):
|
|||
ptype = alter_type(param['type'])
|
||||
pid = param['identifier']
|
||||
|
||||
if param.get('texinfo', False):
|
||||
return ' struct TextureInfo *texInfo = get_texture_info_from_lua(L);\n'
|
||||
if "struct TextureInfo" in ptype and "*" in ptype:
|
||||
return ' struct TextureInfo *texInfo = smlua_to_texture_info(L, %d);\n' % (i)
|
||||
|
||||
if ptype in VEC_TYPES:
|
||||
if ptype == "Vec3f" and fid in SOUND_FUNCTIONS:
|
||||
|
|
@ -1017,10 +1017,6 @@ def process_function(fname, line, description):
|
|||
param['out'] = True
|
||||
param_str = param_str[len('OUT'):].strip()
|
||||
|
||||
if param_str.startswith('TEXINFO '):
|
||||
param['texinfo'] = True
|
||||
param_str = param_str[len('TEXINFO'):].strip()
|
||||
|
||||
if param_str.endswith('*') or ' ' not in param_str:
|
||||
param['type'] = normalize_type(param_str)
|
||||
param['identifier'] = 'arg%d' % param_index
|
||||
|
|
|
|||
|
|
@ -3367,7 +3367,7 @@ Renders a DJUI HUD texture onto the screen
|
|||
- None
|
||||
|
||||
### C Prototype
|
||||
`void djui_hud_render_texture(TEXINFO struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH);`
|
||||
`void djui_hud_render_texture(struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
|
|
@ -3398,7 +3398,7 @@ Renders a DJUI HUD texture tile onto the screen
|
|||
- None
|
||||
|
||||
### C Prototype
|
||||
`void djui_hud_render_texture_tile(TEXINFO struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH);`
|
||||
`void djui_hud_render_texture_tile(struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
|
|
@ -3429,7 +3429,7 @@ Renders an interpolated DJUI HUD texture onto the screen
|
|||
- None
|
||||
|
||||
### C Prototype
|
||||
`void djui_hud_render_texture_interpolated(TEXINFO struct TextureInfo* texInfo, f32 prevX, f32 prevY, f32 prevScaleW, f32 prevScaleH, f32 x, f32 y, f32 scaleW, f32 scaleH);`
|
||||
`void djui_hud_render_texture_interpolated(struct TextureInfo* texInfo, f32 prevX, f32 prevY, f32 prevScaleW, f32 prevScaleH, f32 x, f32 y, f32 scaleW, f32 scaleH);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
|
|
@ -3464,7 +3464,7 @@ Renders an interpolated DJUI HUD texture tile onto the screen
|
|||
- None
|
||||
|
||||
### C Prototype
|
||||
`void djui_hud_render_texture_tile_interpolated(TEXINFO struct TextureInfo* texInfo, f32 prevX, f32 prevY, f32 prevScaleW, f32 prevScaleH, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH);`
|
||||
`void djui_hud_render_texture_tile_interpolated(struct TextureInfo* texInfo, f32 prevX, f32 prevY, f32 prevScaleW, f32 prevScaleH, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
|
|
|
|||
|
|
@ -512,15 +512,15 @@ void djui_hud_render_texture_tile_raw(const u8* texture, u32 bitSize, u32 width,
|
|||
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
||||
}
|
||||
|
||||
void djui_hud_render_texture(TEXINFO struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH) {
|
||||
void djui_hud_render_texture(struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH) {
|
||||
djui_hud_render_texture_raw(texInfo->texture, texInfo->bitSize, texInfo->width, texInfo->height, x, y, scaleW, scaleH);
|
||||
}
|
||||
|
||||
void djui_hud_render_texture_tile(TEXINFO struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH) {
|
||||
void djui_hud_render_texture_tile(struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH) {
|
||||
djui_hud_render_texture_tile_raw(texInfo->texture, texInfo->bitSize, texInfo->width, texInfo->height, x, y, scaleW, scaleH, tileX, tileY, tileW, tileH);
|
||||
}
|
||||
|
||||
void djui_hud_render_texture_interpolated(TEXINFO struct TextureInfo* texInfo, f32 prevX, f32 prevY, f32 prevScaleW, f32 prevScaleH, f32 x, f32 y, f32 scaleW, f32 scaleH) {
|
||||
void djui_hud_render_texture_interpolated(struct TextureInfo* texInfo, f32 prevX, f32 prevY, f32 prevScaleW, f32 prevScaleH, f32 x, f32 y, f32 scaleW, f32 scaleH) {
|
||||
Gfx* savedHeadPos = gDisplayListHead;
|
||||
f32 savedZ = gDjuiHudUtilsZ;
|
||||
|
||||
|
|
@ -544,7 +544,7 @@ void djui_hud_render_texture_interpolated(TEXINFO struct TextureInfo* texInfo, f
|
|||
interp->rotation = sRotation;
|
||||
}
|
||||
|
||||
void djui_hud_render_texture_tile_interpolated(TEXINFO struct TextureInfo* texInfo, f32 prevX, f32 prevY, f32 prevScaleW, f32 prevScaleH, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH) {
|
||||
void djui_hud_render_texture_tile_interpolated(struct TextureInfo* texInfo, f32 prevX, f32 prevY, f32 prevScaleW, f32 prevScaleH, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH) {
|
||||
Gfx* savedHeadPos = gDisplayListHead;
|
||||
f32 savedZ = gDjuiHudUtilsZ;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef DJUI_HUD_UTILS_H
|
||||
#define DJUI_HUD_UTILS_H
|
||||
|
||||
#define TEXINFO
|
||||
|
||||
enum HudUtilsResolution {
|
||||
RESOLUTION_DJUI,
|
||||
RESOLUTION_N64,
|
||||
|
|
@ -114,15 +112,15 @@ void djui_hud_print_text(const char* message, f32 x, f32 y, f32 scale);
|
|||
/* |description|Prints interpolated DJUI HUD text onto the screen|descriptionEnd| */
|
||||
void djui_hud_print_text_interpolated(const char* message, f32 prevX, f32 prevY, f32 prevScale, f32 x, f32 y, f32 scale);
|
||||
/* |description|Renders a DJUI HUD texture onto the screen|descriptionEnd| */
|
||||
void djui_hud_render_texture(TEXINFO struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH);
|
||||
void djui_hud_render_texture(struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH);
|
||||
void djui_hud_render_texture_raw(const u8* texture, u32 bitSize, u32 width, u32 height, f32 x, f32 y, f32 scaleW, f32 scaleH);
|
||||
/* |description|Renders a DJUI HUD texture tile onto the screen|descriptionEnd| */
|
||||
void djui_hud_render_texture_tile(TEXINFO struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH);
|
||||
void djui_hud_render_texture_tile(struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH);
|
||||
void djui_hud_render_texture_tile_raw(const u8* texture, u32 bitSize, u32 width, u32 height, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH);
|
||||
/* |description|Renders an interpolated DJUI HUD texture onto the screen|descriptionEnd| */
|
||||
void djui_hud_render_texture_interpolated(TEXINFO struct TextureInfo* texInfo, f32 prevX, f32 prevY, f32 prevScaleW, f32 prevScaleH, f32 x, f32 y, f32 scaleW, f32 scaleH);
|
||||
void djui_hud_render_texture_interpolated(struct TextureInfo* texInfo, f32 prevX, f32 prevY, f32 prevScaleW, f32 prevScaleH, f32 x, f32 y, f32 scaleW, f32 scaleH);
|
||||
/* |description|Renders an interpolated DJUI HUD texture tile onto the screen|descriptionEnd| */
|
||||
void djui_hud_render_texture_tile_interpolated(TEXINFO struct TextureInfo* texInfo, f32 prevX, f32 prevY, f32 prevScaleW, f32 prevScaleH, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH);
|
||||
void djui_hud_render_texture_tile_interpolated(struct TextureInfo* texInfo, f32 prevX, f32 prevY, f32 prevScaleW, f32 prevScaleH, f32 x, f32 y, f32 scaleW, f32 scaleH, u32 tileX, u32 tileY, u32 tileW, u32 tileH);
|
||||
/* |description|Renders a DJUI HUD rect onto the screen|descriptionEnd| */
|
||||
void djui_hud_render_rect(f32 x, f32 y, f32 width, f32 height);
|
||||
/* |description|Renders an interpolated DJUI HUD rect onto the screen|descriptionEnd| */
|
||||
|
|
|
|||
|
|
@ -450,7 +450,7 @@ int smlua_func_texture_override_set(lua_State* L) {
|
|||
const char* textureName = smlua_to_string(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("texture_override_set: Failed to convert parameter 1"); return 0; }
|
||||
|
||||
struct TextureInfo *overrideTexInfo = get_texture_info_from_lua(L);
|
||||
struct TextureInfo *overrideTexInfo = smlua_to_texture_info(L, 2);
|
||||
if (!overrideTexInfo || !gSmLuaConvertSuccess) { LOG_LUA("texture_override_set: Failed to convert parameter 2"); return 0; }
|
||||
|
||||
dynos_texture_override_set(textureName, overrideTexInfo);
|
||||
|
|
|
|||
|
|
@ -12719,7 +12719,7 @@ int smlua_func_djui_hud_render_texture(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct TextureInfo *texInfo = get_texture_info_from_lua(L);
|
||||
struct TextureInfo *texInfo = smlua_to_texture_info(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_render_texture"); return 0; }
|
||||
f32 x = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "djui_hud_render_texture"); return 0; }
|
||||
|
|
@ -12744,7 +12744,7 @@ int smlua_func_djui_hud_render_texture_tile(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct TextureInfo *texInfo = get_texture_info_from_lua(L);
|
||||
struct TextureInfo *texInfo = smlua_to_texture_info(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_render_texture_tile"); return 0; }
|
||||
f32 x = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "djui_hud_render_texture_tile"); return 0; }
|
||||
|
|
@ -12777,7 +12777,7 @@ int smlua_func_djui_hud_render_texture_interpolated(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct TextureInfo *texInfo = get_texture_info_from_lua(L);
|
||||
struct TextureInfo *texInfo = smlua_to_texture_info(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_render_texture_interpolated"); return 0; }
|
||||
f32 prevX = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "djui_hud_render_texture_interpolated"); return 0; }
|
||||
|
|
@ -12810,7 +12810,7 @@ int smlua_func_djui_hud_render_texture_tile_interpolated(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct TextureInfo *texInfo = get_texture_info_from_lua(L);
|
||||
struct TextureInfo *texInfo = smlua_to_texture_info(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_render_texture_tile_interpolated"); return 0; }
|
||||
f32 prevX = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "djui_hud_render_texture_tile_interpolated"); return 0; }
|
||||
|
|
|
|||
|
|
@ -258,6 +258,39 @@ struct LSTNetworkType smlua_to_lnt(lua_State* L, int index) {
|
|||
return lnt;
|
||||
}
|
||||
|
||||
struct TextureInfo *smlua_to_texture_info(lua_State *L, int index) {
|
||||
static struct TextureInfo tmpTexInfo = { 0 }; // Static should be okay
|
||||
struct TextureInfo *texInfo = &tmpTexInfo;
|
||||
|
||||
if (smlua_is_cobject(L, index, LOT_TEXTUREINFO)) {
|
||||
return smlua_to_cobject(L, index, LOT_TEXTUREINFO);
|
||||
} else {
|
||||
int top = lua_gettop(L);
|
||||
lua_pushvalue(L, index);
|
||||
|
||||
lua_pushstring(L, "texture");
|
||||
lua_gettable(L, top + 1);
|
||||
tmpTexInfo.texture = smlua_to_cpointer(L, lua_gettop(L), LVT_U8_P);
|
||||
lua_pop(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { return NULL; }
|
||||
|
||||
tmpTexInfo.bitSize = smlua_get_integer_field(top + 1, "bitSize");
|
||||
if (!gSmLuaConvertSuccess) { return NULL; }
|
||||
|
||||
tmpTexInfo.width = smlua_get_integer_field(top + 1, "width");
|
||||
if (!gSmLuaConvertSuccess) { return NULL; }
|
||||
|
||||
tmpTexInfo.height = smlua_get_integer_field(top + 1, "height");
|
||||
if (!gSmLuaConvertSuccess) { return NULL; }
|
||||
|
||||
tmpTexInfo.name = smlua_get_string_field(top + 1, "name");
|
||||
if (!gSmLuaConvertSuccess) { return NULL; }
|
||||
|
||||
lua_settop(L, top);
|
||||
}
|
||||
return texInfo;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool packet_write_lnt(struct Packet* p, struct LSTNetworkType* lnt) {
|
||||
|
|
@ -641,41 +674,6 @@ LuaFunction smlua_get_any_function_mod_variable(const char *variable) {
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct TextureInfo *get_texture_info_from_lua(lua_State *L) {
|
||||
static struct TextureInfo tmpTexInfo = { 0 }; // Static should be okay
|
||||
struct TextureInfo *texInfo = &tmpTexInfo;
|
||||
|
||||
if (smlua_is_cobject(L, 1, LOT_TEXTUREINFO)) {
|
||||
return smlua_to_cobject(L, 1, LOT_TEXTUREINFO);
|
||||
} else {
|
||||
int top = lua_gettop(L);
|
||||
lua_pushvalue(L, 1);
|
||||
|
||||
lua_pushstring(L, "texture");
|
||||
lua_gettable(L, top + 1);
|
||||
tmpTexInfo.texture = smlua_to_cpointer(L, lua_gettop(L), LVT_U8_P);
|
||||
lua_pop(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { return NULL; }
|
||||
|
||||
tmpTexInfo.bitSize = smlua_get_integer_field(top + 1, "bitSize");
|
||||
if (!gSmLuaConvertSuccess) { return NULL; }
|
||||
|
||||
tmpTexInfo.width = smlua_get_integer_field(top + 1, "width");
|
||||
if (!gSmLuaConvertSuccess) { return NULL; }
|
||||
|
||||
tmpTexInfo.height = smlua_get_integer_field(top + 1, "height");
|
||||
if (!gSmLuaConvertSuccess) { return NULL; }
|
||||
|
||||
tmpTexInfo.name = smlua_get_string_field(top + 1, "name");
|
||||
if (!gSmLuaConvertSuccess) { return NULL; }
|
||||
|
||||
lua_settop(L, top);
|
||||
}
|
||||
return texInfo;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const char* smlua_lnt_to_str(struct LSTNetworkType* lnt) {
|
||||
static char sLntStr[32] = "";
|
||||
switch (lnt->type) {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ bool smlua_is_cobject(lua_State* L, int index, u16 lot);
|
|||
void* smlua_to_cobject(lua_State* L, int index, u16 lot);
|
||||
void* smlua_to_cpointer(lua_State* L, int index, u16 lvt);
|
||||
struct LSTNetworkType smlua_to_lnt(lua_State* L, int index);
|
||||
struct TextureInfo *smlua_to_texture_info(lua_State *L, int index);
|
||||
|
||||
bool packet_write_lnt(struct Packet* p, struct LSTNetworkType* lnt);
|
||||
bool packet_read_lnt(struct Packet* p, struct LSTNetworkType* lnt);
|
||||
|
|
@ -50,8 +51,6 @@ s64 smlua_get_any_integer_mod_variable(const char* variable);
|
|||
LuaFunction smlua_get_function_mod_variable(u16 modIndex, const char *variable);
|
||||
LuaFunction smlua_get_any_function_mod_variable(const char *variable);
|
||||
|
||||
struct TextureInfo *get_texture_info_from_lua(lua_State *L);
|
||||
|
||||
void smlua_logline(void);
|
||||
void smlua_dump_stack(void);
|
||||
void smlua_dump_globals(void);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue