[sparticle] 2d hud particles (#849)

* wip, taking a break to work on asm stuff first

* the goal code for sparticle

* mips2c the first sparticle asm function

* temp

* particle processing no longer crashing

* temp

* working texture cache for vi1 and hud textures

* sprites

* cleanup 1

* temp

* temp

* add zstd library

* temp

* working

* tests

* include fix

* uncomment

* better decomp of sparticle stuff, part 1

* update references
This commit is contained in:
water111
2021-09-26 11:41:58 -04:00
committed by GitHub
parent d777337095
commit f0ceea8b2e
158 changed files with 19773 additions and 44989 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+24 -115
View File
@@ -230,121 +230,30 @@
(new 'static 'sparticle-launcher
:init-specs
(new 'static 'inline-array sp-field-init-spec 20
(new 'static 'sp-field-init-spec
:field #x1
:initial-valuef (the-as float #x200000)
)
(new 'static 'sp-field-init-spec
:field #x6
:flags #x1
:initial-valuef 8.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #xd
:flags #x1
:initial-valuef 1228.8
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x10
:flags #x1
:initial-valuef -32768.0
:random-rangef 65536.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x11
:flags #x3
:initial-valuef (the-as float #xfffffffc)
:random-multf (the-as float #x1)
)
(new 'static 'sp-field-init-spec
:field #x12
:flags #x1
:initial-valuef 90.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x13
:flags #x1
:initial-valuef 90.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x14
:flags #x1
:initial-valuef 90.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x15
:flags #x1
:initial-valuef 20.0
:random-rangef 20.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x1a
:flags #x1
:initial-valuef 8.192
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x1c
:flags #x1
:initial-valuef 17.066668
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x20
:flags #x3
:initial-valuef (the-as float #xfffffffc)
:random-multf (the-as float #x1)
)
(new 'static 'sp-field-init-spec
:field #x24
:flags #x1
:initial-valuef -0.3
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x2e
:initial-valuef (the-as float #x138c)
:random-multf (the-as float #x1)
)
(new 'static 'sp-field-init-spec
:field #x2f
:initial-valuef (the-as float #xc)
:random-multf (the-as float #x1)
)
(new 'static 'sp-field-init-spec
:field #x36
:flags #x1
:initial-valuef -3640.889
:random-rangef 2730.6667
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x3a
:flags #x1
:initial-valuef 16384.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x3b
:flags #x1
:initial-valuef -32768.0
:random-rangef 65536.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x3e
:flags #x1
:initial-valuef 819.2
:random-multf 1.0
)
(new 'static 'sp-field-init-spec :field #x43)
(sp-tex spt-texture (new 'static 'texture-id :page #x2))
(sp-flt spt-num 8.0)
(sp-flt spt-scale-x (meters 0.3))
(sp-rnd-flt spt-rot-z (degrees -180.0) (degrees 360.0) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 90.0)
(sp-flt spt-g 90.0)
(sp-flt spt-b 90.0)
(sp-rnd-flt spt-a 20.0 20.0 1.0)
(sp-flt spt-vel-y (meters 0.002))
(sp-flt spt-scalevel-x (meters 0.004166667))
(sp-copy-from-other spt-scalevel-y -4)
(sp-flt spt-fade-a -0.3)
(sp-int spt-timer 5004)
(sp-cpuinfo-flags bit2 bit3)
(sp-rnd-flt spt-launchrot-x (degrees -20.0) (degrees 15.0) 1.0)
(sp-flt spt-conerot-x (degrees 90.0))
(sp-rnd-flt spt-conerot-y (degrees -180.0) (degrees 360.0) 1.0)
(sp-flt spt-conerot-radius (meters 0.2))
(sp-end)
)
)
)
@@ -33,7 +33,7 @@
(scalevely float :offset 44)
(friction float :offset-assert 96)
(timer int32 :offset-assert 100)
(flags uint32 :offset-assert 104)
(flags sp-cpuinfo-flag :offset-assert 104)
(user-int32 int32 :offset-assert 108)
(user-uint32 uint32 :offset 108)
(user-float float :offset 108)
@@ -123,8 +123,8 @@
;; definition of type sparticle-system
(deftype sparticle-system (basic)
((blocks int32 2 :offset-assert 4)
(length uint32 2 :offset-assert 12)
(num-alloc uint32 2 :offset-assert 20)
(length int32 2 :offset-assert 12)
(num-alloc int32 2 :offset-assert 20)
(is-3d basic :offset-assert 28)
(flags uint32 :offset-assert 32)
(alloc-table (pointer uint64) :offset-assert 36)
@@ -3,19 +3,19 @@
;; definition of type sp-field-init-spec
(deftype sp-field-init-spec (structure)
((field uint16 :offset-assert 0)
(flags uint16 :offset-assert 2)
(initial-valuef float :offset-assert 4)
(random-rangef float :offset-assert 8)
(random-multf float :offset-assert 12)
(initial-value int32 :offset 4)
(random-range int32 :offset 8)
(random-mult int32 :offset 12)
(sym symbol :offset 4)
(func function :offset 4)
(tex uint32 :offset 4)
(pntr pointer :offset 4)
(sound basic :offset 4)
((field sp-field-id :offset-assert 0)
(flags sp-flag :offset-assert 2)
(initial-valuef float :offset-assert 4)
(random-rangef float :offset-assert 8)
(random-multf float :offset-assert 12)
(initial-value int32 :offset 4)
(random-range int32 :offset 8)
(random-mult int32 :offset 12)
(sym symbol :offset 4)
(func function :offset 4)
(tex uint32 :offset 4)
(pntr pointer :offset 4)
(sound basic :offset 4)
)
:method-count-assert 9
:size-assert #x10
@@ -63,15 +63,15 @@
;; definition of type sparticle-group-item
(deftype sparticle-group-item (structure)
((launcher uint32 :offset-assert 0)
(fade-after meters :offset-assert 4)
(falloff-to meters :offset-assert 8)
(flags uint16 :offset-assert 12)
(period uint16 :offset-assert 14)
(length uint16 :offset-assert 16)
(offset uint16 :offset-assert 18)
(hour-mask uint32 :offset-assert 20)
(binding uint32 :offset-assert 24)
((launcher uint32 :offset-assert 0)
(fade-after meters :offset-assert 4)
(falloff-to meters :offset-assert 8)
(flags sp-group-item-flag :offset-assert 12)
(period uint16 :offset-assert 14)
(length uint16 :offset-assert 16)
(offset uint16 :offset-assert 18)
(hour-mask uint32 :offset-assert 20)
(binding uint32 :offset-assert 24)
)
:method-count-assert 9
:size-assert #x1c
@@ -95,20 +95,20 @@
;; definition of type sparticle-launch-state
(deftype sparticle-launch-state (structure)
((group-item sparticle-group-item :offset-assert 0)
(flags uint16 :offset-assert 4)
(randomize uint16 :offset-assert 6)
(origin vector :offset-assert 8)
(sprite3d sprite-vec-data-3d :offset-assert 12)
(sprite basic :offset-assert 16)
(offset uint32 :offset-assert 20)
(accum float :offset-assert 24)
(spawn-time uint32 :offset-assert 28)
(swarm basic :offset 20)
(seed uint32 :offset 24)
(time uint32 :offset 28)
(spec basic :offset 16)
(id uint32 :offset 12)
((group-item sparticle-group-item :offset-assert 0)
(flags sp-launch-state-flags :offset-assert 4)
(randomize uint16 :offset-assert 6)
(origin vector :offset-assert 8)
(sprite3d sprite-vec-data-3d :offset-assert 12)
(sprite sparticle-cpuinfo :offset-assert 16)
(offset uint32 :offset-assert 20)
(accum float :offset-assert 24)
(spawn-time uint32 :offset-assert 28)
(swarm basic :offset 20)
(seed uint32 :offset 24)
(time uint32 :offset 28)
(spec basic :offset 16)
(id uint32 :offset 12)
)
:method-count-assert 9
:size-assert #x20
@@ -144,8 +144,8 @@
((length int16 :offset-assert 4)
(duration uint16 :offset-assert 6)
(linger-duration uint16 :offset-assert 8)
(flags uint16 :offset-assert 10)
(name basic :offset-assert 12)
(flags sp-group-flag :offset-assert 10)
(name string :offset-assert 12)
(launcher (inline-array sparticle-group-item) :offset-assert 16)
(bounds sphere :inline :offset-assert 32)
)
@@ -187,10 +187,10 @@
:flag-assert #xe00000040
(:methods
(initialize (_type_ sparticle-launch-group process) none 9)
(dummy-10 () none 10)
(dummy-11 (_type_ vector) none 11)
(deactivate (_type_) none 12)
(dummy-13 () none 13)
(is-visible? (_type_ vector) symbol 10)
(spawn (_type_ vector) object 11)
(kill-and-free-particles (_type_) none 12)
(kill-particles (_type_) none 13)
)
)
+14 -1
View File
@@ -141,7 +141,20 @@
)
;; definition for function add-to-sprite-aux-list
;; ERROR: function was not converted to expressions. Cannot decompile.
;; INFO: Return type mismatch int vs none.
(defun
add-to-sprite-aux-list
((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 sprite-vec-data-3d))
(let ((v1-0 *sprite-aux-list*))
(when (< (-> v1-0 entry) (-> v1-0 num-entries))
(set! (-> v1-0 data (-> v1-0 entry)) (-> arg1 sprite))
(+! (-> v1-0 entry) 1)
)
)
(set! (-> arg2 r-g-b-a w) 0.0)
0
(none)
)
;; definition of type sprite-frame-data
(deftype sprite-frame-data (structure)
+1 -1
View File
@@ -1859,7 +1859,7 @@
(-> obj segment-common)
a2-0
-2
(bucket-id bucket-65)
(bucket-id pre-sprite-textures)
)
(return #f)
)
+2 -2
View File
@@ -35,8 +35,8 @@
(pat-length int32 :offset-assert 48)
(texture-remap-table (pointer uint64) :offset-assert 52)
(texture-remap-table-len int32 :offset-assert 56)
(unk-data-1 pointer :offset-assert 60)
(unk-data-1-len int32 :offset-assert 64)
(texture-ids (pointer texture-id) :offset-assert 60)
(texture-page-count int32 :offset-assert 64)
(unk-zero-0 basic :offset-assert 68)
(name symbol :offset-assert 72)
(nickname symbol :offset-assert 76)
+1 -1
View File
@@ -73,7 +73,7 @@
(set! (-> mem-use length) (max 58 (-> mem-use length)))
(set! (-> mem-use data 57 name) "bsp-misc")
(+! (-> mem-use data 57 count) 1)
(let ((v1-56 (* (-> obj unk-data-1-len) 4)))
(let ((v1-56 (* (-> obj texture-page-count) 4)))
(+! (-> mem-use data 57 used) v1-56)
(+! (-> mem-use data 57 total) (logand -16 (+ v1-56 15)))
)
+1 -1
View File
@@ -297,7 +297,7 @@
(debug-print-entities (_type_ symbol type) none 13)
(debug-draw-actors (_type_ symbol) none 14)
(dummy-15 (_type_) object 15)
(dummy-16 (_type_) int 16)
(level-update (_type_) int 16)
(level-get-target-inside (_type_) level 17)
(alloc-levels! (_type_ symbol) int 18)
(load-commands-set! (_type_ pair) pair 19)
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff