Merge branch 'mr-origin-96'

This commit is contained in:
banjo.decomp
2024-10-19 23:10:46 -05:00
291 changed files with 2238 additions and 2204 deletions

View File

@@ -321,7 +321,7 @@ void chTiptup_update(Actor *this){
}
}
else{
if(ml_distance_vec3f(this->position, player_position) < 300.0f && player_getTransformation() == TRANSFORM_1_BANJO && !jiggyscore_isSpawned(JIGGY_27_BGS_TIPTUP)){
if(ml_vec3f_distance(this->position, player_position) < 300.0f && player_getTransformation() == TRANSFORM_1_BANJO && !jiggyscore_isSpawned(JIGGY_27_BGS_TIPTUP)){
chTiptup_setState(this, 2);
}
}
@@ -335,12 +335,12 @@ void chTiptup_update(Actor *this){
}
} //L80389370
else{
if(ml_distance_vec3f(this->position, player_position) >= 300.0f)
if(ml_vec3f_distance(this->position, player_position) >= 300.0f)
chTiptup_setState(this, 1);
}
}//L803893A0
if(this->state == 6){
if(ml_distance_vec3f(this->position, player_position) < 300.0f && !unqPtr->unk8){
if(ml_vec3f_distance(this->position, player_position) < 300.0f && !unqPtr->unk8){
unqPtr->unk8 = 1;
gcdialog_showText(0xc7d, 4, 0, 0, 0, 0);
}

View File

@@ -17,7 +17,6 @@ typedef struct{
extern f32 mapModel_getFloorY(f32 *);
extern void func_80256E24(f32 [3], f32, f32, f32, f32, f32);
void chflibbit_update(Actor *this);
Actor *chflibbit_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
@@ -373,7 +372,7 @@ void chflibbit_update(Actor *this){
sp84[0] = (f32)local->unkE[0];
sp84[1] = (f32)local->unkE[1];
sp84[2] = (f32)local->unkE[2];
if(ml_distance_vec3f(this->position, sp84) < 30.0f){
if(ml_vec3f_distance(this->position, sp84) < 30.0f){
func_80386AEC(this, 1);
}
else{

View File

@@ -260,7 +260,7 @@ bool func_8038C2A8(ActorMarker *marker) {
local = (ActorLocal_MrVile *)&this->local;
player_getPosition(player_position);
if (this->state == 6) {
return ml_distance_vec3f(this->position, player_position) < 150.0f;
return ml_vec3f_distance(this->position, player_position) < 150.0f;
}
return local->unk0 == 1;
}
@@ -351,7 +351,7 @@ void chvile_update(Actor *this) {
local->game_marker = actorArray_findClosestActorFromActorId(this->position, 0x138, -1, &sp90)->marker;
}
player_getPosition(player_position);
sp90 = ml_distance_vec3f(this->position, player_position);
sp90 = ml_vec3f_distance(this->position, player_position);
if (sp90 <= 300.0f) {
local->unk0 = (local->unk0 == 0) ? 1 : 2;
} else if (sp90 > 300.0f) {
@@ -411,7 +411,7 @@ void chvile_update(Actor *this) {
if (this->state == 4) {
player_getPosition(local->target_position);
local->unk10 = 500.0f;
if ((local->unkC == 102) && (ml_distance_vec3f(this->position, local->target_position) < 200.0f)) {
if ((local->unkC == 102) && (ml_vec3f_distance(this->position, local->target_position) < 200.0f)) {
BGS_func_8038BBA0(this, 103);
}
if ((local->unkC == 103) && (skeletalAnim_getLoopCount(this->unk148) >= 2)) {
@@ -420,7 +420,7 @@ void chvile_update(Actor *this) {
}
if (this->state == 5) {
local->unk10 = 200.0f;
if (ml_distance_vec3f(this->position, local->target_position) < 100.0f) {
if (ml_vec3f_distance(this->position, local->target_position) < 100.0f) {
local->target_position[0] = randf2(-500.0f, 500.0f);
local->target_position[1] = 0.0f;
local->target_position[2] = randf2(-500.0f, 500.0f);
@@ -428,12 +428,12 @@ void chvile_update(Actor *this) {
}
if ((this->state == 6)){
local->unk10 = 400.0f;
if((ml_distance_vec3f(this->position, local->target_position) < 100.0f) || (ml_distance_vec3f(player_position, local->target_position) < 300.0f)) {
if((ml_vec3f_distance(this->position, local->target_position) < 100.0f) || (ml_vec3f_distance(player_position, local->target_position) < 300.0f)) {
for(i = 0; i < 10; i++){
random_position[0] = randf2(-500.0f, 500.0f);
random_position[1] = 0.0f;
random_position[2] = randf2(-500.0f, 500.0f);
if ((i == 0) || (ml_distance_vec3f(player_position, random_position) > ml_distance_vec3f(player_position, local->target_position))) {
if ((i == 0) || (ml_vec3f_distance(player_position, random_position) > ml_vec3f_distance(player_position, local->target_position))) {
local->target_position[0] = random_position[0];
local->target_position[1] = random_position[1];
local->target_position[2] = random_position[2];

View File

@@ -140,7 +140,7 @@ void func_8038F6A4(Actor *this)
player_getPosition(sp48);
if (!this->has_met_before)
{
if ((((ml_distance_vec3f(local->unk18, sp48) < 250.0f) && (ml_distance_vec3f(local->unk18, sp48) > 80.0f)) && (!func_8028ECAC())) && (player_getTransformation() == TRANSFORM_1_BANJO))
if ((((ml_vec3f_distance(local->unk18, sp48) < 250.0f) && (ml_vec3f_distance(local->unk18, sp48) > 80.0f)) && (!func_8028ECAC())) && (player_getTransformation() == TRANSFORM_1_BANJO))
{
gcdialog_showText(0xC7E, 0, 0, 0, 0, 0);
this->has_met_before = TRUE;

View File

@@ -423,7 +423,7 @@ void BGS_func_8038E034(Actor *this) {
sp7C[0] = (f32) local->unk10[0];
sp7C[1] = (f32) local->unk10[1];
sp7C[2] = (f32) local->unk10[2];
if (ml_distance_vec3f(this->position, sp7C) < 30.0f) {
if (ml_vec3f_distance(this->position, sp7C) < 30.0f) {
func_8038D9D0(this, 1);
} else {
func_8038D9D0(this, 5);

View File

@@ -3,8 +3,6 @@
#include "math.h"
#include "variables.h"
extern f32 func_80256AB4(f32, f32, f32, f32);
extern f32 func_8025715C(f32, f32);
extern f32 *chVile_getPostion(ActorMarker *);
extern void bundle_setRandomVelocity(f32);
extern void func_802FDCB8(s32);
@@ -171,7 +169,7 @@ void BGS_func_80389850(Actor *this, s32 arg1) {
sp7C[2] = 0.0f;
sp7C[1] = sp94[1];
sp7C[0] = 0.0f;
if(ml_distance_vec3f(sp94, sp7C) <= 1000.0f){
if(ml_vec3f_distance(sp94, sp7C) <= 1000.0f){
break;
}
}
@@ -430,7 +428,7 @@ void chvilegame_player_consume_piece(Actor *this) {
if ((end != begin) && BGS_func_80389810(sp44)){
sp44[1] = 0.0f;
for(i_ptr = begin; i_ptr < end; i_ptr++){
if ((ml_distance_vec3f(i_ptr->position, sp44) < 65.25) && chyumblie_is_edible(i_ptr->marker)) {
if ((ml_vec3f_distance(i_ptr->position, sp44) < 65.25) && chyumblie_is_edible(i_ptr->marker)) {
is_correct_type = ((local->current_type != YUMBLIE) && (i_ptr->type != YUMBLIE)) || (((local->current_type == YUMBLIE) && i_ptr->type == YUMBLIE));
if (is_correct_type) {
local->player_score++;
@@ -468,7 +466,7 @@ bool chvilegame_cpu_consume_piece(ActorMarker *marker, f32 position[3]) {
begin = vector_getBegin(local->game_pieces);
end = vector_getEnd(local->game_pieces);
for(i_ptr = begin; i_ptr < end; i_ptr++){
if ((ml_distance_vec3f(i_ptr->position, position) < 50.0f) && func_8038B684(i_ptr->marker)) {
if ((ml_vec3f_distance(i_ptr->position, position) < 50.0f) && func_8038B684(i_ptr->marker)) {
local->vile_score++;
timedFunc_set_1(0.0f, (GenFunction_1)func_802FDCB8, ITEM_1B_VILE_VILE_SCORE);
timedFunc_set_1(0.5f, (GenFunction_1)func_802FDCB8, ITEM_1B_VILE_VILE_SCORE);
@@ -547,12 +545,12 @@ bool chvilegame_find_closest_piece(ActorMarker *marker, f32 position[0], f32 yaw
piece_direction[0] = i_ptr->position[0] - position[0];
piece_direction[1] = i_ptr->position[1] - position[1];
piece_direction[2] = i_ptr->position[2] - position[2];
distance = ml_distance_vec3f(i_ptr->position, position);
distance = ml_vec3f_distance(i_ptr->position, position);
angle_diff = func_80256AB4(target_direction[0], target_direction[2], piece_direction[0], piece_direction[2]);
if( (distance > 300.0f)
|| ((-0.8 < angle_diff) && (angle_diff < 0.8) && ((piece_direction[0]*target_direction[0] + piece_direction[1]*target_direction[1] + piece_direction[2]*target_direction[2]) >= 0.0f))
) {
if ((closest_piece == NULL) || (distance < ml_distance_vec3f(position, closest_piece->position))){
if ((closest_piece == NULL) || (distance < ml_vec3f_distance(position, closest_piece->position))){
closest_piece = i_ptr;
}
}

View File

@@ -1,9 +1,9 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "CC.h"
#include <core1/viewport.h>
#include "core2/modelRender.h"
typedef struct{

View File

@@ -1,8 +1,8 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
#include "core2/modelRender.h"
extern BKCollisionTri *func_8028EF48(void);
@@ -19,7 +19,6 @@ extern int func_80340020(s32, f32[3], s32, f32, s32, BKVertexList *, f32[3], f32
extern void boneTransformList_getBoneScale(s32, s32, f32[3]);
extern void boneTransformList_setBoneScale(s32, s32, f32[3]);
extern void func_8033A9A8(s32, s32, f32[3]);
extern void ml_vec3f_normalize(f32[3]);
extern void func_8033A45C(s32, s32);
extern void modelRender_setBoneTransformList(s32);
extern void func_8028FAB0(f32[3]);
@@ -331,7 +330,7 @@ void CC_func_80388F4C(void){
CC_func_80387D4C();
if(D_80389FA0.unk21 != 0 && func_80334904() == 2){
player_getPosition(sp6C);
D_80389FA0.unk20 = (ml_distance_vec3f(sp6C, D_80389FA0.unkC) < 200.0f);
D_80389FA0.unk20 = (ml_vec3f_distance(sp6C, D_80389FA0.unkC) < 200.0f);
D_80389FA0.unk38 += sp68;
sp64 = skeletalAnim_getProgress(D_80389FA0.unk0);
@@ -381,7 +380,7 @@ void CC_func_80388F4C(void){
if(D_80389FA0.unk21 == 3){
func_8034A174(D_80389FA0.unk34, 6, sp48);
if(ml_distance_vec3f(sp48, sp6C) <= 130.0f && sp6C[1] - sp48[1] < 50.0f){
if(ml_vec3f_distance(sp48, sp6C) <= 130.0f && sp6C[1] - sp48[1] < 50.0f){
func_8031D04C(MAP_21_CC_WITCH_SWITCH_ROOM, 1);
}
}//L80389260

View File

@@ -136,7 +136,7 @@ void func_803870F8(Actor *this){
sp3C[0] = this->position_x;
sp3C[1] = this->position_y + 100;
sp3C[2] = this->position_z;
if(ml_distance_vec3f(&sp3C, &sp70) < 120.0f){
if(ml_vec3f_distance(&sp3C, &sp70) < 120.0f){
func_8031D04C(MAP_22_CC_INSIDE_CLANKER, (local->unk0 == 1)? 7 : 6);
}
}//L80387500

View File

@@ -45,7 +45,7 @@ void func_803878A0(Actor *this, s32 next_state) {
local->unkC[0] = randf2(-500.0f, 500.0f);
local->unkC[1] = randf2(400.0f, 900.0f);
local->unkC[2] = randf2(-400.0f, 700.0f);
if(ml_distance_vec3f(this->position, local->unkC) > 800.0f)
if(ml_vec3f_distance(this->position, local->unkC) > 800.0f)
break;
}
local->unk8 = randf2(500.0f, 1000.0f);
@@ -90,7 +90,7 @@ void CCW_func_80387A40(Actor *this) {
sp5C[0] = local->unkC[0] - this->position[0];
sp5C[1] = local->unkC[1] - this->position[1];
sp5C[2] = local->unkC[2] - this->position[2];
if (ml_distance_vec3f(this->position, local->unkC) < 500.0f) {
if (ml_vec3f_distance(this->position, local->unkC) < 500.0f) {
ml_vec3f_set_length(sp5C, local->unk8 * 8.0f);
} else {
ml_vec3f_set_length(sp5C, local->unk8 * 2);
@@ -106,7 +106,7 @@ void CCW_func_80387A40(Actor *this) {
}
func_80258A4C(this->position, this->yaw - 90.0f, local->unkC, &sp58, &sp54, &sp50);
this->yaw += 140.0f * sp50 * sp68;
if (ml_distance_vec3f(this->position, local->unkC) < 100.0f) {
if (ml_vec3f_distance(this->position, local->unkC) < 100.0f) {
func_803878A0(this, 1);
}
}

View File

@@ -1,8 +1,8 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
typedef struct{
@@ -183,10 +183,10 @@ void func_8038687C(Actor *this) {
sp4C[1] = -100.0f;
sp4C[2] = randf2(-500.0f, 900.0f);
if(ml_distance_vec3f(this->position, sp4C) < 400.0f)
if(ml_vec3f_distance(this->position, sp4C) < 400.0f)
continue;
tmp = ml_distance_vec3f(sp5C, sp4C);
tmp = ml_vec3f_distance(sp5C, sp4C);
phi_v0 = (phi_s0 < 0xA) ? 500 : 200;
if(tmp < (f32) phi_v0)
continue;
@@ -207,7 +207,7 @@ void func_8038687C(Actor *this) {
func_803865F4(this, 3);
} else if ((local->unk0 != NULL) && (map_get() == MAP_5A_CCW_SUMMER_ZUBBA_HIVE)) {
player_getPosition(sp40);
if ((ml_distance_vec3f(this->position, sp40) < 300.0f) && (player_getTransformation() == TRANSFORM_1_BANJO)) {
if ((ml_vec3f_distance(this->position, sp40) < 300.0f) && (player_getTransformation() == TRANSFORM_1_BANJO)) {
func_803865F4(this, 2);
}
}

View File

@@ -161,7 +161,7 @@ void chGobiCCW_update(Actor *this) {
if(this->state == 1){
if (!this->has_met_before) {
player_getPosition(sp48);
if (ml_distance_vec3f(this->position, sp48) < 600.0f) {
if (ml_vec3f_distance(this->position, sp48) < 600.0f) {
if (local->unk0->unk2 != 0) {
gcdialog_showText((s32) local->unk0->unk2, 4, NULL, NULL, NULL, NULL);
}

View File

@@ -271,7 +271,7 @@ void CCW_func_80389BFC(Actor *this) {
}
if ((local->unk0->map_id != MAP_43_CCW_SPRING) && ((this->position[0] + 500.0f) < sp4C[0])) {
player_setCarryObjectPoseInCylinder(this->position, 1110.0f, 200.0f, ACTOR_2A2_CATERPILLAR, &this);
if ((local->unk0->unkE != 0) && (carriedObj_getActorId() == ACTOR_2A2_CATERPILLAR) && (ml_distance_vec3f(this->position, sp4C) < 1010.0f) && (player_throwCarriedObject() != 0)) {
if ((local->unk0->unkE != 0) && (carriedObj_getActorId() == ACTOR_2A2_CATERPILLAR) && (ml_vec3f_distance(this->position, sp4C) < 1010.0f) && (player_throwCarriedObject() != 0)) {
player_setThrowTargetPosition(D_8038FDE0);
if ((local->unk0->map_id == MAP_44_CCW_SUMMER) && (local->unk4 == 0)) {
gcdialog_showText(0xCD8, 4, NULL, NULL, NULL, NULL);

View File

@@ -111,13 +111,13 @@ void chcaterpillar_update(Actor *this){
if(this->state == 1){
skeletalAnim_getProgressRange(this->unk148, &sp64, &sp60);
player_getPosition(sp74);
if(ml_distance_vec3f(this->position, local->unk0) < 10.0f){
if(ml_vec3f_distance(this->position, local->unk0) < 10.0f){
for(i = 0; i < 10; i++){
local->unk0[0] = randf2(-300.0f, 300.0f) + this->position_x;
local->unk0[1] = this->position_y;
local->unk0[2] = randf2(-300.0f, 300.0f) + this->position_z;
if( !(ml_distance_vec3f(local->unk0, this->position) < 50.0f) && func_80329210(this, local->unk0))
if( !(ml_vec3f_distance(local->unk0, this->position) < 50.0f) && func_80329210(this, local->unk0))
break;
}//L8038A544
if(i == 10){
@@ -150,7 +150,7 @@ void chcaterpillar_update(Actor *this){
}
}//L8038A714
if(ml_distance_vec3f(this->position, sp74) < 50.0f){
if(ml_vec3f_distance(this->position, sp74) < 50.0f){
func_8028F030(ACTOR_2A2_CATERPILLAR);
if(!volatileFlag_get(VOLATILE_FLAG_B2)){
gcdialog_showText(ASSET_CC7_TEXT_UNKNOWN, 4, NULL, NULL, NULL, NULL);
@@ -177,7 +177,7 @@ void chcaterpillar_update(Actor *this){
local->unk24 += 3.3333333333333335*sp84;
local->unk24 = (1.0 < local->unk24) ? 1.0 : local->unk24;
ml_interpolate_vec3f(this->position, local->unkC, local->unk18, local->unk24);
ml_vec3f_interpolate_fast(this->position, local->unkC, local->unk18, local->unk24);
this->position[1] += 50.0f*sinf(local->unk24*3.141592654);
if(1.0 == local->unk24){

View File

@@ -101,7 +101,7 @@ void func_8038AA8C(Actor *this) {
}
player_getPosition(sp54);
if (ml_distance_vec3f(this->position, sp54) < 850.0f) {
if (ml_vec3f_distance(this->position, sp54) < 850.0f) {
func_8038A950(this, 2);
}
}

View File

@@ -133,7 +133,7 @@ void chnabnut_update(Actor *this) {
if (this->state == NABNUT_STATE_1_SAD) {
player_getPosition(sp30);
if (!this->has_met_before && (ml_distance_vec3f(this->position, sp30) < 400.0f)) {
if (!this->has_met_before && (ml_vec3f_distance(this->position, sp30) < 400.0f)) {
this->has_met_before = TRUE;
gcdialog_showText(0xCCA, 0xE, this->position, NULL, NULL, NULL);
}
@@ -143,7 +143,7 @@ void chnabnut_update(Actor *this) {
}
if (this->has_met_before && !func_803114B0()) {
player_setCarryObjectPoseInCylinder(this->position, 500.0f, 200.0f, ACTOR_2A9_ACORN, &this);
if ((carriedObj_getActorId() == ACTOR_2A9_ACORN) && (ml_distance_vec3f(this->position, sp30) < 300.0f) && player_throwCarriedObject()) {
if ((carriedObj_getActorId() == ACTOR_2A9_ACORN) && (ml_vec3f_distance(this->position, sp30) < 300.0f) && player_throwCarriedObject()) {
player_setThrowTargetPosition(D_8038F350);
local->returned_acorn_count++;
if (local->returned_acorn_count == 6) {

View File

@@ -114,7 +114,7 @@ void func_8038C41C(Actor *this) {
if ((this->marker->id == 0x1CB) && (this->state == 2)) {
player_getPosition(sp2C);
if (!this->has_met_before && (ml_distance_vec3f(this->position, sp2C) < 400.0f)) {
if (!this->has_met_before && (ml_vec3f_distance(this->position, sp2C) < 400.0f)) {
this->has_met_before = TRUE;
gcdialog_showText(0xCCD, 0, NULL, NULL, NULL, NULL);
}

View File

@@ -73,7 +73,7 @@ void func_8038C7A8(Actor *this) {
if (this->state == 1) {
player_getPosition(sp38);
if (ml_distance_vec3f(this->position, sp38) < 50.0f) {
if (ml_vec3f_distance(this->position, sp38) < 50.0f) {
func_8028F030(0x2A9);
FUNC_8030E8B4(SFX_C5_TWINKLY_POP, 1.0f, 25000, this->position, 500, 2500);
CCW_func_8038C6A0(this, 5);
@@ -91,7 +91,7 @@ void func_8038C7A8(Actor *this) {
if (this->state == 3) {
local->unk18 += 3.3333333333333333 * sp44;
local->unk18 = (local->unk18 > 1.0) ? 1.0 : local->unk18;
ml_interpolate_vec3f(this->position, local->unk0, local->unkC, local->unk18);
ml_vec3f_interpolate_fast(this->position, local->unk0, local->unkC, local->unk18);
this->position[1] += 50.0f * sinf(local->unk18 * BAD_PI);
if (local->unk18 == 1.0) {
CCW_func_8038C6A0(this, 4);

View File

@@ -118,7 +118,7 @@ void func_8038CC4C(Actor *this) {
}
if (!this->has_met_before) {
player_getPosition(sp38);
if (ml_distance_vec3f(this->position, sp38) < 900.0f) {
if (ml_vec3f_distance(this->position, sp38) < 900.0f) {
if (local->unk0->map_id != MAP_46_CCW_WINTER || func_8028F2FC()) {
gcdialog_showText(local->unk0->unk4, 4, NULL, NULL, NULL, NULL);
this->has_met_before = TRUE;

View File

@@ -116,7 +116,7 @@ void func_8038CFB4(Actor *this) {
if (this->state == 1) {
if (!this->has_met_before) {
player_getPosition(sp60);
if (ml_distance_vec3f(this->position, sp60) < 900.0f) {
if (ml_vec3f_distance(this->position, sp60) < 900.0f) {
gcdialog_showText(0xCCF, 4, NULL, NULL, NULL, NULL);
this->has_met_before = TRUE;
}

View File

@@ -69,7 +69,7 @@ void func_8038D368(Actor *this) {
if(!this->has_met_before){
player_getPosition(plyr_pos);
if (ml_distance_vec3f(this->position, plyr_pos) < 600.0f) {
if (ml_vec3f_distance(this->position, plyr_pos) < 600.0f) {
if (!jiggyscore_isCollected(JIGGY_4B_CCW_GNAWTY)) {
gcdialog_showText(local->unk0->unk2, 4, NULL, NULL, NULL, NULL);
} else {

View File

@@ -84,7 +84,7 @@ void func_8038A318(ActorMarker *caller, enum asset_e text_id, s32 arg1){
func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 32000);
func_8025A6EC(COMUSIC_5B_FP_IGLOO_HAPPY, 25000);
func_8025A58C(0, 4000);
func_8024BD08(0);
core1_ce60_incOrDecCounter(FALSE);
}
}

View File

@@ -201,7 +201,7 @@ void func_80388D70(ActorMarker *caller, enum asset_e text_id, s32 arg2){
case 0xc29://L80388DC4
func_8025A6EC(COMUSIC_3A_FP_BOGGY_RACE, 25000);
func_8025A58C(0, 4000);
func_8024BD08(0);
core1_ce60_incOrDecCounter(FALSE);
func_802BE720();
local->unk0 = partEmitMgr_newEmitter(16);
local->unk4 = partEmitMgr_newEmitter(16);

View File

@@ -1,7 +1,6 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "ml/mtx.h"
void chScarfSled_update(Actor *this);

View File

@@ -199,7 +199,7 @@ void func_8038D3D8(void){
comusic_8025AB44(COMUSIC_68_TWINKLY_MINIGAME, 0, 4000);
func_8025AABC(COMUSIC_68_TWINKLY_MINIGAME);
func_8025A58C(-1, 4000);
func_8024BD08(1);
core1_ce60_incOrDecCounter(TRUE);
}
void func_8038D41C(ActorMarker *marker){
@@ -265,7 +265,7 @@ void func_8038D5C8(ActorMarker *this_marker, ActorMarker *other_marker){
this->unk1C[1] = 0.0f;
func_8025A6EC(COMUSIC_68_TWINKLY_MINIGAME, 25000);
func_8025A58C(0, 4000);
func_8024BD08(0);
core1_ce60_incOrDecCounter(FALSE);
this->unk1C[2] = 428571.0f;
func_8025AEA0(0x68, (s32)this->unk1C[2]);
subaddie_set_state_with_direction(this, 3, 0.001f, 1);

View File

@@ -140,7 +140,7 @@ bool func_8038F5D4(Actor *this, f32 arg1[3], f32 arg2, f32 arg3, s32 arg4){
}
this->actor_specific_1_f = (1.0f- sp24)*arg2;
func_80329054(this, 2);
if(ml_distance_vec3f(this->position, arg1) <= arg4)
if(ml_vec3f_distance(this->position, arg1) <= arg4)
return TRUE;
return FALSE;

View File

@@ -1,7 +1,7 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
void func_80390EB0(Actor *this);

View File

@@ -1,8 +1,8 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "prop.h"
#include "SnS.h"
#include "actor.h"
extern ActorInfo D_80367FE0;

View File

@@ -69,7 +69,7 @@ void func_8038ABDC(void){
comusic_8025AB44(COMUSIC_3A_FP_BOGGY_RACE, 0, 4000);
func_8025AABC(COMUSIC_3A_FP_BOGGY_RACE);
func_8025A58C(-1, 4000);
func_8024BD08(1);
core1_ce60_incOrDecCounter(TRUE);
}
void func_8038AC20(s32 gate_indx, s32 arg1){

View File

@@ -2,7 +2,7 @@
#include "functions.h"
#include "variables.h"
extern void func_80244BB0(s32, s32, s32, f32);
extern void core1_7090_initSfxSource(s32, s32, s32, f32);
typedef struct {
f32 unk0[3];
@@ -75,13 +75,13 @@ void func_80386620(Actor *this){
}
void func_8038678C(void){
func_80244BB0(3, 0x85, 0x7ff8, 1.0f);
func_80244BB0(4, 0x85, 0x7ff8, 1.0f);
core1_7090_initSfxSource(3, 0x85, 0x7ff8, 1.0f);
core1_7090_initSfxSource(4, 0x85, 0x7ff8, 1.0f);
}
void func_803867CC(void){
func_80244C78(3);
func_80244C78(4);
core1_7090_freeSfxSource(3);
core1_7090_freeSfxSource(4);
}
void func_803867F4(void){
@@ -167,7 +167,7 @@ void chAncientOne_update(Actor *this){
if(this->unkF4_8 < 5){
D_80390C28[this->unkF4_8]->propPtr->unk8_4 = TRUE;
func_802BAFE4(GV_D_80390C20[this->unkF4_8 - 1]);
func_80244BB0(2, 0x86, 0x7ff8, 0.3f);
core1_7090_initSfxSource(2, 0x86, 0x7ff8, 0.3f);
timedFunc_set_0(0.45f, func_8038678C);
}//L80386DB0
@@ -190,7 +190,7 @@ void chAncientOne_update(Actor *this){
}//L80386D80
}
if(LOCAL_CH_ANCIENT_ONE(this)->unk1C <= this->position_y){
func_80244C78(2);
core1_7090_freeSfxSource(2);
timedFunc_set_0(0.5f, func_803867CC);
}
}//L80386DB0

View File

@@ -1,7 +1,7 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
void GV_func_8038A084(Actor *this);

View File

@@ -2,7 +2,6 @@
#include "functions.h"
#include "variables.h"
f32 func_80257204(f32, f32, f32, f32);
void func_8038B124(Actor *this);
/* .data */

View File

@@ -72,7 +72,7 @@ void func_8038D47C(Actor *this){
if(!mapSpecificFlags_get(0x14)){
player_getPosition(sp3C);
if(func_8028ECAC() == 0){
if( ml_distance_vec3f(sp3C, this->unk1C) < 100.0f || ml_distance_vec3f(sp3C, this->velocity) < 100.0f){
if( ml_vec3f_distance(sp3C, this->unk1C) < 100.0f || ml_vec3f_distance(sp3C, this->velocity) < 100.0f){
if(gcdialog_showText(ASSET_A7B_TEXT_JINXY_MEET, 0, NULL, NULL, NULL, NULL)){
mapSpecificFlags_set(0x14, 1);
}

View File

@@ -1,10 +1,10 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "SnS.h"
#include "actor.h"
extern void func_80244BB0(s32, s32, s32, f32);
extern void core1_7090_initSfxSource(s32, s32, s32, f32);
extern void func_802D3D54(Actor *this);
extern void func_802D3D74(Actor *this);
extern Actor *func_80325F2C(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
@@ -231,7 +231,7 @@ void func_8038E648(Actor *this){
func_802BAFE4(2);
subaddie_set_state(this, 6);
this->unk38_31 = 600;
func_80244BB0(0, 0x6A, 0x7ff8, 0.3f);
core1_7090_initSfxSource(0, 0x6A, 0x7ff8, 0.3f);
func_802D68F0(25);
item_set(ITEM_6_HOURGLASS, 1);
}
@@ -243,7 +243,7 @@ void func_8038E648(Actor *this){
subaddie_set_state(this, 7);
this->pitch = 90.0f;
func_8030E540(SFX_7F_HEAVYDOOR_SLAM);
func_80244C78(0);
core1_7090_freeSfxSource(0);
}
break;
@@ -251,7 +251,7 @@ void func_8038E648(Actor *this){
this->unk38_31 -= time_getDelta();
if(this->unk38_31 == 0){
subaddie_set_state(this, 8);
func_80244BB0(0, 0x6A, 0x7ff8, 0.3f);
core1_7090_initSfxSource(0, 0x6A, 0x7ff8, 0.3f);
}
break;
@@ -262,7 +262,7 @@ void func_8038E648(Actor *this){
this->pitch = 0.0f;
func_8030E540(SFX_7F_HEAVYDOOR_SLAM);
mapSpecificFlags_set(5, FALSE);
func_80244C78(0);
core1_7090_freeSfxSource(0);
volatileFlag_setAndTriggerDialog_0(VOLATILE_FLAG_AC_GV_TRAPDOOR_MISSED);
}
break;
@@ -296,7 +296,7 @@ void func_8038E97C(Actor *this){
this->position_y += 130.0;
this->unk38_31 = 30;
subaddie_set_state(this, 8);
func_80244BB0(1, 0x6A, 0x7ff8, 0.3f);
core1_7090_initSfxSource(1, 0x6A, 0x7ff8, 0.3f);
}
}//L8038EA6C
@@ -314,7 +314,7 @@ void func_8038E97C(Actor *this){
this->unk38_31 -= 1;
if(this->unk38_31 == 0){
subaddie_set_state(this, 1);
func_80244C78(1);
core1_7090_freeSfxSource(1);
func_8030E540(SFX_7F_HEAVYDOOR_SLAM);
}
@@ -330,7 +330,7 @@ void chKazooieDoor_update(Actor *this){
func_8025A6EC(COMUSIC_2B_DING_B, -1);
func_802BAFE4(3);
subaddie_set_state(this, 6);
func_80244BB0(1, 0x6a, 0x7ff8, 0.3f);
core1_7090_initSfxSource(1, 0x6a, 0x7ff8, 0.3f);
this->unk1C[1] = this->position_y + 210.0f;
this->unk1C[0] = this->position_y;
}
@@ -342,7 +342,7 @@ void chKazooieDoor_update(Actor *this){
if(this->unk1C[1] <= this->position_y){
subaddie_set_state(this, 7);
func_8030E540(SFX_7F_HEAVYDOOR_SLAM);
func_80244C78(1);
core1_7090_freeSfxSource(1);
this->unk38_31 = 450;
}
break;
@@ -351,7 +351,7 @@ void chKazooieDoor_update(Actor *this){
this->unk38_31--;
if(this->unk38_31 == 0){
subaddie_set_state(this, 8);
func_80244BB0(1, 0x6a, 0x7ff8, 0.3f);
core1_7090_initSfxSource(1, 0x6a, 0x7ff8, 0.3f);
}
break;
@@ -362,7 +362,7 @@ void chKazooieDoor_update(Actor *this){
this->position_y = this->unk1C[0];
subaddie_set_state(this, 1);
func_8030E540(SFX_7F_HEAVYDOOR_SLAM);
func_80244C78(1);
core1_7090_freeSfxSource(1);
mapSpecificFlags_set(6, FALSE);
}
break;

View File

@@ -8,7 +8,7 @@
/* external function declarations */
void func_80353064(f32 *, f32);
void func_802BB3DC(s32, f32, f32);
void func_80244BB0(s32, s32, s32, f32);
void core1_7090_initSfxSource(s32, s32, s32, f32);
/* public function declarations */
void chchimpystump_update(Actor *this);
@@ -33,7 +33,7 @@ void __chchimpystump_updateShaking(Actor *this) {
if (this->unk10_12 == 0) {
this->unk10_12 = 1;
func_802BB3DC(1, 3.0f, 1.0f);
func_80244BB0(0, 0x6A, 0x7FF8, 0.2f);
core1_7090_initSfxSource(0, 0x6A, 0x7FF8, 0.2f);
}//L80386D0C
this->position_x = ((globalTimer_getTime() & 1) * 2) ^ (s32) this->position_x;
@@ -67,7 +67,7 @@ void chchimpystump_update(Actor *this) {
this->position_y = this->actor_specific_1_f;
subaddie_set_state(this, CHIMPY_STUMP_STATE_3_RAISED);
func_802BB41C(1);
func_80244C78(0);
core1_7090_freeSfxSource(0);
}
if ((globalTimer_getTime() & 3) == 2) {

View File

@@ -2,9 +2,6 @@
#include "functions.h"
#include "variables.h"
/* extern functions */
extern void ml_vec3f_assign(f32[3], f32, f32, f32);
/* public functions */
void chLoggo_update(Actor *this);

View File

@@ -1,7 +1,7 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
typedef struct{
ActorMarker *jiggy_marker;

View File

@@ -210,7 +210,7 @@ void chChompa_update(Actor *this) {
}//L803880B4
player_getPosition(plyr_position);
plyr_dist = ml_distance_vec3f(this->position, plyr_position);
plyr_dist = ml_vec3f_distance(this->position, plyr_position);
if (this->state == CHOMPA_STATE_4_BITING) {
actor_collisionOn(this);

View File

@@ -1,7 +1,7 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "SnS.h"
#include "actor.h"
extern ActorInfo D_8038BC28;
@@ -33,7 +33,7 @@ extern ActorInfo D_8038BEFC;
extern ActorInfo D_80367E70;
extern ActorInfo D_80372C3C;
extern void func_80244BB0(s32, s32, s32, f32);
extern void core1_7090_initSfxSource(s32, s32, s32, f32);
extern void func_8025AE0C(s32, f32);
extern void func_802EE6CC(f32[3], f32[3], s32[4], s32, f32, f32, s32, s32, s32);
extern void *func_80309B48(f32[3], f32[3], f32[3], u32);
@@ -307,7 +307,7 @@ void func_80388BDC(Actor *this) {
if(mapSpecificFlags_get(MMM_SPECIFIC_FLAG_0_UNKNOWN)) {
func_802BAFE4(0x21);
subaddie_set_state(this, 6);
func_80244BB0(0, 0x6A, 0x7FF8, 0.3f);
core1_7090_initSfxSource(0, 0x6A, 0x7FF8, 0.3f);
mapSpecificFlags_set(MMM_SPECIFIC_FLAG_2_UNKNOWN, FALSE);
func_8025A6EC(COMUSIC_4_MMM_CLOCK_VERSION, -1);
func_8025AE0C(2000, 3.0f);
@@ -320,7 +320,7 @@ void func_80388BDC(Actor *this) {
subaddie_set_state(this, 7U);
this->yaw = 270.0f;
func_8030E540(0x7F);
func_80244C78(0);
core1_7090_freeSfxSource(0);
func_802D68F0(0xE);
item_set(6, 1);
}
@@ -341,7 +341,7 @@ void func_80388BDC(Actor *this) {
func_802BAFE4(0x23);
}
subaddie_set_state(this, 8);
func_80244BB0(0, 0x6A, 0x7FF8, 0.3f);
core1_7090_initSfxSource(0, 0x6A, 0x7FF8, 0.3f);
}
break;
case 8:
@@ -351,7 +351,7 @@ void func_80388BDC(Actor *this) {
this->yaw = 0.0f;
func_8030E540(SFX_7F_HEAVYDOOR_SLAM);
mapSpecificFlags_set(MMM_SPECIFIC_FLAG_0_UNKNOWN, FALSE);
func_80244C78(0);
core1_7090_freeSfxSource(0);
if (!this->unk38_31) {
func_8025A6EC(COMUSIC_3C_MINIGAME_LOSS, 0x7FF8);
func_8025AE0C(0x7D0, 2.5f);

View File

@@ -385,7 +385,7 @@ void organMinigame_update(void){
if(func_8038769C(D_8038C4F0.motzhand_marker)){
player_getPosition(plyr_pos);
motzhand_2 = marker_getActor(D_8038C4F0.motzhand_marker);
if( ml_distance_vec3f(motzhand_2->position, plyr_pos) < 400.0f
if( ml_vec3f_distance(motzhand_2->position, plyr_pos) < 400.0f
&& motzhand_2->position_y - 50.0f <= plyr_pos[1]
){
organMinigame_setState(2);

View File

@@ -1,11 +1,10 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
/* extern functions */
extern void sfxsource_setSampleRate(u8, s32);
extern f32 ml_vec3f_horizontal_distance_zero_likely(f32[3], f32[3]);
/* data */
enum chTumblar_state_e {

View File

@@ -119,7 +119,7 @@ void func_803890BC(Actor *this){
local->unk1C += 0.25 * sp38;
if(1.0f < local->unk1C)
local->unk1C = 1.0f;
ml_interpolate_vec3f(sp2C, local->unk4, local->unk10, local->unk1C);
ml_vec3f_interpolate_fast(sp2C, local->unk4, local->unk10, local->unk1C);
this->pitch = sp2C[0];
this->yaw = sp2C[1];
this->roll = sp2C[2];

View File

@@ -4,7 +4,6 @@
#include "core2/particle.h"
extern void ml_interpolate_vec3f(f32 [3], f32 [3], f32 [3], f32);
extern void bundle_setYaw(f32);
extern int func_80309EB0(f32(*)[3], f32, f32 (*)[3], s32);
extern int func_803342AC(f32(*)[3], f32(*)[3],f32);
@@ -276,7 +275,7 @@ void func_8038F430(ActorMarker *marker, s32 arg1){
if(actor->state < 3){
player_getPosition(&sp18);
if(ml_distance_vec3f(&actor->position, &sp18) < 300.0f)
if(ml_vec3f_distance(&actor->position, &sp18) < 300.0f)
func_8028F55C(5, actor->marker);
func_8038F190(actor, 3);
}//L8038F4A4
@@ -353,7 +352,7 @@ void func_8038F618(Actor *this){
}
func_8038E92C(this);
if(this->state == 1){
if(sp78 && ml_distance_vec3f(&this->position, &sp7C) < 500.0f){
if(sp78 && ml_vec3f_distance(&this->position, &sp7C) < 500.0f){
func_8038F190(this, 2);
}
}//L8038F7A0
@@ -372,7 +371,7 @@ void func_8038F618(Actor *this){
skeletalAnim_getProgressRange(this->unk148, &sp6C, &sp68);
if(0.1 <= sp68 && sp68 <= 0.6)
ml_interpolate_vec3f(this->position, &local->unk14, &local->unk20, (sp68 - 0.1) /0.5 );
ml_vec3f_interpolate_fast(this->position, &local->unk14, &local->unk20, (sp68 - 0.1) /0.5 );
if(sp6C < 0.6 && 0.6 <= sp68)
func_8030E878(SFX_6C_LOCKUP_CLOSING, 1.1 + randf2(-0.05f, 0.05f), 20000, this->position, 500.0f, 1000.0f);
@@ -387,7 +386,7 @@ void func_8038F618(Actor *this){
this->yaw += (sp44*400.0f)*sp70;
if(skeletalAnim_getLoopCount(this->unk148) > 0){
if(ml_distance_vec3f(&this->position, &local->unk8) < 10.0f){
if(ml_vec3f_distance(&this->position, &local->unk8) < 10.0f){
func_8038F190(this, 1);
}else{
func_8038F190(this, 2);

View File

@@ -546,7 +546,7 @@ void func_8038D8BC(Actor *this){
}
}
else{//L8038DAA8
if(ml_distance_vec3f(this->position, player_position) < 1200.0f){
if(ml_vec3f_distance(this->position, player_position) < 1200.0f){
RBB_func_8038CC9C(this, 2);
}
}
@@ -582,7 +582,7 @@ void func_8038D8BC(Actor *this){
skeletalAnim_getProgressRange(this->unk148, &sp54, &sp50);
if(0.1 <= sp50 && sp50 <= 0.6){
sp4C = (sp50 - 0.1)/0.5;
ml_interpolate_vec3f(this->position, local->unk8, local->unk14, sp4C);
ml_vec3f_interpolate_fast(this->position, local->unk8, local->unk14, sp4C);
this->yaw = local->unk24 + sp4C*(local->unk28 - local->unk24);
}
@@ -600,7 +600,7 @@ void func_8038D8BC(Actor *this){
tmp_f2 = tmp_f2/0.3;
else
tmp_f2 = 1.0f;
ml_interpolate_vec3f(this->position, local->unk8, local->unk14, tmp_f2);
ml_vec3f_interpolate_fast(this->position, local->unk8, local->unk14, tmp_f2);
}
}//L8038DE10

View File

@@ -1,9 +1,9 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "prop.h"
#include "actor.h"
#include <core1/viewport.h>
extern ActorInfo D_80390D20;

View File

@@ -101,7 +101,7 @@ void func_80387488(ActorMarker *marker){
player_getPosition(&sp1C);
if(-50.0f < sp1C[1] && sp1C[1] < 600.0f){
sp1C[1] = 0;
if(ml_distance_vec3f(&sp1C, &D_80390264) < 500.0f){
if(ml_vec3f_distance(&sp1C, &D_80390264) < 500.0f){
timedFunc_set_1(1.0f, (GenFunction_1) func_80387488, (s32)actor->marker);
return;
}

View File

@@ -495,7 +495,7 @@ void chSmBottles_update(Actor *this) {
(this->unkF4_8 == 8 && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_2)) ||
(this->unkF4_8 == 8 && mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED) && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_F))
) {//L80389C50
if (((ml_distance_vec3f(plyr_pos, this->unk1C) < this->actor_specific_1_f) && func_8028F20C()) ||
if (((ml_vec3f_distance(plyr_pos, this->unk1C) < this->actor_specific_1_f) && func_8028F20C()) ||
mapSpecificFlags_get(SM_SPECIFIC_FLAG_10)
) {//L80389C8C
if (func_80329530(this, 0x96)) {

View File

@@ -475,7 +475,7 @@ void chVegetablesUpdate(Actor *this) {
ml_vec3f_set_length(this->velocity, 50.0f);
}
if (ml_distance_vec3f(this->position, this->unk1C) < 20.0f) {
if (ml_vec3f_distance(this->position, this->unk1C) < 20.0f) {
func_80387E64(this);
}

View File

@@ -40,7 +40,7 @@ void func_8038A8F8(Actor *this){
this->volatile_initialized = TRUE;
}//L8038A968
player_getPosition(this->velocity);
sp2C = ml_distance_vec3f(this->velocity, this->position);
sp2C = ml_vec3f_distance(this->velocity, this->position);
if(sp2C < (f32) this->unkF4_8)
func_80388D48();
@@ -48,7 +48,7 @@ void func_8038A8F8(Actor *this){
if( !mapSpecificFlags_get(SM_SPECIFIC_FLAG_2)
|| (mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED) && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_F))
){ //L8038AA54
this->yaw_ideal = ml_distance_vec3f(this->velocity, this->unk1C) / 150.0;
this->yaw_ideal = ml_vec3f_distance(this->velocity, this->unk1C) / 150.0;
func_8028F3D8(this->unk1C, this->yaw_ideal, func_8038A8C0, this->marker);
mapSpecificFlags_set(SM_SPECIFIC_FLAG_10, TRUE);
}

View File

@@ -3,7 +3,6 @@
#include "variables.h"
extern Actor *spawnQueue_bundle_f32(s32, s32, s32, s32);
extern f32 func_80257204(f32, f32, f32, f32);
extern ActorProp * func_80320EB0(ActorMarker *, f32, s32);
static void __chClam_updateFunc(Actor *this);

View File

@@ -213,13 +213,13 @@ static void __chNipper_updateFunc(Actor *this){
if(0.0f == this->velocity_x && xVelocity){
comusic_8025AB44(COMUSIC_12_TTC_NIPPER, -1, 5000);
func_8032BB88(this, 0, 4000);
func_8024BD08(0);
core1_ce60_incOrDecCounter(FALSE);
}
else if(!xVelocity && 0.0f != this->velocity_x){
comusic_8025AB44(COMUSIC_12_TTC_NIPPER, 0, 300);
func_8025AABC(COMUSIC_12_TTC_NIPPER);
func_8032BB88(this, -1, 300);
func_8024BD08(1);
core1_ce60_incOrDecCounter(TRUE);
}
this->velocity_x = xVelocity;
}

View File

@@ -1,8 +1,8 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "prop.h"
#include "SnS.h"
#include "actor.h"
extern ActorInfo gChClam;

View File

@@ -1,8 +1,8 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "SnS.h"
/* extern */
extern void func_802D6310(f32, enum map_e, s32, s32, enum file_progress_e);

View File

@@ -1,4 +1,5 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "version.h"
@@ -6,10 +7,6 @@
#define MAIN_THREAD_STACK_SIZE 0x17F0
void setBootMap(enum map_e);
void func_8023DFF0(s32);
#if VERSION == VERSION_PAL
extern s32 D_80000300;
#endif
@@ -17,10 +14,7 @@ void func_8023DFF0(s32);
s32 D_80275610 = 0;
s32 D_80275614 = 0;
u32 gGlobalTimer = 0;
u32 sDebugVar_8027561C[] = { // never used
0x9, 0x4, 0xA, 0x3, 0xB, 0x2, 0xC, 0x5, 0x0,
0x1, 0x6, 0xD, -1
};
u32 sDebugVar_8027561C[] = { 0x9, 0x4, 0xA, 0x3, 0xB, 0x2, 0xC, 0x5, 0x0, 0x1, 0x6, 0xD, -1 }; // never used
u32 D_80275650 = VER_SELECT(0xAD019D3C, 0xA371A8F3, 0, 0); //SM_DATA_CRC_1
u32 D_80275654 = VER_SELECT(0xD381B72F, 0xD0709154, 0, 0); //SM_DATA_CRC_2
char sDebugVar_80275658[] = VER_SELECT("HjunkDire:218755", "HjunkDire:300875", "HjunkDire:", "HjunkDire:");
@@ -33,13 +27,11 @@ u64 sDebugVar_8027A540; // never used
u8 sMainThreadStack[MAIN_THREAD_STACK_SIZE]; // The real size of the stack is unclear yet, maybe there are some out-optimized debug variables below the stack
OSThread sMainThread;
s32 gBootMap;
s32 gDisableInput;
u64 sDebugVar_8027BEF0; // never used
static bool sDisableInput;
static u64 sDebugVar_8027BEF0; // never used
extern u8 core2_TEXT_START[];
extern u16 D_803A5D00[2][0x1ECC0/2];
void func_8023DA20(s32 arg0){
bzero(&D_8027A130, core2_TEXT_START - (u8*)&D_8027A130);
osWriteBackDCacheAll();
@@ -55,7 +47,7 @@ void func_8023DA74(void){
void func_8023DA9C(s32 arg0){
func_80254008();
func_8024C428();
viMgr_clearFramebuffers();
if (D_8027A130 == 4){
func_802E3580();
}
@@ -70,7 +62,7 @@ void func_8023DA9C(s32 arg0){
if (D_8027A130 == 4){
dummy_func_802E35D0();
}
dummy_func_80255CD8();
ucode_stub1();
}
u32 globalTimer_getTimeMasked(u32 mask){
@@ -107,10 +99,10 @@ void core1_init(void) {
#if VERSION == VERSION_PAL
osTvType = 0;
#endif
func_80255C30();
ucode_load();
setBootMap(getDefaultBootMap());
rarezip_init(); //initialize decompressor's huft table
func_8024BE30();
viMgr_init();
overlayManagerloadCore2();
sDebugVar_8027BEF0 = sDebugVar_8027A538;
heap_init();
@@ -151,14 +143,14 @@ void mainLoop(void){
if(D_8027A130 != 3 || getGameMode() != GAME_MODE_4_PAUSED)
globalTimer_incTimer();
if(!gDisableInput)
if (!sDisableInput)
pfsManager_update();
gDisableInput = 0;
sDisableInput = FALSE;
rumbleManager_80250C08();
if(!mapSpecificFlags_validateCRC1()){
write_file_blocks(0, 0, 0x80397AD0, 0x40);
eeprom_writeBlocks(0, 0, 0x80397AD0, 0x40);
}
switch(D_8027A130){
@@ -185,7 +177,7 @@ void mainLoop(void){
){
s32 offset;
//render weird CRC failure image
for(y= 0x1e; y < framebuffer_height - 0x1e; y++){//L8023DEB4
for(y= 0x1e; y < gFramebufferHeight - 0x1e; y++){//L8023DEB4
for(x = 0x14; x < 0xeb; x++){
tmp = ((8 * globalTimer_getTime()) + ((x*x) + (y*y)));
@@ -196,9 +188,9 @@ void mainLoop(void){
rgba = b | r | g | a;
offset = ((framebuffer_width - 0xFF) / 2) + x + (y*framebuffer_width);
D_803A5D00[0][offset] = (s32) rgba;
D_803A5D00[1][offset] = (s32) rgba;
offset = ((gFramebufferWidth - 0xFF) / 2) + x + (y*gFramebufferWidth);
gFramebuffers[0][offset] = (s32) rgba;
gFramebuffers[1][offset] = (s32) rgba;
}
}
}//L8023DF70
@@ -234,5 +226,5 @@ OSThread *mainThread_get(void) {
}
void disableInput_set(void){
gDisableInput = 1;
sDisableInput = TRUE;
}

View File

@@ -1,4 +1,5 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
@@ -23,7 +24,6 @@ u8 func_8025F4A0(ALCSPlayer *, u8);
void func_8025F3F0(ALCSPlayer *, f32, f32);
u16 func_80250474(s32 arg0);
void func_8024AF48(void);
void func_8024FB8C(void);
/* .data */
@@ -602,7 +602,7 @@ u16 func_80250474(s32 arg0){
D_80282110[i].unk10 = -1.0f;
}
osSetIntMask(sp1C);
func_8024AF48();
core1_ce60_func_8024AF48();
if(D_802762C0 == -1){
D_802762C0 = 0xFFFF;
}

View File

@@ -1,21 +0,0 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
void func_8025108C(s32 arg0);
/* .bss */
s32 D_802827F0;
/* .code */
s32 func_80251060(void){
return D_802827F0;
}
void func_8025106C(void){
func_8025108C(0);
}
void func_8025108C(s32 arg0){
D_802827F0 = arg0;
}

View File

@@ -1,31 +0,0 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
u32 func_802510A0(BKSprite *this){
return this->unk8;
}
u32 func_802510A8(BKSprite *this){
return this->unkA;
}
u32 func_802510B0(BKSprite *this){
return this->unk6;
}
u32 func_802510B8(BKSprite *this){
return this->unk4;
}
s32 spriteGetFrameCount(BKSprite *this){
return this->frameCnt;
}
BKSpriteFrame *spriteGetFramePtr(BKSprite *this, u32 frame)
{
BKSpriteFrame * new_var;
new_var = this->offsets[frame] + ((s32) ((*this).offsets + this->frameCnt));
return new_var;
}

View File

@@ -1,74 +0,0 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
struct {
u16 *data;
int unk4;
} gzBuffer;
extern u8 D_8000E800;
extern u16 D_803A5D00[2][0xF660];
void func_80253208(Gfx **gdl, s32 x, s32 y, s32 w, s32 h, void *color_buffer);
void func_80253190(Gfx **gdl){
func_80253208(gdl, 0, 0, framebuffer_width, framebuffer_height, D_803A5D00[getActiveFramebuffer()]);
}
void func_80253208(Gfx **gdl, s32 x, s32 y, s32 w, s32 h, void *color_buffer){
if( gzBuffer.data != NULL && (getGameMode() != GAME_MODE_4_PAUSED || func_80335134())){
//draw z_buffer
gDPPipeSync((*gdl)++);
gDPSetColorImage((*gdl)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_K0_TO_PHYSICAL(gzBuffer.data));
gDPSetCycleType((*gdl)++, G_CYC_FILL);
gDPSetRenderMode((*gdl)++, G_RM_NOOP, G_RM_NOOP2);
gDPSetFillColor((*gdl)++, 0xFFFCFFFC);
gDPScisFillRectangle((*gdl)++, x, y, x + w - 1, y + h - 1);
//draw color_buffer
gDPPipeSync((*gdl)++);
gDPSetColorImage((*gdl)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_K0_TO_PHYSICAL(color_buffer));
}
}
int func_80253400(void){
return gzBuffer.unk4;
}
int func_8025340C(void){
return gzBuffer.data != NULL;
}
void dummy_func_80253420(void){}
void func_80253428(int arg0) {
u16 *var_v0;
int new_var;
if (arg0) {
var_v0 = (gzBuffer.data = &D_8000E800);
while (((s32) gzBuffer.data) % 0x40) {\
var_v0 = (gzBuffer.data = var_v0 + 1);
}
do { } while ((&D_8000E800 && 1) * 0); //remove this
}else{
gzBuffer.data = 0;
}
gzBuffer.unk4 = 0;
}
void func_802534A8(int arg0){
gzBuffer.unk4 = (gzBuffer.data != NULL && arg0);
}
void zBuffer_set(Gfx **gdl){
if(gzBuffer.data && getGameMode() != GAME_MODE_4_PAUSED){
gDPPipeSync((*gdl)++);
gDPSetDepthImage((*gdl)++, gzBuffer.data);
}
}
void *zBuffer_get(void){
return gzBuffer.data;
}

View File

@@ -1,29 +1,13 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "core1/core1.h"
#include <core1/viewport.h>
static Gfx *sGfxStack[2] = { NULL, NULL };
s32 gFramebufferWidth = DEFAULT_FRAMEBUFFER_WIDTH;
s32 gFramebufferHeight = DEFAULT_FRAMEBUFFER_HEIGHT;
typedef struct {
s32 unk0;
s32 unk4;
Gfx *unk8;
Gfx *unkC;
s32 unk10;
s32 unk14;
}Struct_Core1_15B30;
extern u8 D_803A5D00[2][0x1ecc0];
/* .data */
Gfx *gGfxStack[2] = {NULL, NULL};
s32 framebuffer_width = 292;
s32 framebuffer_height = 216;
/* .bss */
Mtx *gMtxStack[2];
Vtx *gVtxStack[2];
s32 gStackSelector;
static Mtx *sMtxStack[2];
static Vtx *sVtxStack[2];
static s32 sStackSelector;
s32 gTextureFilterPoint;
Struct_Core1_15B30 D_80283008[20];
s32 D_802831E8;
@@ -35,11 +19,6 @@ u16 gScissorBoxTop;
u16 gScissorBoxBottom;
Gfx *D_80283214;
/* .h */
void scissorBox_setDefault(void);
void dummy_func_80254464(void);
/* .code */
void func_80253550(void){
osRecvMesg(&D_802831F0, NULL, OS_MESG_BLOCK);
}
@@ -74,8 +53,8 @@ void func_80253640(Gfx ** gdl, void *arg1){
gDPSetAlphaCompare((*gdl)++, G_AC_NONE);
gDPSetColorDither((*gdl)++, G_CD_MAGICSQ);
gDPSetScissor((*gdl)++, G_SC_NON_INTERLACE, gScissorBoxLeft, gScissorBoxRight, gScissorBoxTop, gScissorBoxBottom);
func_80253208(gdl, 0, 0, framebuffer_width, framebuffer_height, arg1);
gDPSetColorImage((*gdl)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_K0_TO_PHYSICAL(arg1));
func_80253208(gdl, 0, 0, gFramebufferWidth, gFramebufferHeight, arg1);
gDPSetColorImage((*gdl)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, OS_K0_TO_PHYSICAL(arg1));
gDPSetCycleType((*gdl)++, G_CYC_1CYCLE);
gDPSetTextureConvert((*gdl)++, G_TC_FILT);
gDPSetTextureDetail((*gdl)++, G_TD_CLAMP);
@@ -98,13 +77,13 @@ void scissorBox_SetForGameMode(Gfx **gdl, s32 framebuffer_idx) {
}
else{
scissorBox_setDefault();
func_80253640(gdl, D_803A5D00[framebuffer_idx]);
func_80253640(gdl, gFramebuffers[framebuffer_idx]);
}
}
void setupScissorBoxAndFramebuffer(Gfx **gfx, s32 framebuffer_address){
gSPSegment((*gfx)++, 0x00, 0x00000000);
gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_PHYSICAL_TO_K0(framebuffer_address));
gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, OS_PHYSICAL_TO_K0(framebuffer_address));
gSPClearGeometryMode((*gfx)++, G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH);
gSPTexture((*gfx)++, 0, 0, 0, G_TX_RENDERTILE, G_OFF);
gSPSetGeometryMode((*gfx)++, G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH);
@@ -121,7 +100,7 @@ void setupScissorBoxAndFramebuffer(Gfx **gfx, s32 framebuffer_address){
void setupDefaultScissorBoxAndFramebuffer(Gfx **gfx, s32 framebuffer_idx){
scissorBox_setDefault();
setupScissorBoxAndFramebuffer(gfx, D_803A5D00[framebuffer_idx]);
setupScissorBoxAndFramebuffer(gfx, gFramebuffers[framebuffer_idx]);
}
void func_80253DC0(Gfx **gfx){
@@ -184,7 +163,7 @@ void scissorBox_get(u32 *left, u32 *top, u32 *right, u32 *bottom){
}
void func_80253FE8(void){
func_8024BFAC();
viMgr_func_8024BFAC();
}
void func_80254008(void){
@@ -208,29 +187,29 @@ void drawRectangle2D(Gfx **gfx, s32 x, s32 y, s32 w, s32 h, s32 r, s32 g, s32 b)
gDPScisFillRectangle((*gfx)++, x, y, x + w -1, y + h -1);
}
void graphicsCache_release(void){
if(gGfxStack[0]){
free(gGfxStack[0]);
free(gGfxStack[1]);
free(gMtxStack[0]);
free(gMtxStack[1]);
free(gVtxStack[0]);
free(gVtxStack[1]);
gGfxStack[0] = NULL;
void graphicsCache_release(void) {
if (sGfxStack[0]) {
free(sGfxStack[0]);
free(sGfxStack[1]);
free(sMtxStack[0]);
free(sMtxStack[1]);
free(sVtxStack[0]);
free(sVtxStack[1]);
sGfxStack[0] = NULL;
}
}
void graphicsCache_init(void){
if(gGfxStack[0] == NULL){
gGfxStack[0] = (Gfx *)malloc(29600); // 3700 dlist commands
gGfxStack[1] = (Gfx *)malloc(29600);
gMtxStack[0] = (Mtx *)malloc(44800); // 700 matrices
gMtxStack[1] = (Mtx *)malloc(44800);
gVtxStack[0] = (Vtx *)malloc(6880); // 430 vertices
gVtxStack[1] = (Vtx *)malloc(6880);
if(sGfxStack[0] == NULL){
sGfxStack[0] = (Gfx *)malloc(29600); // 3700 dlist commands
sGfxStack[1] = (Gfx *)malloc(29600);
sMtxStack[0] = (Mtx *)malloc(44800); // 700 matrices
sMtxStack[1] = (Mtx *)malloc(44800);
sVtxStack[0] = (Vtx *)malloc(6880); // 430 vertices
sVtxStack[1] = (Vtx *)malloc(6880);
dummy_func_80254464();
}
gStackSelector = 0;
sStackSelector = 0;
gTextureFilterPoint = 0;
}
@@ -239,8 +218,8 @@ void scissorBox_set(s32 left, s32 top, s32 right, s32 bottom) {
gScissorBoxTop = top;
gScissorBoxRight = right;
gScissorBoxBottom = bottom;
framebuffer_width = top - left;
framebuffer_height = bottom - right;
gFramebufferWidth = top - left;
gFramebufferHeight = bottom - right;
viewport_pushFramebufferExtendsToVpStack();
}
@@ -253,7 +232,7 @@ void func_80254374(s32 arg0) {
Struct_Core1_15B30 *sp1C;
func_80253550();
func_8024C2A0(arg0);
viMgr_setActiveFramebuffer(arg0);
sp1C = &D_80283008[D_802831E8];
D_802831E8 = (s32) (D_802831E8 + 1) % 20;
func_8025357C();
@@ -267,10 +246,10 @@ void toggleTextureFilterPoint(void){
}
void getGraphicsStacks(Gfx **gfx, Mtx **mtx, Vtx **vtx){
gStackSelector = (1 - gStackSelector);
*gfx = gGfxStack[gStackSelector];
*mtx = gMtxStack[gStackSelector];
*vtx = gVtxStack[gStackSelector];
sStackSelector = (1 - sStackSelector);
*gfx = sGfxStack[sStackSelector];
*mtx = sMtxStack[sStackSelector];
*vtx = sVtxStack[sStackSelector];
}
void dummy_func_80254464(void){}
void dummy_func_80254464(void) {}

View File

@@ -1,28 +0,0 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "save.h"
#define ROUND_UP_DIVIDE(a, b) (((a) + (b) - 1) / (b))
// The round up divide is not technically needed, but will come in handy for modding
#define gameFile_NUM_BLOCKS ROUND_UP_DIVIDE(sizeof(SaveData),EEPROM_BLOCK_SIZE)
s32 write_file_blocks(s32 filenum, s32 blockOffset, u8 *buffer, s32 blockCount) {
s32 address = (filenum * gameFile_NUM_BLOCKS) + blockOffset;
s32 ret;
func_8024F35C(3);
ret = osEepromLongWrite(pfsManager_getFrameReplyQ(), address, buffer, blockCount * EEPROM_BLOCK_SIZE);
func_8024F35C(0);
return ret;
}
s32 load_file_blocks(s32 filenum, s32 blockOffset, u8 *buffer, s32 blockCount) {
s32 address = (filenum * gameFile_NUM_BLOCKS) + blockOffset;
s32 ret;
func_8024F35C(3);
ret = osEepromLongRead(pfsManager_getFrameReplyQ(), address, buffer, blockCount * EEPROM_BLOCK_SIZE);
func_8024F35C(0);
return ret;
}

View File

@@ -1,32 +0,0 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
/* .bss */
u8 D_80283280[0x100];
s32 D_80283380;
s32 D_80283384;
s32 D_80283388;
void func_80255C30(void) {
D_80283384 = *(s32 *)0xA4000000 ^ -1;
D_80283388 = (D_80283384) ? 1 :0;
D_80283380 = *(s32 *)0xA4001000 ^ 6103;
D_80283388 |= (D_80283380) ? 2 :0;
if (D_80283388 == 0) {
piMgr_read(&D_80283280, 0xB0000B70, 0x100);
}
}
void dummy_func_80255CD8(void){}
void func_80255CE0(void){
osPiReadIo(0, NULL);
}
s32 func_80255D04(void){return 0;}
void func_80255D0C(u64 **ucode_ptr, u32 *ucode_size){
*ucode_ptr = &D_80283280;
*ucode_size = 0x100;
}

View File

@@ -1,4 +1,5 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"

View File

@@ -1,4 +1,5 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "version.h"

View File

@@ -1,15 +0,0 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
void dummy_func_8025AFB0(void) {}
void dummy_func_8025AFB8(void) {}
void dummy_func_8025AFC0(Gfx **arg0, Mtx **arg1, Vtx **arg2) {}
s32 dummy_func_8025AFD0(void)
{
return 0;
}

View File

@@ -1,7 +1,7 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "SnS.h"
#include "save.h"
bool snsToRestoreItems = FALSE;

View File

@@ -1,71 +0,0 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include <core1/viewport.h>
s32 D_80275860 = 0;
void func_802409C0(f32 arg0[3], f32 arg1){
f32 vp_rotation[3];
f32 sp30[3];
f32 sp28[2];
f32 dt;
dt = time_getDelta()*arg1;
controller_getJoystick(0, sp28);
sp30[0] = sp28[0] * dt;
sp30[1] = 0.0f;
sp30[2] = -(sp28[1] * dt);
viewport_getRotation_vec3f(vp_rotation);
ml_vec3f_yaw_rotate_copy(sp30, sp30, vp_rotation[1]);
arg0[0] = arg0[0] + sp30[0];
arg0[1] = arg0[1] + sp30[1];
arg0[2] = arg0[2] + sp30[2];
}
void func_80240A74(f32 arg0[3]){
func_802409C0(arg0, 400.0f);
}
f32 func_80240A94(s32 arg0, f32 arg1){
if(arg0 >= 0x29){
arg0 = 0x28;
}
return arg1 + (f32)arg0*(arg1)/16 ;
}
void func_80240AC8(f32 arg0[3], f32 arg1){
f32 vp_rotation[3];
f32 sp30[3];
f32 sp28[2];
f32 dt;
dt = time_getDelta()*arg1;
controller_getJoystick(0, sp28);
if(0.0f != sp28[0] || 0.0f != sp28[1]){
D_80275860++;
if(D_80275860 >= 0x12D)
D_80275860 = 0x12C;
}
else{
D_80275860 = 1;
}
dt = func_80240A94(D_80275860, dt);
sp30[0] = sp28[0] * dt;
sp30[1] = 0.0f;
sp30[2] = -(sp28[1] * dt);
viewport_getRotation_vec3f(vp_rotation);
ml_vec3f_yaw_rotate_copy(sp30, sp30, vp_rotation[1]);
arg0[0] = arg0[0] + sp30[0];
arg0[1] = arg0[1] + sp30[1];
arg0[2] = arg0[2] + sp30[2];
}

View File

@@ -1,4 +1,6 @@
#include <ultra64.h>
#include "core1/core1.h"
extern f32 gu_sqrtf(f32);
static void __guMtxF2L(float mf[4][4], Mtx *m)

View File

@@ -1,4 +1,5 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "n_libaudio.h"

View File

@@ -1,7 +1,5 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "core1/rarezip.h"
#include "core1/core1.h"
static int _rarezip_uncompress(u8 **arg0, u8 **arg1, struct huft * arg2);

View File

@@ -1,70 +1,62 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
extern void sfxsource_setSampleRate(u8, s32);
extern void func_8030E2C4(u8);
s16 *D_802758E0 = NULL;
typedef struct struct_27_s{
s16 unk0;
u8 pad2[0x12];
}struct27s;
s16 * D_802758E0 = NULL;
void func_80244C78(int arg0);
/* .code */
void func_80244AB0(void){
void core1_7090_alloc(void) {
int i;
if(D_802758E0)
if (D_802758E0)
return;
D_802758E0 = (struct16s *) malloc(10*sizeof(s16));
for(i = 0; i < 10; i++){
D_802758E0 = (s16 *) malloc(10 * sizeof(s16));
for (i = 0; i < 10; i++) {
D_802758E0[i] = 0;
}
}
void func_80244B3C(void){
void core1_7090_release(void) {
int i;
if(!D_802758E0)
if (!D_802758E0)
return;
for(i = 0; i < 10; i++){
if(D_802758E0[i])
func_8030E394((u8)D_802758E0[i]);
for (i = 0; i < 10; i++) {
if (D_802758E0[i])
func_8030E394(D_802758E0[i]);
}
free(D_802758E0);
D_802758E0 = NULL;
}
void func_80244BB0(s32 arg0, s32 arg1, s32 arg2, f32 arg3){
s32 i;
u8 indx;
if(func_8030ED70(func_80255D44(arg1))){
i = sfxsource_createSfxsourceAndReturnIndex();
indx = i;
if(i){
sfxsource_setSfxId(indx, func_80255D44(arg1));
sfxsource_playSfxAtVolume(indx, arg3);
sfxsource_setSampleRate(indx, arg2);
func_8030E2C4(indx);
func_80244C78(arg0);
D_802758E0[arg0] = indx;
void core1_7090_initSfxSource(s32 idx, s32 lookup_idx, s32 sample_rate, f32 volume) {
u8 sfx_source_index;
if (func_8030ED70(lookup_getSfxId(lookup_idx))) {
sfx_source_index = sfxsource_createSfxsourceAndReturnIndex();
if (sfx_source_index) {
sfxsource_setSfxId(sfx_source_index, lookup_getSfxId(lookup_idx));
sfxsource_playSfxAtVolume(sfx_source_index, volume);
sfxsource_setSampleRate(sfx_source_index, sample_rate);
func_8030E2C4(sfx_source_index);
core1_7090_freeSfxSource(idx);
D_802758E0[idx] = sfx_source_index;
}
}
else{
func_8030E6A4(func_80255D44(arg1), arg3, arg2);
else {
func_8030E6A4(lookup_getSfxId(lookup_idx), volume, sample_rate);
}
}
void func_80244C78(int arg0){
if(D_802758E0[arg0]){
sfxsource_freeSfxsourceByIndex(D_802758E0[arg0]);
void core1_7090_freeSfxSource(int idx) {
if (D_802758E0[idx]) {
sfxsource_freeSfxsourceByIndex(D_802758E0[idx]);
}
D_802758E0[arg0] = 0;
D_802758E0[idx] = 0;
}

View File

@@ -1,11 +1,11 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
int collisionTri_isHitFromAbove_actor(f32 arg0[3], Actor *arg1, s32 arg2);
extern bool func_80320DB0(f32[3], f32, f32[3], u32);
extern bool func_80323240(struct56s *, f32, f32[3]);
extern f32 ml_dotProduct_vec3f(f32[3], f32[3]);
extern BKCollisionTri *func_80320B98(f32[3], f32[3], f32[3], u32);
extern BKCollisionTri *func_80320C94(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3[3], s32 arg4, u32 arg5);
extern f32 func_8031C5D4(struct0*);
@@ -121,7 +121,7 @@ void func_802450DC(f32 arg0[3], f32 arg1[3], f32 arg2[3], f32 arg3[3], f32 arg4[
ml_vec3f_diff_copy(sp3C, arg1, arg0);
ml_vec3f_diff_copy(sp30, arg3, arg2);
ml_vec3f_diff_copy(sp24, sp3C, sp30);
phi_f12 = -ml_dotProduct_vec3f(arg4, sp24);
phi_f12 = -ml_vec3f_dot_product(arg4, sp24);
phi_f12 = MAX(5.0f, phi_f12);
arg1[0] += phi_f12 * arg4[0];
arg1[1] += phi_f12 * arg4[1];
@@ -144,13 +144,13 @@ void func_802451A4(f32 arg0[3], f32 arg1[3], f32 arg2[3], f32 arg3[3], f32 arg4[
ml_vec3f_diff_copy(sp54, sp6C, sp60);
ml_vec3f_normalize_copy(sp3C, sp54);
ml_vec3f_yaw_rotate_copy(sp30, sp3C, 90.0f);
sp28 = ml_dotProduct_vec3f(arg4, sp3C);
sp28 = ml_vec3f_dot_product(arg4, sp3C);
if (arg5 != 0) {
D_8027EF30 = ml_dotProduct_vec3f(arg4, sp30);
D_8027EF30 = ml_vec3f_dot_product(arg4, sp30);
}
phi_v0 = (D_8027EF30 < 0.0f) ? -1 : 1;
ml_vec3f_yaw_rotate_copy(sp48, arg4,(phi_v0 * sp28) * 45.0);
phi_f12 = -ml_dotProduct_vec3f(sp48, sp54);
phi_f12 = -ml_vec3f_dot_product(sp48, sp54);
phi_f12 = MAX(5.0f, phi_f12);
arg1[0] += phi_f12 * sp48[0];
arg1[1] += phi_f12 * sp48[1];
@@ -279,7 +279,7 @@ void func_8024560C(f32 arg0[3], struct0 *arg1, UNK_TYPE(s32) arg2, u8 *arg3, f32
}
BKCollisionTri *func_8024575C(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3[3], s32 arg4, u32 arg5){
if(arg2 < ml_distance_vec3f(arg0, arg1)){
if(arg2 < ml_vec3f_distance(arg0, arg1)){
return NULL;
}
return func_80320C94(arg0, arg1, arg2, arg3, arg4, arg5);

View File

@@ -1,4 +1,5 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "version.h"

View File

@@ -1,4 +1,5 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "version.h"
@@ -120,7 +121,7 @@ void func_80246744(OSMesg arg0){
}
void func_80246794(Struct_Core1_8C50_s * arg0){
func_80255D0C(&D_80275910.t.ucode_boot, &D_80275910.t.ucode_boot_size);
ucode_getPtrAndSize(&D_80275910.t.ucode_boot, &D_80275910.t.ucode_boot_size);
D_80275910.t.ucode = n_aspMainTextStart;
D_80275910.t.ucode_data = n_aspMainDataStart;
D_80275910.t.data_ptr = (void*) arg0->unk8;
@@ -134,7 +135,7 @@ void func_80246794(Struct_Core1_8C50_s * arg0){
}
void func_80246844(Struct_Core1_8C50_s * arg0){
func_80255D0C(&D_80275950.t.ucode_boot, &D_80275950.t.ucode_boot_size);
ucode_getPtrAndSize(&D_80275950.t.ucode_boot, &D_80275950.t.ucode_boot_size);
D_80275950.t.ucode = gSPF3DEX_fifoTextStart;
D_80275950.t.ucode_data = gSPF3DEX_fifoDataStart;
D_80275950.t.data_ptr = (void*) arg0->unk8;
@@ -152,7 +153,7 @@ void func_80246844(Struct_Core1_8C50_s * arg0){
}
void func_8024692C(Struct_Core1_8C50_s * arg0){
func_80255D0C(&D_80275950.t.ucode_boot, &D_80275950.t.ucode_boot_size);
ucode_getPtrAndSize(&D_80275950.t.ucode_boot, &D_80275950.t.ucode_boot_size);
D_80275950.t.ucode = gSPL3DEX_fifoTextStart;
D_80275950.t.ucode_data = gSPL3DEX_fifoDataStart;
D_80275950.t.data_ptr = (void*) arg0->unk8;
@@ -218,7 +219,7 @@ void func_80246C2C(void){
if((D_8027FC14 << 1) < 0){
osDpSetStatus(DPC_SET_FREEZE);
D_80280688 = osViGetCurrentFramebuffer();
func_8024BFAC();
viMgr_func_8024BFAC();
}
D_8027FC14 = D_8027FC18 = 2;
D_80275998 = 0;
@@ -473,7 +474,7 @@ void func_80247560(void){
osSetEventMesg(OS_EVENT_SP, &D_8027FB60, CORE1_8C50_EVENT_SP);
osSetEventMesg(OS_EVENT_FAULT, &D_8027FB60, CORE1_8C50_EVENT_FAULT);
osSetEventMesg(OS_EVENT_PRENMI, &D_8027FB60, CORE1_8C50_EVENT_PRENMI);
func_8024BDAC(&D_8027FB60, 5);
viMgr_func_8024BDAC(&D_8027FB60, 5);
D_8027FC0C = 0;
D_8027FC10 = 0;
D_8027FC14 = D_8027FC18 = 2;

View File

@@ -1,13 +1,11 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "version.h"
#if VERSION == VERSION_USA_1_0
extern u16 D_803A5D00[2][0xF660]; //framebuffer
extern s32 framebuffer_width; //framebuffer width
extern s32 framebuffer_height; //framebuffer height
/* .data */
u8 D_80275A50[8][3] = {
@@ -95,11 +93,11 @@ void func_80247750(s32 r, s32 g, s32 b){
void func_8024776C(s32 x, s32 y) {
s32 rgba16;
if( ((x >= 0) && (x < framebuffer_width))
&& ((y >= 0) && (y < framebuffer_height))
if( ((x >= 0) && (x < gFramebufferWidth))
&& ((y >= 0) && (y < gFramebufferHeight))
) {
D_803A5D00[0][x + y*framebuffer_width] = _SHIFTL(D_80275A68 >> 3, 11, 5) | _SHIFTL(D_80275A6C >> 3, 6, 5) | _SHIFTL(D_80275A70 >> 3, 1, 5) | _SHIFTL(1, 0, 1);
D_803A5D00[1][x + y*framebuffer_width] = _SHIFTL(D_80275A68 >> 3, 11, 5) | _SHIFTL(D_80275A6C >> 3, 6, 5) | _SHIFTL(D_80275A70 >> 3, 1, 5) | _SHIFTL(1, 0, 1);
gFramebuffers[0][x + y*gFramebufferWidth] = _SHIFTL(D_80275A68 >> 3, 11, 5) | _SHIFTL(D_80275A6C >> 3, 6, 5) | _SHIFTL(D_80275A70 >> 3, 1, 5) | _SHIFTL(1, 0, 1);
gFramebuffers[1][x + y*gFramebufferWidth] = _SHIFTL(D_80275A68 >> 3, 11, 5) | _SHIFTL(D_80275A6C >> 3, 6, 5) | _SHIFTL(D_80275A70 >> 3, 1, 5) | _SHIFTL(1, 0, 1);
}
}
@@ -119,7 +117,7 @@ void func_80247818(s32 x, s32 y, s32 w, s32 h) {
void func_802478C0(s32 r, s32 g, s32 b) {
func_80247750(r, g, b);
func_80247818((framebuffer_width - 128) / 2, (framebuffer_height - 100) / 2, 128, 100);
func_80247818((gFramebufferWidth - 128) / 2, (gFramebufferHeight - 100) / 2, 128, 100);
}
void func_8024792C(void){}
@@ -206,9 +204,9 @@ void func_80247C20(void) {
}
if (D_80275BE0) {
for(i = 0; i < framebuffer_width * framebuffer_height; i++){
D_803A5D00[0][i] = 0;
D_803A5D00[1][i] = 0;
for(i = 0; i < gFramebufferWidth * gFramebufferHeight; i++){
gFramebuffers[0][i] = 0;
gFramebuffers[1][i] = 0;
}
osWriteBackDCacheAll();
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,44 +1,30 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "core1/core1.h"
// transform seed (in mips3 file)
u32 func_8025C29C(u32 *seed);
u32 func_8025C29C(u32 *seed); // TODO: This function does not exist in source code, why does it work?
void glcrc_calc_checksum(void *start, void *end, u32 checksum[2])
{
void glcrc_calc_checksum(void *start, void *end, u32 checksum[2]) {
u8 *p;
u32 shift = 0;
u64 seed = 0x8F809F473108B3C1;
u32 crc1 = 0;
u32 crc2 = 0;
u32 tmp;
// CRC1: Iterate forwards over bytes
for (p = start; (void *)p < end; p++)
{
for (p = start; (void *)p < end; p++) {
seed += *p << (shift & 15);
tmp = func_8025C29C(&seed);
shift += 7;
crc1 ^= tmp;
}
// CRC2: Iterate backwards over bytes
for (p = (u8 *)end - 1; (void *)p >= start; p--)
{
for (p = (u8 *)end - 1; (void *)p >= start; p--) {
seed += *p << (shift & 15);
tmp = func_8025C29C(&seed);
shift += 3;
crc2 ^= tmp;
}

View File

@@ -1,4 +1,5 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"

70
src/core1/depthbuffer.c Normal file
View File

@@ -0,0 +1,70 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
struct {
void *data;
int unk4;
} sDepthBuffer;
void func_80253190(Gfx **gfx) {
func_80253208(gfx, 0, 0, gFramebufferWidth, gFramebufferHeight, gFramebuffers[getActiveFramebuffer()]);
}
void func_80253208(Gfx **gfx, s32 x, s32 y, s32 w, s32 h, void *color_buffer){
if( sDepthBuffer.data != NULL && (getGameMode() != GAME_MODE_4_PAUSED || func_80335134())){
//draw z_buffer
gDPPipeSync((*gfx)++);
gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, OS_K0_TO_PHYSICAL(sDepthBuffer.data));
gDPSetCycleType((*gfx)++, G_CYC_FILL);
gDPSetRenderMode((*gfx)++, G_RM_NOOP, G_RM_NOOP2);
gDPSetFillColor((*gfx)++, 0xFFFCFFFC);
gDPScisFillRectangle((*gfx)++, x, y, x + w - 1, y + h - 1);
//draw color_buffer
gDPPipeSync((*gfx)++);
gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, OS_K0_TO_PHYSICAL(color_buffer));
}
}
int func_80253400(void){
return sDepthBuffer.unk4;
}
bool depthBuffer_isPointerSet(void) {
return sDepthBuffer.data != NULL;
}
void depthBuffer_stub(void) {}
void func_80253428(int arg0) {
u16 *var_v0;
int new_var;
if (arg0) {
var_v0 = (sDepthBuffer.data = &D_8000E800);
while (((s32) sDepthBuffer.data) % 0x40) {
var_v0 = (sDepthBuffer.data = var_v0 + 1);
}
do { } while ((&D_8000E800 && 1) * 0); //remove this
}else{
sDepthBuffer.data = NULL;
}
sDepthBuffer.unk4 = FALSE;
}
void func_802534A8(int arg0) {
sDepthBuffer.unk4 = (sDepthBuffer.data != NULL && arg0);
}
void zBuffer_set(Gfx **gfx) {
if (sDepthBuffer.data && getGameMode() != GAME_MODE_4_PAUSED) {
gDPPipeSync((*gfx)++);
gDPSetDepthImage((*gfx)++, sDepthBuffer.data);
}
}
void *zBuffer_get(void) {
return sDepthBuffer.data;
}

30
src/core1/eeprom.c Normal file
View File

@@ -0,0 +1,30 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "save.h"
#define ROUND_UP_DIVIDE(a, b) (((a) + (b) - 1) / (b))
// The round up divide is not technically needed, but will come in handy for modding
#define GAMEFILE_NUM_BLOCKS ROUND_UP_DIVIDE(sizeof(SaveData), EEPROM_BLOCK_SIZE)
s32 eeprom_writeBlocks(s32 file, s32 offset, void *buffer, s32 count) {
s32 address = file * GAMEFILE_NUM_BLOCKS + offset;
s32 ret;
func_8024F35C(3);
ret = osEepromLongWrite(pfsManager_getFrameReplyQ(), address, buffer, count * EEPROM_BLOCK_SIZE);
func_8024F35C(0);
return ret;
}
s32 eeprom_readBlocks(s32 file, s32 offset, void *buffer, s32 count) {
s32 address = file * GAMEFILE_NUM_BLOCKS + offset;
s32 ret;
func_8024F35C(3);
ret = osEepromLongRead(pfsManager_getFrameReplyQ(), address, buffer, count * EEPROM_BLOCK_SIZE);
func_8024F35C(0);
return ret;
}

View File

@@ -1,7 +1,5 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "core1/core1.h"
#define IA8_I(ia) ((ia) >> 4)
#define IA8_A(ia) ((ia) & 0xF)
@@ -14,24 +12,12 @@
#define C5_TO_C8(c5) ((c5) << 3)
#define C8_TO_C5(c5) ((c5) >> 3)
static s32 sPrimColor_r;
static s32 sPrimColor_g;
static s32 sPrimColor_b;
static s32 sBufferIndex;
void func_8024A3C8(s32 x, s32 y);
void draw_prim_rect(s32 x, s32 y, s32 w, s32 h);
void set_prim_color(s32 r, s32 g, s32 b);
void func_8024A85C(s32 buffer_indx);
extern u16 D_803A5D00[2][0xF660]; //framebuffer
extern s32 framebuffer_width; //framebuffer width
extern s32 framebuffer_height; //framebuffer height
/* .bss */
s32 D_802806E0;
s32 D_802806E4;
s32 D_802806E8;
s32 D_802806EC;
void draw_sprite_ci4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled)
void framebufferdraw_draw_CI4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled)
{
BKSpriteFrame *sprite_frame;
s32 palette_offset;
@@ -50,11 +36,11 @@ void draw_sprite_ci4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enable
s32 color1;
s32 color2;
framebuffer = D_803A5D00[D_802806EC];
sprite_frame = spriteGetFramePtr(sprite, (u32) frame);
framebuffer = gFramebuffers[sBufferIndex];
sprite_frame = sprite_getFramePtr(sprite, (u32) frame);
if (!alpha_enabled){
set_prim_color(0, 0, 0x80);
draw_prim_rect(x, y, sprite_frame->w, sprite_frame->h);
framebufferdraw_setPrimColor(0, 0, 0x80);
framebufferdraw_drawRect(x, y, sprite_frame->w, sprite_frame->h);
}
//align palette
@@ -78,12 +64,12 @@ void draw_sprite_ci4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enable
indx1 = ((*tmem) >> 4) & 0xF;
indx2 = *tmem & 0xF;
fb_x = (chunk->x + x) + ix;
if ((0 <= fb_x) && (fb_x < framebuffer_width))
if ((0 <= fb_x) && (fb_x < gFramebufferWidth))
{
fb_y = (chunk->y + y) + iy;
if ((fb_y >= 0) && (fb_y < framebuffer_height))
if ((fb_y >= 0) && (fb_y < gFramebufferHeight))
{
pxl_ptr = (framebuffer + fb_x) + (fb_y * framebuffer_width);
pxl_ptr = (framebuffer + fb_x) + (fb_y * gFramebufferWidth);
color1 = palette[indx1];
if (color1 & 1) {
*pxl_ptr = color1;
@@ -105,7 +91,7 @@ void draw_sprite_ci4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enable
}
}
void draw_sprite_ci8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled)
void framebufferdraw_draw_CI8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled)
{
static s32 D_80275C00 = 0;
u16 *palette;
@@ -126,11 +112,11 @@ void draw_sprite_ci8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enable
if (D_80275C00 == 0xA) {
D_80275C00 = 0;
}
framebuffer = D_803A5D00[D_802806EC];
sprite_frame = spriteGetFramePtr(sprite, (u32) frame);
framebuffer = gFramebuffers[sBufferIndex];
sprite_frame = sprite_getFramePtr(sprite, (u32) frame);
if (!alpha_enabled){
set_prim_color(0, 0, 0x80);
draw_prim_rect(x, y, sprite_frame->w, sprite_frame->h);
framebufferdraw_setPrimColor(0, 0, 0x80);
framebufferdraw_drawRect(x, y, sprite_frame->w, sprite_frame->h);
}
palette = (u16 *) (sprite_frame + 1);
@@ -149,12 +135,12 @@ void draw_sprite_ci8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enable
for (iy = 0; iy < chunk->h; iy++){
for (ix = 0; ix < chunk->w; ix++){
fb_x = (chunk->x + x) + ix;
if ((0 <= fb_x) && (fb_x < framebuffer_width))
if ((0 <= fb_x) && (fb_x < gFramebufferWidth))
{
fb_y = (chunk->y + y) + iy;
if ((fb_y >= 0) && (fb_y < framebuffer_height))
if ((fb_y >= 0) && (fb_y < gFramebufferHeight))
{
pxl_ptr = (framebuffer + fb_x) + (fb_y * framebuffer_width);
pxl_ptr = (framebuffer + fb_x) + (fb_y * gFramebufferWidth);
if (palette[*tmem] & 1){
*pxl_ptr = palette[*tmem];
}
@@ -179,7 +165,7 @@ void draw_sprite_ci8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enable
}
void draw_sprite_rgba16(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabled) {
void framebufferdraw_draw_RGBA16(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabled) {
BKSpriteFrame *sprite_ptr;
BKSpriteTextureBlock *chunk_ptr;
s16 *tmem;
@@ -192,11 +178,11 @@ void draw_sprite_rgba16(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_en
u16 *pxl_ptr;
u16 rgba;
framebuffer_ptr = &D_803A5D00[D_802806EC][0];
sprite_ptr = spriteGetFramePtr(sprite, frame);
framebuffer_ptr = &gFramebuffers[sBufferIndex][0];
sprite_ptr = sprite_getFramePtr(sprite, frame);
if (!alpha_enabled) {
set_prim_color(0, 0, 0x80);
draw_prim_rect(x, y, sprite_ptr->w, sprite_ptr->h);
framebufferdraw_setPrimColor(0, 0, 0x80);
framebufferdraw_drawRect(x, y, sprite_ptr->w, sprite_ptr->h);
}
chunk_ptr = (BKSpriteTextureBlock *)(sprite_ptr + 1);
for(i_chunk = 0; i_chunk < sprite_ptr->chunkCnt; i_chunk++) {
@@ -205,10 +191,10 @@ void draw_sprite_rgba16(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_en
for(txtr_y = 0; txtr_y < chunk_ptr->h; txtr_y++) {
for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x++) {
fb_x = chunk_ptr->x + x + txtr_x;
if ((fb_x >= 0) && (fb_x < framebuffer_width)) {
if ((fb_x >= 0) && (fb_x < gFramebufferWidth)) {
fb_y = chunk_ptr->y + y + txtr_y;
if ((fb_y >= 0) && (fb_y < framebuffer_height)) {
pxl_ptr = framebuffer_ptr + fb_x + (fb_y * framebuffer_width);
if ((fb_y >= 0) && (fb_y < gFramebufferHeight)) {
pxl_ptr = framebuffer_ptr + fb_x + (fb_y * gFramebufferWidth);
rgba = *tmem;
if (rgba & 1) {
*pxl_ptr = rgba;
@@ -224,7 +210,7 @@ void draw_sprite_rgba16(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_en
}
}
void draw_sprite_i4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabled) {
void framebufferdraw_draw_I4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabled) {
BKSpriteFrame *frame_ptr;
BKSpriteTextureBlock *chunk_ptr;
s16 *temp_v0;
@@ -239,11 +225,11 @@ void draw_sprite_i4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enable
s32 txtr_x;
u16 *fb_pxl_ptr;
framebuffer_ptr = &D_803A5D00[D_802806EC][0];
frame_ptr = spriteGetFramePtr(sprite, frame);
framebuffer_ptr = &gFramebuffers[sBufferIndex][0];
frame_ptr = sprite_getFramePtr(sprite, frame);
if (!aplha_enabled) {
set_prim_color(0, 0, 0x80);
draw_prim_rect(x, y, frame_ptr->w, frame_ptr->h);
framebufferdraw_setPrimColor(0, 0, 0x80);
framebufferdraw_drawRect(x, y, frame_ptr->w, frame_ptr->h);
}
chunk_ptr = (BKSpriteTextureBlock *)(frame_ptr + 1);
for(i_chunk = 0; i_chunk < frame_ptr->chunkCnt; i_chunk++) {
@@ -252,12 +238,12 @@ void draw_sprite_i4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enable
for(txtr_y = 0; txtr_y < chunk_ptr->h; txtr_y++) {
for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x += 2) {
fb_x = chunk_ptr->x + x + txtr_x;
if ((fb_x >= 0) && (fb_x < framebuffer_width)) {
if ((fb_x >= 0) && (fb_x < gFramebufferWidth)) {
fb_y = chunk_ptr->y + y + txtr_y;
if ((fb_y >= 0) && (fb_y < framebuffer_height)) {
if ((fb_y >= 0) && (fb_y < gFramebufferHeight)) {
p1 = (*tmem >> 4);
p2 = (*tmem & 0xF);
fb_pxl_ptr = framebuffer_ptr + fb_x + (fb_y * framebuffer_width);
fb_pxl_ptr = framebuffer_ptr + fb_x + (fb_y * gFramebufferWidth);
if (p1) {
*fb_pxl_ptr = (p1 << 0xC) | (p1 << 0x7) | (p1 << 0x2) | 1;
} else if (!aplha_enabled) {
@@ -277,7 +263,7 @@ void draw_sprite_i4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enable
}
}
void draw_sprite_ia4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabled) {
void framebufferdraw_draw_IA4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabled) {
BKSpriteFrame *frame_ptr;
BKSpriteTextureBlock *chunk_ptr;
s16 *temp_v0;
@@ -296,11 +282,11 @@ void draw_sprite_ia4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabl
s32 txtr_x;
u16 *fb_pxl_ptr;
framebuffer_ptr = &D_803A5D00[D_802806EC][0];
frame_ptr = spriteGetFramePtr(sprite, frame);
framebuffer_ptr = &gFramebuffers[sBufferIndex][0];
frame_ptr = sprite_getFramePtr(sprite, frame);
if (!aplha_enabled) {
set_prim_color(0, 0, 0x80);
draw_prim_rect(x, y, frame_ptr->w, frame_ptr->h);
framebufferdraw_setPrimColor(0, 0, 0x80);
framebufferdraw_drawRect(x, y, frame_ptr->w, frame_ptr->h);
}
chunk_ptr = (BKSpriteTextureBlock *)(frame_ptr + 1);
for(i_chunk = 0; i_chunk < frame_ptr->chunkCnt; i_chunk++) {
@@ -309,10 +295,10 @@ void draw_sprite_ia4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabl
for(txtr_y = 0; txtr_y < chunk_ptr->h; txtr_y++) {
for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x += 2) {
fb_x = chunk_ptr->x + x + txtr_x;
if ((fb_x >= 0) && (fb_x < framebuffer_width)) {
if ((fb_x >= 0) && (fb_x < gFramebufferWidth)) {
fb_y = chunk_ptr->y + y + txtr_y;
if ((fb_y >= 0) && (fb_y < framebuffer_height)) {
fb_pxl_ptr = framebuffer_ptr + fb_x + (fb_y * framebuffer_width);\
if ((fb_y >= 0) && (fb_y < gFramebufferHeight)) {
fb_pxl_ptr = framebuffer_ptr + fb_x + (fb_y * gFramebufferWidth);\
p1 = (*tmem >> 4);
p2 = (*tmem & 0xF);
p1_i = p1 & 0xE;
@@ -338,7 +324,7 @@ void draw_sprite_ia4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabl
}
}
void draw_sprite_i8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled) {
void framebufferdraw_draw_I8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled) {
BKSpriteFrame *frame_ptr;
BKSpriteTextureBlock *chunk_ptr;
s16 *pixel_ptr;
@@ -351,11 +337,11 @@ void draw_sprite_i8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled
s32 i_chunk;
s32 txtr_y;
framebuffer_ptr = &D_803A5D00[D_802806EC][0];
frame_ptr = spriteGetFramePtr(sprite, frame);
framebuffer_ptr = &gFramebuffers[sBufferIndex][0];
frame_ptr = sprite_getFramePtr(sprite, frame);
if (!alpha_enabled) {
set_prim_color(0, 0, 0x80);
draw_prim_rect(x, y, frame_ptr->w, frame_ptr->h);
framebufferdraw_setPrimColor(0, 0, 0x80);
framebufferdraw_drawRect(x, y, frame_ptr->w, frame_ptr->h);
}
chunk_ptr = (BKSpriteTextureBlock *)(frame_ptr + 1);
for(i_chunk = 0; i_chunk < frame_ptr->chunkCnt; i_chunk++){
@@ -366,10 +352,10 @@ void draw_sprite_i8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled
for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x++){
fb_x = chunk_ptr->x + x + txtr_x;
if (fb_x >= 0) {
if (fb_x < framebuffer_width) {
if (fb_x < gFramebufferWidth) {
fb_y = chunk_ptr->y + y + txtr_y;
if ((fb_y >= 0) && (fb_y < framebuffer_height)) {
pixel_ptr = framebuffer_ptr + fb_x + fb_y * framebuffer_width;
if ((fb_y >= 0) && (fb_y < gFramebufferHeight)) {
pixel_ptr = framebuffer_ptr + fb_x + fb_y * gFramebufferWidth;
intensity = (s32) *txtr_ptr >> 3;
if (intensity != 0) {
*pixel_ptr = (intensity << 0xB) | (intensity << 6) | (intensity << 1) | 1;
@@ -386,7 +372,7 @@ void draw_sprite_i8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled
}
}
void draw_sprite_ia8(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabled) {
void framebufferdraw_draw_IA8(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabled) {
BKSpriteFrame *sprite_frame;
BKSpriteTextureBlock *chunk_ptr;
s16 *temp_a1;
@@ -400,12 +386,12 @@ void draw_sprite_ia8(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabl
s32 var_t3;
u32 temp_a2;
framebuffer_ptr = &D_803A5D00[D_802806EC][0];
sprite_frame = spriteGetFramePtr(sprite, frame);
framebuffer_ptr = &gFramebuffers[sBufferIndex][0];
sprite_frame = sprite_getFramePtr(sprite, frame);
if (!alpha_enabled) {
//draw blue rect over display area
set_prim_color(0, 0, 0x80);
draw_prim_rect(x, y, sprite_frame->w, sprite_frame->h);
framebufferdraw_setPrimColor(0, 0, 0x80);
framebufferdraw_drawRect(x, y, sprite_frame->w, sprite_frame->h);
}
chunk_ptr = (BKSpriteTextureBlock *)(sprite_frame + 1);
for(i_chunk = 0; i_chunk < sprite_frame->chunkCnt; i_chunk++) {
@@ -414,10 +400,10 @@ void draw_sprite_ia8(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabl
for(var_t3 = 0; var_t3 < chunk_ptr->h; var_t3++){
for(var_a3 = 0; var_a3 < chunk_ptr->w; var_a3++) {
fb_x = chunk_ptr->x + x + var_a3;
if ((fb_x >= 0) && (fb_x < framebuffer_width)) {
if ((fb_x >= 0) && (fb_x < gFramebufferWidth)) {
fb_y = chunk_ptr->y + y + var_t3;
if ((fb_y >= 0) && (fb_y < framebuffer_height)) {
temp_a1 = framebuffer_ptr + fb_x + fb_y * framebuffer_width;
if ((fb_y >= 0) && (fb_y < gFramebufferHeight)) {
temp_a1 = framebuffer_ptr + fb_x + fb_y * gFramebufferWidth;
temp_a2 = *var_t2;
if (IA8_A(temp_a2)) {
*temp_a1 = I4_2_RGBA16(IA8_I(temp_a2), 1);
@@ -433,7 +419,7 @@ void draw_sprite_ia8(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabl
}
}
void draw_sprite_rgba32(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled){
void framebufferdraw_draw_RGBA32(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled){
BKSpriteTextureBlock *chunk_ptr;
u32 *tmem;
u32 fb_value;
@@ -455,11 +441,11 @@ void draw_sprite_rgba32(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_ena
s32 blue8;
framebuffer = &D_803A5D00[D_802806EC][0];
sprite_frame = spriteGetFramePtr(sprite, frame);
framebuffer = &gFramebuffers[sBufferIndex][0];
sprite_frame = sprite_getFramePtr(sprite, frame);
if (!alpha_enabled) {
set_prim_color(0, 0, 0x80);
draw_prim_rect(x, y, sprite_frame->w, sprite_frame->h);
framebufferdraw_setPrimColor(0, 0, 0x80);
framebufferdraw_drawRect(x, y, sprite_frame->w, sprite_frame->h);
}
chunk_ptr = (BKSpriteTextureBlock *) (sprite_frame + 1);
for (i_chunk = 0; i_chunk < sprite_frame->chunkCnt; i_chunk++) {
@@ -477,13 +463,13 @@ void draw_sprite_rgba32(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_ena
for (ix = 0; ix < chunk_ptr->w; ix++)
{
fb_x = (chunk_ptr->x + x) + ix;
if ((fb_x >= 0) && (fb_x < framebuffer_width))
if ((fb_x >= 0) && (fb_x < gFramebufferWidth))
{
fb_y = (chunk_ptr->y + y) + iy;
if ((fb_y >= 0) && (fb_y < framebuffer_height))
if ((fb_y >= 0) && (fb_y < gFramebufferHeight))
{
txtr_value = *tmem;
pxl_ptr = (framebuffer + fb_x) + (fb_y * framebuffer_width);
pxl_ptr = (framebuffer + fb_x) + (fb_y * gFramebufferWidth);
fb_value = (unsigned int) (*pxl_ptr);
alpha = _SHIFTR(txtr_value, 0, 8);
if (alpha) {//blend texture with existing pixel color
@@ -507,13 +493,10 @@ void draw_sprite_rgba32(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_ena
}
}
void func_802499BC(s32 arg0, s32 arg1, s32 arg2, s32 arg3){//signature may have more variables passed in
}
void framebufferdraw_stub1(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {} //signature may have more variables passed in
void framebufferdraw_stub2(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {} //signature may have more variables passed in
void func_802499D0(s32 arg0, s32 arg1, s32 arg2, s32 arg3){//signature may have more variables passed in
}
void draw_texture_ci4(s32 x, s32 y, void *tmem, s32 w, s32 h, bool alpha_enabled){
void framebufferdraw_drawTexture_CI4(s32 x, s32 y, void *tmem, s32 w, s32 h, bool alpha_enabled) {
s32 ix;
s32 iy;
s32 icolor;
@@ -523,7 +506,7 @@ void draw_texture_ci4(s32 x, s32 y, void *tmem, s32 w, s32 h, bool alpha_enabled
palette_ptr = (u16*)tmem;
pixel_ptr = (u8*)&palette_ptr[0x10];
framebuffer_ptr = &D_803A5D00[D_802806EC][x + y * framebuffer_width];
framebuffer_ptr = &gFramebuffers[sBufferIndex][x + y * gFramebufferWidth];
for(iy = 0; iy < h; iy++){
for(ix = 0; ix < w; ix++){
icolor = (ix & 1)? pixel_ptr[ix/2 + (iy*w)/2] & 0xF
@@ -531,35 +514,35 @@ void draw_texture_ci4(s32 x, s32 y, void *tmem, s32 w, s32 h, bool alpha_enabled
*framebuffer_ptr = palette_ptr[icolor];
framebuffer_ptr++;
}
framebuffer_ptr += (framebuffer_width - w);
framebuffer_ptr += (gFramebufferWidth - w);
}
}
void draw_sprite(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled) {
s16 temp_v0;
void framebufferdraw_draw(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled) {
s16 type;
temp_v0 = sprite->type;
if (temp_v0 & SPRITE_TYPE_I4) {
draw_sprite_i4(x, y, sprite, frame, alpha_enabled);
} else if (temp_v0 & SPRITE_TYPE_IA4) {
draw_sprite_ia4(x, y, sprite, frame, alpha_enabled);
} else if (temp_v0 & SPRITE_TYPE_I8) {
draw_sprite_i8(x, y, sprite, frame, alpha_enabled);
} else if (temp_v0 & SPRITE_TYPE_IA8) {
draw_sprite_ia8(x, y, sprite, frame, alpha_enabled);
} else if (temp_v0 & SPRITE_TYPE_RGBA16) {
draw_sprite_rgba16(x, y, sprite, frame, alpha_enabled);
} else if (temp_v0 & SPRITE_TYPE_RGBA32) {
draw_sprite_rgba32(x, y, sprite, frame, alpha_enabled);
} else if (temp_v0 & SPRITE_TYPE_CI4) {
draw_sprite_ci4(x, y, sprite, frame, alpha_enabled);
} else if (temp_v0 & SPRITE_TYPE_CI8) {
draw_sprite_ci8(x, y, sprite, frame, alpha_enabled);
type = sprite->type;
if (type & SPRITE_TYPE_I4) {
framebufferdraw_draw_I4(x, y, sprite, frame, alpha_enabled);
} else if (type & SPRITE_TYPE_IA4) {
framebufferdraw_draw_IA4(x, y, sprite, frame, alpha_enabled);
} else if (type & SPRITE_TYPE_I8) {
framebufferdraw_draw_I8(x, y, sprite, frame, alpha_enabled);
} else if (type & SPRITE_TYPE_IA8) {
framebufferdraw_draw_IA8(x, y, sprite, frame, alpha_enabled);
} else if (type & SPRITE_TYPE_RGBA16) {
framebufferdraw_draw_RGBA16(x, y, sprite, frame, alpha_enabled);
} else if (type & SPRITE_TYPE_RGBA32) {
framebufferdraw_draw_RGBA32(x, y, sprite, frame, alpha_enabled);
} else if (type & SPRITE_TYPE_CI4) {
framebufferdraw_draw_CI4(x, y, sprite, frame, alpha_enabled);
} else if (type & SPRITE_TYPE_CI8) {
framebufferdraw_draw_CI8(x, y, sprite, frame, alpha_enabled);
}
}
//arg4 = alpha enabled?
void func_80249DE0(s32 x, s32 y, s16 *arg2, s32 arg3, s32 arg4) {
void framebufferdraw_func_80249DE0(s32 x, s32 y, s16 *arg2, s32 arg3, s32 arg4) {
s32 ix;
s32 var_t2;
s32 iy;
@@ -571,11 +554,11 @@ void func_80249DE0(s32 x, s32 y, s16 *arg2, s32 arg3, s32 arg4) {
temp_v0 = func_8033EFB0(arg2, arg3);
texture_ptr = (u16*)(temp_v0 + 1);
if (*arg2 == SPRITE_TYPE_CI4) {
draw_texture_ci4(x, y, temp_v0 + 1, temp_v0->w, temp_v0->h, arg4);
framebufferdraw_drawTexture_CI4(x, y, temp_v0 + 1, temp_v0->w, temp_v0->h, arg4);
return;
}
//otherwise RGBA16
framebuffer_ptr = &D_803A5D00[D_802806EC][x + y*framebuffer_width];
framebuffer_ptr = &gFramebuffers[sBufferIndex][x + y*gFramebufferWidth];
for(iy = 0; iy < temp_v0->h; iy++){
for(ix = 0; ix < temp_v0->w; ix++){
temp_v1 = *texture_ptr;
@@ -587,11 +570,11 @@ void func_80249DE0(s32 x, s32 y, s16 *arg2, s32 arg3, s32 arg4) {
texture_ptr++;
framebuffer_ptr++;
}
framebuffer_ptr += (framebuffer_width - temp_v0->w);
framebuffer_ptr += (gFramebufferWidth - temp_v0->w);
}
}
void func_80249F34(s32 x, s32 y, Struct84s* maskList, s32 maskIndex, s32 mX, s32 mY, s32 mW, s32 mH, s32 maskColor, s32 mStride, bool dim, s32 replacementColor) {
void framebufferdraw_func_80249F34(s32 x, s32 y, Struct84s* maskList, s32 maskIndex, s32 mX, s32 mY, s32 mW, s32 mH, s32 maskColor, s32 mStride, bool dim, s32 replacementColor) {
BKSpriteTextureBlock* mask_texture;
s32 ix;
s32 iy;
@@ -600,7 +583,7 @@ void func_80249F34(s32 x, s32 y, Struct84s* maskList, s32 maskIndex, s32 mX, s32
mask_texture = func_8033EFB0(maskList, maskIndex);
mask_ptr = (u16*)(mask_texture + 1) + mX + mY * mask_texture->w;
color_ptr = &D_803A5D00[D_802806EC][x + y * framebuffer_width];
color_ptr = &gFramebuffers[sBufferIndex][x + y * gFramebufferWidth];
for(iy = 0; iy < mH; iy += mStride){
for(ix = 0; ix < mW; ix++){
@@ -618,126 +601,108 @@ void func_80249F34(s32 x, s32 y, Struct84s* maskList, s32 maskIndex, s32 mX, s32
mask_ptr++;
}
mask_ptr += ((mStride * mask_texture->w) - mW);
color_ptr += (framebuffer_width - mW);
color_ptr += (gFramebufferWidth - mW);
}
}
//fill framebuffer with vert and horz lines
void func_8024A284(s32 x, s32 y, s32 arg2, s32 arg3, s32 horz_spacing, s32 vert_spacing) {
s32 var_s2;
s32 var_s3;
void framebufferdraw_drawGrid(s32 x, s32 y, s32 arg2, s32 arg3, s32 horz_spacing, s32 vert_spacing) {
s32 x1;
s32 y1;
for(var_s2 = 0; var_s2 < framebuffer_width; var_s2 += horz_spacing){
for(var_s3 = 0; var_s3 < framebuffer_height; var_s3++){
func_8024A3C8(x + var_s2, y + var_s3);
for (x1 = 0; x1 < gFramebufferWidth; x1 += horz_spacing) {
for (y1 = 0; y1 < gFramebufferHeight; y1++) {
framebufferdraw_setPixel(x + x1, y + y1);
}
}
for(var_s3 = 0; var_s3 < framebuffer_height; var_s3 += vert_spacing) {
for(var_s2 = 0; var_s2 < framebuffer_width; var_s2++){
func_8024A3C8(x + var_s2, y + var_s3);
for (y1 = 0; y1 < gFramebufferHeight; y1 += vert_spacing) {
for (x1 = 0; x1 < gFramebufferWidth; x1++) {
framebufferdraw_setPixel(x + x1, y + y1);
}
}
}
//fills in pixel in frame buffer with D_802806E0 color
void func_8024A3C8(s32 x, s32 y) {
s32 temp_v0;
if (x >= 0) {
if ((x < framebuffer_width) && (y >= 0) && (y < framebuffer_height)) {
D_803A5D00[D_802806EC][x + y * framebuffer_width] = _SHIFTL(D_802806E0 >> 3, 11, 5) | _SHIFTL(D_802806E4 >> 3, 6, 5) | _SHIFTL(D_802806E8 >> 3, 1, 5) | _SHIFTL(1, 0, 1);
}
void framebufferdraw_setPixel(s32 x, s32 y) {
if ((x >= 0) && (x < gFramebufferWidth) && (y >= 0) && (y < gFramebufferHeight)) {
gFramebuffers[sBufferIndex][x + y * gFramebufferWidth] = _SHIFTL(sPrimColor_r >> 3, 11, 5) | _SHIFTL(sPrimColor_g >> 3, 6, 5) | _SHIFTL(sPrimColor_b >> 3, 1, 5) | _SHIFTL(1, 0, 1);
}
}
//draw rectangular outline
void func_8024A490(s32 x, s32 y, s32 w, s32 h) {
s32 var_s1;
void framebufferdraw_drawOutline(s32 x, s32 y, s32 w, s32 h) {
s32 x1;
for(var_s1 = 0; var_s1 < w; var_s1++){
func_8024A3C8(x + var_s1, y);
func_8024A3C8(x + var_s1, y + h - 1);
for (x1 = 0; x1 < w; x1++) {
framebufferdraw_setPixel(x + x1, y);
framebufferdraw_setPixel(x + x1, y + h - 1);
}
for(var_s1 = 1; var_s1 < h - 1; var_s1++){
func_8024A3C8(x, y + var_s1);
func_8024A3C8(x + w - 1, y + var_s1);
for (x1 = 1; x1 < h - 1; x1++) {
framebufferdraw_setPixel(x, y + x1);
framebufferdraw_setPixel(x + w - 1, y + x1);
}
}
void func_8024A564(s32 x, s32 y, u16 *arg2, s32 arg3, s32 arg4, f32 arg5, f32 arg6)
{
s32 temp_a2;
s32 temp_a2_2;
s32 temp_a2_3;
s32 temp_f6;
s32 temp_f6_2;
s32 temp_lo;
s32 temp_t5;
s32 var_a0;
s32 var_a2;
s32 new_var;
f32 new_var3;
s32 new_var2;
s32 var_t1;
s32 var_t3;
s32 var_v0;
s32 var_v1;
u16 temp_t8;
s16 *var_t0;
s16 *var_t2;
var_v0 = 0;
var_v1 = framebuffer_width;
var_t0 = &D_803A5D00[D_802806EC][x + (y * framebuffer_width)];
new_var = (s32) (((f64) (256.0f / (new_var3 = arg6))) + 0.5);
new_var2 = (s32) (((f64) (256.0f / arg5)) + 0.5);
for (var_t1 = (arg4 * arg6) + 0.5; var_t1 != 0; var_t1--)
{
temp_lo = (arg3 * arg5) + 0.5;
var_a2 = ((var_v0 >> 8) * arg3) << 8;
var_t2 = var_t0;
for (var_t3 = temp_lo; var_t3 != 0; var_t3--)
void framebufferdraw_func_8024A564(s32 x, s32 y, u16 *arg2, s32 arg3, s32 arg4, f32 arg5, f32 arg6) {
s32 temp_lo;
s32 var_a2;
s32 new_var;
f32 new_var3;
s32 new_var2;
s32 var_t1;
s32 var_t3;
s32 var_v0;
s32 fb_width;
s16 *pixel;
s16 *var_t2;
var_v0 = 0;
fb_width = gFramebufferWidth;
pixel = &gFramebuffers[sBufferIndex][x + (y * gFramebufferWidth)];
new_var = (s32) (((f64) (256.0f / (new_var3 = arg6))) + 0.5);
new_var2 = (s32) (((f64) (256.0f / arg5)) + 0.5);
for (var_t1 = (arg4 * arg6) + 0.5; var_t1 != 0; var_t1--)
{
*var_t2 = arg2[var_a2 >> 8];
var_a2 += new_var2;
var_t2++;
temp_lo = (arg3 * arg5) + 0.5;
var_a2 = ((var_v0 >> 8) * arg3) << 8;
var_t2 = pixel;
for (var_t3 = temp_lo; var_t3 != 0; var_t3--) {
*var_t2 = arg2[var_a2 >> 8];
var_a2 += new_var2;
var_t2++;
}
pixel += gFramebufferWidth;
var_v0 += new_var;
}
var_t0 += framebuffer_width;
var_v0 += new_var;
}
}
//fills in rectangle in frame buffer with D_802806E0 color
void draw_prim_rect(s32 x, s32 y, s32 w, s32 h) {
s32 var_s0;
s32 var_s1;
s32 var_s4;
void framebufferdraw_drawRect(s32 x, s32 y, s32 w, s32 h) {
s32 y1, x1;
var_s4 = 0;
for(var_s4 = 0; var_s4 < w; var_s4++) {
for(var_s0 = 0; var_s0 < h; var_s0++){
func_8024A3C8(x + var_s4, y + var_s0);
for (x1 = 0; x1 < w; x1++) {
for (y1 = 0; y1 < h; y1++) {
framebufferdraw_setPixel(x + x1, y + y1);
}
}
}
void func_8024A810(void){
set_prim_color(0, 0x80, 0);
func_8024A85C(0);
void framebufferdraw_resetPrimColorAndBuffer(void) {
framebufferdraw_setPrimColor(0, 128, 0);
framebufferdraw_setBufferIndex(0);
}
void set_prim_color(s32 r, s32 g, s32 b){
D_802806E0 = r;
D_802806E4 = g;
D_802806E8 = b;
void framebufferdraw_setPrimColor(s32 r, s32 g, s32 b) {
sPrimColor_r = r;
sPrimColor_g = g;
sPrimColor_b = b;
}
void func_8024A85C(s32 buffer_indx){
D_802806EC = buffer_indx;
void framebufferdraw_setBufferIndex(s32 buffer_indx) {
sBufferIndex = buffer_indx;
}
s32 func_8024A868(void){
return D_802806EC;
s32 framebufferdraw_getBufferIndex(void) {
return sBufferIndex;
}

View File

@@ -1,8 +1,5 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "core1/rarezip.h"
#include "core1/core1.h"
/* static */ int huft_build(b, n, s, d, e, t, m)
unsigned *b; /* code lengths in bits (all assumed <= BMAX) */

View File

@@ -1,4 +1,5 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"

View File

@@ -1,8 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "core1/core1.h"
s16 D_802765C0[] ={
static s16 sAnimAssetIds[] = {
0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008,
0x0009, 0x000A, 0x029E, 0x000C, 0x000D, 0x000E, 0x029F, 0x0010,
0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018,
@@ -68,7 +67,7 @@ s16 D_802765C0[] ={
0x012B, 0x012C, 0x012D, 0x012E, 0x012F, 0xFFFF
};
s16 D_802769AC[] = {
static s16 sSfxIds[] = {
0x0000, 0x0001,
0x0002, 0x0003, 0x018F, 0x0005, 0x008C, 0x0007, 0x0008, 0xFFFE,
0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0063,
@@ -103,7 +102,7 @@ s16 D_802769AC[] = {
0x00A8, 0x00A9, 0xFFFF, 0x0000
};
s16 D_80276B98[] = {
static s16 sCoMusicIds[] = {
0x002F, 0x0030, 0x0099, 0x005F,
0x0002, 0x0003, 0xFFFE, 0x0005, 0x0006, 0xFFFE, 0x0008, 0x0009,
0x000A, 0x000B, 0x000C, 0x000D, 0xFFFE, 0x000F, 0x0010, 0xFFFE,
@@ -124,14 +123,14 @@ s16 D_80276B98[] = {
0xFFFE, 0xFFFE, 0xFFFE, 0x0044, 0xFFFF, 0x0000, 0x0000, 0x0000,
};
s32 func_80255D30(s32 arg0){
return D_80276B98[arg0];
enum comusic_e lookup_getCoMusicId(s32 idx) {
return sCoMusicIds[idx];
}
s32 func_80255D44(s32 arg0){
return D_802769AC[arg0];
enum sfx_e lookup_getSfxId(s32 idx) {
return sSfxIds[idx];
}
s32 func_80255D58(s32 arg0){
return D_802765C0[arg0];
enum asset_e lookup_getAnimAssetId(s32 idx) {
return sAnimAssetIds[idx];
}

View File

@@ -1,7 +1,7 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "SnS.h"
#include "version.h"
/*
* Every chunk of allocated memory is prefixed with a HeapHeader.

View File

@@ -1,12 +1,9 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "version.h"
#include <core1/viewport.h>
/* .data*/
#if VERSION == VERSION_USA_1_0
u32 D_80276CB0 = 0xD22FFFD8; //WHAT IS THIS?
u32 D_80276CB4 = 0xDEFEF692; //WHAT IS THIS?
@@ -14,9 +11,11 @@ u32 D_80276CB4 = 0xDEFEF692; //WHAT IS THIS?
u32 D_80276CB0 = 0x90FA97CB; //WHAT IS THIS?
u32 D_80276CB4 = 0x8D96D002; //WHAT IS THIS?
#endif
u16 *D_80276CB8 = NULL; //! ml_acosPrecValTblPtr
//! Might not be 90, but 91 or 92? Initial lowerIdx is OOB if 90
f32 ml_acosValTbl[90] = { //D_80276CBC
f32 sLookupTableAcosDegrees[90] = {
1.0000000000, 0.9998480080, 0.9993910190, 0.9986299870, 0.9975640180,
0.9961950180, 0.9945219760, 0.9925460220, 0.9902679920, 0.9876880050,
0.9848080280, 0.9816269870, 0.9781479840, 0.9743700030, 0.9702960250,
@@ -37,42 +36,27 @@ f32 ml_acosValTbl[90] = { //D_80276CBC
0.0871559978, 0.0697569996, 0.0523359999, 0.0348990001, 0.0174519997
};
// .h
void func_80257918(f32 arg0[3], f32 arg1[3], f32 arg2[3], f32 arg3[3]);
void ml_vec3f_roll_rotate_copy(f32 arg0[3], f32 arg1[3], f32);
#define _SQ2(x, y) ((x) * (x) + (y) * (y))
#define _SQ3(x, y, z) (((x) * (x)) + ((y) * (y)) + ((z) * (z)))
/* .code */
f32 func_80255D70(f32 x)
{
f32 ml_acosf_deg(f32 x) {
s32 sign;
s32 upperIdx;
s32 lowerIdx;
f32 res;
f32 *table = sLookupTableAcosDegrees;
f32 *table = &ml_acosValTbl[0];
if (x < 0)
{
// Invert the result
if (x < 0) {
sign = -1;
// Precomputed values are all positive
x = -x;
}
else
{
} else {
sign = 1;
}
upperIdx = 0;
lowerIdx = 90 + 1;
lowerIdx = 91;
while (TRUE)
{
while (TRUE) {
s32 idx = (upperIdx + lowerIdx) / 2;
if (x > table[idx])
@@ -81,8 +65,7 @@ f32 func_80255D70(f32 x)
upperIdx = idx;
if (upperIdx + 1 == lowerIdx)
// Found the 1 degree range containing the result
break;
break; // Found the 1 degree range containing the result
}
// Check for trivial result
@@ -95,19 +78,17 @@ f32 func_80255D70(f32 x)
return sign > 0 ? res : 180 - res;
}
void func_80255E58(f32 vec1[3], f32 vec2[3], f32 vec3[3], f32 vec4[3])
{
void ml_vec3f_sub_and_rotate(f32 vec1[3], f32 rotation[3], f32 vec2[3], f32 dst[3]) {
f32 tmp[3];
TUPLE_DIFF_COPY(tmp, vec3, vec1)
TUPLE_DIFF_COPY(tmp, vec2, vec1)
ml_vec3f_yaw_rotate_copy(tmp, tmp, -vec2[1]);
ml_vec3f_pitch_rotate_copy( tmp, tmp, -vec2[0]);
ml_vec3f_roll_rotate_copy(vec4, tmp, -vec2[2]);
ml_vec3f_yaw_rotate_copy(tmp, tmp, -rotation[1]);
ml_vec3f_pitch_rotate_copy( tmp, tmp, -rotation[0]);
ml_vec3f_roll_rotate_copy(dst, tmp, -rotation[2]);
}
f32 func_80255F14(f32 vec1[3], f32 vec2[3])
{
f32 ml_vec3f_cos_between(f32 vec1[3], f32 vec2[3]) {
f32 tmp1[3];
f32 tmp2[3];
@@ -117,32 +98,27 @@ f32 func_80255F14(f32 vec1[3], f32 vec2[3])
return TUPLE_DOT_PRODUCT(tmp1, tmp2);
}
//ml_vec3f_cross_product
void ml_crossProduct_vec3f(f32 dst[3], f32 vec1[3], f32 vec2[3])
{
void ml_vec3f_cross_product(f32 dst[3], f32 vec1[3], f32 vec2[3]) {
TUPLE_CROSS_PRODUCT(dst, vec1, vec2)
}
void ml_interpolate_vec3f(f32 dst[3], f32 vec1[3], f32 vec2[3], f32 scale)
{
dst[0] = vec1[0] + (vec2[0] - vec1[0]) * scale;
dst[1] = vec1[1] + (vec2[1] - vec1[1]) * scale;
dst[2] = vec1[2] + (vec2[2] - vec1[2]) * scale;
void ml_vec3f_interpolate_fast(f32 dst[3], f32 start[3], f32 end[3], f32 t) {
dst[0] = start[0] + (end[0] - start[0]) * t;
dst[1] = start[1] + (end[1] - start[1]) * t;
dst[2] = start[2] + (end[2] - start[2]) * t;
}
f32 ml_dotProduct_vec3f(f32 vec1[3], f32 vec2[3])
{
f32 ml_vec3f_dot_product(f32 vec1[3], f32 vec2[3]) {
return TUPLE_DOT_PRODUCT(vec1, vec2);
}
f32 ml_distance_vec3f(f32 vec1[3], f32 vec2[3])
{
f32 ml_vec3f_distance(f32 vec1[3], f32 vec2[3]) {
f32 diff[3];
TUPLE_DIFF_COPY(diff, vec1, vec2)
return LENGTH_VEC3F(diff);
}
f32 func_802560D0(f32 arg0[3], f32 arg1[3], f32 arg2[3]) {
f32 ml_func_802560D0(f32 arg0[3], f32 arg1[3], f32 arg2[3]) {
f32 sp4C[3];
f32 pad48;
f32 sp3C[3];
@@ -157,7 +133,7 @@ f32 func_802560D0(f32 arg0[3], f32 arg1[3], f32 arg2[3]) {
sp20 = LENGTH_VEC3F(sp24);
if (sp20 < 0.01) {
return ml_distance_vec3f(arg0, arg2);
return ml_vec3f_distance(arg0, arg2);
}
TUPLE_DIFF_COPY(sp3C, arg2, arg0)
@@ -172,7 +148,7 @@ f32 func_802560D0(f32 arg0[3], f32 arg1[3], f32 arg2[3]) {
sp4C[0] = arg0[0] + (sp24[0] * sp30);
sp4C[1] = arg0[1] + (sp24[1] * sp30);
sp4C[2] = arg0[2] + (sp24[2] * sp30);
return ml_distance_vec3f(sp4C, arg2);
return ml_vec3f_distance(sp4C, arg2);
}
f32 ml_distanceSquared_vec3f(f32 vec1[3], f32 vec2[3])
@@ -651,7 +627,7 @@ void func_802578A4(f32 dst[3], f32 vec1[3], f32 vec2[3])
ml_vec3f_diff_copy(tmp1, &vec2[3], vec2);
ml_vec3f_diff_copy(tmp2, &vec2[6], vec2);
ml_crossProduct_vec3f(tmp3, tmp1, tmp2);
ml_vec3f_cross_product(tmp3, tmp1, tmp2);
ml_vec3f_normalize(tmp3);
func_80257918(dst, vec1, vec2, tmp3);
}
@@ -767,7 +743,7 @@ void func_80257DB0(f32 arg0[3], f32 arg1[3], f32 arg2[3])
f32 tmp[3];
ml_vec3f_scale_copy(arg0, arg1, -1);
dot_product = ml_dotProduct_vec3f(arg0, arg2);
dot_product = ml_vec3f_dot_product(arg0, arg2);
ml_vec3f_scale_copy(tmp, arg2, 2 * dot_product);
ml_vec3f_diff_copy(arg0, tmp, arg0);
}
@@ -900,7 +876,7 @@ int func_80258210(f32 x, f32 y, f32 *dst)
return TRUE;
}
int ml_isZero_vec3f(f32 vec[3])
bool ml_isZero_vec3f(f32 vec[3])
{
return !(vec[0] != 0 || vec[1] != 0 || vec[2] != 0);
}
@@ -910,31 +886,26 @@ bool ml_isNonzero_vec3f(f32 vec[3])
return vec[0] != 0 || vec[1] != 0 || vec[2] != 0;
}
//ml_vec3f_not_on_vertical_axis
int func_802583D8(f32 vec[3])
bool ml_vec3f_not_on_vertical_axis(f32 vec[3])
{
return vec[0] != 0 && vec[2] != 0;
}
//ml_vec3f_inside_box_f
int func_80258424(f32 vec[3], f32 minX, f32 minY, f32 minZ, f32 maxX, f32 maxY, f32 maxZ)
bool ml_vec3f_inside_box_f(f32 vec[3], f32 minX, f32 minY, f32 minZ, f32 maxX, f32 maxY, f32 maxZ)
{
return vec[0] > minX && vec[0] < maxX
&& vec[1] > minY && vec[1] < maxY
&& vec[2] > minZ && vec[2] < maxZ;
}
//ml_vec3f_inside_box_vec3f
int func_802584FC(f32 vec[3], f32 min[3], f32 max[3])
bool ml_vec3f_inside_box_vec3f(f32 vec[3], f32 min[3], f32 max[3])
{
return vec[0] > min[0] && vec[0] < max[0]
&& vec[1] > min[1] && vec[1] < max[1]
&& vec[2] > min[2] && vec[2] < max[2];
}
//ml_vec3w_inside_box_w
int func_802585E0(s32 vec[3], s32 minX, s32 minY, s32 minZ, s32 maxX, s32 maxY, s32 maxZ)
{
bool ml_vec3w_inside_box_w(s32 vec[3], s32 minX, s32 minY, s32 minZ, s32 maxX, s32 maxY, s32 maxZ) {
return vec[0] > minX && vec[0] < maxX
&& vec[1] > minY && vec[1] < maxY
&& vec[2] > minZ && vec[2] < maxZ;
@@ -951,8 +922,7 @@ f32 ml_vec3f_horizontal_distance_zero_likely(f32 vec1[3], f32 vec2[3]) {
return 0;
}
//ml_vec3f_horizontal_distance_squared_zero_likely
f32 func_802586B0(f32 vec1[3], f32 vec2[3])
f32 ml_vec3f_horizontal_distance_squared_zero_likely(f32 vec1[3], f32 vec2[3])
{
f32 dX = vec1[0] - vec2[0];
f32 dZ = vec1[2] - vec2[2];
@@ -1281,20 +1251,16 @@ bool ml_vec3f_within_distance(f32 vec1[3], f32 vec2[3], f32 distance)
return LENGTH_SQ_VEC3F(t) <= distance * distance;
}
bool func_80259400(f32 a0)
{
bool ml_stub_80259400(f32 x) {
// wtf?
return *(u32 *)&a0 == 0x80 || *(u32 *)&a0 == 0x2A8800;
return *(u32 *)&x == 0x80 || *(u32 *)&x == 0x2A8800;
}
void func_80259430(f32 *val)
{
*val -= time_getDelta();
void ml_sub_delta_time(f32 *x) {
*x -= time_getDelta();
if (*val < 0)
*val = 0;
return;
if (*x < 0)
*x = 0;
}
void func_8025947C(f32 a0[3], f32 a1[3], f32 a2[3], f32 a3[3])
@@ -1392,9 +1358,8 @@ void func_802596AC(f32 a0[3], f32 a1[3], f32 a2[3], f32 a3[3])
}
s32 func_8025975C(f32 a0)
{
f32 val = (s32)(viewport_getYaw() - a0);
s32 ml_getViewportYawWithOffset(f32 x) {
f32 val = (s32)(viewport_getYaw() - x);
while (val < 0)
val += 360;
@@ -1405,14 +1370,13 @@ s32 func_8025975C(f32 a0)
return val;
}
bool func_80259808(f32 a0)
{
return func_8025975C(a0) < 0xB4;
bool ml_isViewportYawWithOffsetNormalized(f32 x) {
return ml_getViewportYawWithOffset(x) < 180;
}
void func_8025982C(f32 dst[3], f32 arg1[3], f32 arg2[3], f32 arg3){
void ml_vec3f_interpolate(f32 dst[3], f32 start[3], f32 end[3], f32 t) {
int i;
for(i=0; i< 3; i++){
dst[i] = arg1[i] + (arg2[i]-arg1[i])*arg3;
for (i = 0; i < 3; i++) {
dst[i] = start[i] + (end[i] - start[i]) * t;
}
}

View File

@@ -1,11 +1,11 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "version.h"
#include "ml/mtx.h"
void _guRotateF(f32 mf[4][4], f32, f32, f32, f32);
f32 func_80263FF0(f32);
f32 cosf(f32);

View File

@@ -1,6 +1,4 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern OSThread *__osRunningThread;

View File

@@ -1,6 +1,4 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern OSThread *__osRunningThread;

View File

@@ -1,4 +1,5 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
@@ -10,7 +11,6 @@ typedef struct{
extern struct49s D_803FFE10[];
extern u8 D_8000E800;
extern u8 D_8002D500;
extern u32 D_8027BF2C;
extern u32 D_8027BF30;

View File

@@ -1,4 +1,5 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
@@ -17,7 +18,6 @@ typedef struct struct_2a_s{
} OverlayAddressMap;
extern u8 D_803A5D00;
#define SEGMENT_EXTERNS(segname) \
extern u8 segname##_VRAM[]; \
@@ -111,7 +111,7 @@ s32 __overlayManager80251178(void){
sp18 = func_802546DC();
sp1C = __overlayManager80251170();
return ((sp1C + &D_803A5D00) - largest_overlay->ram_end) + sp18;
return ((sp1C + (u8 *)gFramebuffers) - largest_overlay->ram_end) + sp18;
}
void __overlayManager802511C4(void){

View File

@@ -1,4 +1,5 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
@@ -6,8 +7,6 @@
#define PFSMANAGER_THREAD_STACK_SIZE 0x200
extern s32 D_803727F4;
extern struct {
u8 pad0[4];
s32 unk4;
@@ -15,22 +14,7 @@ extern struct {
s32 unkC;
} D_80379B90;
typedef struct {
s32 face_button[6];
s32 side_button[3];
s32 unk24[4];
s32 start_button;
}Struct_core1_10A00_0;
typedef struct {
s16 unk0;
s16 unk2;
u16 unk4;
u16 unk6;
f32 unk8[2];
f32 joystick[2];
}Struct_core1_10A00_1;
extern s32 D_803727F4;
extern s32 D_80276574;
/* .data */
@@ -41,13 +25,14 @@ extern s32 D_80276574;
s32 D_80275D30 = 0xED7BCDB7; //WHAT IS THIS?
s32 D_80275D34 = 0xF82DC7AC; //WHAT IS THIS?
#endif
s32 D_80275D38 = 0;
static s32 D_80275D38 = 0;
/* .bss */
UNK_TYPE(s32) D_802810E0[4][5];
u8 pfsManagerBitPattern;
Struct_core1_10A00_0 D_80281138[4];
Struct_core1_10A00_0 D_80281218;
PfsManagerControllerData D_80281138[4];
PfsManagerControllerData D_80281218;
Struct_core1_10A00_1 D_80281250[4];
OSMesg pfsManagerContPollingMsqBuf;
OSMesg pfsManagerContReplyMsgBuf;
@@ -66,13 +51,6 @@ OSMesgQueue D_802816E8;
OSMesg D_80281700[4];
u8 pad_D_80281710[1];
/* .h */
void func_8024F224(void);
void func_8024F35C(bool arg0);
void func_8024F450(void);
void func_8024F4AC(void);
/* .code */
f32 func_8024E420(s32 arg0, s32 arg1, s32 arg2) {
f32 phi_f2;
@@ -101,7 +79,7 @@ void controller_copyFaceButtons(s32 controller_index, s32 dst[6]){
dst[FACE_BUTTON(BUTTON_C_RIGHT)] = D_80281138[controller_index].face_button[FACE_BUTTON(BUTTON_C_RIGHT)];
}
void func_8024E5A8(s32 controller_index, s32 dst[6]){
void pfsManager_getFirstControllerFaceButtonState(s32 controller_index, s32 dst[6]){
dst[FACE_BUTTON(BUTTON_A)] = D_80281218.face_button[FACE_BUTTON(BUTTON_A)];
dst[FACE_BUTTON(BUTTON_B)] = D_80281218.face_button[FACE_BUTTON(BUTTON_B)];
dst[FACE_BUTTON(BUTTON_C_LEFT)] = D_80281218.face_button[FACE_BUTTON(BUTTON_C_LEFT)];
@@ -171,7 +149,9 @@ void pfsManager_update(void) {
if (func_8023E000() == 3) {
func_802E4384();
}
osSetThreadPri(0, 0x29);
D_802812D0.stick_x = pfsManagerContPadData[0].stick_x;
D_802812D0.stick_y = pfsManagerContPadData[0].stick_y;
D_802812D0.button = pfsManagerContPadData[0].button;
@@ -304,7 +284,7 @@ void pfsManager_entry(void *arg) {
} while (1);
}
void pfsManager_init(void){
void pfsManager_init(void) {
osCreateMesgQueue(&pfsManagerContPollingMsqQ, &pfsManagerContPollingMsqBuf, 1);
osCreateMesgQueue(&pfsManagerContReplyMsgQ, &pfsManagerContReplyMsgBuf, 1);
osCreateThread(&sPfsManagerThread, 7, pfsManager_entry, NULL, sPfsManagerThreadStack + PFSMANAGER_THREAD_STACK_SIZE, 40);
@@ -384,7 +364,7 @@ OSMesgQueue *pfsManager_getFrameMesgQ(void){
return &pfsManagerContPollingMsqQ;
}
void func_8024F35C(bool arg0){
void func_8024F35C(s32 arg0) {
if(!arg0)
func_8024F4AC();
else
@@ -408,10 +388,10 @@ OSContPad *func_8024F3F4(void){
}
/* initilizes D_802816E8 message queue */
void func_8024F400(void){
void func_8024F400(void) {
D_80275D38 = TRUE;
osCreateMesgQueue(&D_802816E8, &D_80281700, 5);
osSendMesg(&D_802816E8, 0, 0);
osSendMesg(&D_802816E8, 0, OS_MESG_NOBLOCK);
}
void func_8024F450(void){
@@ -422,5 +402,5 @@ void func_8024F450(void){
}
void func_8024F4AC(void){
osSendMesg(&D_802816E8, 0, 0);
osSendMesg(&D_802816E8, NULL, OS_MESG_NOBLOCK);
}

View File

@@ -1,4 +1,5 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "version.h"

View File

@@ -1,4 +1,5 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
@@ -125,7 +126,7 @@ void rumbleManager_init(void) {
osCreateMesgQueue(&D_80282390, &D_802823A8, 1);
osCreateThread(&sRumbleThread, 8, rumbleThread_entry, NULL, sRumbleThreadStack + RUMBLE_THREAD_STACK_SIZE, 25);
osStartThread(&sRumbleThread);
func_8024BDAC(&D_80282390, 0);
viMgr_func_8024BDAC(&D_80282390, 0);
}
}

View File

@@ -1,7 +1,7 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#include "SnS.h"
/* .data*/
/**

28
src/core1/sprite.c Normal file
View File

@@ -0,0 +1,28 @@
#include <ultra64.h>
#include "core1/core1.h"
u32 sprite_getUnk8(BKSprite *this) {
return this->unk8;
}
u32 sprite_getUnkA(BKSprite *this) {
return this->unkA;
}
u32 sprite_getUnk6(BKSprite *this) {
return this->unk6;
}
u32 sprite_getUnk4(BKSprite *this) {
return this->unk4;
}
s32 sprite_getFrameCount(BKSprite *this) {
return this->frameCnt;
}
BKSpriteFrame *sprite_getFramePtr(BKSprite *this, u32 frame_id) {
BKSpriteFrame *sprite_frame;
sprite_frame = (BKSpriteFrame *) (this->offsets[frame_id] + ((s32) ((*this).offsets + this->frameCnt)));
return sprite_frame;
}

20
src/core1/stub_13640.c Normal file
View File

@@ -0,0 +1,20 @@
#include <ultra64.h>
#include "core1/core1.h"
s32 stub_13640_get(void);
void stub_13640_init(void);
void stub_13640_set(s32 value);
static s32 sUnused;
s32 stubVar_13640_get(void) {
return sUnused;
}
void stub_13640_init(void) {
stub_13640_set(0);
}
void stub_13640_set(s32 arg0) {
sUnused = arg0;
}

7
src/core1/stub_1D590.c Normal file
View File

@@ -0,0 +1,7 @@
#include <ultra64.h>
#include "core1/core1.h"
void dummy_func_8025AFB0(void) {}
void dummy_func_8025AFB8(void) {}
void dummy_func_8025AFC0(Gfx **gfx, Mtx **mtx, Vtx **vtx) {}
s32 dummy_func_8025AFD0(void) { return 0; }

75
src/core1/stub_2FA0.c Normal file
View File

@@ -0,0 +1,75 @@
#include <ultra64.h>
#include "core1/core1.h"
#include "functions.h"
// all functions in this file are unsued
void stub_802409C0(f32 position[3], f32 speed);
void stub_80240A74(f32 position[3]);
f32 stub_80240A94(s32 time_out, f32 arg1);
void stub_80240AC8(f32 position[3], f32 speed);
static s32 sTimeout = 0;
void stub_802409C0(f32 position[3], f32 speed) {
f32 vp_rotation[3];
f32 delta_position[3];
f32 joystick_data[2];
f32 dt;
dt = time_getDelta() * speed;
controller_getJoystick(0, joystick_data);
delta_position[0] = joystick_data[0] * dt;
delta_position[1] = 0.0f;
delta_position[2] = -(joystick_data[1] * dt);
viewport_getRotation_vec3f(vp_rotation);
ml_vec3f_yaw_rotate_copy(delta_position, delta_position, vp_rotation[1]);
position[0] = position[0] + delta_position[0];
position[1] = position[1] + delta_position[1];
position[2] = position[2] + delta_position[2];
}
void stub_80240A74(f32 position[3]) {
stub_802409C0(position, 400.0f);
}
f32 stub_80240A94(s32 time_out, f32 delta_time) {
if (time_out > 40)
time_out = 40;
return delta_time + (f32) time_out * delta_time / 16;
}
void stub_80240AC8(f32 position[3], f32 speed) {
f32 vp_rotation[3];
f32 delta_position[3];
f32 joystick_data[2];
f32 dt;
dt = time_getDelta() * speed;
controller_getJoystick(0, joystick_data);
if (0.0f != joystick_data[0] || 0.0f != joystick_data[1]) {
sTimeout++;
if (sTimeout > 300)
sTimeout = 300;
} else {
sTimeout = 1;
}
dt = stub_80240A94(sTimeout, dt);
delta_position[0] = joystick_data[0] * dt;
delta_position[1] = 0.0f;
delta_position[2] = -(joystick_data[1] * dt);
viewport_getRotation_vec3f(vp_rotation);
ml_vec3f_yaw_rotate_copy(delta_position, delta_position, vp_rotation[1]);
position[0] = position[0] + delta_position[0];
position[1] = position[1] + delta_position[1];
position[2] = position[2] + delta_position[2];
}

View File

@@ -1,13 +1,9 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "core1/core1.h"
#include <core1/viewport.h>
// all functions in this file are unsued
extern f32 ml_cos_deg(f32);
extern f32 ml_sin_deg(f32);
Gfx D_80275880[] = {
static Gfx sGfxSublist[] = {
gsSPClearGeometryMode(G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH | G_CLIPPING | 0x0060CD00),
gsSPTexture(0, 0, 0, G_TX_RENDERTILE, G_OFF),
gsDPPipeSync(),
@@ -18,34 +14,37 @@ Gfx D_80275880[] = {
gsSPEndDisplayList()
};
/* .code */
void func_80241490(Gfx **gfx, Vtx **vtx, s32 arg2[3], s32 arg3[3], s32 arg4[3], s32 arg5[3], s32 arg6, s32 arg7) {
s32 spB4[3];
void func_80241490(Gfx **gfx, Vtx **vtx, s32 arg2[3], s32 arg3[3], s32 arg4[3], s32 arg5[3], bool cull_front, s32 arg7) {
s32 vp_position[3];
s32 var_a0;
s32 var_v0;
s32 var_v1;
s32 sp78[3][4];
s32 colors[3][4];
s32 i;
viewport_getPosition_vec3w(spB4);
gSPDisplayList((*gfx)++, D_80275880);
if (arg6 != 0) {
viewport_getPosition_vec3w(vp_position);
gSPDisplayList((*gfx)++, sGfxSublist);
if (cull_front != FALSE) {
gSPSetGeometryMode((*gfx)++, G_ZBUFFER | G_CULL_BACK);
} else {
gSPSetGeometryMode((*gfx)++, G_ZBUFFER | G_CULL_FRONT);
}
gSPVertex((*gfx)++, *vtx, 8, 0);
for(i = 0; i < 2; i++){
for(var_a0 = 0; var_a0 < 2; var_a0++){
for(var_v1 = 0; var_v1 < 2; var_v1++){
var_v0 = (var_v1 == 0) ? arg2[0] : arg3[0];
(*vtx)->v.ob[0] = (s16) (var_v0 - spB4[0]);
(*vtx)->v.ob[0] = (s16) (var_v0 - vp_position[0]);
var_v0 = (i == 0) ? arg2[1] : arg3[1];
(*vtx)->v.ob[1] = (s16) (var_v0 - spB4[1]);
(*vtx)->v.ob[1] = (s16) (var_v0 - vp_position[1]);
var_v0 = (var_a0 == 0) ? arg2[2] : arg3[2];
(*vtx)->v.ob[2] = (s16) (var_v0 - spB4[2]);
(*vtx)->v.ob[2] = (s16) (var_v0 - vp_position[2]);
(*vtx)->v.flag = 0;
(*vtx)->v.tc[0] = 0;
@@ -62,50 +61,50 @@ void func_80241490(Gfx **gfx, Vtx **vtx, s32 arg2[3], s32 arg3[3], s32 arg4[3],
if (arg7 != 0) {
for(i = 0; i < 3; i++){
for(var_v1 = 0; var_v1 < 3; var_v1++){
sp78[i][var_v1] = (arg4[var_v1] * arg5[i]) / 255;
colors[i][var_v1] = (arg4[var_v1] * arg5[i]) / 255;
}
sp78[i][3] = 0xFF;
colors[i][3] = 0xFF;
}
} else {
for(i = 0; i < 3; i++){
for(var_v1 = 0; var_v1 < 3; var_v1++){
sp78[i][var_v1] = arg4[var_v1];
colors[i][var_v1] = arg4[var_v1];
}
sp78[i][3] = arg5[i];
colors[i][3] = arg5[i];
}
}
gDPPipeSync((*gfx)++);
gDPSetPrimColor((*gfx)++, 0, 0, sp78[0][0], sp78[0][1], sp78[0][2], sp78[0][3]);
gDPSetPrimColor((*gfx)++, 0, 0, colors[0][0], colors[0][1], colors[0][2], colors[0][3]);
gSP2Triangles((*gfx)++, 7, 3, 5, 0, 5, 3, 1, 0);
gSP1Quadrangle((*gfx)++, 6, 4, 0, 2, 0);
gDPPipeSync((*gfx)++);
gDPSetPrimColor((*gfx)++, 0, 0, sp78[1][0], sp78[1][1], sp78[1][2], sp78[1][3]);
gDPSetPrimColor((*gfx)++, 0, 0, colors[1][0], colors[1][1], colors[1][2], colors[1][3]);
gSP1Quadrangle((*gfx)++, 7, 6, 2, 3, 0);
gSP2Triangles((*gfx)++, 4, 5, 0, 0, 5, 1, 0, 0);
gDPPipeSync((*gfx)++);
gDPSetPrimColor((*gfx)++, 0, 0, sp78[2][0], sp78[2][1], sp78[2][2], sp78[2][3]);
gDPSetPrimColor((*gfx)++, 0, 0, colors[2][0], colors[2][1], colors[2][2], colors[2][3]);
gSP1Quadrangle((*gfx)++, 5, 4, 6, 7, 0);
gSP2Triangles((*gfx)++, 0, 1, 2, 0, 1, 3, 2, 0);
}
void func_80241928(Gfx** gfx, Vtx** vtx, s32 arg2[3], s32 arg3, s32 arg4[3]) {
s32 spB4[3];
s32 vp_position[3];
f32 var_f26;
s32 var_fp;
s32 var_s0;
viewport_getPosition_vec3w(spB4);
viewport_getPosition_vec3w(vp_position);
for(var_fp = 0; var_fp < 4; var_fp++){
gSPDisplayList((*gfx)++, D_80275880);
gSPDisplayList((*gfx)++, sGfxSublist);
gSPSetGeometryMode((*gfx)++, G_ZBUFFER);
gSPVertex((*gfx)++, *vtx, 10, 0);
for(var_f26 = 0; var_f26 <= 90; var_f26 += 22.5){
for(var_s0 = -300; var_s0 < 900; var_s0 += 600){
(*vtx)->v.ob[0] = ((ml_sin_deg(var_fp*90 + var_f26) * arg3) + (f32) arg2[0]) - spB4[0];
(*vtx)->v.ob[1] = ((var_s0 / 2) + arg2[1]) - spB4[1];
(*vtx)->v.ob[2] = ((ml_cos_deg(var_fp*90 + var_f26) * arg3) + (f32) arg2[2]) - spB4[2];
(*vtx)->v.ob[0] = ((ml_sin_deg(var_fp*90 + var_f26) * arg3) + (f32) arg2[0]) - vp_position[0];
(*vtx)->v.ob[1] = ((var_s0 / 2) + arg2[1]) - vp_position[1];
(*vtx)->v.ob[2] = ((ml_cos_deg(var_fp*90 + var_f26) * arg3) + (f32) arg2[2]) - vp_position[2];
(*vtx)->v.tc[0] = 0;
(*vtx)->v.tc[1] = 0;
(*vtx)->v.cn[0] = 0;
@@ -164,7 +163,7 @@ void func_802424D4(Gfx **gfx, Mtx **mtx, Vtx **vtx, f32 arg3[3], f32 arg4[3], f3
sp68[2] *= arg5;
viewport_getPosition_vec3f(sp5C);
gSPDisplayList((*gfx)++, D_80275880);
gSPDisplayList((*gfx)++, sGfxSublist);
gSPSetGeometryMode((*gfx)++, G_ZBUFFER);
gSPVertex((*gfx)++, *vtx, 8, 0);
for( var_a0 = 0; var_a0 < 2; var_a0++){
@@ -203,51 +202,58 @@ void func_802424D4(Gfx **gfx, Mtx **mtx, Vtx **vtx, f32 arg3[3], f32 arg4[3], f3
}
}
void func_80242BE8(Gfx **gfx, Vtx **arg1, f32 arg2[2][2][2][3], s32 arg3[3], s32 *arg4, s32 arg5)
void func_80242BE8(Gfx **gfx, Vtx **vtx, f32 arg2[2][2][2][3], s32 color[3], s32 alpha_values[3], s32 cull_back)
{
f32 sp84[3];
f32 vp_position[3];
#define var_v0 ((f32*)((u8*)arg2 + (i << 2) * sizeof(f32[3]) + (j << 1) * sizeof(f32[3]) + k * sizeof(f32[3])))
s32 i;
s32 j;
s32 k;
viewport_getPosition_vec3f(sp84);
gSPDisplayList((*gfx)++, D_80275880);
if (arg5){
viewport_getPosition_vec3f(vp_position);
gSPDisplayList((*gfx)++, sGfxSublist);
if (cull_back){
gSPSetGeometryMode((*gfx)++, G_CULL_BACK);
} else {
gSPSetGeometryMode((*gfx)++, G_CULL_FRONT);
}
gSPVertex((*gfx)++, *arg1, 8, 0);
for(i = 0; i < 2; i++){
for(j = 0; j < 2; j++){
for(k = 0; k < 2; k++){
(*arg1)->v.ob[0] = var_v0[0] - sp84[0];
(*arg1)->v.ob[1] = var_v0[1] - sp84[1];
(*arg1)->v.ob[2] = var_v0[2] - sp84[2];
(*arg1)->v.flag = 0;
(*arg1)->v.tc[0] = 0;
(*arg1)->v.tc[1] = 0;
(*arg1)->v.cn[0] = 0;
(*arg1)->v.cn[1] = 0;
(*arg1)->v.cn[2] = 0;
(*arg1)->v.cn[3] = 0;
(*arg1)++;
gSPVertex((*gfx)++, *vtx, 8, 0);
for (i = 0; i < 2; i++) {
for (j = 0; j < 2; j++) {
for (k = 0; k < 2; k++) {
(*vtx)->v.ob[0] = var_v0[0] - vp_position[0];
(*vtx)->v.ob[1] = var_v0[1] - vp_position[1];
(*vtx)->v.ob[2] = var_v0[2] - vp_position[2];
(*vtx)->v.flag = 0;
(*vtx)->v.tc[0] = 0;
(*vtx)->v.tc[1] = 0;
(*vtx)->v.cn[0] = 0;
(*vtx)->v.cn[1] = 0;
(*vtx)->v.cn[2] = 0;
(*vtx)->v.cn[3] = 0;
(*vtx)++;
}
}
}
#undef var_v0
gDPPipeSync((*gfx)++);
gDPSetPrimColor((*gfx)++, 0, 0, arg3[0], arg3[1], arg3[2], arg4[0]);
gDPSetPrimColor((*gfx)++, 0, 0, color[0], color[1], color[2], alpha_values[0]);
gSP2Triangles((*gfx)++, 7, 3, 5, 0, 5, 3, 1, 0);
gSP1Quadrangle((*gfx)++, 6, 4, 0, 2, 0);
gDPPipeSync((*gfx)++);
gDPSetPrimColor((*gfx)++, 0, 0, arg3[0], arg3[1], arg3[2], arg4[1]);
gDPSetPrimColor((*gfx)++, 0, 0, color[0], color[1], color[2], alpha_values[1]);
gSP1Quadrangle((*gfx)++, 7, 6, 2, 3, 0);
gSP2Triangles((*gfx)++, 4, 5, 0, 0, 5, 1, 0, 0);
gDPPipeSync((*gfx)++);
gDPSetPrimColor((*gfx)++, 0, 0, arg3[0], arg3[1], arg3[2], arg4[2]);
gDPSetPrimColor((*gfx)++, 0, 0, color[0], color[1], color[2], alpha_values[2]);
gSP1Quadrangle((*gfx)++, 5, 4, 6, 7, 0);
gSP2Triangles((*gfx)++, 0, 1, 2, 0, 1, 3, 2, 0);
}

39
src/core1/ucode.c Normal file
View File

@@ -0,0 +1,39 @@
#include <ultra64.h>
#include <PR/rcp.h>
#include "core1/core1.h"
#include "functions.h"
#include "variables.h"
#define UCODE_SIZE 256
static u8 sUcodeData[UCODE_SIZE];
static s32 D_80283380;
static s32 D_80283384;
static s32 D_80283388;
void ucode_load(void) {
D_80283384 = *(s32 *)PHYS_TO_K1(0x04000000) ^ -1;
D_80283388 = D_80283384 ? 0x01 : 0x00;
D_80283380 = *(s32 *)PHYS_TO_K1(0x04001000) ^ 0x17D7;
D_80283388 |= D_80283380 ? 0x02 : 0x00;
if (D_80283388 == 0) {
piMgr_read(&sUcodeData, 0xB0000B70, UCODE_SIZE);
}
}
void ucode_stub1(void) {}
void ucode_stub2(void) {
osPiReadIo(0, NULL);
}
s32 ucode_stub3(void) {
return 0;
}
void ucode_getPtrAndSize(void **ptr, u32 *size) {
*ptr = &sUcodeData;
*size = UCODE_SIZE;
}

Some files were not shown because too many files have changed in this diff Show More