Skip to content

Commit

Permalink
Wind Waker: Fix some math function names
Browse files Browse the repository at this point in the history
  • Loading branch information
magcius committed Nov 16, 2024
1 parent 66f2687 commit bd48ca7
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 89 deletions.
4 changes: 2 additions & 2 deletions src/ZeldaTwilightPrincess/LegacyActor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { GfxRenderInstManager } from '../gfx/render/GfxRenderInstManager.js';
import { ColorKind } from '../gx/gx_render.js';
import { colorNewFromRGBA8 } from '../Color.js';
import { calc_mtx, MtxTrans, mDoMtx_ZXYrotM, mDoMtx_YrotM } from '../ZeldaWindWaker/m_do_mtx.js';
import { cM__Short2Rad } from '../ZeldaWindWaker/SComponent.js';
import { cM_s2rad } from '../ZeldaWindWaker/SComponent.js';

const scratchVec3a = vec3.create();

Expand Down Expand Up @@ -886,7 +886,7 @@ function spawnLegacyActor(globals: dGlobals, legacy: d_a_noclip_legacy, actor: f
} else if (type >= 2) {
const child = buildChildModel(rarc, `bmdr/rd_bow.bmd`);
child.setParentJoint(m, `yubiL`);
mat4.rotateX(child.modelMatrix, child.modelMatrix, cM__Short2Rad(0x4000));
mat4.rotateX(child.modelMatrix, child.modelMatrix, cM_s2rad(0x4000));
}

m.bindANK1(parseBCK(rarc, `bck/rd_wait01.bck`));
Expand Down
10 changes: 5 additions & 5 deletions src/ZeldaTwilightPrincess/d_a.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { JPABaseEmitter } from "../Common/JSYSTEM/JPA.js";
import { BTIData } from "../Common/JSYSTEM/JUTTexture.js";
import { MathConstants, Vec3UnitY, invlerp, saturate, scaleMatrix } from "../MathHelpers.js";
import { TSDraw } from "../SuperMarioGalaxy/DDraw.js";
import { cLib_addCalc, cLib_addCalc2, cLib_addCalcAngleS2, cLib_addCalcAngleS_, cLib_chaseF, cLib_targetAngleX, cLib_targetAngleY, cM__Short2Rad, cM__Deg2Short, cM_atan2s } from "../ZeldaWindWaker/SComponent.js";
import { cLib_addCalc, cLib_addCalc2, cLib_addCalcAngleS2, cLib_addCalcAngleS_, cLib_chaseF, cLib_targetAngleX, cLib_targetAngleY, cM_s2rad, cM_deg2s, cM_atan2s } from "../ZeldaWindWaker/SComponent.js";
import { dBgW } from "../ZeldaWindWaker/d_bg.js";
import { MtxPosition, MtxTrans, calc_mtx, mDoMtx_XrotM, mDoMtx_YrotM, mDoMtx_YrotS, mDoMtx_ZXYrotM, mDoMtx_ZrotM } from "../ZeldaWindWaker/m_do_mtx.js";
import { GfxDevice } from "../gfx/platform/GfxPlatform.js";
Expand Down Expand Up @@ -3100,7 +3100,7 @@ class d_a_obj_magLiftRot extends fopAc_ac_c {
private modeMove(deltaTimeFrames: number): void {
this.speedF = cLib_chaseF(this.speedF, 8.0, 0.05 * deltaTimeFrames);

const speed = cM__Deg2Short(this.speedF);
const speed = cM_deg2s(this.speedF);
this.rot[2] = cLib_addCalcAngleS_(this.rot[2], this.rotTarget, 1, speed * deltaTimeFrames, 1);

if ((this.rotTarget - this.rot[2]) === 0) {
Expand Down Expand Up @@ -3213,7 +3213,7 @@ class d_a_e_hp extends fopAc_ac_c {
public override execute(globals: dGlobals, deltaTimeFrames: number): void {
super.execute(globals, deltaTimeFrames);

this.height = 170.0 + Math.sin(cM__Short2Rad(this.counter * 1000)) * 20;
this.height = 170.0 + Math.sin(cM_s2rad(this.counter * 1000)) * 20;

this.mtx_set();

Expand Down Expand Up @@ -3290,8 +3290,8 @@ class d_a_e_hp extends fopAc_ac_c {
swing = 6000.0

this.swingRate = cLib_addCalc2(this.swingRate, swing, 0.1, swing * 0.1);
this.swingAngle[0] = cLib_addCalcAngleS2(this.swingAngle[0], this.swingRate * Math.sin(cM__Short2Rad(this.counter * 2000)), 8, 0x400);
this.swingAngle[2] = this.swingRate * Math.sin(cM__Short2Rad(this.counter * 2500.0));
this.swingAngle[0] = cLib_addCalcAngleS2(this.swingAngle[0], this.swingRate * Math.sin(cM_s2rad(this.counter * 2000)), 8, 0x400);
this.swingAngle[2] = this.swingRate * Math.sin(cM_s2rad(this.counter * 2500.0));
}
}

Expand Down
20 changes: 10 additions & 10 deletions src/ZeldaTwilightPrincess/d_kankyo_wether.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { MathConstants, computeMatrixWithoutTranslation, invlerp, saturate } fro
import { DeviceProgram } from "../Program.js";
import { TDDraw } from "../SuperMarioGalaxy/DDraw.js";
import { TextureMapping } from "../TextureHolder.js";
import { cLib_addCalc, cM__Short2Rad, cM_rndF, cM_rndFX } from "../ZeldaWindWaker/SComponent.js";
import { cLib_addCalc, cM_s2rad, cM_rndF, cM_rndFX } from "../ZeldaWindWaker/SComponent.js";
import { PeekZManager, PeekZResult } from "../ZeldaWindWaker/d_dlst_peekZ.js";
import { mDoLib_project, mDoLib_projectFB } from "../ZeldaWindWaker/m_do_ext.js";
import { MtxTrans, calc_mtx, mDoMtx_XrotM, mDoMtx_ZrotM } from "../ZeldaWindWaker/m_do_mtx.js";
Expand Down Expand Up @@ -520,9 +520,9 @@ export class dKankyo_sun_Packet {

private lensflareBaseSize: number = 160.0;
private lensflareCount: number = 16.0;
private lensflareAngleSteps: number[] = [cM__Short2Rad(0x1000), cM__Short2Rad(0x1C71)];
private lensflareAngleSteps: number[] = [cM_s2rad(0x1000), cM_s2rad(0x1C71)];
private lensflareSizes: number[] = [0.1, 1.1, 0.2, 0.4];
private lensflareWidth: number = cM__Short2Rad(1000.0);
private lensflareWidth: number = cM_s2rad(1000.0);

private drawLenzflare(globals: dGlobals, ddraw: TDDraw, renderInstManager: GfxRenderInstManager, viewerInput: ViewerRenderInput): void {
if (this.visibility <= 0.1)
Expand Down Expand Up @@ -607,8 +607,8 @@ export class dKankyo_sun_Packet {
submitScratchRenderInst(renderInstManager, materialHelper, renderInst, viewerInput);
}

let angle0 = cM__Short2Rad(globals.counter * 0x00 - 0x07F6);
let angle1 = cM__Short2Rad(globals.counter * -0x0E + 0x416B);
let angle0 = cM_s2rad(globals.counter * 0x00 - 0x07F6);
let angle1 = cM_s2rad(globals.counter * -0x0E + 0x416B);
for (let i = 0; i < this.lensflareCount; i++) {
ddraw.begin(GX.Command.DRAW_TRIANGLES);

Expand Down Expand Up @@ -1393,7 +1393,7 @@ export class dKankyo_star_Packet {
scratchVec3a[2] = radiusXZ * 300.0 * Math.cos(angle);

angle += angleIncr;
angleIncr += cM__Short2Rad(0x09C4);
angleIncr += cM_s2rad(0x09C4);

radius += (1.0 + 3.0 * (radius / 200.0 ** 3.0));
if (radius > 200.0)
Expand Down Expand Up @@ -2076,7 +2076,7 @@ function wether_move_vrkumo(globals: dGlobals, deltaTimeFrames: number): void {
windPower = 0.3;

const windDir = dKyw_get_wind_vec(envLight);
const windPitch = vecPitch(windDir), windAngle = vecAngle(windDir) + cM__Short2Rad(24575.0);
const windPitch = vecPitch(windDir), windAngle = vecAngle(windDir) + cM_s2rad(24575.0);
const cosPitch = Math.cos(windPitch);
const sinAngle = Math.sin(windAngle), cosAngle = Math.cos(windAngle);
pkt.cloudScrollX = (pkt.cloudScrollX + cosPitch * sinAngle * windPower * 0.0014 * deltaTimeFrames) % 1.0;
Expand Down Expand Up @@ -2115,11 +2115,11 @@ export function dKyw_wind_set(globals: dGlobals): void {

let windAngleXZ = 0, windAngleY = 0;
if (windDirFlag === 2)
windAngleXZ = cM__Short2Rad(-0x4000);
windAngleXZ = cM_s2rad(-0x4000);
else if (windDirFlag === 4)
windAngleXZ = cM__Short2Rad(0x4000);
windAngleXZ = cM_s2rad(0x4000);
else if (windDirFlag === 5)
windAngleXZ = cM__Short2Rad(0x7FFF);
windAngleXZ = cM_s2rad(0x7FFF);

const targetWindVecX = Math.sin(windAngleXZ) * Math.cos(windAngleY);
const targetWindVecY = Math.sin(windAngleY);
Expand Down
4 changes: 2 additions & 2 deletions src/ZeldaTwilightPrincess/d_particle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { TDDraw } from "../SuperMarioGalaxy/DDraw.js";
import { TextureMapping } from "../TextureHolder.js";
import { nArray } from "../util.js";
import { ViewerRenderInput } from "../viewer.js";
import { cLib_addCalc2, cM__Short2Rad } from "../ZeldaWindWaker/SComponent.js";
import { cLib_addCalc2, cM_s2rad } from "../ZeldaWindWaker/SComponent.js";
import { dGlobals } from "./Main.js";
import * as GX from '../gx/gx_enum.js';
import { ColorKind } from "../gx/gx_render.js";
Expand Down Expand Up @@ -142,7 +142,7 @@ export class dPa_control_c {
if (pos !== null)
vec3.copy(baseEmitter.globalTranslation, pos);
if (rot !== null)
computeModelMatrixR(baseEmitter.globalRotation, cM__Short2Rad(rot[0]), cM__Short2Rad(rot[1]), cM__Short2Rad(rot[2]));
computeModelMatrixR(baseEmitter.globalRotation, cM_s2rad(rot[0]), cM_s2rad(rot[1]), cM_s2rad(rot[2]));
if (scale !== null)
baseEmitter.setGlobalScale(scale);

Expand Down
22 changes: 11 additions & 11 deletions src/ZeldaWindWaker/Grass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { colorCopy, colorFromRGBA } from '../Color.js';
import { dKy_GxFog_set } from './d_kankyo.js';
import { dBgS_GndChk } from './d_bg.js';
import { getMatrixTranslation } from '../MathHelpers.js';
import { cM__Short2Rad } from './SComponent.js';
import { cM_s2rad } from './SComponent.js';

function createMaterialHelper(material: GXMaterial): GXMaterialHelperGfx {
// Patch material.
Expand Down Expand Up @@ -326,8 +326,8 @@ export class FlowerPacket {
public calc(frameCount: number): void {
// Idle animation updates
for (let i = 0; i < 8; i++) {
const theta = Math.cos(cM__Short2Rad(1000.0 * (frameCount + 0xfa * i)));
this.anims[i].rotationX = cM__Short2Rad(1000.0 + 1000.0 * theta);
const theta = Math.cos(cM_s2rad(1000.0 * (frameCount + 0xfa * i)));
this.anims[i].rotationX = cM_s2rad(1000.0 + 1000.0 * theta);
}

// @TODO: Hit checks
Expand Down Expand Up @@ -643,11 +643,11 @@ export class TreePacket {
public calc(frameCount: number): void {
// Idle animation updates
for (let i = 0; i < 8; i++) {
let theta = Math.cos(cM__Short2Rad(4000.0 * (frameCount + 0xfa * i)));
this.anims[i].topRotationY = cM__Short2Rad(100.0 + this.anims[i].initialRotationShort + 100.0 * theta);
let theta = Math.cos(cM_s2rad(4000.0 * (frameCount + 0xfa * i)));
this.anims[i].topRotationY = cM_s2rad(100.0 + this.anims[i].initialRotationShort + 100.0 * theta);

theta = Math.cos(cM__Short2Rad(1000.0 * (frameCount + 0xfa * i)));
this.anims[i].topRotationX = cM__Short2Rad(100 + 100 * theta);
theta = Math.cos(cM_s2rad(1000.0 * (frameCount + 0xfa * i)));
this.anims[i].topRotationX = cM_s2rad(100 + 100 * theta);
}

// @TODO: Hit checks
Expand Down Expand Up @@ -700,7 +700,7 @@ export class TreePacket {

mat4.fromYRotation(anim.trunkMtx, anim.trunkFallYaw);
mat4.rotateX(anim.trunkMtx, anim.trunkMtx, anim.trunkRotationX);
mat4.rotateY(anim.trunkMtx, anim.trunkMtx, cM__Short2Rad(anim.initialRotationShort) - anim.trunkFallYaw);
mat4.rotateY(anim.trunkMtx, anim.trunkMtx, cM_s2rad(anim.initialRotationShort) - anim.trunkFallYaw);
}

// Update grass packets
Expand Down Expand Up @@ -919,7 +919,7 @@ export class GrassPacket {
for (let i = 0; i < 8; i++) {
this.anims[i] = {
active: true,
rotationY: cM__Short2Rad(0x2000 * i),
rotationY: cM_s2rad(0x2000 * i),
rotationX: 0,
modelMtx: mat4.create(),
}
Expand Down Expand Up @@ -951,8 +951,8 @@ export class GrassPacket {

// Idle animation updates
for (let i = 0; i < 8; i++) {
let theta = Math.cos(cM__Short2Rad(windPower * (frameCount + 0xfa * i)));
this.anims[i].rotationX = cM__Short2Rad(windPower + windPower * theta);
let theta = Math.cos(cM_s2rad(windPower * (frameCount + 0xfa * i)));
this.anims[i].rotationX = cM_s2rad(windPower + windPower * theta);
}

// @TODO: Hit checks
Expand Down
18 changes: 11 additions & 7 deletions src/ZeldaWindWaker/SComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,23 @@ export function cM_rndFX(max: number): number {
}

export function cM_atan2s(y: number, x: number): number {
return cM__Rad2Short(Math.atan2(y, x));
return cM_rad2s(Math.atan2(y, x));
}

export function cM__Short2Rad(v: number): number {
return v * (Math.PI / 0x8000);
export function cM_rad2s(v: number): number {
return v * (0x8000 / Math.PI);
}

export function cM__Rad2Short(v: number): number {
return v * (0x8000 / Math.PI);
export function cM_deg2s(v: number): number {
return cM_rad2s(v * MathConstants.DEG_TO_RAD);
}

export function cM_s2rad(v: number): number {
return v * (Math.PI / 0x8000);
}

export function cM__Deg2Short(v: number): number {
return cM__Rad2Short(v * MathConstants.DEG_TO_RAD);
export function cM_sht2d(v: number): number {
return cM_s2rad(v) * MathConstants.RAD_TO_DEG;
}

export function cLib_targetAngleX(p0: ReadonlyVec3, p1: ReadonlyVec3): number {
Expand Down
26 changes: 13 additions & 13 deletions src/ZeldaWindWaker/d_a.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { TevDefaultSwapTables } from "../gx/gx_material.js";
import { ColorKind, DrawParams, GXMaterialHelperGfx, MaterialParams } from "../gx/gx_render.js";
import { arrayRemove, assert, assertExists, nArray } from "../util.js";
import { ViewerRenderInput } from "../viewer.js";
import { cLib_addCalc, cLib_addCalc2, cLib_addCalcAngleRad2, cLib_addCalcAngleS, cLib_addCalcAngleS2, cLib_addCalcPosXZ2, cLib_chasePosXZ, cLib_distanceSqXZ, cLib_distanceXZ, cLib_targetAngleX, cLib_targetAngleY, cM__Short2Rad, cM_atan2s, cM_rndF, cM_rndFX } from "./SComponent.js";
import { cLib_addCalc, cLib_addCalc2, cLib_addCalcAngleRad2, cLib_addCalcAngleS, cLib_addCalcAngleS2, cLib_addCalcPosXZ2, cLib_chasePosXZ, cLib_distanceSqXZ, cLib_distanceXZ, cLib_targetAngleX, cLib_targetAngleY, cM_s2rad, cM_atan2s, cM_rndF, cM_rndFX } from "./SComponent.js";
import { dLib_getWaterY, dLib_waveInit, dLib_waveRot, dLib_wave_c, d_a_sea } from "./d_a_sea.js";
import { cBgW_Flags, dBgS_GndChk, dBgW } from "./d_bg.js";
import { PeekZResult } from "./d_dlst_peekZ.js";
Expand Down Expand Up @@ -1139,7 +1139,7 @@ class d_a_obj_lpalm extends fopAc_ac_c {

if (vec3.length(scratchVec3b) >= 0.00000001) {
vec3.normalize(scratchVec3b, scratchVec3b);
quat.setAxisAngle(this.baseQuatTarget, scratchVec3b, windPow * cM__Short2Rad(0x600));
quat.setAxisAngle(this.baseQuatTarget, scratchVec3b, windPow * cM_s2rad(0x600));
} else {
quat.identity(this.baseQuatTarget);
}
Expand All @@ -1148,10 +1148,10 @@ class d_a_obj_lpalm extends fopAc_ac_c {

for (let i = 0; i < 2; i++) {
const animDirTarget = Math.min(windPow * 0x180, 0x100);
this.animDir[i] = cLib_addCalcAngleRad2(this.animDir[i], cM__Short2Rad(animDirTarget), cM__Short2Rad(0x04), cM__Short2Rad(0x20));
this.animDir[i] = cLib_addCalcAngleRad2(this.animDir[i], cM_s2rad(animDirTarget), cM_s2rad(0x04), cM_s2rad(0x20));

// Rock back and forth.
this.animWave[i] += cM__Short2Rad((windPow * 0x800) + cM_rndFX(0x80)) *deltaTimeFrames;
this.animWave[i] += cM_s2rad((windPow * 0x800) + cM_rndFX(0x80)) *deltaTimeFrames;
const wave = Math.sin(this.animWave[i]);

vec3.set(scratchVec3a, wave, 0, wave);
Expand Down Expand Up @@ -2162,7 +2162,7 @@ class dCloth_packet_c {

vec3.normalize(dst, dst);

const theta = cM__Short2Rad(this.rotateY) * Math.sin(cM__Short2Rad((this.wave + this.ripple * (fly + hoist))));
const theta = cM_s2rad(this.rotateY) * Math.sin(cM_s2rad((this.wave + this.ripple * (fly + hoist))));
computeModelMatrixR(scratchMat4a, 0, theta, 0);
transformVec3Mat4w0(dst, scratchMat4a, dst);
}
Expand Down Expand Up @@ -2208,7 +2208,7 @@ class dCloth_packet_c {

public cloth_move(deltaTimeFrames: number): void {
// Compute global wind vector.
vec3.scale(scratchVec3a, this.globalWind, this.windSpeed + this.windSpeedWave * Math.sin(cM__Short2Rad(this.wave)));
vec3.scale(scratchVec3a, this.globalWind, this.windSpeed + this.windSpeedWave * Math.sin(cM_s2rad(this.wave)));

const distFly = (this.flyLength / (this.flyGridSize - 1)) * this.flyFlex;
const distHoist = (this.hoistLength / (this.hoistGridSize - 1)) * this.hoistFlex;
Expand Down Expand Up @@ -2872,7 +2872,7 @@ class d_a_majuu_flag extends fopAc_ac_c {

private majuu_flag_move(globals: dGlobals, deltaTimeFrames: number): void {
this.wave += this.waveSpeed * deltaTimeFrames;
const windSpeed = lerp(this.windSpeed1, this.windSpeed2, Math.sin(cM__Short2Rad(this.wave)) * 0.5 + 0.5);
const windSpeed = lerp(this.windSpeed1, this.windSpeed2, Math.sin(cM_s2rad(this.wave)) * 0.5 + 0.5);

const windpow = dKyw_get_wind_pow(globals.g_env_light);
vec3.set(scratchVec3a, 0, 0, windSpeed * windpow * 2.0);
Expand Down Expand Up @@ -3365,12 +3365,12 @@ class d_a_obj_ikada extends fopAc_ac_c implements ModeFuncExec<d_a_obj_ikada_mod
dLib_waveRot(globals, this.wave, this.pos, 0.0, deltaTimeFrames);
vec3.copy(this.model.baseScale, this.scale);

const waveAnim1 = Math.sin(cM__Short2Rad(this.waveAnim1Timer));
const waveAnim1 = Math.sin(cM_s2rad(this.waveAnim1Timer));
const waveAnim1X = 0xC8 * waveAnim1;
const waveAnim1Z = 0x3C * waveAnim1;

const rockAnimAmpl = Math.sin(this.linkRideRockTimer) * this.linkRideRockAmpl;
const rockAnimTheta = Math.cos(cM__Short2Rad(this.rot[1]));
const rockAnimTheta = Math.cos(cM_s2rad(this.rot[1]));
const rockAnimX = rockAnimAmpl * Math.cos(rockAnimTheta);
const rockAnimZ = rockAnimAmpl * Math.sin(rockAnimTheta);

Expand Down Expand Up @@ -3496,7 +3496,7 @@ class d_a_obj_ikada extends fopAc_ac_c implements ModeFuncExec<d_a_obj_ikada_mod

const rotTargetY = cM_atan2s(scratchVec3a[0], scratchVec3a[2]);
this.pathRotY = cLib_addCalcAngleS(this.pathRotY, rotTargetY, 8, 0x200 * deltaTimeFrames, 8);
const fwdSpeed = this.velocityFwd * deltaTimeFrames * Math.cos(cM__Short2Rad(rotTargetY - this.pathRotY));
const fwdSpeed = this.velocityFwd * deltaTimeFrames * Math.cos(cM_s2rad(rotTargetY - this.pathRotY));
cLib_chasePosXZ(dst, this.curPathP1, fwdSpeed);

return cLib_distanceSqXZ(dst, this.curPathP1) < fwdSpeed ** 2.0;
Expand Down Expand Up @@ -3777,7 +3777,7 @@ class d_a_oship extends fopAc_ac_c implements ModeFuncExec<d_a_oship_mode> {

const rotTargetY = cM_atan2s(scratchVec3a[0], scratchVec3a[2]);
this.pathRotY = cLib_addCalcAngleS(this.pathRotY, rotTargetY, 8, 0x200 * deltaTimeFrames, 8);
const fwdSpeed = this.velocityFwd * deltaTimeFrames * Math.cos(cM__Short2Rad(rotTargetY - this.pathRotY));
const fwdSpeed = this.velocityFwd * deltaTimeFrames * Math.cos(cM_s2rad(rotTargetY - this.pathRotY));
cLib_chasePosXZ(dst, this.curPathP1, fwdSpeed);

return cLib_distanceSqXZ(dst, this.curPathP1) < fwdSpeed ** 2.0;
Expand Down Expand Up @@ -3983,7 +3983,7 @@ class d_a_oship extends fopAc_ac_c implements ModeFuncExec<d_a_oship_mode> {
dLib_waveRot(globals, this.wave, this.pos, this.attackSwayAmount, deltaTimeFrames);

const angleY = this.rot[1] + cLib_targetAngleY(this.pos, globals.cameraPosition);
const swayAmount = Math.sin(cM__Short2Rad(this.attackSwayTimer)) * (this.attackSwayAmount * 10);
const swayAmount = Math.sin(cM_s2rad(this.attackSwayTimer)) * (this.attackSwayAmount * 10);

if (this.curMode !== d_a_oship_mode.delete) {
this.rot[0] = this.wave.rotX + Math.cos(angleY) * swayAmount;
Expand Down Expand Up @@ -4606,7 +4606,7 @@ export class d_a_ff extends fopAc_ac_c {
this.flickerTimerTimer = 200.0 + cM_rndF(100.0);
}

const scaleTarget = (this.flickerTimer <= 0.0) ? Math.sin(cM__Short2Rad(this.liveTimer * 1000)) * 0.15 * 0.25 + 0.225 : 0.0;
const scaleTarget = (this.flickerTimer <= 0.0) ? Math.sin(cM_s2rad(this.liveTimer * 1000)) * 0.15 * 0.25 + 0.225 : 0.0;
this.flyScale = cLib_addCalc2(this.flyScale, scaleTarget, 0.1 * deltaTimeFrames, 0.05);

let motion = false;
Expand Down
6 changes: 3 additions & 3 deletions src/ZeldaWindWaker/d_a_sea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { dKy_get_seacolor, dKy_GxFog_sea_set } from './d_kankyo.js';
import { colorLerp, OpaqueBlack } from '../Color.js';
import { dKy_usonami_set } from './d_kankyo_wether.js';
import { Plane } from '../Geometry.js';
import { cLib_addCalcAngleS2, cM_atan2s, cM_rndF, cM__Short2Rad } from './SComponent.js';
import { cLib_addCalcAngleS2, cM_atan2s, cM_rndF, cM_s2rad } from './SComponent.js';
import { dStage_stagInfo_GetSTType } from './d_stage.js';

const scratchVec2a = vec2.create();
Expand Down Expand Up @@ -741,6 +741,6 @@ export function dLib_waveRot(globals: dGlobals, wave: dLib_wave_c, pos: Readonly
wave.animX += 400 * deltaTimeFrames;
wave.animZ += 430 * deltaTimeFrames;
const swayAmountFull = 130.0 + swayAmount;
wave.rotX = wave.angleX + swayAmountFull * Math.sin(cM__Short2Rad(wave.animX));
wave.rotZ = wave.angleZ + swayAmountFull * Math.cos(cM__Short2Rad(wave.animZ));
wave.rotX = wave.angleX + swayAmountFull * Math.sin(cM_s2rad(wave.animX));
wave.rotZ = wave.angleZ + swayAmountFull * Math.cos(cM_s2rad(wave.animZ));
}
Loading

0 comments on commit bd48ca7

Please sign in to comment.