Skip to content

Commit

Permalink
Added Plantronics ColorPlus support. Huge thanks to @PickledDog for i…
Browse files Browse the repository at this point in the history
…mplementing this.
  • Loading branch information
viti95 committed Aug 8, 2021
1 parent 665a887 commit 6117851
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 4 deletions.
2 changes: 1 addition & 1 deletion FASTDOOM/d_main.c
Expand Up @@ -916,7 +916,7 @@ void D_DoomMain(void)

IdentifyVersion();

#ifdef MODE_EGA
#if defined(MODE_EGA) || defined(MODE_PCP)
D_AddFile("mode16.wad");
#endif

Expand Down
86 changes: 83 additions & 3 deletions FASTDOOM/i_ibm.c
Expand Up @@ -201,7 +201,7 @@ void I_StartupSound(void);
void I_ShutdownSound(void);
void I_ShutdownTimer(void);

#if defined(MODE_EGA) || defined(MODE_T8025) || defined(MODE_T8050) || defined(MODE_T4025) || defined(MODE_T4050) || defined(MODE_T80100)
#if defined(MODE_EGA) || defined(MODE_T8025) || defined(MODE_T8050) || defined(MODE_T4025) || defined(MODE_T4050) || defined(MODE_T80100) || defined(MODE_PCP)
byte lut16colors[14 * 256];
byte *ptrlut16colors;
#endif
Expand Down Expand Up @@ -344,7 +344,27 @@ const byte textcolors[48] = {
0x3F, 0x3F, 0x3F};
#endif

#if defined(MODE_EGA) || defined(MODE_T8025) || defined(MODE_T8050) || defined(MODE_T4025) || defined(MODE_T4050) || defined(MODE_T80100)
#ifdef MODE_PCP
const byte textcolors[48] = {
0x00, 0x00, 0x00,
0x00, 0x2A, 0x00,
0x2A, 0x00, 0x00,
0x2A, 0x15, 0x00,
0x15, 0x15, 0x15,
0x15, 0x3F, 0x15,
0x3F, 0x15, 0x15,
0x3F, 0x3F, 0x15,
0x00, 0x00, 0x2A,
0x00, 0x2A, 0x2A,
0x2A, 0x00, 0x2A,
0x2A, 0x2A, 0x2A,
0x15, 0x15, 0x3F,
0x15, 0x3F, 0x3F,
0x3F, 0x15, 0x3F,
0x3F, 0x3F, 0x3F};
#endif

#if defined(MODE_EGA) || defined(MODE_T8025) || defined(MODE_T8050) || defined(MODE_T4025) || defined(MODE_T4050) || defined(MODE_T80100) || defined(MODE_PCP)
void I_ProcessPalette(byte *palette)
{
int i, j;
Expand Down Expand Up @@ -410,7 +430,7 @@ void I_SetPalette(int numpalette)
ptrsumcolors11 = sumcolors11 + numpalette * 256;
#endif

#if defined(MODE_T8025) || defined(MODE_T8050) || defined(MODE_EGA) || defined(MODE_T4025) || defined(MODE_T4050) || defined(MODE_T80100)
#if defined(MODE_T8025) || defined(MODE_T8050) || defined(MODE_EGA) || defined(MODE_T4025) || defined(MODE_T4050) || defined(MODE_T80100) || defined(MODE_PCP)
ptrlut16colors = lut16colors + numpalette * 256;
#endif

Expand Down Expand Up @@ -825,6 +845,57 @@ void EGA_DrawBackbuffer(void)
}
#endif

#ifdef MODE_PCP
void CPLUS_DrawBackbuffer(void)
{
int x;
unsigned char *vram = (unsigned char *)0xB8000;
unsigned int base = 0;
unsigned char color0, color1, color2, color3;

for (base = 0; base < SCREENHEIGHT * 320;)
{
for (x = 0; x < SCREENWIDTH / 4; x++, base += 4, vram++)
{
color0 = ptrlut16colors[backbuffer[base]];
color1 = ptrlut16colors[backbuffer[base + 1]];
color2 = ptrlut16colors[backbuffer[base + 2]];
color3 = ptrlut16colors[backbuffer[base + 3]];
*(vram) = (color0 & 3) << 6 | (color1 & 3) << 4 | (color2 & 3) << 2 | (color3 & 3);
}
base -= 320;
vram -= 80;
for (x = 0; x < SCREENWIDTH / 4; x++, base += 4, vram++)
{
color0 = ptrlut16colors[backbuffer[base]];
color1 = ptrlut16colors[backbuffer[base + 1]];
color2 = ptrlut16colors[backbuffer[base + 2]];
color3 = ptrlut16colors[backbuffer[base + 3]];
*(vram + 0x4000) = (color0 & 12) << 4 | (color1 & 12) << 2 | (color2 & 12) | (color3 & 12) >> 2;
}
vram -= 80;
for (x = 0; x < SCREENWIDTH / 4; x++, base += 4, vram++)
{
color0 = ptrlut16colors[backbuffer[base]];
color1 = ptrlut16colors[backbuffer[base + 1]];
color2 = ptrlut16colors[backbuffer[base + 2]];
color3 = ptrlut16colors[backbuffer[base + 3]];
*(vram + 0x2000) = (color0 & 3) << 6 | (color1 & 3) << 4 | (color2 & 3) << 2 | (color3 & 3);
}
base -= 320;
vram -= 80;
for (x = 0; x < SCREENWIDTH / 4; x++, base += 4, vram++)
{
color0 = ptrlut16colors[backbuffer[base]];
color1 = ptrlut16colors[backbuffer[base + 1]];
color2 = ptrlut16colors[backbuffer[base + 2]];
color3 = ptrlut16colors[backbuffer[base + 3]];
*(vram + 0x6000) = (color0 & 12) << 4 | (color1 & 12) << 2 | (color2 & 12) | (color3 & 12) >> 2;
}
}
}
#endif

#ifdef MODE_CGA
void CGA_DrawBackbuffer(void)
{
Expand Down Expand Up @@ -994,6 +1065,9 @@ void I_FinishUpdate(void)
#ifdef MODE_EGA
EGA_DrawBackbuffer();
#endif
#ifdef MODE_PCP
CPLUS_DrawBackbuffer();
#endif
#if defined(MODE_V)
{
int x, y;
Expand Down Expand Up @@ -1463,6 +1537,12 @@ void I_InitGraphics(void)
int386(0x10, (union REGS *)&regs, &regs);
pcscreen = destscreen = (byte *)0xB8000;
#endif
#ifdef MODE_PCP
regs.w.ax = 0x04;
int386(0x10, (union REGS *)&regs, &regs);
outp(0x3DD, 0x10);
pcscreen = destscreen = (byte *)0xB8000;
#endif
#ifdef MODE_EGA
regs.w.ax = 0x0D;
int386(0x10, (union REGS *)&regs, &regs);
Expand Down
5 changes: 5 additions & 0 deletions buildPCP.bat
@@ -0,0 +1,5 @@
cd fastdoom
wmake fdoom13h.exe EXTERNOPT="/dMODE_PCP /dUSE_BACKBUFFER" %1 %2 %3 %4 %5 %6 %7 %8 %9
copy fdoom13h.exe ..\fdoompcp.exe
cd ..
sb -r fdoompcp.exe
1 change: 1 addition & 0 deletions cleanALL.BAT
Expand Up @@ -14,3 +14,4 @@ call cleanvbd.bat
call cleanv.bat
call cleanv2.bat
call cleant52.bat
call cleanpcp.bat
6 changes: 6 additions & 0 deletions cleanPCP.BAT
@@ -0,0 +1,6 @@
cd fastdoom
wmake clean
wmake fdoom13h.exe EXTERNOPT="/dMODE_PCP /dUSE_BACKBUFFER" %1 %2 %3 %4 %5 %6 %7 %8 %9
copy fdoom13h.exe ..\fdoompcp.exe
cd ..
sb -r fdoompcp.exe

0 comments on commit 6117851

Please sign in to comment.