Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wind Waker: Link now appears in cutscenes (Neat!!) #732

Merged
merged 44 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
e20f06e
Created empty d_a_py_lk actor
themikelester Nov 16, 2024
8901b71
Load d_a_py_lk on demo start (most of them expect it to be loaded))
themikelester Nov 16, 2024
7fd466f
Basic body rendering
themikelester Nov 16, 2024
99f751f
Eyes now render in front of hair, but with correct scene depth
themikelester Nov 16, 2024
946f03a
Link uses custom setDemoData function
themikelester Nov 17, 2024
74237ab
JStudio: Add JSGDebugGetAnimationName and hook it up to d_a_py_lk
themikelester Nov 17, 2024
09665db
Basic link animation support
themikelester Nov 19, 2024
d341d7c
Link responds to animation mode 512 in demos
themikelester Nov 21, 2024
89435be
Add basic texture animation support
themikelester Nov 21, 2024
9e6fd31
Fix Link's eyes rendering in front of everything
themikelester Nov 21, 2024
6c898c3
Set Link's clothes using the demo actor ShapeID
themikelester Nov 21, 2024
0524b2b
Link can wear casual clothes!
themikelester Nov 22, 2024
68739c2
Fix links eye masking textures not animating
themikelester Nov 22, 2024
fa0c989
Snap link to the ground
themikelester Nov 22, 2024
2c5f46b
Load the Link arcs and create his actor when creating a demo scene
themikelester Nov 28, 2024
055da95
Update LinkDemoMode enum with better values
themikelester Nov 28, 2024
2966d97
Root motion from translations is now applied to position
themikelester Nov 28, 2024
ceabbce
Link's root position moves when an anim moves his feet. He can walk!
themikelester Nov 28, 2024
62ac2ca
Adjust movement speed based on ground angle
themikelester Nov 28, 2024
ad31e56
Reorder logic in execute() to match the game. Fix initial state of po…
themikelester Nov 28, 2024
7be84c2
Fix up ground clamping behavior
themikelester Nov 28, 2024
9367b0d
Add "Stolen Sister" to list of available demo scenes
themikelester Nov 28, 2024
cac942c
Cleanup
themikelester Nov 29, 2024
979f33b
Remove unused enum values so they don't add a billion lines
themikelester Nov 29, 2024
bb1f71e
Use proper parameters for default Link wait animation
themikelester Nov 29, 2024
1eee2e1
Fix up Title Screen to use Link's casual clothes
themikelester Nov 29, 2024
6196aeb
Fix first rendered frame of a new tool animation using the old anim.
themikelester Nov 29, 2024
50b0845
Link handles btk (uv) demo animations. His pupils now contract when s…
themikelester Nov 29, 2024
b3182da
Link can equip his sword. Equips based on demo events.
themikelester Nov 29, 2024
49bd7cb
Spawn link at the origin, rather than an arbitrary position
themikelester Dec 5, 2024
b02dc54
Fix typo 'gdnChk`
themikelester Dec 5, 2024
704e242
Add small todo
themikelester Dec 5, 2024
aa4572b
Update comments around eye translucency settings
themikelester Dec 5, 2024
7c5964b
Use modeProcInit/modeProcExec() helpers
themikelester Dec 5, 2024
6a45f7f
Warn on unsupported demo modes (only once)
themikelester Dec 5, 2024
eda91f4
Move Link arc loading to the d_a_py_lk actor
themikelester Dec 7, 2024
fca5769
Use `Math.hypot()`
themikelester Dec 7, 2024
6ef6536
Use `frameCtrl.SetFrame/GetFrame()`
themikelester Dec 7, 2024
fc409ab
Use LinkDemoMode enum instead of int
themikelester Dec 7, 2024
517bd9f
Fix velocity y/z swap
themikelester Dec 7, 2024
3fcbcdb
Use const enum if not using enum stringification
themikelester Dec 7, 2024
312128d
Start an LkJoint enum for commonly accessed joints
themikelester Dec 7, 2024
b09545e
Use `===` and `!==` in the Link and Aryll actors
themikelester Dec 7, 2024
ec0ea00
Merge branch 'master' into d_a_py_lk
magcius Dec 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/Common/JSYSTEM/JStudio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,8 @@ export abstract class TActor extends JStage.TObject {
public JSGGetTextureAnimationFrame(): number { return 0.0; }
public JSGSetTextureAnimationFrame(x: number): void { }
public JSGGetTextureAnimationFrameMax(): number { return 0.0; }

public JSGDebugGetAnimationName(x: number): string | null { return null; }
}

class TActorAdaptor extends TAdaptor {
Expand Down Expand Up @@ -699,7 +701,11 @@ class TActorAdaptor extends TAdaptor {

public adaptor_do_ANIMATION(data: ParagraphData): void {
assert(data.dataOp === EDataOp.ObjectIdx);
this.log(`SetAnimation: ${(data.value) & 0xFFFF} (${(data.value) >> 4 & 0x01})`);
const animName = this.object.JSGDebugGetAnimationName(data.value);
if( animName )
this.log(`SetAnimation: ${animName}`);
else
this.log(`SetAnimation: ${(data.value) & 0xFFFF} (${(data.value) >> 4 & 0x01})`);
this.object.JSGSetAnimation(data.value);
}

Expand Down
19 changes: 12 additions & 7 deletions src/ZeldaWindWaker/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { LegacyActor__RegisterFallbackConstructor } from './LegacyActor.js';
import { dDlst_2DStatic_c, d_a__RegisterConstructors } from './d_a.js';
import { d_a_sea } from './d_a_sea.js';
import { dBgS } from './d_bg.js';
import { EDemoCamFlags, EDemoMode, dDemo_manager_c } from './d_demo.js';
import { dDlst_list_Set, dDlst_list_c } from './d_drawlist.js';
import { dKankyo_create, dKy__RegisterConstructors, dKy_setLight, dScnKy_env_light_c } from './d_kankyo.js';
import { dKyw__RegisterConstructors } from './d_kankyo_wether.js';
Expand All @@ -40,8 +39,9 @@ import { dProcName_e } from './d_procname.js';
import { ResType, dRes_control_c } from './d_resorce.js';
import { dStage_dt_c_roomLoader, dStage_dt_c_roomReLoader, dStage_dt_c_stageInitLoader, dStage_dt_c_stageLoader, dStage_roomControl_c, dStage_roomStatus_c, dStage_stageDt_c } from './d_stage.js';
import { WoodPacket } from './d_wood.js';
import { fopAcM_create, fopAc_ac_c } from './f_op_actor.js';
import { fopAcM_create, fopAcM_searchFromName, fopAc_ac_c } from './f_op_actor.js';
import { cPhs__Status, fGlobals, fopDw_Draw, fopScn, fpcCt_Handler, fpcLy_SetCurrentLayer, fpcM_Management, fpcPf__Register, fpcSCtRq_Request, fpc_pc__ProfileList } from './framework.js';
import { dDemo_manager_c, EDemoCamFlags, EDemoMode } from './d_demo.js';

type SymbolData = { Filename: string, SymbolName: string, Data: ArrayBufferSlice };
type SymbolMapData = { SymbolData: SymbolData[] };
Expand Down Expand Up @@ -858,7 +858,7 @@ class SceneDesc {
modelCache.fetchObjectData(`Always`);
modelCache.fetchStageData(`Stage`);

modelCache.fetchFileData(`extra.crg1_arc`, 9);
modelCache.fetchFileData(`extra.crg1_arc`, 10);
modelCache.fetchFileData(`f_pc_profiles.crg1_arc`);

const particleArchives = [
Expand Down Expand Up @@ -999,7 +999,7 @@ class DemoDesc extends SceneDesc implements Viewer.SceneDesc {
globals.scnPlay.demo.remove();

// TODO: Don't render until the camera has been placed for this demo. The cuts are jarring.

// noclip modification: This normally happens on room load. Do it here instead so that we don't waste time
// loading .arcs for cutscenes that aren't going to be played
const lbnk = globals.roomCtrl.status[this.roomList[0]].data.lbnk;
Expand All @@ -1014,11 +1014,16 @@ class DemoDesc extends SceneDesc implements Viewer.SceneDesc {
// @TODO: Better error handling. This does not prevent a debugger break.
console.log(`Failed to load stage demo file: ${globals.roomCtrl.demoArcName}`, e);
})

await globals.modelCache.waitForLoad();
}
}

await globals.modelCache.waitForLoad();

// Most cutscenes expect the Link actor to be loaded
if(!fopAcM_searchFromName(globals, 'Link', 0, 0)) {
fopAcM_create(globals.frameworkGlobals, dProcName_e.d_a_py_lk, 0, null, globals.mStayNo, null, null, 0xFF, -1);
}
magcius marked this conversation as resolved.
Show resolved Hide resolved

// noclip modification: ensure all the actors are created before we load the cutscene
await new Promise(resolve => { (function waitForActors(){
if (globals.frameworkGlobals.ctQueue.length === 0) return resolve(null);
Expand Down Expand Up @@ -1048,7 +1053,6 @@ class DemoDesc extends SceneDesc implements Viewer.SceneDesc {
// It has been reconstructed by cross-referencing each Room's lbnk section (which points to a Demo*.arc file for each layer),
// the .stb files contained in each of those Objects/Demo*.arc files, and the FileName attribute from the event action.
const demoDescs = [
new DemoDesc("sea", "Stolen Sister", [44], "stolensister.stb", 9, [0.0, 0.0, 20000.0], 0, 0, 0),
new DemoDesc("sea", "Departure", [44], "departure.stb", 10, [-200000.0, 0.0, 320000.0], 0.0, 204, 0),
new DemoDesc("sea", "Pirate Zelda Fly", [44], "kaizoku_zelda_fly.stb", 0, [-200000.0, 0.0, 320000.0], 180.0, 0, 0),
new DemoDesc("sea", "Zola Awakens", [13], "awake_zola.stb", 8, [200000.0, 0.0, -200000.0], 0, 227, 0),
Expand Down Expand Up @@ -1128,6 +1132,7 @@ const sceneDescs = [
"Cutscenes",
new DemoDesc("sea_T", "Title Screen", [44], "title.stb", 0, [-220000.0, 0.0, 320000.0], 180.0, 0, 0),
new DemoDesc("sea", "Awaken", [44], "awake.stb", 0, [-220000.0, 0.0, 320000.0], 0.0, 0, 0),
new DemoDesc("sea", "Stolen Sister", [44], "stolensister.stb", 9, [0.0, 0.0, 20000.0], 0, 0, 0),

"Outset Island",
new SceneDesc("sea_T", "Title Screen", [44]),
Expand Down
Loading
Loading