diff options
| author | coco875 <59367621+coco875@users.noreply.github.com> | 2025-07-09 22:36:39 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-09 16:36:39 -0600 |
| commit | 5277fced87de9f48455e862eb41b3cda1ce62c66 (patch) | |
| tree | 4796432871f914746fa9bfc1fdc12e07b3bb5ce1 /src | |
| parent | d175f5ef243c16fed27730d5c89eb709dcfc4d5a (diff) | |
make replace neon texture (#435)
* make replace neon texture
* cmake are dumb
* fix neon render
* Update render_objects.c
---------
Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/render_objects.c | 31 | ||||
| -rw-r--r-- | src/update_objects.c | 31 |
2 files changed, 41 insertions, 21 deletions
diff --git a/src/render_objects.c b/src/render_objects.c index ee0fa7592..89fad088e 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -2081,7 +2081,8 @@ void render_texture_tile_rgba32_block(s16 x, s16 y, u8* texture, u32 width, u32 void render_game_logo(s16 x, s16 y) { int32_t height = 128; - int32_t width = ResourceGetTexWidthByName(logo_mario_kart_64) * height / ResourceGetTexHeightByName(logo_mario_kart_64); + int32_t width = + ResourceGetTexWidthByName(logo_mario_kart_64) * height / ResourceGetTexHeightByName(logo_mario_kart_64); render_texture_tile_rgba32_block(x, y, logo_mario_kart_64, width, height); } @@ -2706,7 +2707,7 @@ void render_digital_speedometer(s32 playerIdx) { size_t len = (size_t) snprintf(str, sizeof(str), "%.2f", speed); if (len >= sizeof(str)) { - printf("[render_objects.c] [render_digital_speedometer] str buffer too small, characters were discarded!\n"); + printf("[render_objects.c] [render_digital_speedometer] str buffer too small, characters were discarded!\n"); } text_draw_wide(270, 224, str, 0, 0.5f, 0.5f); @@ -2747,8 +2748,8 @@ void func_8004EF9C(s32 arg0) { temp_v0 = CM_GetPropsCourseId(arg0)->Minimap.Width; temp_t0 = CM_GetPropsCourseId(arg0)->Minimap.Height; - func_8004D37C(0x00000104, 0x0000003C, CM_GetPropsCourseId(arg0)->Minimap.Texture, 0x000000FF, 0x000000FF, 0x000000FF, - 0x000000FF, temp_v0, temp_t0, temp_v0, temp_t0); + func_8004D37C(0x00000104, 0x0000003C, CM_GetPropsCourseId(arg0)->Minimap.Texture, 0x000000FF, 0x000000FF, + 0x000000FF, 0x000000FF, temp_v0, temp_t0, temp_v0, temp_t0); } void set_minimap_finishline_position(s32 playerId) { @@ -2812,7 +2813,7 @@ void draw_minimap_character(s32 arg0, s32 playerId, s32 characterId) { x = (center - (CM_GetProps()->Minimap.Width / 2)) + CM_GetProps()->Minimap.PlayerX + (s16) (thing0); y = (CM_GetProps()->Minimap.Pos[arg0].Y - (CM_GetProps()->Minimap.Height / 2)) + - CM_GetProps()->Minimap.PlayerY + (s16) (thing1); + CM_GetProps()->Minimap.PlayerY + (s16) (thing1); if (characterId != 8) { if ((gGPCurrentRaceRankByPlayerId[playerId] == 0) && (gModeSelection != 3) && (gModeSelection != 1)) { func_80046424(x, y, player->rotation[1] + 0x8000, 1.0f, @@ -2834,7 +2835,6 @@ void draw_minimap_character(s32 arg0, s32 playerId, s32 characterId) { // @port Resume Interpolation, if interpolated later remove this tag FrameInterpolation_ShouldInterpolateFrame(true); - } #else GLOBAL_ASM("asm/non_matchings/render_objects/draw_minimap_character.s") @@ -3543,7 +3543,6 @@ void func_80051ABC(s16 arg0, s32 arg1) { func_800519D4(objectIndex, object->unk_09C, arg0 - object->unk_09E); FrameInterpolation_RecordCloseChild(); - } } else { func_8004B6C4(255, 255, 255); @@ -4027,6 +4026,14 @@ void func_80055EF4(s32 objectIndex, UNUSED s32 arg1) { } } +Vtx common_vtx_neon[] = { + { { { -32, -31, 0 }, 0, { 0, 0 }, { 255, 255, 255, 255 } } }, + { { { 31, -31, 0 }, 0, { 4032, 0 }, { 255, 255, 255, 255 } } }, + { { { 31, 31, 0 }, 0, { 4032, 3968 }, { 255, 255, 255, 255 } } }, + { { { -32, 31, 0 }, 0, { 0, 3968 }, { 255, 255, 255, 255 } } }, + +}; + void render_object_neon(s32 cameraId) { Camera* camera; s32 objectIndex; @@ -4040,10 +4047,14 @@ void render_object_neon(s32 cameraId) { FrameInterpolation_RecordOpenChild(object, TAG_OBJECT((objectIndex << 8) + i)); if ((object->state >= 2) && (is_obj_index_flag_status_inactive(objectIndex, 0x00080000) != 0) && (is_object_visible_on_camera(objectIndex, camera, 0x2AABU) != 0)) { - Vtx* vtx = (Vtx*) LOAD_ASSET(common_vtx_hedgehog); object->orientation[1] = angle_between_object_camera(objectIndex, camera); - draw_2d_texture_at(object->pos, object->orientation, object->sizeScaling, (u8*) object->activeTLUT, - object->activeTexture, vtx, 0x00000040, 0x00000040, 0x00000040, 0x00000020); + rsp_set_matrix_transformation(object->pos, object->orientation, object->sizeScaling); + gSPDisplayList(gDisplayListHead++, D_0D007D78); + gDPLoadTLUT_pal256(gDisplayListHead++, object->activeTLUT); + rsp_load_texture(object->activeTexture, 64, 64); + gSPVertex(gDisplayListHead++, common_vtx_neon, 4, 0); + gSPDisplayList(gDisplayListHead++, common_rectangle_display); + gSPTexture(gDisplayListHead++, 1, 1, 0, G_TX_RENDERTILE, G_OFF); } FrameInterpolation_RecordCloseChild(); } diff --git a/src/update_objects.c b/src/update_objects.c index 5b2758466..990646a74 100644 --- a/src/update_objects.c +++ b/src/update_objects.c @@ -756,7 +756,10 @@ void update_neon_texture(s32 objectIndex) { // I have no idea why this typecast works gObjectList[objectIndex].activeTLUT = (u8*) ((u32*) gObjectList[objectIndex].tlutList + (gObjectList[objectIndex].textureListIndex * 128)); - gObjectList[objectIndex].activeTexture = gObjectList[objectIndex].textureList; + int idx = gObjectList[objectIndex].textureListIndex; + char* texture = gObjectList[objectIndex].textureList[idx]; + gObjectList[objectIndex].activeTexture = + gObjectList[objectIndex].textureList[gObjectList[objectIndex].textureListIndex]; } void func_80073514(s32 objectIndex) { @@ -3259,10 +3262,10 @@ void verify_probability_table(char* str, const ItemProbabilities* probs, int16_t getProbabilityArray(probs, itemProbabilities); size_t count = 0; for (size_t i = 0; i < ITEM_MAX; i++) { - //printf("prob %d ", itemProbabilities[i]); + // printf("prob %d ", itemProbabilities[i]); count += itemProbabilities[i]; } - //printf("\n"); + // printf("\n"); if (count != 100) { printf("update_objects.c::verify_probability_table\n %s table for rank %d is imba %d/100\n", str, rank, count); @@ -3289,7 +3292,7 @@ u8 gen_random_item(s16 rank, s16 option) { switch (gModeSelection) { case GRAND_PRIX: - switch(option) { + switch (option) { case HUMAN_TABLE: distributionTable = &grandPrixHumanProbabilityTable[rank]; verify_probability_table("Human", distributionTable, rank); @@ -4099,14 +4102,16 @@ void func_80085BB4(s32 objectIndex) { object_next_state(objectIndex); } -const char* sNeonMushroomList[] = { d_course_rainbow_road_neon_mushroom }; +const char* sNeonMushroomList[] = { d_course_rainbow_road_neon_mushroom1, d_course_rainbow_road_neon_mushroom2, + d_course_rainbow_road_neon_mushroom3, d_course_rainbow_road_neon_mushroom4, + d_course_rainbow_road_neon_mushroom5 }; void init_obj_neon_mushroom(s32 objectIndex) { set_obj_origin_pos(objectIndex, xOrientation * -1431.0, 827.0f, -2957.0f); init_texture_object(objectIndex, load_lakitu_tlut_x64(d_course_rainbow_road_neon_mushroom_tlut_list, ARRAY_COUNT(d_course_rainbow_road_neon_mushroom_tlut_list)), - d_course_rainbow_road_neon_mushroom, 0x40U, (u16) 0x00000040); + sNeonMushroomList, 0x40U, (u16) 0x00000040); func_80085BB4(objectIndex); } @@ -4142,14 +4147,16 @@ void func_80085CA0(s32 objectIndex) { } } -const char* sNeonList[] = { d_course_rainbow_road_neon_mario }; +const char* sNeonMarioList[] = { d_course_rainbow_road_neon_mario1, d_course_rainbow_road_neon_mario2, + d_course_rainbow_road_neon_mario3, d_course_rainbow_road_neon_mario4, + d_course_rainbow_road_neon_mario5 }; void func_80085DB8(s32 objectIndex) { set_obj_origin_pos(objectIndex, xOrientation * 799.0, 1193.0f, -5891.0f); init_texture_object(objectIndex, load_lakitu_tlut_x64(d_course_rainbow_road_neon_mario_tlut_list, ARRAY_COUNT(d_course_rainbow_road_neon_mario_tlut_list)), - d_course_rainbow_road_neon_mario, 0x40U, (u16) 0x00000040); + sNeonMarioList, 0x40U, (u16) 0x00000040); func_80085BB4(objectIndex); } @@ -4176,14 +4183,16 @@ void func_80085E38(s32 objectIndex) { } } -const char* sNeonBooList[] = { d_course_rainbow_road_neon_boo }; +const char* sNeonBooList[] = { d_course_rainbow_road_neon_boo1, d_course_rainbow_road_neon_boo2, + d_course_rainbow_road_neon_boo3, d_course_rainbow_road_neon_boo4, + d_course_rainbow_road_neon_boo5 }; void func_80085EF8(s32 objectIndex) { set_obj_origin_pos(objectIndex, xOrientation * -2013.0, 555.0f, 0.0f); init_texture_object(objectIndex, load_lakitu_tlut_x64(d_course_rainbow_road_neon_boo_tlut_list, ARRAY_COUNT(d_course_rainbow_road_neon_boo_tlut_list)), - d_course_rainbow_road_neon_boo, 0x40U, (u16) 0x00000040); + sNeonBooList, 0x40U, (u16) 0x00000040); func_80085BB4(objectIndex); } @@ -4229,7 +4238,7 @@ void func_80085F74(s32 objectIndex) { void func_80086074(s32 objectIndex, s32 arg1) { set_obj_origin_pos(objectIndex, D_800E6734[arg1][0] * xOrientation, D_800E6734[arg1][1], D_800E6734[arg1][2]); init_texture_object(objectIndex, d_course_rainbow_road_static_tluts[arg1], - d_course_rainbow_road_static_textures[arg1], 64, 64); + &d_course_rainbow_road_static_textures[arg1], 64, 64); func_80085BB4(objectIndex); } #else |
