From dc82a26c8a79f1e55fd6845d76844ffca8d63641 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 28 Feb 2008 22:15:24 +0000 Subject: [PATCH] - Fixed: The colormap changes by column, so the assembly rt_* routines need to be setup for every column group, not once per image. SVN r775 (trunk) --- docs/rh-log.txt | 2 ++ src/r_draw.cpp | 16 ---------------- src/r_drawt.cpp | 22 ++++++++++++++++++++++ src/tmap.nas | 37 ++++++++++++++++++++++++------------- 4 files changed, 48 insertions(+), 29 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 62db7c87c..f9282cd59 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ February 28, 2008 +- Fixed: The colormap changes by column, so the assembly rt_* routines need + to be setup for every column group, not once per image. - Fixed: rt_Translate1col() had a couple of bugs. February 27, 2008 diff --git a/src/r_draw.cpp b/src/r_draw.cpp index 410cfb956..3ec52210a 100644 --- a/src/r_draw.cpp +++ b/src/r_draw.cpp @@ -80,9 +80,6 @@ int detailyshift; // [RH] Y shift for vertical detail level extern "C" void STACK_ARGS DoubleHoriz_MMX (int height, int width, BYTE *dest, int pitch); extern "C" void STACK_ARGS DoubleHorizVert_MMX (int height, int width, BYTE *dest, int pitch); extern "C" void STACK_ARGS DoubleVert_ASM (int height, int width, BYTE *dest, int pitch); -extern "C" void R_SetupShadedCol(); -extern "C" void R_SetupAddCol(); -extern "C" void R_SetupAddClampCol(); #endif // [RH] Pointers to the different column drawers. @@ -2273,9 +2270,6 @@ ESPSResult R_SetPatchStyle (FRenderStyle style, fixed_t alpha, int translation, { dc_colormap += fixedlightlev; } -#ifdef USEASM - R_SetupShadedCol(); -#endif return r_columnmethod ? DoDraw1 : DoDraw0; } @@ -2307,16 +2301,6 @@ ESPSResult R_SetPatchStyle (FRenderStyle style, fixed_t alpha, int translation, { return DontDraw; } -#ifdef USEASM - if (hcolfunc_post4 == rt_addclamp4cols || hcolfunc_post4 == rt_tlateaddclamp4cols) - { - R_SetupAddClampCol(); - } - else if (hcolfunc_post4 == rt_add4cols || hcolfunc_post4 == rt_tlateadd4cols) - { - R_SetupAddCol(); - } -#endif return r_columnmethod ? DoDraw1 : DoDraw0; } diff --git a/src/r_drawt.cpp b/src/r_drawt.cpp index e0a3711a1..73cd50b01 100644 --- a/src/r_drawt.cpp +++ b/src/r_drawt.cpp @@ -59,6 +59,12 @@ unsigned int dc_tspans[4][MAXHEIGHT]; unsigned int *dc_ctspan[4]; unsigned int *horizspan[4]; +#ifdef USEASM +extern "C" void R_SetupShadedCol(); +extern "C" void R_SetupAddCol(); +extern "C" void R_SetupAddClampCol(); +#endif + #ifndef USEASM // Copies one span at hx to the screen at sx. void rt_copy1col_c (int hx, int sx, int yl, int yh) @@ -844,6 +850,22 @@ void rt_draw4cols (int sx) dc_ctspan[x][1] = screen->GetHeight(); } +#ifdef USEASM + // Setup assembly routines for changed colormaps or other parameters. + if (hcolfunc_post4 == rt_shaded4cols) + { + R_SetupShadedCol(); + } + else if (hcolfunc_post4 == rt_addclamp4cols || hcolfunc_post4 == rt_tlateaddclamp4cols) + { + R_SetupAddClampCol(); + } + else if (hcolfunc_post4 == rt_add4cols || hcolfunc_post4 == rt_tlateadd4cols) + { + R_SetupAddCol(); + } +#endif + for (;;) { // If a column is out of spans, mark it as such diff --git a/src/tmap.nas b/src/tmap.nas index 7c4b44231..82cc113a3 100644 --- a/src/tmap.nas +++ b/src/tmap.nas @@ -1745,17 +1745,21 @@ GLOBAL @R_SetupShadedCol@0 R_SetupShadedCol: @R_SetupShadedCol@0: mov eax,[dc_colormap] + cmp [s4cm1+3],eax + je .cmdone mov [s4cm1+3],eax mov [s4cm2+3],eax mov [s4cm3+3],eax mov [s4cm4+3],eax - mov eax,[dc_color] +.cmdone mov eax,[dc_color] lea eax,[Col2RGB8+eax*4] + cmp [s4fg1+3],eax + je .cdone mov [s4fg1+3],eax mov [s4fg2+3],eax mov [s4fg3+3],eax mov [s4fg4+3],eax - ret +.cdone ret GLOBAL R_SetupAddCol GLOBAL @R_SetupAddCol@0 @@ -1766,21 +1770,27 @@ GLOBAL @R_SetupAddCol@0 R_SetupAddCol: @R_SetupAddCol@0: mov eax,[dc_colormap] + cmp [a4cm1+3],eax + je .cmdone mov [a4cm1+3],eax mov [a4cm2+3],eax mov [a4cm3+3],eax mov [a4cm4+3],eax - mov eax,[dc_srcblend] +.cmdone mov eax,[dc_srcblend] + cmp [a4fg1+3],eax + je .sbdone mov [a4fg1+3],eax mov [a4fg2+3],eax mov [a4fg3+3],eax mov [a4fg4+3],eax - mov eax,[dc_destblend] +.sbdone mov eax,[dc_destblend] + cmp [a4bg1+3],eax + je .dbdone mov [a4bg1+3],eax mov [a4bg2+3],eax mov [a4bg3+3],eax mov [a4bg4+3],eax - ret +.dbdone ret GLOBAL R_SetupAddClampCol GLOBAL @R_SetupAddClampCol@0 @@ -1791,21 +1801,27 @@ GLOBAL @R_SetupAddClampCol@0 R_SetupAddClampCol: @R_SetupAddClampCol@0: mov eax,[dc_colormap] + cmp [a4cm1+3],eax + je .cmdone mov [ac4cm1+3],eax mov [ac4cm2+3],eax mov [ac4cm3+3],eax mov [ac4cm4+3],eax - mov eax,[dc_srcblend] +.cmdone mov eax,[dc_srcblend] + cmp [ac4fg1+3],eax + je .sbdone mov [ac4fg1+3],eax mov [ac4fg2+3],eax mov [ac4fg3+3],eax mov [ac4fg4+3],eax - mov eax,[dc_destblend] +.sbdone mov eax,[dc_destblend] + cmp [ac4bg1+3],eax + je .dbdone mov [ac4bg1+3],eax mov [ac4bg2+3],eax mov [ac4bg3+3],eax mov [ac4bg4+3],eax - ret +.dbdone ret EXTERN setvlinebpl_ EXTERN setpitch3 @@ -1827,14 +1843,9 @@ _ASM_PatchPitch: mov ecx,eax neg ecx inc ecx -; mov [a4p1+2],ecx inc ecx -; mov [a4p2a+3],ecx -; mov [a4p2b+2],ecx mov [s4p2+2],ecx inc ecx -; mov [a4p3a+3],ecx -; mov [a4p3b+2],ecx mov [s4p3+2],ecx call setpitch3 jmp setvlinebpl_