Commit 5f295323 authored by Steven Fuller's avatar Steven Fuller

Changed gamepal to the correct type and added forgotten (from last commit)

file vi_ogl. Now loads all sprites and walls into memory for now.
parent c3ef597e
...@@ -85,6 +85,7 @@ for every byte when transferring to the pixmap, palette fades require a ...@@ -85,6 +85,7 @@ for every byte when transferring to the pixmap, palette fades require a
screen update screen update
* mitshm * mitshm
* make sure none of the code tries to handle gfx/sound data directly * make sure none of the code tries to handle gfx/sound data directly
* GL_shared_texture_palette
Specific: Specific:
* memory/sound intro screen goes * memory/sound intro screen goes
......
...@@ -999,7 +999,6 @@ void CA_CacheScreen(int chunk) ...@@ -999,7 +999,6 @@ void CA_CacheScreen(int chunk)
// //
// allocate final space, decompress it, and free bigbuffer // allocate final space, decompress it, and free bigbuffer
// Sprites need to have shifts made and various other junk
// //
MM_GetPtr((void *)&dest, expanded); MM_GetPtr((void *)&dest, expanded);
CAL_HuffExpand(source, dest, expanded, grhuffman); CAL_HuffExpand(source, dest, expanded, grhuffman);
......
...@@ -37,7 +37,7 @@ void VWB_Plot(int x, int y, int color); ...@@ -37,7 +37,7 @@ void VWB_Plot(int x, int y, int color);
void VWB_Hlin(int x1, int x2, int y, int color); void VWB_Hlin(int x1, int x2, int y, int color);
void VWB_Vlin(int y1, int y2, int x, int color); void VWB_Vlin(int y1, int y2, int x, int color);
extern byte gamepal; extern byte gamepal[];
extern boolean screenfaded; extern boolean screenfaded;
#define VW_Startup VL_Startup #define VW_Startup VL_Startup
...@@ -47,7 +47,7 @@ extern boolean screenfaded; ...@@ -47,7 +47,7 @@ extern boolean screenfaded;
#define VW_Hlin(x,z,y,c) VL_Hlin(x,y,(z)-(x)+1,c) #define VW_Hlin(x,z,y,c) VL_Hlin(x,y,(z)-(x)+1,c)
#define VW_Vlin(y,z,x,c) VL_Vlin(x,y,(z)-(y)+1,c) #define VW_Vlin(y,z,x,c) VL_Vlin(x,y,(z)-(y)+1,c)
#define VW_WaitVBL VL_WaitVBL #define VW_WaitVBL VL_WaitVBL
#define VW_FadeIn() VL_FadeIn(0,255,&gamepal,30); #define VW_FadeIn() VL_FadeIn(0,255,gamepal,30);
#define VW_FadeOut() VL_FadeOut(0,255,0,0,0,30); #define VW_FadeOut() VL_FadeOut(0,255,0,0,0,30);
void VW_MeasurePropString(char *string, word *width, word *height); void VW_MeasurePropString(char *string, word *width, word *height);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
/* SDM = 2 */ /* SDM = 2 */
/* SOD = 3 */ /* SOD = 3 */
#ifndef WMODE #ifndef WMODE
#define WMODE 1 #define WMODE 3
#endif #endif
#if WMODE == 0 #if WMODE == 0
......
/* vi_ogl.c */
#include "wl_def.h"
#include <GL/gl.h>
byte *SprToLin(byte *source)
{
return source;
}
byte *Pal_256_RGB(byte *source)
{
byte *dest = (byte *)malloc(64 * 64 * 3);
int i;
for (i = 0; i < 4096; i++) {
dest[i*3+0] = gamepal[source[i]*3+0] << 2;
dest[i*3+1] = gamepal[source[i]*3+1] << 2;
dest[i*3+2] = gamepal[source[i]*3+2] << 2;
}
return dest;
}
byte *Pal_256_RGBA(byte *source)
{
byte *dest = (byte *)malloc(64 * 64 * 4);
int i;
for (i = 0; i < 4096; i++) {
dest[i*4+0] = gamepal[source[i]*3+0] << 2;
dest[i*4+1] = gamepal[source[i]*3+0] << 2;
dest[i*4+2] = gamepal[source[i]*3+0] << 2;
if (source[i] == 0)
dest[i*4+3] = 0;
else
dest[i*4+3] = 255;
}
return dest;
}
int *sprtex, sprcount;
int *waltex, walcount;
void Init3D()
{
int i;
printf("start init\n");
walcount = PMSpriteStart;
waltex = (int *)malloc(sizeof(int) * walcount);
sprcount = PMSoundStart - PMSpriteStart;
sprtex = (int *)malloc(sizeof(int) * sprcount);
glGenTextures(walcount, waltex);
glGenTextures(sprcount, sprtex);
for (i = 0; i < walcount; i++) {
glBindTexture(GL_TEXTURE_2D, waltex[i]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 64, 64, 0, GL_RGB, GL_UNSIGNED_BYTE, Pal_256_RGB(PM_GetPage(i)));
}
for (i = 0; i < sprcount; i++) {
glBindTexture(GL_TEXTURE_2D, sprtex[i]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, Pal_256_RGBA(SprToLin(PM_GetSpritePage(i))));
}
printf("end init\n");
}
void SetupScaling(int maxheight)
{
}
void DrawPlayerWeapon()
{
}
void ThreeDRefresh()
{
DrawPlayerWeapon();
frameon++;
}
...@@ -124,7 +124,7 @@ void PicturePause (void) ...@@ -124,7 +124,7 @@ void PicturePause (void)
/* TODO: save picture to file */ /* TODO: save picture to file */
VL_SetPalette (&gamepal); VL_SetPalette(gamepal);
VW_WaitVBL(70); VW_WaitVBL(70);
VW_WaitVBL(70); VW_WaitVBL(70);
......
...@@ -684,7 +684,7 @@ void SetupWalls (void) ...@@ -684,7 +684,7 @@ void SetupWalls (void)
void SignonScreen() void SignonScreen()
{ {
VL_SetPalette(&gamepal); VL_SetPalette(gamepal);
VL_MemToScreen(introscn, 320, 200, 0, 0); VL_MemToScreen(introscn, 320, 200, 0, 0);
VW_UpdateScreen(); VW_UpdateScreen();
} }
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#define VIEWCOLOR 0x7f #define VIEWCOLOR 0x7f
#define TEXTCOLOR 0x17 #define TEXTCOLOR 0x17
#define HIGHLIGHT 0x13 #define HIGHLIGHT 0x13
#define MenuFadeIn() VL_FadeIn(0,255,&gamepal,10) #define MenuFadeIn() VL_FadeIn(0,255,gamepal,10)
#define MENUSONG WONDERIN_MUS #define MENUSONG WONDERIN_MUS
......
...@@ -992,8 +992,6 @@ byte whiteshifts[NUMREDSHIFTS][768]; ...@@ -992,8 +992,6 @@ byte whiteshifts[NUMREDSHIFTS][768];
int damagecount,bonuscount; int damagecount,bonuscount;
boolean palshifted; boolean palshifted;
extern byte gamepal;
/* /*
===================== =====================
= =
...@@ -1014,7 +1012,7 @@ void InitRedShifts (void) ...@@ -1014,7 +1012,7 @@ void InitRedShifts (void)
for (i=1;i<=NUMREDSHIFTS;i++) for (i=1;i<=NUMREDSHIFTS;i++)
{ {
workptr = (byte *)&redshifts[i-1][0]; workptr = (byte *)&redshifts[i-1][0];
baseptr = &gamepal; baseptr = gamepal;
for (j=0;j<=255;j++) for (j=0;j<=255;j++)
{ {
...@@ -1030,7 +1028,7 @@ void InitRedShifts (void) ...@@ -1030,7 +1028,7 @@ void InitRedShifts (void)
for (i=1;i<=NUMWHITESHIFTS;i++) for (i=1;i<=NUMWHITESHIFTS;i++)
{ {
workptr = (byte *)&whiteshifts[i-1][0]; workptr = (byte *)&whiteshifts[i-1][0];
baseptr = &gamepal; baseptr = gamepal;
for (j=0;j<=255;j++) for (j=0;j<=255;j++)
{ {
...@@ -1140,7 +1138,7 @@ void UpdatePaletteShifts (void) ...@@ -1140,7 +1138,7 @@ void UpdatePaletteShifts (void)
else if (palshifted) else if (palshifted)
{ {
VW_WaitVBL(1); VW_WaitVBL(1);
VL_SetPalette (&gamepal); // back to normal VL_SetPalette(gamepal); // back to normal
palshifted = false; palshifted = false;
} }
} }
...@@ -1162,7 +1160,7 @@ void FinishPaletteShifts (void) ...@@ -1162,7 +1160,7 @@ void FinishPaletteShifts (void)
{ {
palshifted = 0; palshifted = 0;
VW_WaitVBL(1); VW_WaitVBL(1);
VL_SetPalette (&gamepal); VL_SetPalette(gamepal);
} }
} }
......
...@@ -616,7 +616,7 @@ void ShowArticle(char *article) ...@@ -616,7 +616,7 @@ void ShowArticle(char *article)
VW_UpdateScreen (); VW_UpdateScreen ();
if (firstpage) if (firstpage)
{ {
VL_FadeIn(0,255,&gamepal,10); VL_FadeIn(0,255,gamepal,10);
// VW_FadeIn () // VW_FadeIn ()
firstpage = false; firstpage = false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment