Skip to content

Commit

Permalink
We don't actully need COMM8 in this instance
Browse files Browse the repository at this point in the history
  • Loading branch information
viciious committed Sep 14, 2023
1 parent 4c8e40e commit 9057ec7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
12 changes: 3 additions & 9 deletions mars.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,24 +92,18 @@ static inline void Mars_R_BeginWallPrep(boolean draw)
Mars_R_SecWait();
if (!draw)
return;
MARS_SYS_COMM6 = 0; // next seg
MARS_SYS_COMM8 = 0; // last unready seg
MARS_SYS_COMM6 = 0; // (next seg)<<8|last unready seg
MARS_SYS_COMM4 = draw ? MARS_SECCMD_R_WALL_PREP : MARS_SECCMD_R_WALL_PREP_NODRAW;
}

static inline void Mars_R_WallNext(void)
{
MARS_SYS_COMM6++;
MARS_SYS_COMM6 = MARS_SYS_COMM6 + 0x100;
}

static inline void Mars_R_EndWallPrep(void)
{
MARS_SYS_COMM6 = 0xffff;
}

static inline void Mars_R_WaitSecWallPrep(void)
{
while (MARS_SYS_COMM6 != 0xfffe);
MARS_SYS_COMM6 = 0xff00;
}

// r_phase7
Expand Down
20 changes: 14 additions & 6 deletions r_phase2.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ static void R_SegLoop(viswall_t* segl, unsigned short* clipbounds,

void Mars_Sec_R_WallPrep(void)
{
int cnt;
viswall_t *segl;
viswallextra_t *seglex;
viswall_t *first, *verylast;
Expand All @@ -293,27 +294,32 @@ void Mars_Sec_R_WallPrep(void)

R_InitClipBounds(clipbounds_);

cnt = 0;
first = vd.viswalls;
verylast = NULL;
seglex = vd.viswallextras;
verts = W_GetLumpData(gamemaplump+ML_VERTEXES);

for (segl = first; segl != verylast; )
{
int nextsegs;
unsigned nextsegs;
viswall_t* last;

nextsegs = MARS_SYS_COMM6;
nextsegs = MARS_SYS_COMM6 >> 8;

// check if master CPU finished exec'ing R_BSP()
if (nextsegs == 0xffff)
if (nextsegs == 0xff)
{
Mars_ClearCacheLine(&vd.lastwallcmd);
verylast = vd.lastwallcmd;
nextsegs = verylast - first;
last = verylast;
MARS_SYS_COMM6 = 0xff00 | cnt;
}
else
{
last = first + nextsegs;
}

last = first + nextsegs;
for (; segl < last; segl++)
{
#ifdef MARS
Expand All @@ -324,7 +330,9 @@ void Mars_Sec_R_WallPrep(void)
R_SegLoop(segl, clipbounds, seglex->floorheight, seglex->floornewheight, seglex->ceilnewheight);

seglex++;
MARS_SYS_COMM8++;
cnt++;
if (last == verylast)
MARS_SYS_COMM6 = 0xff00 | cnt;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion r_phase6.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ void R_SegCommands(void)
viswall_t* segl = vd.viswalls + i;

#ifdef MARS
while (MARS_SYS_COMM8 <= i)
while ((MARS_SYS_COMM6 & 0xff) <= i)
continue;
#endif
if (segl->start > segl->stop)
Expand Down

0 comments on commit 9057ec7

Please sign in to comment.