From 375ba5eb73e50894d4e765fdfddbe004e3b4949d Mon Sep 17 00:00:00 2001 From: sup39 Date: Sat, 19 Nov 2022 15:39:30 +0900 Subject: [PATCH] Added `CAngle` for 'Customized Display' to show camera angle --- Codes.xml | 2 + changelog.md | 3 + package.json | 82 +++++++++---------- .../codes/CustomizedDisplay/codegen.js | 15 ++++ site/.vuepress/components/codes/asm.js | 5 +- 5 files changed, 65 insertions(+), 42 deletions(-) diff --git a/Codes.xml b/Codes.xml index 9970bdc..eb51244 100644 --- a/Codes.xml +++ b/Codes.xml @@ -3313,6 +3313,7 @@ |`HSpd`|Horizontal speed of Mario|float| |`VSpd`|Vertical speed of Mario|float| |`QF`|QF offset|\{0,1,2,3}| + |`CAngle`|Camera Angle|uint16| For float data, you can set the *format* to `.{digit}` to specify how many digits to show. @@ -3339,6 +3340,7 @@ |`HSpd`|マリオの水平速度|float| |`VSpd`|マリオのY速度|float| |`QF`|ずれたQFの数|\{0,1,2,3}| + |`CAngle`|カメラの角度|uint16| float(小数)型に対して、「表示のフォーマット」を`.{桁数}`に設定して何桁まで表示するか指定できます。 diff --git a/changelog.md b/changelog.md index 1887ad3..b8e99aa 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # Changelog +## Nov 19, 2022 +Added `CAngle` for 'Customized Display' to show camera angle + ## Nov 9, 2022 ### Added 'Fast Piantissimo' To make Piantissimo go as fast as he will in a level, you need to beat him with an in-game time under 25 seconds and grab his Shine. Or you could just use this code. diff --git a/package.json b/package.json index 9b2ff76..36b5eca 100644 --- a/package.json +++ b/package.json @@ -1,41 +1,41 @@ -{ - "name": "gctgenerator", - "version": "3.0.1", - "description": "Super Mario Sunshine Practice File Generator", - "main": "index.js", - "authors": { - "name": "Matteias Collet", - "email": "matteias.collet@bluewin.ch" - }, - "repository": "https://github.com/BitPatty/gctGenerator/gctGenerator", - "scripts": { - "dev": "npm run codes:inject && npm run translations:compare && vuepress dev site", - "build": "node ./scripts/inject_codes.js && npm run translations:compare && vuepress build site", - "format": "prettier --write ./site/**/*{.md,.js,.json}", - "translations:compare": "node ./scripts/compare_translations.js", - "codes:inject": "node ./scripts/inject_codes.js && npm run format", - "codes:clean": "node ./scripts/clean_codes.js && npm run format", - "precommit": "npm run codes:clean && git add .", - "serve": "serve ./site/.vuepress/dist" - }, - "license": "Apache-2.0", - "devDependencies": { - "@sup39/markdown-it-attr": "1.2.2", - "@sup39/markdown-it-inline-tag": "1.0.1", - "@types/encoding-japanese": "^2.0.1", - "@vuepress/plugin-back-to-top": "1.9.7", - "@vuepress/plugin-medium-zoom": "1.9.7", - "encoding-japanese": "^2.0.0", - "jsdom": "20.0.2", - "pre-commit": "1.2.2", - "prettier": "2.7.1", - "serve": "14.1.1", - "vuepress": "1.9.7" - }, - "dependencies": { - "vuedraggable": "2.24.3" - }, - "pre-commit": [ - "precommit" - ] -} +{ + "name": "gctgenerator", + "version": "3.0.1", + "description": "Super Mario Sunshine Practice File Generator", + "main": "index.js", + "authors": { + "name": "Matteias Collet", + "email": "matteias.collet@bluewin.ch" + }, + "repository": "https://github.com/BitPatty/gctGenerator/gctGenerator", + "scripts": { + "dev": "npm run codes:inject && npm run translations:compare && vuepress dev site", + "build": "node ./scripts/inject_codes.js && npm run translations:compare && vuepress build site", + "format": "prettier --write ./site/**/*{.md,.js,.json}", + "translations:compare": "node ./scripts/compare_translations.js", + "codes:inject": "node ./scripts/inject_codes.js && npm run format", + "codes:clean": "node ./scripts/clean_codes.js && npm run format", + "precommit": "npm run codes:clean && git add .", + "serve": "serve ./site/.vuepress/dist" + }, + "license": "Apache-2.0", + "devDependencies": { + "@sup39/markdown-it-attr": "1.2.2", + "@sup39/markdown-it-inline-tag": "1.0.1", + "@types/encoding-japanese": "^2.0.1", + "@vuepress/plugin-back-to-top": "1.9.7", + "@vuepress/plugin-medium-zoom": "1.9.7", + "encoding-japanese": "^2.0.0", + "jsdom": "20.0.2", + "pre-commit": "1.2.2", + "prettier": "2.7.1", + "serve": "14.1.1", + "vuepress": "1.9.7" + }, + "dependencies": { + "vuedraggable": "2.24.3" + }, + "pre-commit": [ + "precommit" + ] +} diff --git a/site/.vuepress/components/codes/CustomizedDisplay/codegen.js b/site/.vuepress/components/codes/CustomizedDisplay/codegen.js index cc86b6c..e34297e 100644 --- a/site/.vuepress/components/codes/CustomizedDisplay/codegen.js +++ b/site/.vuepress/components/codes/CustomizedDisplay/codegen.js @@ -70,6 +70,12 @@ const bases = { GMSP01: (rT) => ASM.lwz(rT, 13, -0x6120), GMSJ0A: (rT) => ASM.lwz(rT, 13, -0x6188), }), + gpCamera: /**@type{VBase}*/ ({ + GMSJ01: (rT) => ASM.lwz(rT, 13, -0x5750), + GMSE01: (rT) => ASM.lwz(rT, 13, -0x7118), + GMSP01: (rT) => ASM.lwz(rT, 13, -0x7158), + GMSJ0A: (rT) => ASM.lwz(rT, 13, -0x5768), + }), }; /** @typedef {keyof typeof bases} BaseId */ @@ -104,6 +110,15 @@ const fields = [ preview: 0, post: (rT) => ASM.rlwinm(rT, rT, 0, 30, 31, false), }, + { + id: 'CAngle', + base: 'gpCamera', + dtype: 16, + offset: 0xa6, + fmt: '%hu', + preview: 9, + post: (rT) => ASM.addi(rT, rT, -0x8000), // offset by 0x8000 + }, ]; const fieldDB = Object.fromEntries( fields.map(({ id, base, fmt, preview, ...info }) => [ diff --git a/site/.vuepress/components/codes/asm.js b/site/.vuepress/components/codes/asm.js index 1d1b796..6117066 100644 --- a/site/.vuepress/components/codes/asm.js +++ b/site/.vuepress/components/codes/asm.js @@ -114,7 +114,10 @@ const makeInstXS = (op, op2) => (rA, rS, rB, Rc) => InstX(op, rA, rS, rB, op2, + /** @type {(op: number) => InstM} */ const makeInstM = (op) => (rA, rS, SH, MB, ME, Rc) => InstM(op, rA, rS, SH, MB, ME, +Rc); /** @type {(op: number) => InstI} */ -const makeInstI = (op) => (LL, LK, AA = 0) => InstI(op, LL >> 2, +AA, +LK); +const makeInstI = + (op) => + (LL, LK, AA = 0) => + InstI(op, LL >> 2, +AA, +LK); export const ASM = { // store rT, rA, D