Skip to content

Commit 31566ed

Browse files
author
Niko
committed
spider fix
1 parent c5535f7 commit 31566ed

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

decompile/General/231/231_114_117_RB_Spider.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ void DECOMP_RB_Spider_DrawWebs(struct Thread *t, struct TileView *view)
4949

5050
scratchpad[0] = uVar2;
5151
scratchpad[1] = instDef->pos[1] + 0x540;
52-
scratchpad[2] = (int)sVar1;
52+
scratchpad[2] = sVar1;
5353
scratchpad[3] = 0;
5454

5555
scratchpad[4] = uVar2;
5656
scratchpad[5] = t->inst->matrix.t[1] + 0x60;
57-
scratchpad[6] = (int)sVar1;
57+
scratchpad[6] = sVar1;
5858
scratchpad[7] = 0;
5959

6060
scratchpad += 8;
@@ -64,10 +64,11 @@ void DECOMP_RB_Spider_DrawWebs(struct Thread *t, struct TileView *view)
6464

6565
int i, j;
6666
int numPlyr;
67-
p = primMem->curr;
6867
numPlyr = gGT->numPlyrCurrGame;
6968

70-
if (p + (numSpiders * numPlyr) >= primMem->endMin100)
69+
p = primMem->curr;
70+
p = p + (numSpiders * numPlyr);
71+
if (p >= primMem->endMin100)
7172
return;
7273

7374
// loop through all players
@@ -81,6 +82,9 @@ void DECOMP_RB_Spider_DrawWebs(struct Thread *t, struct TileView *view)
8182
gte_SetTransMatrix(m);
8283

8384
scratchpad = 0x1f800000;
85+
86+
// 0x10 * numSpiders
87+
short* output = 0x1F800050;
8488

8589
// loop through spiders
8690
for(j = 0; j < numSpiders; j++)
@@ -98,12 +102,11 @@ void DECOMP_RB_Spider_DrawWebs(struct Thread *t, struct TileView *view)
98102
// rtps is "single", rtpt is "triple"
99103
gte_ldv01(&scratchpad[0], &scratchpad[4]);
100104
gte_rtpt();
101-
gte_stsxy01(&p->f2.x0, &p->f2.x1);
105+
gte_stsxy01(&output[0], &output[2]);
102106

103107
// depth of 2nd vertex
104108
__asm__ ("swc2 $18, 0( %0 );" : : "r"(&depth));
105109
#else
106-
short output[4];
107110

108111
gte_ldv0(&scratchpad[0]);
109112
gte_rtps();
@@ -124,6 +127,9 @@ void DECOMP_RB_Spider_DrawWebs(struct Thread *t, struct TileView *view)
124127
// to be seen, then generate primitives
125128
if ((unsigned int)(depth-1) < (0x1200-1))
126129
{
130+
p = primMem->curr;
131+
primMem->curr = p+1;
132+
127133
p->tpage = 0xe1000a20;
128134
p->f2.tag = 0;
129135

@@ -151,13 +157,10 @@ void DECOMP_RB_Spider_DrawWebs(struct Thread *t, struct TileView *view)
151157
// prim header, OT and prim len
152158
*(int *)p = *ot | 0x5000000;
153159
*ot = (u_int)p & 0xffffff;
154-
155-
p = p + 1;
156160
}
157161
}
158162
}
159163

160-
primMem->curr = p;
161164
}
162165

163166
void DECOMP_RB_Spider_ThTick(struct Thread* t)

0 commit comments

Comments
 (0)