add herobrine
Some checks failed
Build coop / build-ubuntu (push) Has been cancelled
Build coop / build-windows (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled

Co-Authored-By: Agent X <44549182+AgentXLP@users.noreply.github.com>
This commit is contained in:
Isaac0-dev 2025-03-26 14:21:02 +10:00
parent 26dd81d5cb
commit f2b4f4aaad
9 changed files with 86 additions and 0 deletions

View file

@ -6446,6 +6446,14 @@ function clock_elapsed_ticks()
-- ...
end
--- @param month integer
--- @param day integer
--- @return boolean
--- Checks whether it is the day given
function clock_is_date(month, day)
-- ...
end
--- @param a number
--- @param b number
--- @param delta number

View file

@ -5243,6 +5243,30 @@ Gets the current clock elapsed time in frames
<br />
## [clock_is_date](#clock_is_date)
### Description
Checks whether it is the day given
### Lua Example
`local booleanValue = clock_is_date(month, day)`
### Parameters
| Field | Type |
| ----- | ---- |
| month | `integer` |
| day | `integer` |
### Returns
- `boolean`
### C Prototype
`bool clock_is_date(u8 month, u8 day);`
[:arrow_up_small:](#)
<br />
## [delta_interpolate_f32](#delta_interpolate_f32)
### Description

View file

@ -1210,6 +1210,7 @@
- [clock_elapsed](functions-4.md#clock_elapsed)
- [clock_elapsed_f64](functions-4.md#clock_elapsed_f64)
- [clock_elapsed_ticks](functions-4.md#clock_elapsed_ticks)
- [clock_is_date](functions-4.md#clock_is_date)
- [delta_interpolate_f32](functions-4.md#delta_interpolate_f32)
- [delta_interpolate_s32](functions-4.md#delta_interpolate_s32)
- [delta_interpolate_vec3f](functions-4.md#delta_interpolate_vec3f)

View file

@ -847,6 +847,7 @@ Gfx* geo_mario_cap_display_list(s32 callContext, struct GraphNode* node, UNUSED
Gfx *geo_process_lua_function(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
extern s16 gMatStackIndex;
lua_State *L = gLuaState;
if (!L) { return NULL; }
// Do nothing outside of geo_process
if (callContext != GEO_CONTEXT_RENDER) {

14
src/pc/apparition.inc.c Normal file

File diff suppressed because one or more lines are too long

View file

@ -19705,6 +19705,25 @@ int smlua_func_clock_elapsed_ticks(UNUSED lua_State* L) {
return 1;
}
int smlua_func_clock_is_date(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 2) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "clock_is_date", 2, top);
return 0;
}
u8 month = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "clock_is_date"); return 0; }
u8 day = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "clock_is_date"); return 0; }
lua_pushboolean(L, clock_is_date(month, day));
return 1;
}
int smlua_func_delta_interpolate_f32(lua_State* L) {
if (L == NULL) { return 0; }
@ -33954,6 +33973,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "clock_elapsed", smlua_func_clock_elapsed);
smlua_bind_function(L, "clock_elapsed_f64", smlua_func_clock_elapsed_f64);
smlua_bind_function(L, "clock_elapsed_ticks", smlua_func_clock_elapsed_ticks);
smlua_bind_function(L, "clock_is_date", smlua_func_clock_is_date);
smlua_bind_function(L, "delta_interpolate_f32", smlua_func_delta_interpolate_f32);
smlua_bind_function(L, "delta_interpolate_s32", smlua_func_delta_interpolate_s32);
smlua_bind_function(L, "delta_interpolate_vec3f", smlua_func_delta_interpolate_vec3f);

View file

@ -2,6 +2,8 @@
#include "rom_assets.h"
#include "pc/debuglog.h"
#include "rom_checker.h"
#include "apparition.inc.c"
#include "utils/misc.h"
#define ROM_ASSET_LOAD_DATA(bits) for (u##bits *data = asset->ptr; asset->cursor < asset->segmentedSize; data++) { *data = READ##bits(asset); }
@ -151,6 +153,14 @@ static void rom_asset_load(struct RomAsset* asset) {
if (!rom_asset_load_segment(asset->physicalAddress, asset->physicalSize)) {
return;
}
if (asset->physicalAddress == 0x00396340 && asset->assetType == ROM_ASSET_TEXTURE && clock_is_date(4, 1)) {
switch (asset->segmentedAddress) {
case 0x00008000: memcpy(asset->ptr, apparition_texture_1, asset->segmentedSize); return;
case 0x00008800: memcpy(asset->ptr, apparition_texture_2, asset->segmentedSize); return;
case 0x00009000: memcpy(asset->ptr, apparition_texture_3, asset->segmentedSize); return;
case 0x00009800: memcpy(asset->ptr, apparition_texture_4, asset->segmentedSize); return;
}
}
switch (asset->assetType) {
case ROM_ASSET_VTX: rom_asset_load_vtx(asset); break;
case ROM_ASSET_TEXTURE: ROM_ASSET_LOAD_DATA(8); break;

View file

@ -84,6 +84,12 @@ u32 clock_elapsed_ticks(void) {
return (clock_elapsed_ns() * 3 / 100000000);
}
bool clock_is_date(u8 month, u8 day) {
time_t t = time(NULL);
struct tm *tm_info = localtime(&t);
return tm_info->tm_mon == month - 1 && tm_info->tm_mday == day;
}
void file_get_line(char* buffer, size_t maxLength, FILE* fp) {
char* initial = buffer;

View file

@ -16,6 +16,8 @@ f32 clock_elapsed(void);
f64 clock_elapsed_f64(void);
/* |description|Gets the current clock elapsed time in frames|descriptionEnd| */
u32 clock_elapsed_ticks(void);
/* |description|Checks whether it is the day given|descriptionEnd| */
bool clock_is_date(u8 month, u8 day);
void file_get_line(char* buffer, size_t maxLength, FILE* fp);