mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-21 19:45:10 +00:00
Added global textures
This commit is contained in:
parent
29599a82ec
commit
669e17bc18
9 changed files with 84 additions and 8 deletions
|
@ -10,7 +10,8 @@ in_files = [
|
|||
'src/game/camera.h',
|
||||
'src/game/characters.h',
|
||||
'src/engine/surface_collision.h',
|
||||
'src/pc/network/network_player.h'
|
||||
'src/pc/network/network_player.h',
|
||||
'src/pc/djui/djui_hud_utils.h'
|
||||
]
|
||||
|
||||
smlua_cobject_autogen = 'src/pc/lua/smlua_cobject_autogen'
|
||||
|
|
|
@ -205,7 +205,7 @@ ALIGNED8 static const u8 texture_hud_char_multiply[] = {
|
|||
#include "textures/segment2/segment2.05600.rgba16.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_hud_char_coin[] = {
|
||||
ALIGNED8 const u8 texture_hud_char_coin[] = {
|
||||
#include "textures/segment2/segment2.05800.rgba16.inc.c"
|
||||
};
|
||||
|
||||
|
@ -229,7 +229,7 @@ ALIGNED8 const u8 texture_hud_char_wario_head[] = {
|
|||
#include "textures/segment2/custom_wario_head.rgba16.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_hud_char_star[] = {
|
||||
ALIGNED8 const u8 texture_hud_char_star[] = {
|
||||
#include "textures/segment2/segment2.05C00.rgba16.inc.c"
|
||||
};
|
||||
|
||||
|
@ -1801,23 +1801,23 @@ ALIGNED8 static const u8 texture_font_char_us_button_C_right[] = {
|
|||
};
|
||||
#endif
|
||||
|
||||
ALIGNED8 static const u8 texture_hud_char_camera[] = {
|
||||
ALIGNED8 const u8 texture_hud_char_camera[] = {
|
||||
#include "textures/segment2/segment2.07B50.rgba16.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_hud_char_lakitu[] = {
|
||||
ALIGNED8 const u8 texture_hud_char_lakitu[] = {
|
||||
#include "textures/segment2/segment2.07D50.rgba16.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_hud_char_no_camera[] = {
|
||||
ALIGNED8 const u8 texture_hud_char_no_camera[] = {
|
||||
#include "textures/segment2/segment2.07F50.rgba16.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_hud_char_arrow_up[] = {
|
||||
ALIGNED8 const u8 texture_hud_char_arrow_up[] = {
|
||||
#include "textures/segment2/segment2.08150.rgba16.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_hud_char_arrow_down[] = {
|
||||
ALIGNED8 const u8 texture_hud_char_arrow_down[] = {
|
||||
#include "textures/segment2/segment2.081D0.rgba16.inc.c"
|
||||
};
|
||||
|
||||
|
|
|
@ -30,6 +30,13 @@ The `gCharacter[]` table is an array from `0` to `(CT_MAX - 1)` that contains a
|
|||
|
||||
<br />
|
||||
|
||||
## [gTextures](#gTextures)
|
||||
The `gTextures` table contains references to textures. Listed in [GlobalTextures](structs.md#GlobalTextures).
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [gGlobalSyncTable](#gGlobalSyncTable)
|
||||
The `gGlobalSyncTable` is a table used for networking. Any field set inside of this table is automatically synchronized with all other clients. Do not use this table for player-specific variables, keep those in [gPlayerSyncTable](#gPlayerSyncTable). Player-specific variable will desynchronize within this table since it doesn't automatically translate `playerIndex`.
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
- [CutsceneSplinePoint](#CutsceneSplinePoint)
|
||||
- [CutsceneVariable](#CutsceneVariable)
|
||||
- [FloorGeometry](#FloorGeometry)
|
||||
- [GlobalTextures](#GlobalTextures)
|
||||
- [GraphNode](#GraphNode)
|
||||
- [GraphNodeObject](#GraphNodeObject)
|
||||
- [GraphNodeObject_sub](#GraphNodeObject_sub)
|
||||
|
@ -296,6 +297,22 @@
|
|||
|
||||
<br />
|
||||
|
||||
## [GlobalTextures](#GlobalTextures)
|
||||
|
||||
| Field | Type | Access |
|
||||
| ----- | ---- | ------ |
|
||||
| arrow_down | [TextureInfo](#TextureInfo) | read-only |
|
||||
| arrow_up | [TextureInfo](#TextureInfo) | read-only |
|
||||
| camera | [TextureInfo](#TextureInfo) | read-only |
|
||||
| coin | [TextureInfo](#TextureInfo) | read-only |
|
||||
| lakitu | [TextureInfo](#TextureInfo) | read-only |
|
||||
| no_camera | [TextureInfo](#TextureInfo) | read-only |
|
||||
| star | [TextureInfo](#TextureInfo) | read-only |
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [GraphNode](#GraphNode)
|
||||
|
||||
| Field | Type | Access |
|
||||
|
|
|
@ -15,6 +15,24 @@
|
|||
static enum HudUtilsResolution sResolution = RESOLUTION_DJUI;
|
||||
static enum DjuiFontType sFont = FONT_NORMAL;
|
||||
|
||||
extern ALIGNED8 const u8 texture_hud_char_camera[];
|
||||
extern ALIGNED8 const u8 texture_hud_char_lakitu[];
|
||||
extern ALIGNED8 const u8 texture_hud_char_no_camera[];
|
||||
extern ALIGNED8 const u8 texture_hud_char_arrow_up[];
|
||||
extern ALIGNED8 const u8 texture_hud_char_arrow_down[];
|
||||
extern ALIGNED8 const u8 texture_hud_char_coin[];
|
||||
extern ALIGNED8 const u8 texture_hud_char_star[];
|
||||
|
||||
struct GlobalTextures gGlobalTextures = {
|
||||
.camera = { .texture = texture_hud_char_camera, .bitSize = 8, .width = 16, .height = 16 },
|
||||
.lakitu = { .texture = texture_hud_char_lakitu, .bitSize = 8, .width = 16, .height = 16 },
|
||||
.no_camera = { .texture = texture_hud_char_no_camera, .bitSize = 8, .width = 16, .height = 16 },
|
||||
.arrow_up = { .texture = texture_hud_char_arrow_up, .bitSize = 8, .width = 8, .height = 8 },
|
||||
.arrow_down = { .texture = texture_hud_char_arrow_down, .bitSize = 8, .width = 8, .height = 8 },
|
||||
.coin = { .texture = texture_hud_char_coin, .bitSize = 8, .width = 16, .height = 16 },
|
||||
.star = { .texture = texture_hud_char_star, .bitSize = 8, .width = 16, .height = 16 },
|
||||
};
|
||||
|
||||
static void djui_hud_position_translate(f32* x, f32* y) {
|
||||
if (sResolution == RESOLUTION_DJUI) {
|
||||
djui_gfx_position_translate(x, y);
|
||||
|
@ -141,3 +159,4 @@ static void djui_hud_render_texture_raw(const u8* texture, u32 bitSize, u32 widt
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,18 @@ enum DjuiFontType {
|
|||
FONT_COUNT,
|
||||
};
|
||||
|
||||
struct GlobalTextures {
|
||||
struct TextureInfo camera;
|
||||
struct TextureInfo lakitu;
|
||||
struct TextureInfo no_camera;
|
||||
struct TextureInfo arrow_up;
|
||||
struct TextureInfo arrow_down;
|
||||
struct TextureInfo coin;
|
||||
struct TextureInfo star;
|
||||
};
|
||||
|
||||
extern struct GlobalTextures gGlobalTextures;
|
||||
|
||||
void djui_hud_set_resolution(enum HudUtilsResolution resolutionType);
|
||||
void djui_hud_set_font(enum DjuiFontType fontType);
|
||||
void djui_hud_set_color(u8 r, u8 g, u8 b, u8 a);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "game/mario.h"
|
||||
#include "audio/external.h"
|
||||
#include "object_fields.h"
|
||||
#include "pc/djui/djui_hud_utils.h"
|
||||
|
||||
#define LUA_VEC3S_FIELD_COUNT 3
|
||||
static struct LuaObjectField sVec3sFields[LUA_VEC3S_FIELD_COUNT] = {
|
||||
|
@ -222,6 +223,11 @@ void smlua_cobject_init_globals(void) {
|
|||
lua_setglobal(L, "gCharacters");
|
||||
}
|
||||
|
||||
{
|
||||
smlua_push_object(L, LOT_GLOBALTEXTURES, &gGlobalTextures);
|
||||
lua_setglobal(L, "gTextures");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void smlua_bind_cobject(void) {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "src/game/characters.h"
|
||||
#include "src/engine/surface_collision.h"
|
||||
#include "src/pc/network/network_player.h"
|
||||
#include "src/pc/djui/djui_hud_utils.h"
|
||||
|
||||
#define LUA_ANIMATION_FIELD_COUNT 9
|
||||
static struct LuaObjectField sAnimationFields[LUA_ANIMATION_FIELD_COUNT] = {
|
||||
|
@ -207,6 +208,17 @@ static struct LuaObjectField sFloorGeometryFields[LUA_FLOOR_GEOMETRY_FIELD_COUNT
|
|||
// { "unused", LOT_???, offsetof(struct FloorGeometry, unused), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||
};
|
||||
|
||||
#define LUA_GLOBAL_TEXTURES_FIELD_COUNT 7
|
||||
static struct LuaObjectField sGlobalTexturesFields[LUA_GLOBAL_TEXTURES_FIELD_COUNT] = {
|
||||
{ "arrow_down", LVT_COBJECT, offsetof(struct GlobalTextures, arrow_down), true, LOT_TEXTUREINFO },
|
||||
{ "arrow_up", LVT_COBJECT, offsetof(struct GlobalTextures, arrow_up), true, LOT_TEXTUREINFO },
|
||||
{ "camera", LVT_COBJECT, offsetof(struct GlobalTextures, camera), true, LOT_TEXTUREINFO },
|
||||
{ "coin", LVT_COBJECT, offsetof(struct GlobalTextures, coin), true, LOT_TEXTUREINFO },
|
||||
{ "lakitu", LVT_COBJECT, offsetof(struct GlobalTextures, lakitu), true, LOT_TEXTUREINFO },
|
||||
{ "no_camera", LVT_COBJECT, offsetof(struct GlobalTextures, no_camera), true, LOT_TEXTUREINFO },
|
||||
{ "star", LVT_COBJECT, offsetof(struct GlobalTextures, star), true, LOT_TEXTUREINFO },
|
||||
};
|
||||
|
||||
#define LUA_GRAPH_NODE_FIELD_COUNT 6
|
||||
static struct LuaObjectField sGraphNodeFields[LUA_GRAPH_NODE_FIELD_COUNT] = {
|
||||
{ "children", LVT_COBJECT_P, offsetof(struct GraphNode, children), true, LOT_GRAPHNODE },
|
||||
|
@ -683,6 +695,7 @@ struct LuaObjectTable sLuaObjectAutogenTable[LOT_AUTOGEN_MAX - LOT_AUTOGEN_MIN]
|
|||
{ LOT_CUTSCENESPLINEPOINT, sCutsceneSplinePointFields, LUA_CUTSCENE_SPLINE_POINT_FIELD_COUNT },
|
||||
{ LOT_CUTSCENEVARIABLE, sCutsceneVariableFields, LUA_CUTSCENE_VARIABLE_FIELD_COUNT },
|
||||
{ LOT_FLOORGEOMETRY, sFloorGeometryFields, LUA_FLOOR_GEOMETRY_FIELD_COUNT },
|
||||
{ LOT_GLOBALTEXTURES, sGlobalTexturesFields, LUA_GLOBAL_TEXTURES_FIELD_COUNT },
|
||||
{ LOT_GRAPHNODE, sGraphNodeFields, LUA_GRAPH_NODE_FIELD_COUNT },
|
||||
{ LOT_GRAPHNODEOBJECT, sGraphNodeObjectFields, LUA_GRAPH_NODE_OBJECT_FIELD_COUNT },
|
||||
{ LOT_GRAPHNODEOBJECT_SUB, sGraphNodeObject_subFields, LUA_GRAPH_NODE_OBJECT_SUB_FIELD_COUNT },
|
||||
|
|
|
@ -17,6 +17,7 @@ enum LuaObjectAutogenType {
|
|||
LOT_CUTSCENESPLINEPOINT,
|
||||
LOT_CUTSCENEVARIABLE,
|
||||
LOT_FLOORGEOMETRY,
|
||||
LOT_GLOBALTEXTURES,
|
||||
LOT_GRAPHNODE,
|
||||
LOT_GRAPHNODEOBJECT,
|
||||
LOT_GRAPHNODEOBJECT_SUB,
|
||||
|
|
Loading…
Reference in a new issue