Skip to content

Commit

Permalink
Small menu changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Fuller committed Nov 3, 2001
1 parent 8e0b553 commit f106be3
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 49 deletions.
10 changes: 5 additions & 5 deletions README
Expand Up @@ -31,9 +31,9 @@ http://www.avpnews.com/mods/tools/


Yes, the code does something. No, it's not ready for a release. No, it is not
vaporware. I hope to at least complete the single portion of the game before
making an official release. Check out the TODO to see what's needed to be
done.
vaporware. I hope to at least complete the single player part of the game
before making an official release. Check out the TODO to see what's needed to
be done.


If you are really itching to try this out, either install the Gold Ed. in
Expand Down Expand Up @@ -89,8 +89,8 @@ http://www.aliensvpredator.com/ubb/Forum2/HTML/001680.html


The full motion sequences cannot be played because they are encoded with
proprietary codecs (Bink and Smacker). But I do not think they will be
greatly missed.
proprietary codecs (Bink and Smacker - http://www.radgametools.com). But I
do not think they will be greatly missed.


More information about the game and the series can be found at
Expand Down
159 changes: 131 additions & 28 deletions src/main.c
Expand Up @@ -37,7 +37,7 @@ int MouseVelX;
int MouseVelY;

extern int ScanDrawMode; /* to fix image loading */
extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock; /* this should be put in a header file */
extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock;
extern unsigned char KeyboardInput[MAX_NUMBER_OF_INPUT_KEYS];
extern unsigned char GotAnyKey;
extern int NormalFrameTime;
Expand Down Expand Up @@ -65,20 +65,90 @@ PROCESSORTYPES ReadProcessorType()
return PType_PentiumMMX;
}

int SetVideoMode(int Width, int Height)
int SetSoftVideoMode(int Width, int Height, int Depth)
{
SDL_GrabMode isgrab;
int isfull;

ScanDrawMode = ScanDrawD3DHardwareRGB;
GotMouse = 1;

if (surface != NULL) {
isfull = (surface->flags & SDL_FULLSCREEN);
isgrab = SDL_WM_GrabInput(SDL_GRAB_QUERY);

SDL_FreeSurface(surface);
} else {
isfull = 0;
isgrab = SDL_GRAB_OFF;
}

if ((surface = SDL_SetVideoMode(Width, Height, Depth, SDL_SWSURFACE|SDL_DOUBLEBUF)) == NULL) {
fprintf(stderr, "SDL SetVideoMode failed: %s\n", SDL_GetError());
SDL_Quit();
exit(EXIT_FAILURE);
}

SDL_WM_SetCaption("Aliens vs Predator", "Aliens vs Predator");

/* this is for supporting keyboard input processing with little hassle */
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
SDL_EnableUNICODE(1); /* toggle it to ON */

/* -w will disable first fullscreen, -f will turn it on */
// SDL_WM_ToggleFullScreen(surface);
// SDL_WM_GrabInput(SDL_GRAB_ON);
// SDL_ShowCursor(0);

if (isfull) {
SDL_WM_ToggleFullScreen(surface);
if (surface->flags & SDL_FULLSCREEN)
SDL_ShowCursor(0);
}

if (isgrab == SDL_GRAB_ON) {
SDL_WM_GrabInput(SDL_GRAB_ON);
SDL_WM_ToggleFullScreen(surface);
}

ScreenDescriptorBlock.SDB_Width = Width;
ScreenDescriptorBlock.SDB_Height = Height;
ScreenDescriptorBlock.SDB_CentreX = Width/2;
ScreenDescriptorBlock.SDB_CentreY = Height/2;
ScreenDescriptorBlock.SDB_ProjX = Width/2;
ScreenDescriptorBlock.SDB_ProjY = Height/2;
ScreenDescriptorBlock.SDB_ClipLeft = 0;
ScreenDescriptorBlock.SDB_ClipRight = Width;
ScreenDescriptorBlock.SDB_ClipUp = 0;
ScreenDescriptorBlock.SDB_ClipDown = Height;

return 0;
}

int SetOGLVideoMode(int Width, int Height)
{
SDL_GrabMode isgrab;
int isfull;

ScanDrawMode = ScanDrawD3DHardwareRGB;
GotMouse = 1;

if (surface != NULL) {
isfull = (surface->flags & SDL_FULLSCREEN);
isgrab = SDL_WM_GrabInput(SDL_GRAB_QUERY);

SDL_FreeSurface(surface);
} else {
isfull = 0;
isgrab = SDL_GRAB_OFF;
}

SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

if (surface != NULL)
SDL_FreeSurface(surface);

if ((surface = SDL_SetVideoMode(Width, Height, 0, SDL_OPENGL)) == NULL) {
fprintf(stderr, "SDL SetVideoMode failed: %s\n", SDL_GetError());
SDL_Quit();
Expand All @@ -91,11 +161,22 @@ int SetVideoMode(int Width, int Height)
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
SDL_EnableUNICODE(1); /* toggle it to ON */

/* -w will disable to first fullscreen, -f will turn it on */
/* -w will disable first fullscreen, -f will turn it on */
// SDL_WM_ToggleFullScreen(surface);
// SDL_WM_GrabInput(SDL_GRAB_ON);
// SDL_ShowCursor(0);


if (isfull) {
SDL_WM_ToggleFullScreen(surface);
if (surface->flags & SDL_FULLSCREEN)
SDL_ShowCursor(0);
}

if (isgrab == SDL_GRAB_ON) {
SDL_WM_GrabInput(SDL_GRAB_ON);
SDL_WM_ToggleFullScreen(surface);
}

glViewport(0, 0, Width, Height);

glMatrixMode(GL_PROJECTION);
Expand Down Expand Up @@ -402,8 +483,10 @@ static void handle_keypress(int key, int unicode, int press)
RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_KEYDOWN(VK_TAB);
break;
default:
if (unicode && !(unicode & 0xFF80))
if (unicode && !(unicode & 0xFF80)) {
RE_ENTRANT_QUEUE_WinProc_AddMessage_WM_CHAR(unicode);
KeyboardEntryQueue_Add(unicode);
}
break;
}
}
Expand Down Expand Up @@ -551,16 +634,49 @@ int ExitWindowsSystem()
return 0;
}

int main(int argc, char *argv[])
int InitSDL()
{
int menusActive = 0;
int thisLevelHasBeenCompleted = 0;

if (SDL_Init(SDL_INIT_VIDEO) < 0) {
fprintf(stderr, "SDL Init failed: %s\n", SDL_GetError());
exit(EXIT_FAILURE);
}

#if 0
if ((surface = SDL_SetVideoMode(640, 480, 16, SDL_SWSURFACE|SDL_DOUBLEBUF)) == NULL) {
fprintf(stderr, "SDL SetVideoMode failed: %s\n", SDL_GetError());
SDL_Quit();
exit(EXIT_FAILURE);
}

SDL_FreeSurface(surface);

SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

if ((surface = SDL_SetVideoMode(640, 480, 0, SDL_OPENGL)) == NULL) {
fprintf(stderr, "SDL SetVideoMode failed: %s\n", SDL_GetError());
SDL_Quit();
exit(EXIT_FAILURE);
}

SDL_FreeSurface(surface);
#endif

surface = NULL;

return 0;
}

int main(int argc, char *argv[])
{
int menusActive = 0;
int thisLevelHasBeenCompleted = 0;

InitSDL();

LoadCDTrackList();

SetFastRandom();
Expand All @@ -581,7 +697,7 @@ int main(int argc, char *argv[])
#endif
InitGame();

SetVideoMode(640, 480);
SetOGLVideoMode(640, 480);

InitialVideoMode();

Expand Down Expand Up @@ -667,20 +783,7 @@ while(AvP_MainMenus()) {
d3d_light_ctrl.ctrl = LCCM_NORMAL;
d3d_overlay_ctrl.ctrl = OCCM_NORMAL;

SetVideoMode(MyWidth, MyHeight);
#if 0
/* this was in windows SetGameVideoMode: */
ScreenDescriptorBlock.SDB_Width = MyWidth;
ScreenDescriptorBlock.SDB_Height = MyHeight;
ScreenDescriptorBlock.SDB_CentreX = MyWidth/2;
ScreenDescriptorBlock.SDB_CentreY = MyHeight/2;
ScreenDescriptorBlock.SDB_ProjX = MyWidth/2;
ScreenDescriptorBlock.SDB_ProjY = MyHeight/2;
ScreenDescriptorBlock.SDB_ClipLeft = 0;
ScreenDescriptorBlock.SDB_ClipRight = MyWidth;
ScreenDescriptorBlock.SDB_ClipUp = 0;
ScreenDescriptorBlock.SDB_ClipDown = MyHeight;
#endif
SetOGLVideoMode(MyWidth, MyHeight);

InitialiseGammaSettings(RequestedGammaSetting);

Expand Down Expand Up @@ -821,7 +924,7 @@ while(AvP_MainMenus()) {

ClearMemoryPool();

SetVideoMode(640, 480);
SetOGLVideoMode(640, 480);
}

SoundSys_StopAll();
Expand Down
40 changes: 24 additions & 16 deletions src/menus.c
Expand Up @@ -22,6 +22,15 @@

extern int AAFontImageNumber;

int PlayMenuBackgroundBink()
{
fprintf(stderr, "PlayMenuBackgroundBink()\n");

glClear(GL_COLOR_BUFFER_BIT);

return 0;
}

AVPMENUGFX AvPMenuGfxStorage[MAX_NO_OF_AVPMENUGFXS] =
{
{"Menus\\fractal.rim"},
Expand Down Expand Up @@ -118,58 +127,57 @@ int LengthOfMenuText(char *textPtr)

int RenderMenuText(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format)
{
fprintf(stderr, "RenderMenuText(%s, %d, %d, %d, %d)\n", textPtr, x, y, alpha, format);

return Hardware_RenderSmallMenuText(textPtr, x, y, alpha, format);
/*
fprintf(stderr, "RenderMenuText(%s, %d, %d, %d, %d)\n", textPtr, x, y, alpha, format);

return 0;
*/
}

int RenderMenuText_Clipped(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int topY, int bottomY)
{
{
fprintf(stderr, "RenderMenuText_Clipped(%s, %d, %d, %d, %d, %d, %d)\n", textPtr, x, y, alpha, format, topY, bottomY);

return 0;
}

int RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format)
{

return Hardware_RenderSmallMenuText(textPtr, x, y, alpha, format);
/*

fprintf(stderr, "RenderSmallMenuText(%s, %d, %d, %d, %d)\n", textPtr, x, y, alpha, format);

return 0;
*/
}

int RenderSmallMenuText_Coloured(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int red, int green, int blue)
{

return Hardware_RenderSmallMenuText_Coloured(textPtr, x, y, alpha, format, red, green, blue);
/*

fprintf(stderr, "RenderSmallMenuText_Coloured(%s, %d, %d, %d, %d, %d, %d, %d)\n", textPtr, x, y, alpha, format, red, green, blue);

return 0;
*/
return 0;
}

void RenderKeyConfigRectangle(int alpha)
{

void Hardware_RenderKeyConfigRectangle(int alpha);
Hardware_RenderKeyConfigRectangle(alpha);
/*
fprintf(stderr, "RenderKeyConfigRectangle(%d)\n", alpha);
*/

fprintf(stderr, "RenderKeyConfigRectangle(%d)\n", alpha);
}

void RenderHighlightRectangle(int x1, int y1, int x2, int y2, int r, int g, int b)
{

void Hardware_RenderHighlightRectangle(int x1,int y1,int x2,int y2,int r, int g, int b);
Hardware_RenderHighlightRectangle(x1, y1, x2, y2, r, g, b);
/*

fprintf(stderr, "RenderHighlightRectangle(%d, %d, %d, %d, %d, %d, %d)\n", x1, y1, x2, y2, r, g, b);
*/
}

void RenderSmallFontString_Wrapped(char *textPtr,RECT* area,int alpha,int* output_x,int* output_y)
Expand All @@ -191,7 +199,7 @@ void LoadAvPMenuGfx(enum AVPMENUGFX_ID menuGfxID)
/* TODO: make sure this doesn't cause a leak */
InitialiseTextures();
CL_GetImageFileName(buffer, 100, gfxPtr->FilenamePtr, LIO_RELATIVEPATH);

pFastFileData = ffreadbuf(buffer, &fastFileLength);

if (pFastFileData) {
Expand Down Expand Up @@ -273,7 +281,7 @@ void InitialiseMenuGfx()
AvPMenuGfxStorage[i].ImagePtr = NULL;
}

glDisable(GL_BLEND);
glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);

Expand Down
2 changes: 2 additions & 0 deletions src/stubs.c
Expand Up @@ -127,12 +127,14 @@ void StartMenuBackgroundBink()
fprintf(stderr, "StartMenuBackgroundBink()\n");
}

#if 0
int PlayMenuBackgroundBink()
{
fprintf(stderr, "PlayMenuBackgroundBink()\n");

return 0;
}
#endif

void EndMenuBackgroundBink()
{
Expand Down

0 comments on commit f106be3

Please sign in to comment.