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

[jak3] implement autocollect and city turbo board cheats, fix actor heap and level flags #3541

Merged
merged 3 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
46 changes: 18 additions & 28 deletions decompiler/config/jak3/all-types.gc
Original file line number Diff line number Diff line change
Expand Up @@ -7555,37 +7555,27 @@
:type uint32
:bitfield #t
(lf0 0)
(lf1 1)
(lf2 2)
(lf3 3)
(lf4 4)
(lf5 5)
(lf6 6)
(lf7 7)
(lf8 8)
(lf9 9)
(not-physical 1)
(ctycar 2)
(ctypes 3)
(external 4)
(title 5)
(borrow-load 6)
(end-mode 7)
(flut 8)
(sky 9)
(use-camera-other 10)
(lf11 11)
(lf12 12)
(lf13 13)
(display-wait 11)
(ocean-near-translucent 12)
(ocean-far 13)
(low-res-hfrag 14)
(lf15 15)
(lf16 16)
(lf17 17)
(lf18 18)
(lf19 19)
(lf20 20)
(city-borrow-available 15)
(mech 16)
(allow-unloaded 17)
(check-taskname-for-continue 18)
(city-borrow-high-priority 19)
(ocean-all 20)
(desert 21)
(lf22 22)
(lf23 23)
(lf24 24)
(lf25 25)
(lf26 26)
(lf27 27)
(lf28 28)
(lf29 29)
(lf30 30)
(lf31 31)
)
;; ---level-h:level-flags

Expand Down
23 changes: 7 additions & 16 deletions game/overlord/jak2/srpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,6 @@ void* RPC_Loader(unsigned int /*fno*/, void* data, int size) {
}

int VBlank_Handler(void*) {
bool bVar1;
int iVar2;
int iVar3;
uint8_t uVar4;

IopTicks = IopTicks + 1;
if (gSoundEnable == 0) {
return 1;
Expand Down Expand Up @@ -543,18 +538,14 @@ int VBlank_Handler(void*) {
info.diskspeed[1] = 0 /*DAT_00013488*/;
info.lastspeed = 0 /*gLastSpeed*/;
info.dupseg = 0 /*gDupSeg*/;
iVar2 = 1;
do {
iVar3 = snd_GetVoiceStatus(iVar2);
uVar4 = '\0';
if (iVar3 == 1) {
uVar4 = 0xff;
for (int i = 0; i < 48; i++) {
if (snd_GetVoiceStatus(i) == 1) {
info.chinfo[i] = -1;
} else {
info.chinfo[i] = 0;
}
info.chinfo[iVar2] = uVar4;
bVar1 = iVar2 < 0x30;
iVar2 = iVar2 + 1;
} while (bVar1);
LookupSound(0x29a); // lol idk
}
LookupSound(666); // music

/*
local_38 = &info;
Expand Down
7 changes: 7 additions & 0 deletions goal_src/jak3/engine/common-obs/collectables.gc
Original file line number Diff line number Diff line change
Expand Up @@ -2410,6 +2410,13 @@
(if arg5
(mem-copy! (&-> sv-56 type) (&-> arg5 type) 40)
)
;; og:preserve-this pc port cheat
(#when PC_PORT
(when (and (pc-cheats? (-> *pc-settings* cheats) suck-in-all)
(!= arg1 (pickup-type skill)))
(logior! (-> sv-56 options) (actor-option suck-in))
)
)
(set! (-> sv-56 pickup-type) s2-0)
(if (not (logtest? (actor-option dont-override-fact) (-> sv-56 options)))
(set! (-> sv-56 pickup-spawn-amount) 1.0)
Expand Down
2 changes: 1 addition & 1 deletion goal_src/jak3/engine/gfx/foreground/foreground.gc
Original file line number Diff line number Diff line change
Expand Up @@ -2367,6 +2367,6 @@

(define *foreground* (new 'global 'foreground-globals))

(define *foreground-draw-engine* (new 'global 'engine 'draw 768 connection))
(define *foreground-draw-engine* (new 'global 'engine 'draw PROCESS_HEAP_MAX connection))

(kmemclose)
2 changes: 1 addition & 1 deletion goal_src/jak3/engine/gfx/mood/time-of-day.gc
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@
(dotimes (v1-19 (-> *level* length))
(let ((a0-52 (-> *level* level v1-19)))
(when (= (-> a0-52 status) 'active)
(if (logtest? (-> a0-52 info level-flags) (level-flags lf9))
(if (logtest? (-> a0-52 info level-flags) (level-flags sky))
(set! (-> arg0 sky) #t)
)
(if (and (= (-> a0-52 display?) 'display) (-> a0-52 info special-mood))
Expand Down
8 changes: 5 additions & 3 deletions goal_src/jak3/engine/gfx/ocean/ocean.gc
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,7 @@
(let ((s5-0 (-> *level* draw-level v1-2)))
(when (and s5-0 (= (-> s5-0 status) 'active))
(when (= (-> s5-0 display?) 'display)
(if (logtest? (-> s5-0 info level-flags) (level-flags lf13))
(if (logtest? (-> s5-0 info level-flags) (level-flags ocean-far))
(set! (-> this far-on) #t)
)
(let ((a0-13 (-> s5-0 info ocean)))
Expand All @@ -1289,10 +1289,12 @@
((and a0-13 (nonzero? (-> a0-13 value)))
(set! *ocean-map* (the-as ocean-map (-> a0-13 value)))
(set-height! *ocean-map* (-> s5-0 info ocean-height))
(if (logtest? (level-flags lf20) (-> s5-0 info level-flags))
(if (logtest? (level-flags ocean-all) (-> s5-0 info level-flags))
(set! (-> this all-on) #t)
)
(set! (-> this ocean-near-translucent?) (logtest? (-> s5-0 info level-flags) (level-flags lf12)))
(set! (-> this ocean-near-translucent?)
(logtest? (-> s5-0 info level-flags) (level-flags ocean-near-translucent))
)
(goto cfg-24)
)
)
Expand Down
47 changes: 19 additions & 28 deletions goal_src/jak3/engine/gfx/sky/sky-tng.gc
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,6 @@

(defmethod draw-clouds ((this sky-work) (arg0 dma-buffer))
(local-vars (v1-19 float) (sv-16 cloud-vert-array) (sv-20 (inline-array sky-vertex)) (sv-32 int))

(when (zero? *sky-texture-anim-array*) ;; added
(return #f)
)

(rlet ((vf23 :class vf)
(vf27 :class vf)
)
Expand Down Expand Up @@ -549,40 +544,36 @@
)

(defmethod draw-fog ((this sky-work) (arg0 dma-buffer))
(when (zero? *sky-texture-anim-array*) ;; added
(return #f)
)
(let ((s4-0 (-> *sky-texture-anim-array* array-data 8 tex)))
(if s4-0
(dma-buffer-add-gs-set arg0
(tex0-1 (new 'static 'gs-tex0
:tcc #x1
:cld #x1
:psm (the-as int (-> s4-0 psm))
:cpsm (-> s4-0 clutpsm)
:cbp (-> s4-0 clutdest)
:th (log2 (-> s4-0 h))
:tw (log2 (-> s4-0 w))
:tbw (-> s4-0 width 0)
:tbp0 (-> s4-0 dest 0)
)
:tcc #x1
:cld #x1
:psm (the-as int (-> s4-0 psm))
:cpsm (-> s4-0 clutpsm)
:cbp (-> s4-0 clutdest)
:th (log2 (-> s4-0 h))
:tw (log2 (-> s4-0 w))
:tbw (-> s4-0 width 0)
:tbp0 (-> s4-0 dest 0)
)
)
(tex1-1 (new 'static 'gs-tex1 :mmag #x1 :mmin #x1))
(test-1 (new 'static 'gs-test
:ate #x1
:atst (gs-atest greater-equal)
:aref #x70
:afail #x3
:zte #x1
:ztst (gs-ztest greater-equal)
)
:ate #x1
:atst (gs-atest greater-equal)
:aref #x70
:afail #x3
:zte #x1
:ztst (gs-ztest greater-equal)
)
)
(clamp-1 (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp)))
(alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1))
)
)
)

(let* ((v1-26 (the-as (inline-array qword) (-> arg0 base)))
(a0-22 *fog-texture-work*)
(f0-0 (-> a0-22 min-corner y))
Expand Down Expand Up @@ -651,7 +642,7 @@
(dotimes (a0-1 (-> *level* length))
(let ((a1-3 (-> *level* level a0-1)))
(when (= (-> a1-3 status) 'active)
(if (and (= (-> a1-3 display?) 'display) (logtest? (-> a1-3 info level-flags) (level-flags lf9)))
(if (and (= (-> a1-3 display?) 'display) (logtest? (-> a1-3 info level-flags) (level-flags sky)))
(set! v1-0 #t)
)
)
Expand All @@ -677,7 +668,7 @@
(let ((s4-1 (the-as sky-work *fake-scratchpad-data*)))
(mem-copy! (the-as pointer s4-1) (the-as pointer this) #x2814)
(setup-stars s4-1 (-> s4-1 star-mat) (-> this upload-data))
(when (nonzero? (-> s4-1 star-colors 0 x))
(if (nonzero? (-> s4-1 star-colors 0 x))
(stars-transform-asm s4-1)
)
(cond
Expand Down
8 changes: 0 additions & 8 deletions goal_src/jak3/engine/gfx/texture/texture-anim-tables.gc
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
;; name in dgo: texture-anim-tables
;; dgos: GAME

(define-extern *sky-texture-anim-array* (texture-anim-array texture-anim))
(define-extern *darkjak-texture-anim-array* (texture-anim-array texture-anim))
(define-extern *darkjak-highres-texture-anim-array* (texture-anim-array texture-anim))
(define-extern *skull-gem-texture-anim-array* (texture-anim-array texture-anim))
(define-extern *default-water-texture-anim-array* (texture-anim-array texture-anim))
(define-extern *default-warp-texture-anim-array* (texture-anim-array texture-anim))
(define-extern set-darkjak-texture-morph! (function float none))

;; DECOMP BEGINS

(define *sky-texture-anim-array*
Expand Down
46 changes: 18 additions & 28 deletions goal_src/jak3/engine/level/level-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -172,37 +172,27 @@
:type uint32
:bitfield #t
(lf0 0)
(lf1 1)
(lf2 2)
(lf3 3)
(lf4 4)
(lf5 5)
(lf6 6)
(lf7 7)
(lf8 8)
(lf9 9)
(not-physical 1)
(ctycar 2)
(ctypes 3)
(external 4)
(title 5)
(borrow-load 6)
(end-mode 7)
(flut 8)
(sky 9)
(use-camera-other 10)
(lf11 11)
(lf12 12)
(lf13 13)
(display-wait 11)
(ocean-near-translucent 12)
(ocean-far 13)
(low-res-hfrag 14)
(lf15 15)
(lf16 16)
(lf17 17)
(lf18 18)
(lf19 19)
(lf20 20)
(city-borrow-available 15)
(mech 16)
(allow-unloaded 17)
(check-taskname-for-continue 18)
(city-borrow-high-priority 19)
(ocean-all 20)
(desert 21)
(lf22 22)
(lf23 23)
(lf24 24)
(lf25 25)
(lf26 26)
(lf27 27)
(lf28 28)
(lf29 29)
(lf30 30)
(lf31 31)
)
;; ---level-flags

Expand Down
Loading
Loading