-
Notifications
You must be signed in to change notification settings - Fork 0
/
3D_part2.asm
106 lines (94 loc) · 1.79 KB
/
3D_part2.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
; Contain parts of the 3D engine that cannot fit within the allowed memory
; IN a = 0 (nospeedFX)
; a = 1 (simple speedFX)
.setSpeedFX
or a
jr nz,testSpeed1
; no speedFx
ld hl,idle
ld (speed_FX+1),hl
ret
.testSpeed1
; Copy 6 previous positions for NBS balls
ld de,NB_BALLS_TOTAL*NBCRD + ballpos3D
ld hl,NB_BALLS_TOTAL-NBS*NBCRD + ballpos3D
ld bc,6*NBCRD*NBS
ldir
ld hl,speed_effect
ld (speed_FX+1),hl
ret
; ***************
; Symetrie Plan Z
; Bug = we need to multiply by Z stored in the morphObj table (fix)
; Corrupted = AF,BC,DE,HL,BC',DE',HL'
; ***************
.symetrie_planZ
; prepare step through morphObj
ld ix,morphObj
ld bc,3
exx
ld hl,ballpos3D
ld de,NBCRD*NB_BALLS + ballpos3D
ld a,(nbBalls)
add -NB_BALLS_TOTAL
neg
ld b,a
.copySymetrieZ
; Z
; *****
ld a,(ix)
or a
jp P,$+3+2
neg
ld c,a ; save abs(Z) in c
; ***********************************
; compute 2 * |0 0 z| * (_a6 _a7 _a8)
exx
add ix,bc ; inc through MorphObj
;ld a,2*16
ld de,(_a8+1)
call _16mult8cust
ld a,h
add a ; a = 2*abs(z)*_a8
exx
; ***********************************
add (hl) ; a = z + 2*abs(z)*_a8
inc hl
ld (de),a
inc de
; Y
; *****
; ***********************************
; compute 2 * |0 0 z| * (_a6 _a7 _a8)
ld a,c
exx
;ld a,2*16
ld de,(_a7+1)
call _16mult8cust
ld a,h
add a ; a = 2*abs(z)*_a7
exx
; ***********************************
add (hl) ; a = y + 2*abs(z)*_a7
inc hl
ld (de),a
inc de
; X
; *****
; ***********************************
; compute 2 * |0 0 z| * (_a6 _a7 _a8)
ld a,c
exx
;ld a,2*16
ld de,(_a6+1)
call _16mult8cust
ld a,h
add a ; a = 2*abs(z)*_a6
exx
; ***********************************
add (hl) ; a = x + 2*abs(z)*_a6
inc hl
ld (de),a
inc de
djnz copySymetrieZ
ret