Added a README.

Added the HUD font drawing code.  now stubs2.cpp is no longer needed.
This commit is contained in:
Steven Fuller 2001-08-15 07:53:04 +00:00 committed by Patryk Obara
parent 3ea03344ec
commit 681b48343d
13 changed files with 703 additions and 248 deletions

258
src/aafont.h Normal file
View file

@ -0,0 +1,258 @@
char AAFontWidths[256] = {
0, /* 0 */
0, /* 1 */
0, /* 2 */
0, /* 3 */
0, /* 4 */
0, /* 5 */
0, /* 6 */
0, /* 7 */
0, /* 8 */
0, /* 9 */
0, /* 10 */
0, /* 11 */
0, /* 12 */
0, /* 13 */
0, /* 14 */
0, /* 15 */
0, /* 16 */
0, /* 17 */
0, /* 18 */
0, /* 19 */
0, /* 20 */
0, /* 21 */
0, /* 22 */
0, /* 23 */
0, /* 24 */
0, /* 25 */
0, /* 26 */
0, /* 27 */
0, /* 28 */
0, /* 29 */
0, /* 30 */
0, /* 31 */
3, /* 32 */
2, /* 33 */
2, /* 34 */
6, /* 35 */
6, /* 36 */
9, /* 37 */
7, /* 38 */
2, /* 39 */
4, /* 40 */
4, /* 41 */
3, /* 42 */
6, /* 43 */
2, /* 44 */
3, /* 45 */
3, /* 46 */
3, /* 47 */
6, /* 48 */
4, /* 49 */
6, /* 50 */
6, /* 51 */
6, /* 52 */
6, /* 53 */
6, /* 54 */
6, /* 55 */
6, /* 56 */
6, /* 57 */
2, /* 58 */
2, /* 59 */
6, /* 60 */
2, /* 61 */
6, /* 62 */
6, /* 63 */
10, /* 64 */
8, /* 65 */
7, /* 66 */
7, /* 67 */
7, /* 68 */
6, /* 69 */
6, /* 70 */
8, /* 71 */
7, /* 72 */
3, /* 73 */
5, /* 74 */
7, /* 75 */
3, /* 76 */
8, /* 77 */
7, /* 78 */
8, /* 79 */
7, /* 80 */
8, /* 81 */
7, /* 82 */
7, /* 83 */
6, /* 84 */
7, /* 85 */
7, /* 86 */
10, /* 87 */
7, /* 88 */
7, /* 89 */
6, /* 90 */
4, /* 91 */
3, /* 92 */
3, /* 93 */
5, /* 94 */
7, /* 95 */
4, /* 96 */
6, /* 97 */
6, /* 98 */
6, /* 99 */
6, /* 100 */
6, /* 101 */
4, /* 102 */
6, /* 103 */
6, /* 104 */
3, /* 105 */
4, /* 106 */
6, /* 107 */
3, /* 108 */
9, /* 109 */
6, /* 110 */
6, /* 111 */
6, /* 112 */
6, /* 113 */
3, /* 114 */
6, /* 115 */
3, /* 116 */
6, /* 117 */
6, /* 118 */
8, /* 119 */
5, /* 120 */
6, /* 121 */
5, /* 122 */
4, /* 123 */
2, /* 124 */
4, /* 125 */
6, /* 126 */
2, /* 127 */
2, /* 128 */
2, /* 129 */
2, /* 130 */
5, /* 131 */
2, /* 132 */
2, /* 133 */
2, /* 134 */
2, /* 135 */
6, /* 136 */
13, /* 137 */
15, /* 138 */
12, /* 139 */
15, /* 140 */
16, /* 141 */
15, /* 142 */
14, /* 143 */
2, /* 144 */
2, /* 145 */
2, /* 146 */
2, /* 147 */
2, /* 148 */
2, /* 149 */
2, /* 150 */
15, /* 151 */
14, /* 152 */
9, /* 153 */
11, /* 154 */
16, /* 155 */
14, /* 156 */
15, /* 157 */
15, /* 158 */
2, /* 159 */
2, /* 160 */
2, /* 161 */
6, /* 162 */
6, /* 163 */
6, /* 164 */
7, /* 165 */
2, /* 166 */
2, /* 167 */
6, /* 168 */
8, /* 169 */
4, /* 170 */
7, /* 171 */
2, /* 172 */
2, /* 173 */
8, /* 174 */
2, /* 175 */
13, /* 176 */
15, /* 177 */
13, /* 178 */
2, /* 179 */
5, /* 180 */
2, /* 181 */
2, /* 182 */
2, /* 183 */
2, /* 184 */
2, /* 185 */
4, /* 186 */
7, /* 187 */
8, /* 188 */
8, /* 189 */
2, /* 190 */
7, /* 191 */
8, /* 192 */
8, /* 193 */
8, /* 194 */
2, /* 195 */
8, /* 196 */
8, /* 197 */
10, /* 198 */
7, /* 199 */
6, /* 200 */
6, /* 201 */
6, /* 202 */
6, /* 203 */
3, /* 204 */
3, /* 205 */
4, /* 206 */
4, /* 207 */
7, /* 208 */
7, /* 209 */
8, /* 210 */
8, /* 211 */
8, /* 212 */
8, /* 213 */
8, /* 214 */
2, /* 215 */
8, /* 216 */
7, /* 217 */
7, /* 218 */
7, /* 219 */
7, /* 220 */
7, /* 221 */
2, /* 222 */
6, /* 223 */
6, /* 224 */
6, /* 225 */
6, /* 226 */
2, /* 227 */
6, /* 228 */
6, /* 229 */
10, /* 230 */
6, /* 231 */
6, /* 232 */
6, /* 233 */
6, /* 234 */
6, /* 235 */
3, /* 236 */
4, /* 237 */
4, /* 238 */
4, /* 239 */
6, /* 240 */
6, /* 241 */
6, /* 242 */
6, /* 243 */
6, /* 244 */
6, /* 245 */
6, /* 246 */
2, /* 247 */
8, /* 248 */
6, /* 249 */
6, /* 250 */
6, /* 251 */
6, /* 252 */
6, /* 253 */
2, /* 254 */
0 /* 255 */
};

View file

@ -59,9 +59,6 @@ static int testLoop = SOUND_NOACTIVEINDEX;
static int doneCDDA = 0;
#endif
static unsigned int playerZone = -1;
static VECTORCH backgroundSoundPos={0,0,0};
/* Has the player made a noise? */
int playerNoise;
@ -93,7 +90,6 @@ void DoPlayerSounds(void)
{
PLAYER_STATUS *playerStatusPtr;
PLAYER_WEAPON_DATA *weaponPtr;
VECTORCH *playerPos;
#if CDDA_TEST
if (doneCDDA == 0)
@ -848,7 +844,6 @@ void PlayCudgelSound(void) {
char * SecondSoundDir = 0;
static const char * FirstSoundDir = "SOUND\\";
static char *CommonSoundDirectory = ".\\SOUND\\COMMON\\";
int FindAndLoadWavFile(int soundNum,char* wavFileName)
{
@ -904,8 +899,7 @@ printf("FindAndLoadWavFile: %d, %s\n", soundNum, wavFileName);
/* Patrick 5/6/97 -------------------------------------------------------------
Sound data loaders
----------------------------------------------------------------------------*/
//#if USE_REBSND_LOADERS
#if 1
extern unsigned char *ExtractWavFile(int soundIndex, unsigned char *bufferPtr);
void *LoadRebSndFile(char *filename)
{
@ -962,16 +956,12 @@ void LoadSounds(char *soundDirectory)
/* load RebSnd file into a (big) buffer */
{
char filename[64];
#if ALIEN_DEMO
strcpy(filename, "./alienfastfile");//CommonSoundDirectory);
#else
strcpy(filename, "./fastfile");//CommonSoundDirectory);
#endif
// strcat(filename, soundDirectory);
strcat(filename, "/");
// strcat(filename, soundDirectory);
// strcat(filename, ".RebSnd");
strcat(filename, "common.ffl");
#if ALIEN_DEMO
strcpy(filename, "./alienfastfile");
#else
strcpy(filename, "./fastfile");
#endif
strcat(filename, "/common.ffl");
rebSndBuffer = LoadRebSndFile(filename);
@ -1015,68 +1005,3 @@ void LoadSounds(char *soundDirectory)
ReleaseRebSndFile(rebSndBuffer);
}
#else
void LoadSounds(char *soundDirectory)
{
char soundFileName[48];
char fileLine[128];
FILE *myFile;
int soundNum;
int pitchOffset;
int ok;
LOCALASSERT(soundDirectory);
/* first check that sound has initialised and is turned on */
if(!SoundSys_IsOn()) return;
/* construct the sound list file name, and load it */
// strcpy((char*)&soundFileName, gameSoundDirectory);
// strcat((char*)&soundFileName, soundDirectory);
// strcat((char*)&soundFileName, "\\");
strcpy((char*)&soundFileName, CommonSoundDirectory);
strcat((char*)&soundFileName, soundDirectory);
strcat((char*)&soundFileName, ".SL");
myFile = fopen(soundFileName,"rt");
LOCALASSERT(myFile!=NULL);
/* just return if we can't find the file */
if(!myFile) return;
/* Process the file */
while(fgets((char*)fileLine,128,myFile))
{
char wavFileName[128];
if(!strncmp((char*)fileLine,"//",2)) continue; /* comment */
if(strlen((char*)fileLine) < 4) continue; /* blank line, or something */
/* Assume the string is a valid wav file reference */
soundNum = atoi(strtok(fileLine,", \n"));
strcpy((char*)&wavFileName,"Common\\");
strcat((char*)&wavFileName,strtok(NULL,", \n"));
/* pitch offset is in semitones: need to convert to 1/128ths */
pitchOffset = PITCH_DEFAULTPLAT + (atoi(strtok(NULL,", \n"))*128);
if((soundNum<0)||(soundNum>=SID_MAXIMUM)) continue; /* invalid sound number */
if(GameSounds[soundNum].loaded) continue; /* Duplicate game sound loaded */
ok = FindAndLoadWavFile(soundNum, wavFileName);
/* Fill in the GameSound: the pointer to the ds buffer is filled in by
the wav file loader, if everthing went ok. If the load failed, do not
fill in the game sound data: it should remain initialised */
if(ok)
{
GameSounds[soundNum].loaded = 1;
GameSounds[soundNum].activeInstances = 0;;
GameSounds[soundNum].volume = VOLUME_DEFAULT;
GameSounds[soundNum].pitch = pitchOffset;
InitialiseBaseFrequency(soundNum);
}
}
fclose(myFile);
db_log1("loaded all the sounds.");
}
#endif

View file

@ -12,7 +12,7 @@
#include "3dc.h"
#include "inline.h"
#include "indexfnt.hpp"
#include "tallfont.hpp"
//#include "tallfont.hpp"
extern "C"
{
@ -29,8 +29,10 @@ extern "C"
/* Macros **********************************************************/
/* Imported function prototypes ************************************/
extern "C" {
extern void D3D_RenderHUDString(char *stringPtr,int x,int y,int colour);
extern void D3D_RenderHUDString_Clipped(char *stringPtr,int x,int y,int colour);
};
/* Imported data ***************************************************/
#ifdef __cplusplus
@ -39,22 +41,13 @@ extern void D3D_RenderHUDString_Clipped(char *stringPtr,int x,int y,int colour);
#endif
extern unsigned char *ScreenBuffer;
extern long BackBufferPitch;
#if 0 /* LINUX */
extern LPDIRECTDRAWSURFACE lpDDSBack;
extern DDPIXELFORMAT DisplayPixelFormat;
#endif
extern int CloudTable[128][128];
extern int CloakingPhase;
#if 0
extern OurBool DaveDebugOn;
extern FDIEXTENSIONTAG FDIET_Dummy;
extern IFEXTENSIONTAG IFET_Dummy;
extern FDIQUAD FDIQuad_WholeScreen;
extern FDIPOS FDIPos_Origin;
extern FDIPOS FDIPos_ScreenCentre;
extern IFOBJECTLOCATION IFObjLoc_Origin;
extern UncompressedGlobalPlotAtomID UGPAID_StandardNull;
extern IFCOLOUR IFColour_Dummy;
extern IFVECTOR IFVec_Zero;
#endif
#ifdef __cplusplus
};
#endif
@ -422,6 +415,9 @@ IndexedFont_Kerned :: RenderString_Clipped
const SCString& SCStr
) const
{
fprintf(stderr, "IndexedFont_Kerned :: RenderString_Clipped\n");
#if 0 /* LINUX */
ProjChar* pProjChar_I = SCStr . pProjCh();
const LPDIRECTDRAWSURFACE image_ptr = GetImagePtr();
@ -575,6 +571,7 @@ IndexedFont_Kerned :: RenderString_Clipped
pProjChar_I++;
}
image_ptr->Unlock((LPVOID)ddsdimage.lpSurface);
#endif
}
void
@ -586,6 +583,8 @@ IndexedFont_Kerned :: RenderString_Unclipped
) const
#if 1
{
fprintf(stderr, "IndexedFont_Kerned :: RenderString_Unclipped\n");
#if 0 /* LINUX */
ProjChar* pProjChar_I = SCStr . pProjCh();
const LPDIRECTDRAWSURFACE image_ptr = GetImagePtr();
@ -743,6 +742,7 @@ IndexedFont_Kerned :: RenderString_Unclipped
pProjChar_I++;
}
image_ptr->Unlock((LPVOID)ddsdimage.lpSurface);
#endif
}
#else
{

View file

@ -243,16 +243,13 @@
) const;
// protected:
IndexedFont_HUD(FontIndex I_Font_New);
#if 0
IndexedFont_HUD(FontIndex I_Font_New)
: IndexedFont
(
I_Font_New
) ;
)
{
}
#endif
};
inline r2size IndexedFont_HUD::CalcSize
(

View file

@ -1,3 +1,6 @@
#ifndef __AVP_WIN95_FRONTEND_AVP_MENUGFX_HPP__
#define __AVP_WIN95_FRONTEND_AVP_MENUGFX_HPP__
/* KJL 12:27:18 26/06/98 - AvP_MenuGfx.hpp */
enum AVPMENUGFX_ID
@ -114,3 +117,5 @@ extern int HeightOfMenuGfx(enum AVPMENUGFX_ID menuGfxID);
extern void ClearScreenToBlack(void);
#endif

View file

@ -23,8 +23,8 @@
#include "cdtrackselection.h"
#include "gammacontrol.h"
#define MyWidth 512
#define MyHeight 384
#define MyWidth 1024
#define MyHeight 768
char LevelName[] = {"predbit6\0QuiteALongNameActually"}; /* the real way to load levels */
@ -555,7 +555,6 @@ int main(int argc, char *argv[])
LoadKeyConfiguration();
SoundSys_Start();
CDDA_Start();
@ -567,18 +566,24 @@ int main(int argc, char *argv[])
AvP.LevelCompleted = 0;
LoadSounds("PLAYER");
{
extern int DebuggingCommandsActive;
// AvP.Network = I_Host; /* for exploring */
DebuggingCommandsActive = 1;
}
AvP.CurrentEnv = AvP.StartingEnv = 0; /* are these even used? */
// AvP.PlayerType = I_Alien;
// SetLevelToLoad(AVP_ENVIRONMENT_TEMPLE); /* starting alien level */
AvP.PlayerType = I_Marine;
// SetLevelToLoad(AVP_ENVIRONMENT_DERELICT); /* starting marine level */
SetLevelToLoad(AVP_ENVIRONMENT_DERELICT); /* starting marine level */
// AvP.PlayerType = I_Predator;
// SetLevelToLoad(AVP_ENVIRONMENT_WATERFALL); /* starting predator level */
SetLevelToLoad(AVP_ENVIRONMENT_LEADWORKS_MP); /* multiplayer */
// SetLevelToLoad(AVP_ENVIRONMENT_LEADWORKS_MP); /* multiplayer */
// SetLevelToLoad(AVP_ENVIRONMENT_E3DEMOSP); /* demo level */

View file

@ -35,6 +35,7 @@ extern int StaticImageNumber;
extern int PredatorNumbersImageNumber;
extern int BurningImageNumber;
extern int HUDFontsImageNumber;
extern int AAFontImageNumber;
extern int FMVParticleColour;
extern int HUDScaleFactor;
@ -44,6 +45,8 @@ static D3DTexture *CurrTextureHandle;
static enum TRANSLUCENCY_TYPE CurrentTranslucencyMode = TRANSLUCENCY_OFF; /* opengl state variable */
static enum FILTERING_MODE_ID CurrentFilteringMode = FILTERING_BILINEAR_OFF;
static GLuint CurrentlyBoundTexture = 0; /* opengl state variable */
static void CheckBoundTextureIsCorrect(GLuint tex)
@ -52,6 +55,20 @@ static void CheckBoundTextureIsCorrect(GLuint tex)
return;
glBindTexture(GL_TEXTURE_2D, tex);
/*
switch(CurrentFilteringMode) {
case FILTERING_BILINEAR_OFF:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
break;
case FILTERING_BILINEAR_ON:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
break;
default:
}
*/
CurrentlyBoundTexture = tex;
}
@ -100,6 +117,27 @@ static void CheckTranslucencyModeIsCorrect(enum TRANSLUCENCY_TYPE mode)
CurrentTranslucencyMode = mode;
}
void CheckFilteringModeIsCorrect(enum FILTERING_MODE_ID filter)
{
if (filter == CurrentFilteringMode)
return;
switch(filter) {
case FILTERING_BILINEAR_OFF:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
break;
case FILTERING_BILINEAR_ON:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
break;
default:
fprintf(stderr, "CheckFilteringModeIsCorrect: filter = %d\n", filter);
}
CurrentFilteringMode = filter;
}
#define TA_MAXVERTICES 8
typedef struct TriangleArray
{
@ -989,8 +1027,8 @@ void D3D_PlayerOnFireOverlay()
tex = ImageHeaderArray[BurningImageNumber].D3DTexture;
CheckTranslucencyModeIsCorrect(TRANSLUCENCY_GLOWING);
//CheckFilteringModeIsCorrect(FILTERING_BILINEAR_ON);
CheckBoundTextureIsCorrect(tex->id);
CheckFilteringModeIsCorrect(FILTERING_BILINEAR_ON);
glColor4ub(r, g, b, a);
@ -1059,9 +1097,8 @@ void D3D_PlayerDamagedOverlay(int intensity)
break;
}
// CheckFilteringModeIsCorrect(FILTERING_BILINEAR_ON);
CheckBoundTextureIsCorrect(tex->id);
CheckFilteringModeIsCorrect(FILTERING_BILINEAR_ON);
colour = 0xffffff - baseColour + (intensity<<24);
@ -1143,8 +1180,8 @@ void DrawNoiseOverlay(int tr)
tex = ImageHeaderArray[StaticImageNumber].D3DTexture;
CheckTranslucencyModeIsCorrect(TRANSLUCENCY_GLOWING);
// CheckFilteringModeIsCorrect(FILTERING_BILINEAR_ON);
CheckBoundTextureIsCorrect(tex->id);
CheckFilteringModeIsCorrect(FILTERING_BILINEAR_ON);
glDepthFunc(GL_ALWAYS);
u = FastRandom()&255;
@ -1201,8 +1238,8 @@ void D3D_ScreenInversionOverlay()
tex = ImageHeaderArray[SpecialFXImageNumber].D3DTexture;
CheckTranslucencyModeIsCorrect(TRANSLUCENCY_DARKENINGCOLOUR);
// CheckFilteringModeIsCorrect(FILTERING_BILINEAR_ON);
CheckBoundTextureIsCorrect(tex->id);
CheckFilteringModeIsCorrect(FILTERING_BILINEAR_ON);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
@ -1284,8 +1321,8 @@ void DrawScanlinesOverlay(float level)
tex = ImageHeaderArray[PredatorNumbersImageNumber].D3DTexture;
CheckTranslucencyModeIsCorrect(TRANSLUCENCY_NORMAL);
//CheckFilteringModeIsCorrect(FILTERING_BILINEAR_ON);
CheckBoundTextureIsCorrect(tex->id);
CheckFilteringModeIsCorrect(FILTERING_BILINEAR_ON);
glDepthFunc(GL_ALWAYS);
c = 255;
@ -1458,7 +1495,7 @@ void D3D_RenderHUDNumber_Centred(unsigned int number,int x,int y,int colour)
x += (3*w)/2;
// CheckFilteringModeIsCorrect(FILTERING_BILINEAR_OFF);
CheckFilteringModeIsCorrect(FILTERING_BILINEAR_OFF);
do {
int topLeftU, topLeftV;
@ -1495,6 +1532,212 @@ void D3D_RenderHUDNumber_Centred(unsigned int number,int x,int y,int colour)
} while (--noOfDigits);
}
void D3D_RenderHUDString(char *stringPtr,int x,int y,int colour)
{
struct VertexTag quadVertices[4];
quadVertices[0].Y = y-1;
quadVertices[1].Y = y-1;
quadVertices[2].Y = y + HUD_FONT_HEIGHT + 1;
quadVertices[3].Y = y + HUD_FONT_HEIGHT + 1;
CheckFilteringModeIsCorrect(FILTERING_BILINEAR_OFF);
while( *stringPtr )
{
char c = *stringPtr++;
{
int topLeftU = 1+((c-32)&15)*16;
int topLeftV = 1+((c-32)>>4)*16;
quadVertices[0].U = topLeftU - 1;
quadVertices[0].V = topLeftV - 1;
quadVertices[1].U = topLeftU + HUD_FONT_WIDTH + 1;
quadVertices[1].V = topLeftV - 1;
quadVertices[2].U = topLeftU + HUD_FONT_WIDTH + 1;
quadVertices[2].V = topLeftV + HUD_FONT_HEIGHT + 1;
quadVertices[3].U = topLeftU - 1;
quadVertices[3].V = topLeftV + HUD_FONT_HEIGHT + 1;
quadVertices[0].X = x - 1;
quadVertices[3].X = x - 1;
quadVertices[1].X = x + HUD_FONT_WIDTH + 1;
quadVertices[2].X = x + HUD_FONT_WIDTH + 1;
D3D_HUDQuad_Output
(
AAFontImageNumber,
quadVertices,
colour
);
}
x += AAFontWidths[(int)c];
}
}
void D3D_RenderHUDString_Clipped(char *stringPtr,int x,int y,int colour)
{
struct VertexTag quadVertices[4];
// LOCALASSERT(y<=0);
CheckFilteringModeIsCorrect(FILTERING_BILINEAR_OFF);
quadVertices[2].Y = y + HUD_FONT_HEIGHT + 1;
quadVertices[3].Y = y + HUD_FONT_HEIGHT + 1;
quadVertices[0].Y = 0;
quadVertices[1].Y = 0;
while ( *stringPtr )
{
char c = *stringPtr++;
{
int topLeftU = 1+((c-32)&15)*16;
int topLeftV = 1+((c-32)>>4)*16;
quadVertices[0].U = topLeftU - 1;
quadVertices[0].V = topLeftV - y;
quadVertices[1].U = topLeftU + HUD_FONT_WIDTH+1;
quadVertices[1].V = topLeftV - y;
quadVertices[2].U = topLeftU + HUD_FONT_WIDTH+1;
quadVertices[2].V = topLeftV + HUD_FONT_HEIGHT+1;
quadVertices[3].U = topLeftU - 1;
quadVertices[3].V = topLeftV + HUD_FONT_HEIGHT+1;
quadVertices[0].X = x - 1;
quadVertices[3].X = x - 1;
quadVertices[1].X = x + HUD_FONT_WIDTH + 1;
quadVertices[2].X = x + HUD_FONT_WIDTH + 1;
D3D_HUDQuad_Output
(
AAFontImageNumber,
quadVertices,
colour
);
}
x += AAFontWidths[(int)c];
}
}
void D3D_RenderHUDString_Centred(char *stringPtr, int centreX, int y, int colour)
{
int x, length = 0;
char *ptr = stringPtr;
struct VertexTag quadVertices[4];
while(*ptr)
{
length+=AAFontWidths[(int)*ptr++];
}
length = MUL_FIXED(HUDScaleFactor,length);
x = centreX-length/2;
quadVertices[0].Y = y-MUL_FIXED(HUDScaleFactor,1);
quadVertices[1].Y = y-MUL_FIXED(HUDScaleFactor,1);
quadVertices[2].Y = y + MUL_FIXED(HUDScaleFactor,HUD_FONT_HEIGHT + 1);
quadVertices[3].Y = y + MUL_FIXED(HUDScaleFactor,HUD_FONT_HEIGHT + 1);
CheckFilteringModeIsCorrect(FILTERING_BILINEAR_OFF);
while( *stringPtr )
{
char c = *stringPtr++;
{
int topLeftU = 1+((c-32)&15)*16;
int topLeftV = 1+((c-32)>>4)*16;
quadVertices[0].U = topLeftU - 1;
quadVertices[0].V = topLeftV - 1;
quadVertices[1].U = topLeftU + HUD_FONT_WIDTH + 1;
quadVertices[1].V = topLeftV - 1;
quadVertices[2].U = topLeftU + HUD_FONT_WIDTH + 1;
quadVertices[2].V = topLeftV + HUD_FONT_HEIGHT + 1;
quadVertices[3].U = topLeftU - 1;
quadVertices[3].V = topLeftV + HUD_FONT_HEIGHT + 1;
quadVertices[0].X = x - MUL_FIXED(HUDScaleFactor,1);
quadVertices[3].X = x - MUL_FIXED(HUDScaleFactor,1);
quadVertices[1].X = x + MUL_FIXED(HUDScaleFactor,HUD_FONT_WIDTH + 1);
quadVertices[2].X = x + MUL_FIXED(HUDScaleFactor,HUD_FONT_WIDTH + 1);
D3D_HUDQuad_Output
(
AAFontImageNumber,
quadVertices,
colour
);
}
x += MUL_FIXED(HUDScaleFactor,AAFontWidths[(int)c]);
}
}
void RenderString(char *stringPtr, int x, int y, int colour)
{
D3D_RenderHUDString(stringPtr,x,y,colour);
}
void RenderStringCentred(char *stringPtr, int centreX, int y, int colour)
{
int length = 0;
char *ptr = stringPtr;
while(*ptr)
{
length+=AAFontWidths[(int)*ptr++];
}
D3D_RenderHUDString(stringPtr,centreX-length/2,y,colour);
}
void RenderStringVertically(char *stringPtr, int centreX, int bottomY, int colour)
{
struct VertexTag quadVertices[4];
int y = bottomY;
quadVertices[0].X = centreX - (HUD_FONT_HEIGHT/2) - 1;
quadVertices[1].X = quadVertices[0].X;
quadVertices[2].X = quadVertices[0].X+2+HUD_FONT_HEIGHT*1;
quadVertices[3].X = quadVertices[2].X;
CheckFilteringModeIsCorrect(FILTERING_BILINEAR_OFF);
while( *stringPtr )
{
char c = *stringPtr++;
{
int topLeftU = 1+((c-32)&15)*16;
int topLeftV = 1+((c-32)>>4)*16;
quadVertices[0].U = topLeftU - 1;
quadVertices[0].V = topLeftV - 1;
quadVertices[1].U = topLeftU + HUD_FONT_WIDTH;
quadVertices[1].V = topLeftV - 1;
quadVertices[2].U = topLeftU + HUD_FONT_WIDTH;
quadVertices[2].V = topLeftV + HUD_FONT_HEIGHT + 1;
quadVertices[3].U = topLeftU - 1;
quadVertices[3].V = topLeftV + HUD_FONT_HEIGHT + 1;
quadVertices[0].Y = y ;
quadVertices[1].Y = y - HUD_FONT_WIDTH*1 -1;
quadVertices[2].Y = y - HUD_FONT_WIDTH*1 -1;
quadVertices[3].Y = y ;
D3D_HUDQuad_Output
(
AAFontImageNumber,
quadVertices,
colour
);
}
y -= AAFontWidths[(int)c];
}
}
void ColourFillBackBuffer(int FillColour)
{
float r, g, b, a;
@ -1565,3 +1808,98 @@ void D3D_DrawBackdrop()
return;
}
}
#if 0
/* ** menu-type stuff that should be moved later ** */
#include "avp_menugfx.hpp"
int Hardware_RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format)
{
switch(format)
{
default:
// GLOBALASSERT("UNKNOWN TEXT FORMAT"==0);
case AVPMENUFORMAT_LEFTJUSTIFIED:
{
// supplied x is correct
break;
}
case AVPMENUFORMAT_RIGHTJUSTIFIED:
{
int length = 0;
char *ptr = textPtr;
while(*ptr)
{
length+=AAFontWidths[*ptr++];
}
x -= length;
break;
}
case AVPMENUFORMAT_CENTREJUSTIFIED:
{
int length = 0;
char *ptr = textPtr;
while(*ptr)
{
length+=AAFontWidths[*ptr++];
}
x -= length/2;
break;
}
}
// LOCALASSERT(x>0);
{
unsigned int colour = alpha>>8;
if (colour>255) colour = 255;
colour = (colour<<24)+0xffffff;
D3D_RenderHUDString(textPtr,x,y,colour);
}
return x;
}
void RenderBriefingText(int centreY, int brightness)
{
int lengthOfLongestLine=-1;
int x,y,i;
for(i=0; i<5; i++)
{
int length = 0;
{
char *ptr = BriefingTextString[i];
while(*ptr)
{
length+=AAFontWidths[*ptr++];
}
}
if (lengthOfLongestLine < length)
{
lengthOfLongestLine = length;
}
}
x = (ScreenDescriptorBlock.SDB_Width-lengthOfLongestLine)/2;
y = centreY - 3*HUD_FONT_HEIGHT;
for(i=0; i<5; i++)
{
// if (AvPMenus.MenusState != MENUSSTATE_MAINMENUS)
{
Hardware_RenderSmallMenuText(BriefingTextString[i], x, y, brightness, AVPMENUFORMAT_LEFTJUSTIFIED/*,MENU_CENTREY-60-100,MENU_CENTREY-60+180*/);
// }
// else
// {
// RenderSmallMenuText(BriefingTextString[i], x, y, brightness, AVPMENUFORMAT_LEFTJUSTIFIED);
// }
if (i) y+=HUD_FONT_HEIGHT;
else y+=HUD_FONT_HEIGHT*2;
}
}
#endif

View file

@ -41,12 +41,6 @@ void Draw_Item_2dTexturePolygon(int *itemptr)
}
/* indexfnt.cpp */
void INDEXFNT_PFLoadHook(FontIndex I_Font_New, PFFONT *pffont_New)
{
fprintf(stderr, "INDEXFNT_PFLoadHook(%d, %p)\n", I_Font_New, pffont_New);
}
/* avp_mp_config.cpp */
char* GetCustomMultiplayerLevelName(int index, int gameType)
@ -136,7 +130,7 @@ void ATRemoveTexture(void * pTexture)
/* avp_menugfx.cpp */
char AAFontWidths[256];
/* char AAFontWidths[256]; */
AVPMENUGFX AvPMenuGfxStorage[MAX_NO_OF_AVPMENUGFXS]; /* TODO: this is initialized in avp_menugfx.cpp */
void FadedScreen(int alpha)
@ -277,16 +271,6 @@ void InitForceField()
fprintf(stderr, "InitForceField()\n");
}
void RenderString(char *stringPtr, int x, int y, int colour)
{
fprintf(stderr, "RenderString(%s, %d, %d, %d)\n", stringPtr, x, y, colour);
}
void RenderStringCentred(char *stringPtr, int centreX, int y, int colour)
{
fprintf(stderr, "RenderStringCentred(%s, %d, %d, %d)\n", stringPtr, centreX, y, colour);
}
void PostLandscapeRendering()
{
fprintf(stderr, "PostLandscapeRendering()\n");
@ -375,10 +359,6 @@ void D3D_BackdropPolygon_Output(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVer
fprintf(stderr, "D3D_BackdropPolygon_Output(%p, %p)\n", inputPolyPtr, renderVerticesPtr);
}
void D3D_RenderHUDString_Centred(char *stringPtr, int centreX, int y, int colour)
{
fprintf(stderr, "D3D_RenderHUDString_Centred(%s, %d, %d, %d)\n", stringPtr, centreX, y, colour);
}
/* dd_func.cpp */
long BackBufferPitch;
@ -737,3 +717,5 @@ void AddNetMsg_SpotOtherSound(enum soundindex SoundIndex,VECTORCH *position,int
fprintf(stderr, "AddNetMsg_SpotOtherSound(%d, %p, %d)\n", SoundIndex, position, explosion);
}
#include "aafont.h"

View file

@ -1,107 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fixer.h"
#include "3dc.h"
#include "platform.h"
#include "indexfnt.hpp"
/* indexfnt.cpp */
IndexedFont* IndexedFont :: pIndexedFont[ IndexedFonts_MAX_NUMBER_OF_FONTS ];
IndexedFont::IndexedFont(FontIndex I_Font_New)
{
fprintf(stderr, "IndexedFont::IndexedFont(%d)\n", I_Font_New);
I_Font_Val = I_Font_New;
pIndexedFont[ I_Font_New ] = this;
}
IndexedFont::~IndexedFont()
{
fprintf(stderr, "IndexedFont::~IndexedFont()\n");
}
void IndexedFont::UnloadFont(FontIndex I_Font_ToGet)
{
fprintf(stderr, "IndexedFont::UnloadFont(%d)\n", I_Font_ToGet);
}
OurBool IndexedFont::bCanRenderFully(ProjChar* pProjCh)
{
fprintf(stderr, "IndexedFont::bCanRenderFully(%p)\n", pProjCh);
return 0;
}
void IndexedFont_Proportional_PF::PFUnLoadHook(FontIndex I_Font_ToGet)
{
fprintf(stderr, "IndexedFont_Proportional_PF::PFUnLoadHook(%d)\n", I_Font_ToGet);
}
IndexedFont_HUD::IndexedFont_HUD(FontIndex I_Font_New) : IndexedFont(I_Font_New)
{
fprintf(stderr, "IndexedFont_HUD::IndexedFont_HUD(%d)\n", I_Font_New);
}
void IndexedFont_HUD :: RenderString_Clipped
(
struct r2pos& R2Pos_Cursor,
const struct r2rect& R2Rect_Clip,
int FixP_Alpha,// FixP_Alpha,
const SCString& SCStr
) const
{
fprintf(stderr, "IndexedFont_HUD :: RenderString_Clipped(stuff, stuff, %d, stuff)\n", FixP_Alpha);
}
void IndexedFont_HUD :: RenderString_Unclipped
(
struct r2pos& R2Pos_Cursor,
int FixP_Alpha, // FixP_Alpha,
const SCString& SCStr
) const
{
fprintf(stderr, "IndexedFont_HUD :: RenderString_Unclipped: shouldn't be called!\n");
exit(EXIT_FAILURE);
}
r2size IndexedFont_HUD :: CalcSize
(
ProjChar* pProjCh
) const
{
r2size R2Size_Return
(
0,
GetHeight()
);
fprintf(stderr, "IndexedFont_HUD :: CalcSize(%p)\n", pProjCh);
return R2Size_Return;
}
void IndexedFont_HUD :: RenderChar_Clipped
(
struct r2pos& R2Pos_Cursor,
const struct r2rect& R2Rect_Clip,
int, // FixP_Alpha,
ProjChar ProjCh
) const
{
fprintf(stderr, "IndexedFont_HUD :: RenderChar_Clipped(stuff, stuff, stuff, stuff)\n");
}
void IndexedFont_HUD :: RenderChar_Unclipped
(
struct r2pos& R2Pos_Cursor,
int, // FixP_Alpha,
ProjChar ProjCh
) const
{
fprintf(stderr, "IndexedFont_HUD :: RenderChar_Unclipped(stuff, stuff, stuff)\n");
}