mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
Created TextureInfo struct
This commit is contained in:
parent
ded74e7fb5
commit
29599a82ec
13 changed files with 133 additions and 96 deletions
|
@ -18,6 +18,9 @@ def translate_type_to_lvt(ptype):
|
||||||
if ptype == 'char':
|
if ptype == 'char':
|
||||||
ptype = 'u8'
|
ptype = 'u8'
|
||||||
|
|
||||||
|
if 'const ' in ptype:
|
||||||
|
ptype = ptype.replace('const ', '').strip()
|
||||||
|
|
||||||
if ('char' in ptype and '[' in ptype):
|
if ('char' in ptype and '[' in ptype):
|
||||||
return 'LVT_STRING'
|
return 'LVT_STRING'
|
||||||
|
|
||||||
|
@ -57,15 +60,18 @@ def translate_type_to_lvt(ptype):
|
||||||
return 'LVT_???'
|
return 'LVT_???'
|
||||||
|
|
||||||
def translate_type_to_lot(ptype):
|
def translate_type_to_lot(ptype):
|
||||||
if ptype == 'char':
|
|
||||||
ptype = 'u8'
|
|
||||||
|
|
||||||
if ptype == 'const char*':
|
if ptype == 'const char*':
|
||||||
return 'LOT_NONE'
|
return 'LOT_NONE'
|
||||||
|
|
||||||
if ptype == 'char*' or ('char' in ptype and '[' in ptype):
|
if ptype == 'char*' or ('char' in ptype and '[' in ptype):
|
||||||
return 'LOT_NONE'
|
return 'LOT_NONE'
|
||||||
|
|
||||||
|
if 'const ' in ptype:
|
||||||
|
ptype = ptype.replace('const ', '')
|
||||||
|
|
||||||
|
if ptype == 'char':
|
||||||
|
ptype = 'u8'
|
||||||
|
|
||||||
if '[' in ptype or '{' in ptype:
|
if '[' in ptype or '{' in ptype:
|
||||||
return 'LOT_???'
|
return 'LOT_???'
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ override_field_immutable = {
|
||||||
"MarioState": [ "playerIndex" ],
|
"MarioState": [ "playerIndex" ],
|
||||||
"Character": [ "*" ],
|
"Character": [ "*" ],
|
||||||
"NetworkPlayer": [ "*" ],
|
"NetworkPlayer": [ "*" ],
|
||||||
|
"TextureInfo": [ "*" ],
|
||||||
}
|
}
|
||||||
|
|
||||||
sLuaManuallyDefinedStructs = [
|
sLuaManuallyDefinedStructs = [
|
||||||
|
@ -188,7 +189,7 @@ def get_struct_field_info(struct, field):
|
||||||
|
|
||||||
lvt = translate_type_to_lvt(ftype)
|
lvt = translate_type_to_lvt(ftype)
|
||||||
lot = translate_type_to_lot(ftype)
|
lot = translate_type_to_lot(ftype)
|
||||||
fimmutable = str(lvt == 'LVT_COBJECT' or lvt.endswith('_P')).lower()
|
fimmutable = str(lvt == 'LVT_COBJECT' or lvt.endswith('_P') or 'const ' in ftype).lower()
|
||||||
|
|
||||||
if sid in override_field_immutable:
|
if sid in override_field_immutable:
|
||||||
if fid in override_field_immutable[sid] or '*' in override_field_immutable[sid]:
|
if fid in override_field_immutable[sid] or '*' in override_field_immutable[sid]:
|
||||||
|
|
|
@ -711,17 +711,14 @@
|
||||||
## [djui_hud_render_texture](#djui_hud_render_texture)
|
## [djui_hud_render_texture](#djui_hud_render_texture)
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
`djui_hud_render_texture(texture, bitSize, x, y, width, height, scaleW, scaleH)`
|
`djui_hud_render_texture(texInfo, x, y, scaleW, scaleH)`
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
| Field | Type |
|
| Field | Type |
|
||||||
| ----- | ---- |
|
| ----- | ---- |
|
||||||
| texture | Pointer <integer> |
|
| texInfo | [TextureInfo](structs.md#TextureInfo) |
|
||||||
| bitSize | integer |
|
|
||||||
| x | number |
|
| x | number |
|
||||||
| y | number |
|
| y | number |
|
||||||
| width | integer |
|
|
||||||
| height | integer |
|
|
||||||
| scaleW | number |
|
| scaleW | number |
|
||||||
| scaleH | number |
|
| scaleH | number |
|
||||||
|
|
||||||
|
@ -729,7 +726,7 @@
|
||||||
- None
|
- None
|
||||||
|
|
||||||
### C Prototype
|
### C Prototype
|
||||||
`void djui_hud_render_texture(const u8* texture, u32 bitSize, f32 x, f32 y, u32 width, u32 height, f32 scaleW, f32 scaleH);`
|
`void djui_hud_render_texture(struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH);`
|
||||||
|
|
||||||
[:arrow_up_small:](#)
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
- [SPTask](#SPTask)
|
- [SPTask](#SPTask)
|
||||||
- [SpawnInfo](#SpawnInfo)
|
- [SpawnInfo](#SpawnInfo)
|
||||||
- [Surface](#Surface)
|
- [Surface](#Surface)
|
||||||
|
- [TextureInfo](#TextureInfo)
|
||||||
- [TransitionInfo](#TransitionInfo)
|
- [TransitionInfo](#TransitionInfo)
|
||||||
- [UnusedArea28](#UnusedArea28)
|
- [UnusedArea28](#UnusedArea28)
|
||||||
- [VblankHandler](#VblankHandler)
|
- [VblankHandler](#VblankHandler)
|
||||||
|
@ -174,7 +175,7 @@
|
||||||
| capModelId | integer | read-only |
|
| capModelId | integer | read-only |
|
||||||
| capWingModelId | integer | read-only |
|
| capWingModelId | integer | read-only |
|
||||||
| hudHead | char | read-only |
|
| hudHead | char | read-only |
|
||||||
| hudHeadTexture | Pointer <integer> | read-only |
|
| hudHeadTexture | [TextureInfo](#TextureInfo) | read-only |
|
||||||
| modelId | integer | read-only |
|
| modelId | integer | read-only |
|
||||||
| name | string | read-only |
|
| name | string | read-only |
|
||||||
| soundAttacked | integer | read-only |
|
| soundAttacked | integer | read-only |
|
||||||
|
@ -771,6 +772,19 @@
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
## [TextureInfo](#TextureInfo)
|
||||||
|
|
||||||
|
| Field | Type | Access |
|
||||||
|
| ----- | ---- | ------ |
|
||||||
|
| bitSize | const u8 | read-only |
|
||||||
|
| height | const u32 | read-only |
|
||||||
|
| texture | Pointer <integer> | read-only |
|
||||||
|
| width | const u32 | read-only |
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
## [TransitionInfo](#TransitionInfo)
|
## [TransitionInfo](#TransitionInfo)
|
||||||
|
|
||||||
| Field | Type | Access |
|
| Field | Type | Access |
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include <ultra64.h>
|
#include <ultra64.h>
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "src/game/characters.h"
|
|
||||||
#include "pc/network/version.h"
|
#include "pc/network/version.h"
|
||||||
|
|
||||||
// Certain functions are marked as having return values, but do not
|
// Certain functions are marked as having return values, but do not
|
||||||
|
@ -396,6 +395,14 @@ struct MarioState
|
||||||
/*????*/ f32 curAnimOffset;
|
/*????*/ f32 curAnimOffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct TextureInfo
|
||||||
|
{
|
||||||
|
const u8* texture;
|
||||||
|
const u8 bitSize;
|
||||||
|
const u32 width;
|
||||||
|
const u32 height;
|
||||||
|
};
|
||||||
|
|
||||||
#define PLAY_MODE_NORMAL 0
|
#define PLAY_MODE_NORMAL 0
|
||||||
#define PLAY_MODE_PAUSED 2
|
#define PLAY_MODE_PAUSED 2
|
||||||
#define PLAY_MODE_CHANGE_AREA 3
|
#define PLAY_MODE_CHANGE_AREA 3
|
||||||
|
@ -404,4 +411,6 @@ struct MarioState
|
||||||
|
|
||||||
#define MAX_PLAYERS 16
|
#define MAX_PLAYERS 16
|
||||||
|
|
||||||
|
#include "src/game/characters.h"
|
||||||
|
|
||||||
#endif // _SM64_TYPES_H_
|
#endif // _SM64_TYPES_H_
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "pc/configfile.h"
|
#include "pc/configfile.h"
|
||||||
#include "audio/external.h"
|
#include "audio/external.h"
|
||||||
#include "engine/graph_node.h"
|
#include "engine/graph_node.h"
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
extern Gfx mario_cap_seg3_dl_03022F48[];
|
extern Gfx mario_cap_seg3_dl_03022F48[];
|
||||||
extern Gfx luigi_cap_seg3_dl_03022F48[];
|
extern Gfx luigi_cap_seg3_dl_03022F48[];
|
||||||
|
@ -29,7 +30,7 @@ struct Character gCharacters[CT_MAX] = {
|
||||||
.type = CT_MARIO,
|
.type = CT_MARIO,
|
||||||
.name = "Mario",
|
.name = "Mario",
|
||||||
.hudHead = ',',
|
.hudHead = ',',
|
||||||
.hudHeadTexture = texture_hud_char_mario_head,
|
.hudHeadTexture = { .texture = texture_hud_char_mario_head, .bitSize = 8, .width = 16, .height = 16 },
|
||||||
.cameraHudHead = GLYPH_CAM_MARIO_HEAD,
|
.cameraHudHead = GLYPH_CAM_MARIO_HEAD,
|
||||||
.modelId = MODEL_MARIO,
|
.modelId = MODEL_MARIO,
|
||||||
.capModelId = MODEL_MARIOS_CAP,
|
.capModelId = MODEL_MARIOS_CAP,
|
||||||
|
@ -92,7 +93,7 @@ struct Character gCharacters[CT_MAX] = {
|
||||||
.type = CT_LUIGI,
|
.type = CT_LUIGI,
|
||||||
.name = "Luigi",
|
.name = "Luigi",
|
||||||
.hudHead = '.',
|
.hudHead = '.',
|
||||||
.hudHeadTexture = texture_hud_char_luigi_head,
|
.hudHeadTexture = { .texture = texture_hud_char_luigi_head, .bitSize = 8, .width = 16, .height = 16 },
|
||||||
.cameraHudHead = GLYPH_CAM_LUIGI_HEAD,
|
.cameraHudHead = GLYPH_CAM_LUIGI_HEAD,
|
||||||
.modelId = MODEL_LUIGI,
|
.modelId = MODEL_LUIGI,
|
||||||
.capModelId = MODEL_LUIGIS_CAP,
|
.capModelId = MODEL_LUIGIS_CAP,
|
||||||
|
@ -155,7 +156,7 @@ struct Character gCharacters[CT_MAX] = {
|
||||||
.type = CT_TOAD,
|
.type = CT_TOAD,
|
||||||
.name = "Toad",
|
.name = "Toad",
|
||||||
.hudHead = '/',
|
.hudHead = '/',
|
||||||
.hudHeadTexture = texture_hud_char_toad_head,
|
.hudHeadTexture = { .texture = texture_hud_char_toad_head, .bitSize = 8, .width = 16, .height = 16 },
|
||||||
.cameraHudHead = GLYPH_CAM_TOAD_HEAD,
|
.cameraHudHead = GLYPH_CAM_TOAD_HEAD,
|
||||||
.modelId = MODEL_TOAD_PLAYER,
|
.modelId = MODEL_TOAD_PLAYER,
|
||||||
.capModelId = MODEL_TOADS_CAP,
|
.capModelId = MODEL_TOADS_CAP,
|
||||||
|
@ -218,7 +219,7 @@ struct Character gCharacters[CT_MAX] = {
|
||||||
.type = CT_WALUIGI,
|
.type = CT_WALUIGI,
|
||||||
.name = "Waluigi",
|
.name = "Waluigi",
|
||||||
.hudHead = 'z',
|
.hudHead = 'z',
|
||||||
.hudHeadTexture = texture_hud_char_waluigi_head,
|
.hudHeadTexture = { .texture = texture_hud_char_waluigi_head, .bitSize = 8, .width = 16, .height = 16 },
|
||||||
.cameraHudHead = GLYPH_CAM_WALUIGI_HEAD,
|
.cameraHudHead = GLYPH_CAM_WALUIGI_HEAD,
|
||||||
.modelId = MODEL_WALUIGI,
|
.modelId = MODEL_WALUIGI,
|
||||||
.capModelId = MODEL_WALUIGIS_CAP,
|
.capModelId = MODEL_WALUIGIS_CAP,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef CHARACTERS_H
|
#ifndef CHARACTERS_H
|
||||||
#define CHARACTERS_H
|
#define CHARACTERS_H
|
||||||
#include "PR/ultratypes.h"
|
#include "PR/ultratypes.h"
|
||||||
|
#include "types.h"
|
||||||
// NOTE: do not include any additional headers
|
// NOTE: do not include any additional headers
|
||||||
|
|
||||||
enum CharacterType {
|
enum CharacterType {
|
||||||
|
@ -18,7 +19,7 @@ struct Character {
|
||||||
enum CharacterType type;
|
enum CharacterType type;
|
||||||
char* name;
|
char* name;
|
||||||
char hudHead;
|
char hudHead;
|
||||||
const u8* hudHeadTexture;
|
struct TextureInfo hudHeadTexture;
|
||||||
u32 cameraHudHead;
|
u32 cameraHudHead;
|
||||||
u32 modelId;
|
u32 modelId;
|
||||||
u32 capModelId;
|
u32 capModelId;
|
||||||
|
|
|
@ -117,7 +117,7 @@ void djui_hud_print_text(const char* message, float x, float y, float scale) {
|
||||||
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
void djui_hud_render_texture(const u8* texture, u32 bitSize, f32 x, f32 y, u32 width, u32 height, f32 scaleW, f32 scaleH) {
|
static void djui_hud_render_texture_raw(const u8* texture, u32 bitSize, u32 width, u32 height, f32 x, f32 y, f32 scaleW, f32 scaleH) {
|
||||||
// translate position
|
// translate position
|
||||||
f32 translatedX = x;
|
f32 translatedX = x;
|
||||||
f32 translatedY = y;
|
f32 translatedY = y;
|
||||||
|
@ -137,3 +137,7 @@ void djui_hud_render_texture(const u8* texture, u32 bitSize, f32 x, f32 y, u32 w
|
||||||
// pop
|
// pop
|
||||||
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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->width, x, y, scaleW, scaleH);
|
||||||
|
}
|
||||||
|
|
|
@ -23,6 +23,6 @@ u32 djui_hud_get_screen_height(void);
|
||||||
|
|
||||||
f32 djui_hud_measure_text(const char* message);
|
f32 djui_hud_measure_text(const char* message);
|
||||||
void djui_hud_print_text(const char* message, float x, float y, float scale);
|
void djui_hud_print_text(const char* message, float x, float y, float scale);
|
||||||
void djui_hud_render_texture(const u8* texture, u32 bitSize, f32 x, f32 y, u32 width, u32 height, f32 scaleW, f32 scaleH);
|
void djui_hud_render_texture(struct TextureInfo* texInfo, f32 x, f32 y, f32 scaleW, f32 scaleH);
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -18,7 +18,7 @@ static struct DjuiText* djuiTextLocations[MAX_PLAYERS] = { 0 };
|
||||||
static void playerlist_update_row(u8 i, struct NetworkPlayer* np) {
|
static void playerlist_update_row(u8 i, struct NetworkPlayer* np) {
|
||||||
u8 charIndex = np->modelIndex;
|
u8 charIndex = np->modelIndex;
|
||||||
if (charIndex >= CT_MAX) { charIndex = 0; }
|
if (charIndex >= CT_MAX) { charIndex = 0; }
|
||||||
djuiImages[i]->texture = gCharacters[charIndex].hudHeadTexture;
|
djuiImages[i]->texture = gCharacters[charIndex].hudHeadTexture.texture;
|
||||||
|
|
||||||
u8 visible = np->connected;
|
u8 visible = np->connected;
|
||||||
if (np == gNetworkPlayerServer && gServerSettings.headlessServer) {
|
if (np == gNetworkPlayerServer && gServerSettings.headlessServer) {
|
||||||
|
|
|
@ -110,7 +110,7 @@ static struct LuaObjectField sCharacterFields[LUA_CHARACTER_FIELD_COUNT] = {
|
||||||
{ "capModelId", LVT_U32, offsetof(struct Character, capModelId), true, LOT_NONE },
|
{ "capModelId", LVT_U32, offsetof(struct Character, capModelId), true, LOT_NONE },
|
||||||
{ "capWingModelId", LVT_U32, offsetof(struct Character, capWingModelId), true, LOT_NONE },
|
{ "capWingModelId", LVT_U32, offsetof(struct Character, capWingModelId), true, LOT_NONE },
|
||||||
{ "hudHead", LVT_U8, offsetof(struct Character, hudHead), true, LOT_NONE },
|
{ "hudHead", LVT_U8, offsetof(struct Character, hudHead), true, LOT_NONE },
|
||||||
{ "hudHeadTexture", LVT_U8_P, offsetof(struct Character, hudHeadTexture), true, LOT_POINTER },
|
{ "hudHeadTexture", LVT_COBJECT, offsetof(struct Character, hudHeadTexture), true, LOT_TEXTUREINFO },
|
||||||
{ "modelId", LVT_U32, offsetof(struct Character, modelId), true, LOT_NONE },
|
{ "modelId", LVT_U32, offsetof(struct Character, modelId), true, LOT_NONE },
|
||||||
{ "name", LVT_STRING_P, offsetof(struct Character, name), true, LOT_NONE },
|
{ "name", LVT_STRING_P, offsetof(struct Character, name), true, LOT_NONE },
|
||||||
{ "soundAttacked", LVT_S32, offsetof(struct Character, soundAttacked), true, LOT_NONE },
|
{ "soundAttacked", LVT_S32, offsetof(struct Character, soundAttacked), true, LOT_NONE },
|
||||||
|
@ -466,7 +466,7 @@ static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = {
|
||||||
{ "areaTimerDuration", LVT_U32, offsetof(struct Object, areaTimerDuration), false, LOT_NONE },
|
{ "areaTimerDuration", LVT_U32, offsetof(struct Object, areaTimerDuration), false, LOT_NONE },
|
||||||
// { "areaTimerRunOnceCallback)(void)", LVT_???, offsetof(struct Object, areaTimerRunOnceCallback)(void)), false, LOT_??? }, <--- UNIMPLEMENTED
|
// { "areaTimerRunOnceCallback)(void)", LVT_???, offsetof(struct Object, areaTimerRunOnceCallback)(void)), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||||
{ "areaTimerType", LVT_S32, offsetof(struct Object, areaTimerType), false, LOT_NONE },
|
{ "areaTimerType", LVT_S32, offsetof(struct Object, areaTimerType), false, LOT_NONE },
|
||||||
// { "behavior", LVT_???, offsetof(struct Object, behavior), false, LOT_??? }, <--- UNIMPLEMENTED
|
// { "behavior", LVT_???, offsetof(struct Object, behavior), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||||
{ "bhvDelayTimer", LVT_S16, offsetof(struct Object, bhvDelayTimer), false, LOT_NONE },
|
{ "bhvDelayTimer", LVT_S16, offsetof(struct Object, bhvDelayTimer), false, LOT_NONE },
|
||||||
// { "bhvStack", LOT_???, offsetof(struct Object, bhvStack), false, LOT_??? }, <--- UNIMPLEMENTED
|
// { "bhvStack", LOT_???, offsetof(struct Object, bhvStack), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||||
{ "bhvStackIndex", LVT_U32, offsetof(struct Object, bhvStackIndex), false, LOT_NONE },
|
{ "bhvStackIndex", LVT_U32, offsetof(struct Object, bhvStackIndex), false, LOT_NONE },
|
||||||
|
@ -474,7 +474,7 @@ static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = {
|
||||||
// { "collidedObjs", LOT_???, offsetof(struct Object, collidedObjs), false, LOT_??? }, <--- UNIMPLEMENTED
|
// { "collidedObjs", LOT_???, offsetof(struct Object, collidedObjs), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||||
// { "collisionData", LVT_???, offsetof(struct Object, collisionData), false, LOT_??? }, <--- UNIMPLEMENTED
|
// { "collisionData", LVT_???, offsetof(struct Object, collisionData), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||||
{ "createdThroughNetwork", LVT_U8, offsetof(struct Object, createdThroughNetwork), false, LOT_NONE },
|
{ "createdThroughNetwork", LVT_U8, offsetof(struct Object, createdThroughNetwork), false, LOT_NONE },
|
||||||
// { "curBhvCommand", LVT_???, offsetof(struct Object, curBhvCommand), false, LOT_??? }, <--- UNIMPLEMENTED
|
// { "curBhvCommand", LVT_???, offsetof(struct Object, curBhvCommand), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||||
{ "globalPlayerIndex", LVT_U8, offsetof(struct Object, globalPlayerIndex), false, LOT_NONE },
|
{ "globalPlayerIndex", LVT_U8, offsetof(struct Object, globalPlayerIndex), false, LOT_NONE },
|
||||||
{ "header", LVT_COBJECT, offsetof(struct Object, header), true, LOT_OBJECTNODE },
|
{ "header", LVT_COBJECT, offsetof(struct Object, header), true, LOT_OBJECTNODE },
|
||||||
{ "heldByPlayerIndex", LVT_U32, offsetof(struct Object, heldByPlayerIndex), false, LOT_NONE },
|
{ "heldByPlayerIndex", LVT_U32, offsetof(struct Object, heldByPlayerIndex), false, LOT_NONE },
|
||||||
|
@ -596,6 +596,14 @@ static struct LuaObjectField sSurfaceFields[LUA_SURFACE_FIELD_COUNT] = {
|
||||||
{ "vertex3", LVT_COBJECT, offsetof(struct Surface, vertex3), true, LOT_VEC3S },
|
{ "vertex3", LVT_COBJECT, offsetof(struct Surface, vertex3), true, LOT_VEC3S },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define LUA_TEXTURE_INFO_FIELD_COUNT 4
|
||||||
|
static struct LuaObjectField sTextureInfoFields[LUA_TEXTURE_INFO_FIELD_COUNT] = {
|
||||||
|
{ "bitSize", LVT_U8, offsetof(struct TextureInfo, bitSize), true, LOT_NONE },
|
||||||
|
{ "height", LVT_U32, offsetof(struct TextureInfo, height), true, LOT_NONE },
|
||||||
|
{ "texture", LVT_U8_P, offsetof(struct TextureInfo, texture), true, LOT_POINTER },
|
||||||
|
{ "width", LVT_U32, offsetof(struct TextureInfo, width), true, LOT_NONE },
|
||||||
|
};
|
||||||
|
|
||||||
#define LUA_TRANSITION_INFO_FIELD_COUNT 9
|
#define LUA_TRANSITION_INFO_FIELD_COUNT 9
|
||||||
static struct LuaObjectField sTransitionInfoFields[LUA_TRANSITION_INFO_FIELD_COUNT] = {
|
static struct LuaObjectField sTransitionInfoFields[LUA_TRANSITION_INFO_FIELD_COUNT] = {
|
||||||
{ "focDist", LVT_F32, offsetof(struct TransitionInfo, focDist), false, LOT_NONE },
|
{ "focDist", LVT_F32, offsetof(struct TransitionInfo, focDist), false, LOT_NONE },
|
||||||
|
@ -697,6 +705,7 @@ struct LuaObjectTable sLuaObjectAutogenTable[LOT_AUTOGEN_MAX - LOT_AUTOGEN_MIN]
|
||||||
{ LOT_PLAYERGEOMETRY, sPlayerGeometryFields, LUA_PLAYER_GEOMETRY_FIELD_COUNT },
|
{ LOT_PLAYERGEOMETRY, sPlayerGeometryFields, LUA_PLAYER_GEOMETRY_FIELD_COUNT },
|
||||||
{ LOT_SPAWNINFO, sSpawnInfoFields, LUA_SPAWN_INFO_FIELD_COUNT },
|
{ LOT_SPAWNINFO, sSpawnInfoFields, LUA_SPAWN_INFO_FIELD_COUNT },
|
||||||
{ LOT_SURFACE, sSurfaceFields, LUA_SURFACE_FIELD_COUNT },
|
{ LOT_SURFACE, sSurfaceFields, LUA_SURFACE_FIELD_COUNT },
|
||||||
|
{ LOT_TEXTUREINFO, sTextureInfoFields, LUA_TEXTURE_INFO_FIELD_COUNT },
|
||||||
{ LOT_TRANSITIONINFO, sTransitionInfoFields, LUA_TRANSITION_INFO_FIELD_COUNT },
|
{ LOT_TRANSITIONINFO, sTransitionInfoFields, LUA_TRANSITION_INFO_FIELD_COUNT },
|
||||||
{ LOT_WALLCOLLISIONDATA, sWallCollisionDataFields, LUA_WALL_COLLISION_DATA_FIELD_COUNT },
|
{ LOT_WALLCOLLISIONDATA, sWallCollisionDataFields, LUA_WALL_COLLISION_DATA_FIELD_COUNT },
|
||||||
{ LOT_WARPNODE, sWarpNodeFields, LUA_WARP_NODE_FIELD_COUNT },
|
{ LOT_WARPNODE, sWarpNodeFields, LUA_WARP_NODE_FIELD_COUNT },
|
||||||
|
|
|
@ -39,6 +39,7 @@ enum LuaObjectAutogenType {
|
||||||
LOT_PLAYERGEOMETRY,
|
LOT_PLAYERGEOMETRY,
|
||||||
LOT_SPAWNINFO,
|
LOT_SPAWNINFO,
|
||||||
LOT_SURFACE,
|
LOT_SURFACE,
|
||||||
|
LOT_TEXTUREINFO,
|
||||||
LOT_TRANSITIONINFO,
|
LOT_TRANSITIONINFO,
|
||||||
LOT_WALLCOLLISIONDATA,
|
LOT_WALLCOLLISIONDATA,
|
||||||
LOT_WARPNODE,
|
LOT_WARPNODE,
|
||||||
|
|
|
@ -253,26 +253,20 @@ int smlua_func_djui_hud_print_text(lua_State* L) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int smlua_func_djui_hud_render_texture(lua_State* L) {
|
int smlua_func_djui_hud_render_texture(lua_State* L) {
|
||||||
if(!smlua_functions_valid_param_count(L, 8)) { return 0; }
|
if(!smlua_functions_valid_param_count(L, 5)) { return 0; }
|
||||||
|
|
||||||
const u8* texture = (const u8*)smlua_to_cpointer(L, 1, LVT_U8_P);
|
struct TextureInfo* texInfo = (struct TextureInfo*)smlua_to_cobject(L, 1, LOT_TEXTUREINFO);
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
if (!gSmLuaConvertSuccess) { return 0; }
|
||||||
u32 bitSize = smlua_to_integer(L, 2);
|
f32 x = smlua_to_number(L, 2);
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
if (!gSmLuaConvertSuccess) { return 0; }
|
||||||
f32 x = smlua_to_number(L, 3);
|
f32 y = smlua_to_number(L, 3);
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
if (!gSmLuaConvertSuccess) { return 0; }
|
||||||
f32 y = smlua_to_number(L, 4);
|
f32 scaleW = smlua_to_number(L, 4);
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
if (!gSmLuaConvertSuccess) { return 0; }
|
||||||
u32 width = smlua_to_integer(L, 5);
|
f32 scaleH = smlua_to_number(L, 5);
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
|
||||||
u32 height = smlua_to_integer(L, 6);
|
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
|
||||||
f32 scaleW = smlua_to_number(L, 7);
|
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
|
||||||
f32 scaleH = smlua_to_number(L, 8);
|
|
||||||
if (!gSmLuaConvertSuccess) { return 0; }
|
if (!gSmLuaConvertSuccess) { return 0; }
|
||||||
|
|
||||||
djui_hud_render_texture(texture, bitSize, x, y, width, height, scaleW, scaleH);
|
djui_hud_render_texture(texInfo, x, y, scaleW, scaleH);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue