mirror of https://github.com/yaz0r/FITD.git
Start cleaning up palette code
This commit is contained in:
parent
6b5d8b3d83
commit
38ceb6ad57
|
@ -16,17 +16,18 @@ int make3dTatou(void)
|
||||||
{
|
{
|
||||||
char* tatou2d;
|
char* tatou2d;
|
||||||
char* tatou3d;
|
char* tatou3d;
|
||||||
unsigned char* tatouPal;
|
|
||||||
int time;
|
int time;
|
||||||
int deltaTime;
|
int deltaTime;
|
||||||
int rotation;
|
int rotation;
|
||||||
int unk1;
|
int unk1;
|
||||||
unsigned char paletteBackup[768];
|
|
||||||
unsigned int localChrono;
|
unsigned int localChrono;
|
||||||
|
palette_t tatouPal;
|
||||||
|
palette_t paletteBackup;
|
||||||
|
|
||||||
tatou2d = CheckLoadMallocPak("ITD_RESS",AITD1_TATOU_MCG);
|
tatou2d = CheckLoadMallocPak("ITD_RESS",AITD1_TATOU_MCG);
|
||||||
tatou3d = CheckLoadMallocPak("ITD_RESS",AITD1_TATOU_3DO);
|
tatou3d = CheckLoadMallocPak("ITD_RESS",AITD1_TATOU_3DO);
|
||||||
tatouPal = (unsigned char*)CheckLoadMallocPak("ITD_RESS",AITD1_TATOU_PAL);
|
char* tatouPalRaw = CheckLoadMallocPak("ITD_RESS",AITD1_TATOU_PAL);
|
||||||
|
copyPalette(tatouPalRaw, tatouPal);
|
||||||
|
|
||||||
time = 8920;
|
time = 8920;
|
||||||
deltaTime = 50;
|
deltaTime = 50;
|
||||||
|
@ -58,15 +59,18 @@ int make3dTatou(void)
|
||||||
//timeGlobal++;
|
//timeGlobal++;
|
||||||
timer = timeGlobal;
|
timer = timeGlobal;
|
||||||
|
|
||||||
if(evalChrono(&localChrono)<=180) // avant eclair
|
if(evalChrono(&localChrono)<=180)
|
||||||
{
|
{
|
||||||
|
// before lightning strike
|
||||||
if(key || Click)
|
if(key || Click)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // eclair
|
else
|
||||||
{
|
{
|
||||||
|
// lightning strike
|
||||||
|
|
||||||
/* LastSample = -1;
|
/* LastSample = -1;
|
||||||
LastPriority = -1; */
|
LastPriority = -1; */
|
||||||
|
|
||||||
|
@ -95,8 +99,10 @@ int make3dTatou(void)
|
||||||
osystem_CopyBlockPhys((unsigned char*)frontBuffer,0,0,320,200);
|
osystem_CopyBlockPhys((unsigned char*)frontBuffer,0,0,320,200);
|
||||||
|
|
||||||
|
|
||||||
while(key==0 && Click == 0 && JoyD == 0) // boucle de rotation du tatou
|
while(key==0 && Click == 0 && JoyD == 0)
|
||||||
{
|
{
|
||||||
|
// Armadillo rotation loop
|
||||||
|
|
||||||
process_events();
|
process_events();
|
||||||
|
|
||||||
time+=deltaTime-25;
|
time+=deltaTime-25;
|
||||||
|
@ -121,7 +127,6 @@ int make3dTatou(void)
|
||||||
}
|
}
|
||||||
}while(1);
|
}while(1);
|
||||||
|
|
||||||
free(tatouPal);
|
|
||||||
free(tatou3d);
|
free(tatou3d);
|
||||||
free(tatou2d);
|
free(tatou2d);
|
||||||
|
|
||||||
|
@ -133,13 +138,13 @@ int make3dTatou(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
FadeOutPhys(32,0);
|
FadeOutPhys(32,0);
|
||||||
copyPalette((unsigned char*)paletteBackup,currentGamePalette);
|
copyPalette(paletteBackup,currentGamePalette);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FadeOutPhys(16,0);
|
FadeOutPhys(16,0);
|
||||||
copyPalette((unsigned char*)paletteBackup,currentGamePalette);
|
copyPalette(paletteBackup,currentGamePalette);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -291,8 +291,8 @@ void AITD2_ReadBook(int index, int type)
|
||||||
case 0: // READ_MESSAGE
|
case 0: // READ_MESSAGE
|
||||||
{
|
{
|
||||||
LoadPak("ITD_RESS", AITD2_LETTRE, aux);
|
LoadPak("ITD_RESS", AITD2_LETTRE, aux);
|
||||||
unsigned char lpalette[0x300];
|
palette_t lpalette;
|
||||||
copyPalette((unsigned char*)aux+64000,lpalette);
|
copyPalette(aux+64000,lpalette);
|
||||||
convertPaletteIfRequired(lpalette);
|
convertPaletteIfRequired(lpalette);
|
||||||
copyPalette(lpalette,currentGamePalette);
|
copyPalette(lpalette,currentGamePalette);
|
||||||
setPalette(lpalette);
|
setPalette(lpalette);
|
||||||
|
@ -304,8 +304,8 @@ void AITD2_ReadBook(int index, int type)
|
||||||
case 1: // READ_BOOK
|
case 1: // READ_BOOK
|
||||||
{
|
{
|
||||||
LoadPak("ITD_RESS", AITD2_LIVRE, aux);
|
LoadPak("ITD_RESS", AITD2_LIVRE, aux);
|
||||||
unsigned char lpalette[0x300];
|
palette_t lpalette;
|
||||||
copyPalette((unsigned char*)aux+64000,lpalette);
|
copyPalette(aux+64000,lpalette);
|
||||||
convertPaletteIfRequired(lpalette);
|
convertPaletteIfRequired(lpalette);
|
||||||
copyPalette(lpalette,currentGamePalette);
|
copyPalette(lpalette,currentGamePalette);
|
||||||
setPalette(lpalette);
|
setPalette(lpalette);
|
||||||
|
@ -317,8 +317,8 @@ void AITD2_ReadBook(int index, int type)
|
||||||
case 2: // READ_CARNET
|
case 2: // READ_CARNET
|
||||||
{
|
{
|
||||||
LoadPak("ITD_RESS", AITD2_CARNET, aux);
|
LoadPak("ITD_RESS", AITD2_CARNET, aux);
|
||||||
unsigned char lpalette[0x300];
|
palette_t lpalette;
|
||||||
copyPalette((unsigned char*)aux+64000,lpalette);
|
copyPalette(aux+64000,lpalette);
|
||||||
convertPaletteIfRequired(lpalette);
|
convertPaletteIfRequired(lpalette);
|
||||||
copyPalette(lpalette,currentGamePalette);
|
copyPalette(lpalette,currentGamePalette);
|
||||||
setPalette(lpalette);
|
setPalette(lpalette);
|
||||||
|
|
|
@ -20,7 +20,8 @@ void JACK_ReadBook(int index, int type)
|
||||||
{
|
{
|
||||||
unsigned char* pImage = (unsigned char*)loadPak("ITD_RESS", JACK_LIVRE);
|
unsigned char* pImage = (unsigned char*)loadPak("ITD_RESS", JACK_LIVRE);
|
||||||
memcpy(aux, pImage, 320*200);
|
memcpy(aux, pImage, 320*200);
|
||||||
unsigned char* lpalette = pImage+320*200;
|
palette_t lpalette;
|
||||||
|
copyPalette(aux + 64000, lpalette);
|
||||||
convertPaletteIfRequired(lpalette);
|
convertPaletteIfRequired(lpalette);
|
||||||
copyPalette(lpalette,currentGamePalette);
|
copyPalette(lpalette,currentGamePalette);
|
||||||
setPalette(lpalette);
|
setPalette(lpalette);
|
||||||
|
|
|
@ -147,6 +147,7 @@ typedef signed long S32;
|
||||||
#include "fmopl.h"
|
#include "fmopl.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "sequence.h"
|
#include "sequence.h"
|
||||||
|
#include "palette.h"
|
||||||
|
|
||||||
// include game specific stuff
|
// include game specific stuff
|
||||||
#include "AITD1.h"
|
#include "AITD1.h"
|
||||||
|
|
|
@ -1643,8 +1643,8 @@ void processLife(int lifeNum, bool callFoundLife)
|
||||||
|
|
||||||
FadeOutPhys(32, 0);
|
FadeOutPhys(32, 0);
|
||||||
LoadPak("ITD_RESS", lifeTempVar1, aux);
|
LoadPak("ITD_RESS", lifeTempVar1, aux);
|
||||||
unsigned char lpalette[0x300];
|
palette_t lpalette;
|
||||||
copyPalette((unsigned char*)aux + 64000, lpalette);
|
copyPalette(aux + 64000, lpalette);
|
||||||
convertPaletteIfRequired(lpalette);
|
convertPaletteIfRequired(lpalette);
|
||||||
copyPalette(lpalette, currentGamePalette);
|
copyPalette(lpalette, currentGamePalette);
|
||||||
setPalette(lpalette);
|
setPalette(lpalette);
|
||||||
|
@ -2004,8 +2004,8 @@ void processLife(int lifeNum, bool callFoundLife)
|
||||||
if (g_gameId > AITD1)
|
if (g_gameId > AITD1)
|
||||||
{
|
{
|
||||||
FadeOutPhys(0x10, 0);
|
FadeOutPhys(0x10, 0);
|
||||||
unsigned char lpalette[0x300];
|
palette_t lpalette;
|
||||||
copyPalette((unsigned char*)aux + 64000, lpalette);
|
copyPalette(aux + 64000, lpalette);
|
||||||
convertPaletteIfRequired(lpalette);
|
convertPaletteIfRequired(lpalette);
|
||||||
copyPalette(lpalette, currentGamePalette);
|
copyPalette(lpalette, currentGamePalette);
|
||||||
setPalette(lpalette);
|
setPalette(lpalette);
|
||||||
|
|
|
@ -582,7 +582,7 @@ void fillBox(int x1, int y1, int x2, int y2, char color) // fast recode. No RE
|
||||||
|
|
||||||
void loadPalette(void)
|
void loadPalette(void)
|
||||||
{
|
{
|
||||||
unsigned char localPalette[768];
|
palette_t localPalette;
|
||||||
|
|
||||||
if(g_gameId == AITD2)
|
if(g_gameId == AITD2)
|
||||||
{
|
{
|
||||||
|
@ -592,7 +592,7 @@ void loadPalette(void)
|
||||||
{
|
{
|
||||||
LoadPak("ITD_RESS",3,aux);
|
LoadPak("ITD_RESS",3,aux);
|
||||||
}
|
}
|
||||||
copyPalette((unsigned char*)aux,currentGamePalette);
|
copyPalette(aux,currentGamePalette);
|
||||||
|
|
||||||
copyPalette(currentGamePalette,localPalette);
|
copyPalette(currentGamePalette,localPalette);
|
||||||
// fadeInSub1(localPalette);
|
// fadeInSub1(localPalette);
|
||||||
|
@ -1335,11 +1335,15 @@ void loadCamera(int cameraIdx)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memcpy(currentGamePalette,defaultPalette,0x30);
|
for (int i = 0; i < 16; i++) {
|
||||||
convertPaletteIfRequired((unsigned char*)currentGamePalette);
|
currentGamePalette[i][0] = defaultPalette[i * 3 + 0];
|
||||||
|
currentGamePalette[i][1] = defaultPalette[i * 3 + 1];
|
||||||
|
currentGamePalette[i][2] = defaultPalette[i * 3 + 2];
|
||||||
|
}
|
||||||
|
convertPaletteIfRequired(currentGamePalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
osystem_setPalette(currentGamePalette);
|
osystem_setPalette(¤tGamePalette);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
#include "debugFont.h"
|
#include "debugFont.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern "C"{
|
#include "palette.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define byte char
|
#define byte char
|
||||||
|
@ -49,6 +50,7 @@ extern "C"{
|
||||||
void osystem_putpixel(int x, int y, int pixel);
|
void osystem_putpixel(int x, int y, int pixel);
|
||||||
void osystem_setColor(byte i, byte R, byte G, byte B);
|
void osystem_setColor(byte i, byte R, byte G, byte B);
|
||||||
void osystem_setPalette(unsigned byte * palette);
|
void osystem_setPalette(unsigned byte * palette);
|
||||||
|
void osystem_setPalette(palette_t* palette);
|
||||||
void osystem_setPalette320x200(byte * palette);
|
void osystem_setPalette320x200(byte * palette);
|
||||||
void osystem_flip(unsigned char *videoBuffer);
|
void osystem_flip(unsigned char *videoBuffer);
|
||||||
void osystem_draw320x200BufferToScreen(unsigned char *videoBuffer);
|
void osystem_draw320x200BufferToScreen(unsigned char *videoBuffer);
|
||||||
|
@ -57,7 +59,6 @@ extern "C"{
|
||||||
void osystem_drawText(int X, int Y, char *text);
|
void osystem_drawText(int X, int Y, char *text);
|
||||||
void osystem_drawTextColor(int X, int Y, char *string, unsigned char R, unsigned char G, unsigned char B);
|
void osystem_drawTextColor(int X, int Y, char *string, unsigned char R, unsigned char G, unsigned char B);
|
||||||
void osystem_drawLine(int X1,int X2,int Y1,int Y2,unsigned char color, unsigned char* palette);
|
void osystem_drawLine(int X1,int X2,int Y1,int Y2,unsigned char color, unsigned char* palette);
|
||||||
void osystem_getPalette(unsigned char* palette);
|
|
||||||
void osystem_playSampleFromName(char* sampleName);
|
void osystem_playSampleFromName(char* sampleName);
|
||||||
void osystem_playSample(char* samplePtr,int size);
|
void osystem_playSample(char* samplePtr,int size);
|
||||||
// void getMouseStatus(mouseStatusStruct * mouseData);
|
// void getMouseStatus(mouseStatusStruct * mouseData);
|
||||||
|
@ -90,8 +91,4 @@ extern "C"{
|
||||||
int osystem_playTrack(int trackId);
|
int osystem_playTrack(int trackId);
|
||||||
void osystem_playAdlib();
|
void osystem_playAdlib();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
#include "common.h"
|
||||||
|
#include "palette.h"
|
||||||
|
|
||||||
|
void paletteFill(palette_t& palette, unsigned char r, unsigned char g, unsigned b)
|
||||||
|
{
|
||||||
|
r <<= 1;
|
||||||
|
g <<= 1;
|
||||||
|
b <<= 1;
|
||||||
|
|
||||||
|
for (int i = 0; i < 256; i++)
|
||||||
|
{
|
||||||
|
palette[i][0] = r;
|
||||||
|
palette[i][1] = g;
|
||||||
|
palette[i][2] = b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPalette(palette_t& sourcePal)
|
||||||
|
{
|
||||||
|
osystem_setPalette(&sourcePal);
|
||||||
|
}
|
||||||
|
|
||||||
|
void copyPalette(palette_t& source, palette_t& dest)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 256; i++)
|
||||||
|
{
|
||||||
|
dest[i] = source[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void copyPalette(void* source, palette_t& dest)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 256; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 3; j++) {
|
||||||
|
dest[i][j] = ((uint8*)source)[i * 3 + j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void convertPaletteIfRequired(palette_t& lpalette)
|
||||||
|
{
|
||||||
|
if (g_gameId >= JACK && g_gameId < AITD3)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 256; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 3; j++)
|
||||||
|
{
|
||||||
|
lpalette[i][j] = (((unsigned int)lpalette[i][j] * 255) / 63) & 0xFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void computePalette(palette_t& inPalette, palette_t& outPalette, int coef)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 256; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 3; j++) {
|
||||||
|
outPalette[i][j] = (inPalette[i][j] * coef) >> 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
typedef std::array<std::array<uint8_t, 3>, 256> palette_t;
|
||||||
|
void paletteFill(palette_t& palette, unsigned char r, unsigned char g, unsigned b);
|
||||||
|
void setPalette(palette_t& palette);
|
||||||
|
void copyPalette(void* source, palette_t& dest);
|
||||||
|
void copyPalette(palette_t& source, palette_t& dest);
|
||||||
|
void convertPaletteIfRequired(palette_t& lpalette);
|
||||||
|
void computePalette(palette_t& inPalette, palette_t& outPalette, int coef);
|
||||||
|
|
||||||
|
extern palette_t currentGamePalette;
|
|
@ -208,9 +208,15 @@ void osystem_setPalette(u8* palette)
|
||||||
bgfx::updateTexture2D(g_paletteTexture, 0, 0, 0, 0, 3, 256, bgfx::copy(RGB_Pal, 256 * 3));
|
bgfx::updateTexture2D(g_paletteTexture, 0, 0, 0, 0, 3, 256, bgfx::copy(RGB_Pal, 256 * 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
void osystem_getPalette(unsigned char* palette)
|
void osystem_setPalette(palette_t* palette)
|
||||||
{
|
{
|
||||||
memcpy(palette, RGB_Pal, 256 * 3);
|
for (int i = 0; i < 256; i++) {
|
||||||
|
for (int j = 0; j < 3; j++) {
|
||||||
|
RGB_Pal[i * 3 + j] = palette->at(i)[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bgfx::updateTexture2D(g_paletteTexture, 0, 0, 0, 0, 3, 256, bgfx::copy(RGB_Pal, 256 * 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct s_vertexData
|
struct s_vertexData
|
||||||
|
|
|
@ -1,25 +1,5 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
void convertPaletteIfRequired(unsigned char* lpalette)
|
|
||||||
{
|
|
||||||
if(g_gameId >= JACK && g_gameId < AITD3)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
unsigned char* ptr2 = lpalette;
|
|
||||||
for(i=0;i<256;i++)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
for(j=0;j<3;j++)
|
|
||||||
{
|
|
||||||
unsigned int composante = *(ptr2);
|
|
||||||
composante*=255;
|
|
||||||
composante/=63;
|
|
||||||
*(ptr2++) = composante&0xFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* sequenceListAITD2[]=
|
const char* sequenceListAITD2[]=
|
||||||
{
|
{
|
||||||
"BATL",
|
"BATL",
|
||||||
|
@ -156,7 +136,6 @@ void playSequence(int sequenceIdx, int fadeStart, int fadeOutVar)
|
||||||
int var_4 = 1;
|
int var_4 = 1;
|
||||||
int quitPlayback = 0;
|
int quitPlayback = 0;
|
||||||
int nextFrame = 1;
|
int nextFrame = 1;
|
||||||
unsigned char localPalette[0x300];
|
|
||||||
|
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
if (g_gameId == AITD2)
|
if (g_gameId == AITD2)
|
||||||
|
@ -194,7 +173,8 @@ void playSequence(int sequenceIdx, int fadeStart, int fadeOutVar)
|
||||||
|
|
||||||
if(!currentFrameId) // first frame
|
if(!currentFrameId) // first frame
|
||||||
{
|
{
|
||||||
memcpy(localPalette,logicalScreen,0x300); // copy palette
|
palette_t localPalette;
|
||||||
|
copyPalette(logicalScreen, localPalette); // copy palette
|
||||||
memcpy(aux,logicalScreen+0x300,64000);
|
memcpy(aux,logicalScreen+0x300,64000);
|
||||||
nextFrame = READ_LE_U16(logicalScreen+64768);
|
nextFrame = READ_LE_U16(logicalScreen+64768);
|
||||||
|
|
||||||
|
@ -213,7 +193,7 @@ void playSequence(int sequenceIdx, int fadeStart, int fadeOutVar)
|
||||||
flipOtherPalette(palette);
|
flipOtherPalette(palette);
|
||||||
} */
|
} */
|
||||||
|
|
||||||
osystem_setPalette(localPalette);
|
osystem_setPalette(&localPalette);
|
||||||
copyPalette(localPalette,currentGamePalette);
|
copyPalette(localPalette,currentGamePalette);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,3 @@ typedef struct sequenceParamStruct sequenceParamStruct;
|
||||||
extern int numSequenceParam;
|
extern int numSequenceParam;
|
||||||
|
|
||||||
extern sequenceParamStruct sequenceParams[NUM_MAX_SEQUENCE_PARAM];
|
extern sequenceParamStruct sequenceParams[NUM_MAX_SEQUENCE_PARAM];
|
||||||
|
|
||||||
void convertPaletteIfRequired(unsigned char* lpalette);
|
|
||||||
|
|
|
@ -22,56 +22,13 @@ void blitScreenTatou(void)
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void copyPalette(unsigned char* source, unsigned char* dest)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for(i=0;i<768;i++)
|
|
||||||
{
|
|
||||||
dest[i] = source[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void FastCopyScreen(void* source, void* dest)
|
void FastCopyScreen(void* source, void* dest)
|
||||||
{
|
{
|
||||||
memcpy(dest, source, 64000);
|
memcpy(dest, source, 64000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void paletteFill(void* palette, unsigned char r, unsigned char g, unsigned b)
|
|
||||||
{
|
|
||||||
unsigned char* paletteLocal = (unsigned char*) palette;
|
|
||||||
int offset = 0;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
r<<=1;
|
|
||||||
g<<=1;
|
|
||||||
b<<=1;
|
|
||||||
|
|
||||||
for(i=0;i<256;i++)
|
|
||||||
{
|
|
||||||
paletteLocal[offset] = r;
|
|
||||||
paletteLocal[offset+1] = g;
|
|
||||||
paletteLocal[offset+2] = b;
|
|
||||||
offset += 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void computePalette(unsigned char* inPalette, unsigned char* outPalette, int coef)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for(i=0;i<256;i++)
|
|
||||||
{
|
|
||||||
*(outPalette++) = ((*(inPalette++))*coef)>> 8;
|
|
||||||
*(outPalette++) = ((*(inPalette++))*coef)>> 8;
|
|
||||||
*(outPalette++) = ((*(inPalette++))*coef)>> 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void FadeInPhys(int step,int start)
|
void FadeInPhys(int step,int start)
|
||||||
{
|
{
|
||||||
unsigned char localPalette[0x300];
|
|
||||||
|
|
||||||
freezeTime();
|
freezeTime();
|
||||||
|
|
||||||
if(fadeState == 2) // only used for the ending ?
|
if(fadeState == 2) // only used for the ending ?
|
||||||
|
@ -82,6 +39,7 @@ void FadeInPhys(int step,int start)
|
||||||
for(int i=0;i<256;i+=step)
|
for(int i=0;i<256;i+=step)
|
||||||
{
|
{
|
||||||
process_events();
|
process_events();
|
||||||
|
palette_t localPalette;
|
||||||
computePalette(currentGamePalette,localPalette,i);
|
computePalette(currentGamePalette,localPalette,i);
|
||||||
setPalette(localPalette);
|
setPalette(localPalette);
|
||||||
osystem_refreshFrontTextureBuffer();
|
osystem_refreshFrontTextureBuffer();
|
||||||
|
@ -96,13 +54,12 @@ void FadeInPhys(int step,int start)
|
||||||
|
|
||||||
void FadeOutPhys(int var1, int var2)
|
void FadeOutPhys(int var1, int var2)
|
||||||
{
|
{
|
||||||
unsigned char localPalette[0x300];
|
|
||||||
|
|
||||||
freezeTime();
|
freezeTime();
|
||||||
|
|
||||||
for(int i=256;i>=0;i-=var1)
|
for(int i=256;i>=0;i-=var1)
|
||||||
{
|
{
|
||||||
process_events();
|
process_events();
|
||||||
|
palette_t localPalette;
|
||||||
computePalette(currentGamePalette,localPalette,i);
|
computePalette(currentGamePalette,localPalette,i);
|
||||||
setPalette(localPalette);
|
setPalette(localPalette);
|
||||||
osystem_refreshFrontTextureBuffer();
|
osystem_refreshFrontTextureBuffer();
|
||||||
|
@ -112,11 +69,6 @@ void FadeOutPhys(int var1, int var2)
|
||||||
unfreezeTime();
|
unfreezeTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPalette(void* sourcePal)
|
|
||||||
{
|
|
||||||
osystem_setPalette((unsigned char*)sourcePal);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef PCLIKE
|
#ifdef PCLIKE
|
||||||
void process_events( void )
|
void process_events( void )
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,17 +3,15 @@
|
||||||
|
|
||||||
int make3dTatou(void);
|
int make3dTatou(void);
|
||||||
//////////////// to mode
|
//////////////// to mode
|
||||||
void paletteFill(void* palette, unsigned char r, unsigned char g, unsigned b);
|
|
||||||
void setPalette(void* palette);
|
|
||||||
void startChrono(unsigned int* chrono);
|
|
||||||
int evalChrono(unsigned int* chrono);
|
|
||||||
void process_events( void );
|
void process_events( void );
|
||||||
void copyPalette(unsigned char* source, unsigned char* dest);
|
|
||||||
void FastCopyScreen(void* source, void* dest);
|
void FastCopyScreen(void* source, void* dest);
|
||||||
void Rotate(unsigned int x, unsigned int y, unsigned int z, int* xOut, int* yOut);
|
void Rotate(unsigned int x, unsigned int y, unsigned int z, int* xOut, int* yOut);
|
||||||
void FadeInPhys(int var1,int var2);
|
void FadeInPhys(int var1,int var2);
|
||||||
void FadeOutPhys(int var1, int var2);
|
void FadeOutPhys(int var1, int var2);
|
||||||
void playSound(int num);
|
void playSound(int num);
|
||||||
void setCameraTarget(int x,int y,int z,int alpha,int beta,int gamma,int time);
|
void setCameraTarget(int x,int y,int z,int alpha,int beta,int gamma,int time);
|
||||||
|
|
||||||
|
void startChrono(unsigned int* chrono);
|
||||||
|
int evalChrono(unsigned int* chrono);
|
||||||
//////////////
|
//////////////
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,7 +29,7 @@ char* PtrFont;
|
||||||
|
|
||||||
char* PtrCadre;
|
char* PtrCadre;
|
||||||
|
|
||||||
unsigned char currentGamePalette[256*3];
|
palette_t currentGamePalette;
|
||||||
|
|
||||||
//OSystem osystem;
|
//OSystem osystem;
|
||||||
|
|
||||||
|
|
|
@ -284,8 +284,6 @@ extern char* PtrFont;
|
||||||
|
|
||||||
extern char* PtrCadre;
|
extern char* PtrCadre;
|
||||||
|
|
||||||
extern unsigned char currentGamePalette[0x300];
|
|
||||||
|
|
||||||
//extern OSystem osystem;
|
//extern OSystem osystem;
|
||||||
extern unsigned char frontBuffer[320*200];
|
extern unsigned char frontBuffer[320*200];
|
||||||
extern char rgbaBuffer[320*200*4];
|
extern char rgbaBuffer[320*200*4];
|
||||||
|
|
Loading…
Reference in New Issue