Remove old cursor code. Refs #2823.

master
Rene Jochum 2011-07-14 23:10:35 +02:00
parent 3971d661c7
commit d51379938d
20 changed files with 83 additions and 2314 deletions

View File

@ -88,9 +88,6 @@ libframework_a_SOURCES = \
strres_parser.tab.cpp \
configfile.cpp \
crc.cpp \
cursors16.cpp \
cursors32.cpp \
cursors.cpp \
debug.cpp \
frame.cpp \
frameresource.cpp \

View File

@ -1,27 +0,0 @@
/*
This file is part of Warzone 2100.
Copyright (C) 2008 Giel van Schijndel
Copyright (C) 2008-2011 Warzone 2100 Project
Warzone 2100 is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Warzone 2100 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Warzone 2100; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "frame.h"
#include "cursors.h"
void init_system_cursor(CURSOR cur, enum CURSOR_TYPE type)
{
init_system_cursor32(cur);
}

View File

@ -58,14 +58,4 @@ enum CURSOR
CURSOR_MAX,
};
enum CURSOR_TYPE
{
CURSOR_16,
CURSOR_32,
};
void init_system_cursor(CURSOR cur, CURSOR_TYPE type);
void init_system_cursor32(CURSOR cur);
void init_system_cursor16(CURSOR cur);
#endif // __INCLUDED_LIB_FRAMEWORK_CURSORS_H__

View File

@ -1,836 +0,0 @@
/*
This file is part of Warzone 2100.
Copyright (C) 1999-2004 Eidos Interactive
Copyright (C) 2005-2011 Warzone 2100 Project
Warzone 2100 is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Warzone 2100 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Warzone 2100; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/** @file
* \brief Cursor definition (16x16)
*/
#include "frame.h"
#include "cursors.h"
#include "wzapp_c.h"
/* TODO: do bridge and attach need swapping? */
static const char *cursor_arrow[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
"X ",
".X ",
"..X ",
"...X ",
"....X ",
".X. ",
"X .X ",
" X. ",
" .X ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
"0,0"
};
static const char *cursor_dest[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" ",
" ",
" . ",
" .XX ",
" .. X ",
" . X X ",
" . . .X.. ",
" . .XX.. ",
" ... ..... ",
" ... X.XX. ",
" X ..X..X. ",
" XXXXXX ",
" ",
" ",
"7,9"
};
static const char *cursor_sight[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" . ..... . ",
" ..XX XX..X ",
" .... ....X ",
" X..X ..XX ",
" .X.X .X. ",
" .X .X ",
" . .X ",
" . .X ",
" .X. . .X ",
" X.. ..XX ",
" .... ....X ",
" ..XX X..X ",
" .XXX.....XXX. ",
" XXXX ",
" ",
"7,8"
};
static const char *cursor_target[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" . ",
" ... ",
" ..X.X.. ",
" .X . . ",
" . .X ",
" .X . ",
" ....X . .... ",
" .X . ",
" .X . ",
" . . .X ",
" . . .X ",
" X.....X ",
" X.X ",
" X ",
" ",
"7,7"
};
static const char *cursor_larrow[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" ",
" ",
" . ",
" .. ",
" ........X ",
" ..........X ",
" X........X ",
" X..XXXXX ",
" X. ",
" ",
" ",
" ",
" ",
" ",
"3,7"
};
static const char *cursor_rarrow[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" ",
" ",
" ",
" .. ",
" ........ ",
" .......... ",
" ..........X ",
" ........X ",
" ..X ",
" X ",
" ",
" ",
" ",
" ",
"12,8"
};
static const char *cursor_darrow[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" ",
" ... ",
" ...X ",
" ...X ",
" ...XX ",
" .X...X. ",
" .....X ",
" ..... ",
" ...X ",
" ... ",
" .X ",
" . ",
" ",
" ",
"7,12"
};
static const char *cursor_uarrow[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" . ",
" .X ",
" ... ",
" ...X ",
" ..... ",
" .....X ",
" . ...X. ",
" ...X ",
" ...X ",
" ...X ",
" XXXX ",
" ",
" ",
" ",
"7,4"
};
static const char *cursor_default[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" ",
" ",
" ",
" X ",
" ..X ",
" ....X ",
" .....X ",
" ..XXXX ",
" .X ",
" .X ",
" X ",
" ",
" ",
" ",
"5,6"
};
static const char *cursor_attach[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" ",
" ",
" ",
" ",
" .. ..X .. .. ",
" ... .. ... ",
" .. ..X .. .. ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
"8,7"
};
static const char *cursor_attack[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" . ",
" ... ",
" ..X.X.. ",
" .X . . ",
" . .X ",
" .X . ",
" ....X . .... ",
" .X . ",
" .X . ",
" . . .X ",
" . . .X ",
" X.....X ",
" X.X ",
" X ",
" ",
"7,7"
};
static const char *cursor_bomb[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" .. ",
" X. ",
" X .. ",
" .. ",
" XXX.X ",
" .......X ",
" .........X ",
" .......... ",
" .......... ",
" .......... ",
" .........X ",
" .......X ",
" ....X ",
" ",
" ",
"8,8"
};
static const char *cursor_bridge[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" .. ",
" ..... ",
" ...... . ",
" X...... .X ",
" ...... .XX ",
" .X......XXX ",
" .......XX... ",
" ..X...X...... ",
" .....X.XX.... ",
"....X.X ..... ",
" XX.X .....X",
" ....X ",
" X...X ",
" XX ",
" ",
"8,8"
};
static const char *cursor_build[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" ",
" ",
" ..X.X ",
" X... ",
" ...X ",
" ...XX ",
" ...X..X ",
" .X ..X ",
" ..X ",
" .. ",
" X ",
" ",
" ",
" ",
"7,7"
};
static const char *cursor_embark[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" ...... ",
" ...... ",
" ........X ",
" ......X ",
" X....X ",
" ..X..X.. ",
" ..XX.. ",
" .... ",
" .. ",
" ",
" ",
" ",
" ",
" ",
"8,11"
};
static const char *cursor_disembark[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" ...... ",
" ...... ",
" ........X ",
" ......X ",
" X....X ",
" ..X..X.. ",
" ..XX.. ",
" .... ",
" .. ",
" ",
" ",
" ",
" ",
" ",
"8,11"
};
static const char *cursor_fix[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" ",
" .X ",
" . ",
" . . ",
" .XX.. ",
" ..... ",
" ...XX ",
" ..... ",
" . X ",
" . ",
" .XX ",
" ",
" ",
" ",
"8,8"
};
static const char *cursor_guard[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" ",
" ",
" ... ... ",
" ..XXXXX.. ",
" ......... ",
" .......XX ",
" X.....XX ",
" ....... ",
" X...XX ",
" .X.X ",
" .X ",
" ",
" ",
" ",
"8,8"
};
static const char *cursor_jam[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" ",
" ..X.. ",
" .X X. ",
" . . . .X ",
" X X. X X ",
" . X.X .X ",
" .X... . ",
" X...X ",
" ..... ",
" XXXX ",
" ",
" ",
" ",
" ",
"7,7"
};
static const char *cursor_lockon[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" ",
" ..X.. ",
" .X X. ",
" . . . .X ",
" X X. X X ",
" . X.X .X ",
" .X... . ",
" X...X ",
" ..... ",
" XXXX ",
" ",
" ",
" ",
" ",
"7,7"
};
static const char *cursor_scout[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" ",
" ..X.. ",
" .X X. ",
" . . . .X ",
" X X. X X ",
" . X.X .X ",
" .X... . ",
" X...X ",
" ..... ",
" XXXX ",
" ",
" ",
" ",
" ",
"7,7"
};
static const char *cursor_menu[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" ",
" ",
" ",
" .X ",
" ...X ",
" ....X ",
" ....X ",
" .X ",
" .X ",
" ",
" ",
" ",
" ",
" ",
"5,5"
};
static const char *cursor_move[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" ",
" . ..X. ",
" ..X X.. ",
" .... .... ",
" X.. ..XX ",
" . . ",
" . . ",
" X.. ..XX ",
" .... .... ",
" ..X X.. ",
" . ..X. ",
" ",
" ",
" ",
"7,7"
};
static const char *cursor_notpossible[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" ",
" X X ",
" ..X ..X ",
" ...X ...X ",
" ...X...X ",
" .....X ",
" ...X ",
" .....X ",
" ...X...X ",
" ...X ...X ",
" ..X ..X ",
" X X ",
" ",
" ",
"7,8"
};
static const char *cursor_pickup[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" . . ",
" ... ",
" . ",
" ... ",
" ... ",
" .X ",
" ...X ",
" .....X ",
" ..XXX.. ",
" . . ",
" . . ",
" .X . ",
" .X . ",
" ",
" ",
"7,10"
};
static const char *cursor_seekrepair[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" ",
" ",
" . ",
" .X . ",
" X .X .... ",
" .XX.X ..... ",
" ....X .... ",
" ..XXX . ",
" ....X ",
" .X . ",
" .X ",
" .X ",
" ",
" ",
" ",
"8,7"
};
static const char *cursor_select[] = {
/* width height num_colors chars_per_pixel */
" 16 16 3 1",
/* colors */
"X c #000000",
". c #ffffff",
" c None",
/* pixels */
" ",
" .... .... ",
" .XXX XXX. ",
" .X X. ",
" .X X. ",
" ",
" ",
" . ",
" ",
" ",
" ",
" .X X. ",
" .X X. ",
" .XXX XXX. ",
" .... .... ",
" ",
"7,7"
};
static const struct
{
const char** image;
CURSOR cursor_num;
} cursors[CURSOR_MAX] =
{
{ cursor_arrow, CURSOR_ARROW },
{ cursor_dest, CURSOR_DEST },
{ cursor_sight, CURSOR_SIGHT },
{ cursor_target, CURSOR_TARGET },
{ cursor_larrow, CURSOR_LARROW },
{ cursor_rarrow, CURSOR_RARROW },
{ cursor_darrow, CURSOR_DARROW },
{ cursor_uarrow, CURSOR_UARROW },
{ cursor_default, CURSOR_DEFAULT },
{ cursor_default, CURSOR_EDGEOFMAP },
{ cursor_attach, CURSOR_ATTACH },
{ cursor_attack, CURSOR_ATTACK },
{ cursor_bomb, CURSOR_BOMB },
{ cursor_bridge, CURSOR_BRIDGE },
{ cursor_build, CURSOR_BUILD },
{ cursor_embark, CURSOR_EMBARK },
{ cursor_disembark, CURSOR_EMBARK },
{ cursor_fix, CURSOR_FIX },
{ cursor_guard, CURSOR_GUARD },
{ cursor_jam, CURSOR_JAM },
{ cursor_lockon, CURSOR_LOCKON },
{ cursor_scout, CURSOR_SCOUT },
{ cursor_menu, CURSOR_MENU },
{ cursor_move, CURSOR_MOVE },
{ cursor_notpossible, CURSOR_NOTPOSSIBLE },
{ cursor_pickup, CURSOR_PICKUP },
{ cursor_seekrepair, CURSOR_SEEKREPAIR },
{ cursor_select, CURSOR_SELECT },
};
void init_system_cursor16(CURSOR cur)
{
int i, row, col;
uint8_t data[4 * 16];
uint8_t mask[4 * 16];
int hot_x, hot_y;
const char** image;
ASSERT(cur < CURSOR_MAX, "Attempting to load non-existent cursor: %u", (unsigned int)cur);
ASSERT(cursors[cur].cursor_num == cur, "Bad cursor mapping");
image = cursors[cur].image;
i = -1;
for (row = 0; row < 16; ++row)
{
for (col = 0; col < 16; ++col)
{
if (col % 8)
{
data[i] <<= 1;
mask[i] <<= 1;
}
else
{
++i;
data[i] = mask[i] = 0;
}
switch (image[4 + row][col])
{
case 'X':
data[i] |= 0x01;
mask[i] |= 0x01;
break;
case '.':
mask[i] |= 0x01;
break;
case ' ':
break;
}
}
}
sscanf(image[4 + row], "%d,%d", &hot_x, &hot_y);
wzCreateCursor(cur, data, mask, 16, 16, hot_x, hot_y);
}

File diff suppressed because it is too large Load Diff

View File

@ -39,12 +39,8 @@
#include "cursors.h"
static const enum CURSOR_TYPE cursor_type = CURSOR_32;
/* Linux specific stuff */
static CURSOR currentCursor = CURSOR_MAX;
bool selfTest = false;
/************************************************************************************
@ -132,55 +128,6 @@ UDWORD frameGetFrameNumber(void)
return curFrames;
}
/** Set the current cursor from a Resource ID
*/
void frameSetCursor(CURSOR cur)
{
ASSERT(cur < CURSOR_MAX, "frameSetCursorFromRes: bad resource ID" );
// If we are already using this cursor then do nothing
if (cur != currentCursor)
{
wzSetCursor(cur);
currentCursor = cur;
}
}
static void initCursors(void)
{
init_system_cursor(CURSOR_ARROW, cursor_type);
init_system_cursor(CURSOR_DEST, cursor_type);
init_system_cursor(CURSOR_SIGHT, cursor_type);
init_system_cursor(CURSOR_TARGET, cursor_type);
init_system_cursor(CURSOR_LARROW, cursor_type);
init_system_cursor(CURSOR_RARROW, cursor_type);
init_system_cursor(CURSOR_DARROW, cursor_type);
init_system_cursor(CURSOR_UARROW, cursor_type);
init_system_cursor(CURSOR_DEFAULT, cursor_type);
init_system_cursor(CURSOR_EDGEOFMAP, cursor_type);
init_system_cursor(CURSOR_ATTACH, cursor_type);
init_system_cursor(CURSOR_ATTACK, cursor_type);
init_system_cursor(CURSOR_BOMB, cursor_type);
init_system_cursor(CURSOR_BRIDGE, cursor_type);
init_system_cursor(CURSOR_BUILD, cursor_type);
init_system_cursor(CURSOR_EMBARK, cursor_type);
init_system_cursor(CURSOR_FIX, cursor_type);
init_system_cursor(CURSOR_GUARD, cursor_type);
init_system_cursor(CURSOR_JAM, cursor_type);
init_system_cursor(CURSOR_LOCKON, cursor_type);
init_system_cursor(CURSOR_MENU, cursor_type);
init_system_cursor(CURSOR_MOVE, cursor_type);
init_system_cursor(CURSOR_NOTPOSSIBLE, cursor_type);
init_system_cursor(CURSOR_PICKUP, cursor_type);
init_system_cursor(CURSOR_SEEKREPAIR, cursor_type);
init_system_cursor(CURSOR_SELECT, cursor_type);
}
static void freeCursors(void)
{
// no-op
}
/*
* frameInitialise
*
@ -194,9 +141,6 @@ bool frameInitialise()
return false;
}
/* initialise all cursors */
initCursors();
if (!screenInitialise())
{
/* FIX ME for QT!
@ -249,10 +193,6 @@ void frameShutDown(void)
debug(LOG_NEVER, "Screen shutdown!");
screenShutDown();
/* Free all cursors */
debug(LOG_NEVER, "Free the cursors!");
freeCursors();
// Shutdown the resource stuff
debug(LOG_NEVER, "No more resources!");
resShutDown();
@ -397,7 +337,7 @@ bool saveFile(const char *pFileName, const char *pFileData, UDWORD fileSize)
return false;
}
if (PHYSFS_write(pfile, pFileData, 1, size) != size)
if (PHYSFS_write(pfile, pFileData, 1, size) != size)
{
debug(LOG_ERROR, "%s could not write: %s", pFileName, PHYSFS_getLastError());
assert(false);
@ -410,7 +350,7 @@ bool saveFile(const char *pFileName, const char *pFileData, UDWORD fileSize)
return false;
}
if (PHYSFS_getRealDir(pFileName) == NULL)
if (PHYSFS_getRealDir(pFileName) == NULL)
{
// weird
debug(LOG_ERROR, "PHYSFS_getRealDir(%s) returns NULL (%s)?!", pFileName, PHYSFS_getLastError());

View File

@ -108,8 +108,6 @@ extern int getFramerateLimit(void);
*/
extern void frameUpdate(void);
extern void frameSetCursor(CURSOR cur);
/** Returns the current frame we're on - used to establish whats on screen. */
extern UDWORD frameGetFrameNumber(void);

View File

@ -722,7 +722,7 @@ int wzGetTicks()
/*** Mouse and keyboard support ***/
/****************************************/
void pie_ShowMouse(bool visible)
void wzShowMouse(bool visible)
{
if (!visible)
{
@ -736,13 +736,13 @@ void pie_ShowMouse(bool visible)
void wzSetCursor(CURSOR index)
{
WzMainWindow::instance()->setCursor(index);
lastCursor = index;
}
ASSERT(index < CURSOR_MAX, "Attempting to load non-existent cursor: %u", (unsigned int)index);
void wzCreateCursor(CURSOR index, uint8_t *data, uint8_t *mask, int w, int h, int hot_x, int hot_y)
{
// TODO REMOVE
if (lastCursor != index)
{
WzMainWindow::instance()->setCursor(index);
lastCursor = index;
}
}
void wzGrabMouse()

View File

@ -30,9 +30,9 @@ typedef struct _wzMutex WZ_MUTEX;
typedef struct _wzSemaphore WZ_SEMAPHORE;
void wzQuit(void); ///< Quit game
void wzCreateCursor(CURSOR index, uint8_t *data, uint8_t *mask, int w, int h, int hot_x, int hot_y);
void wzSetCursor(CURSOR index);
void wzScreenFlip(void); ///< Swap the graphics buffers
void wzShowMouse(bool visible); ///< Show the Mouse?
void wzGrabMouse(void); ///< Trap mouse cursor in application window
void wzReleaseMouse(void); ///< Undo the wzGrabMouse operation
bool wzActiveWindow(void); ///< Whether application currently has the mouse pointer over it

View File

@ -37,9 +37,6 @@
*/
// Variables for the coloured mouse cursor
static CURSOR MouseCursor = CURSOR_ARROW;
static IMAGEFILE* MouseCursors = NULL;
static uint16_t MouseCursorIDs[CURSOR_MAX];
static GLuint shaderProgram[SHADER_MAX];
static GLfloat shaderStretch = 0;
static GLint locTeam, locStretch, locTCMask, locFog, locNormalMap;
@ -243,7 +240,7 @@ static bool loadShaders(GLuint *program, const char *definitions,
glShaderSource(shader, 2, (const char **)buffer, NULL);
glCompileShader(shader);
// Check for compilation errors
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
if (!status)
@ -280,7 +277,7 @@ static bool loadShaders(GLuint *program, const char *definitions,
}
}
return success;
return success;
}
// Run from screen.c on init. FIXME: do some kind of FreeShaders on failure.
@ -533,9 +530,9 @@ void pie_SetRendMode(REND_MODE rendMode)
break;
case REND_MULTIPLICATIVE:
glEnable(GL_BLEND);
glBlendFunc(GL_ZERO, GL_SRC_COLOR);
break;
glEnable(GL_BLEND);
glBlendFunc(GL_ZERO, GL_SRC_COLOR);
break;
default:
ASSERT(false, "Bad render state");
@ -545,24 +542,6 @@ void pie_SetRendMode(REND_MODE rendMode)
return;
}
void pie_InitColourMouse(IMAGEFILE* img, const uint16_t cursorIDs[CURSOR_MAX])
{
MouseCursors = img;
memcpy(MouseCursorIDs, cursorIDs, sizeof(MouseCursorIDs));
}
/** Selects the given mouse cursor.
* \param cursor mouse cursor to render
*/
void pie_SetMouse(CURSOR cursor)
{
ASSERT(cursor < CURSOR_MAX, "Attempting to load non-existent cursor: %u", (unsigned int)cursor);
MouseCursor = cursor;
frameSetCursor(MouseCursor);
}
bool _glerrors(const char *function, const char *file, int line)
{
bool ret = false;

View File

@ -82,10 +82,6 @@ extern void pie_SetTexturePage(SDWORD num);
extern void pie_SetAlphaTest(bool keyingOn);
extern void pie_SetRendMode(REND_MODE rendMode);
extern void pie_InitColourMouse(IMAGEFILE* img, const uint16_t cursorIDs[CURSOR_MAX]);
extern void pie_SetMouse(CURSOR cursor);
extern void pie_ShowMouse(bool visible);
// Shaders control center
bool pie_LoadShaders(void);
// Actual shaders (we do not want to export these calls)

View File

@ -868,17 +868,17 @@ void processMouseClickInput(void)
if (gamePaused())
{
pie_SetMouse(CURSOR_DEFAULT);
wzSetCursor(CURSOR_DEFAULT);
}
if (buildState == BUILD3D_VALID)
{
// special casing for building
pie_SetMouse(CURSOR_BUILD);
wzSetCursor(CURSOR_BUILD);
}
else if (buildState == BUILD3D_POS)
{
// special casing for building - can't build here
pie_SetMouse(CURSOR_NOTPOSSIBLE);
wzSetCursor(CURSOR_NOTPOSSIBLE);
}
else if (selection != SC_INVALID)
{
@ -1029,29 +1029,29 @@ void processMouseClickInput(void)
arnMPointers[item][selection] == CURSOR_MOVE && bMultiPlayer)
{
// Alt+move = disembark transporter
pie_SetMouse(CURSOR_DISEMBARK);
wzSetCursor(CURSOR_DISEMBARK);
}
else if (specialOrderKeyDown() && selection == SC_DROID_DIRECT &&
arnMPointers[item][selection] == CURSOR_MOVE)
{
// Alt+move = scout
pie_SetMouse(CURSOR_SCOUT);
wzSetCursor(CURSOR_SCOUT);
}
else if (arnMPointers[item][selection] == CURSOR_NOTPOSSIBLE &&
ObjUnderMouse && (ObjUnderMouse->player == selectedPlayer) &&
ObjUnderMouse->type == OBJ_STRUCTURE && ((STRUCTURE *)ObjUnderMouse)->asWeaps[0].nStat &&
(asWeaponStats[((STRUCTURE *)ObjUnderMouse)->asWeaps[0].nStat].weaponSubClass == WSC_LAS_SAT))
{
pie_SetMouse(CURSOR_SELECT); // Special casing for LasSat
wzSetCursor(CURSOR_SELECT); // Special casing for LasSat
}
else
{
pie_SetMouse(arnMPointers[item][selection]);
wzSetCursor(arnMPointers[item][selection]);
}
}
else
{
pie_SetMouse(CURSOR_DEFAULT);
wzSetCursor(CURSOR_DEFAULT);
}
}
else
@ -1066,22 +1066,22 @@ void processMouseClickInput(void)
if (item == MT_ENEMYDROID || item == MT_ENEMYSTR || item == MT_DAMFEATURE)
{
//display attack cursor
pie_SetMouse(CURSOR_ATTACK);
wzSetCursor(CURSOR_ATTACK);
}
else if (ObjUnderMouse && ObjUnderMouse->player == selectedPlayer && (ObjUnderMouse->type == OBJ_DROID ||
(ObjUnderMouse->type == OBJ_STRUCTURE && lasSatStructSelected((STRUCTURE *)ObjUnderMouse))))
{
// Special casing for selectables
pie_SetMouse(CURSOR_SELECT);
wzSetCursor(CURSOR_SELECT);
}
else if (ObjUnderMouse && ObjUnderMouse->player == selectedPlayer && ObjUnderMouse->type == OBJ_STRUCTURE)
{
pie_SetMouse(CURSOR_DEFAULT);
wzSetCursor(CURSOR_DEFAULT);
}
else
{
//display block cursor
pie_SetMouse(CURSOR_NOTPOSSIBLE);
wzSetCursor(CURSOR_NOTPOSSIBLE);
}
}
else if (ObjUnderMouse && (ObjUnderMouse->player == selectedPlayer) &&
@ -1089,11 +1089,11 @@ void processMouseClickInput(void)
&& (asWeaponStats[((STRUCTURE *)ObjUnderMouse)->asWeaps[0].nStat].weaponSubClass == WSC_LAS_SAT))
|| ObjUnderMouse->type == OBJ_DROID))
{
pie_SetMouse(CURSOR_SELECT); // Special casing for LasSat or own unit
wzSetCursor(CURSOR_SELECT); // Special casing for LasSat or own unit
}
else
{
pie_SetMouse(CURSOR_DEFAULT);
wzSetCursor(CURSOR_DEFAULT);
}
}
@ -1286,7 +1286,7 @@ bool CheckScrollLimits(void)
void displayWorld(void)
{
Vector3i pos;
shakeUpdate();
if (mouseDown(MOUSE_ROTATE) && rotActive)
@ -2173,7 +2173,7 @@ void dealWithLMB( void )
CONPRINTF(ConsoleString, (ConsoleString, "%s tile %d, %d [%d, %d] continent(l%d, h%d) level %g illum %d %s %s",
tileIsExplored(psTile) ? "Explored" : "Unexplored",
mouseTileX, mouseTileY, world_coord(mouseTileX), world_coord(mouseTileY),
(int)psTile->limitedContinent, (int)psTile->hoverContinent, psTile->level, (int)psTile->illumination,
(int)psTile->limitedContinent, (int)psTile->hoverContinent, psTile->level, (int)psTile->illumination,
aux & AUXBITS_DANGER ? "danger" : "", aux & AUXBITS_THREAT ? "threat" : ""));
}

View File

@ -663,7 +663,7 @@ void driveProcessAquireButton(void)
// BASE_OBJECT *psObj;
// psObj = targetAquireNearestObjView((BASE_OBJECT*)psDrivenDroid);
// driveMarkTarget();
// pie_SetMouse(CURSOR_ATTACK);
// wzSetCursor(CURSOR_ATTACK);
}
}

View File

@ -26,6 +26,7 @@
#include <string.h>
#include "lib/framework/frame.h"
#include "lib/framework/wzapp_c.h"
#include "lib/framework/strres.h"
#include "lib/widget/widget.h"
#include "lib/netplay/netplay.h"
@ -277,7 +278,7 @@ static bool _intAddInGameOptions(void)
intMode = INT_INGAMEOP; // change interface mode.
InGameOpUp = true; // inform interface.
pie_SetMouse(CURSOR_DEFAULT);
wzSetCursor(CURSOR_DEFAULT);
return true;
}
@ -289,7 +290,7 @@ bool intAddInGameOptions(void)
return _intAddInGameOptions();
}
//
//
// Quick hack to throw up a ingame 'popup' for when the host drops connection.
//
void intAddInGamePopup(void)
@ -524,9 +525,9 @@ void intProcessInGameOptions(UDWORD id)
{
widgSetString(psWScreen, INTINGAMEOP_TUI_TARGET_ORIGIN_SW, _("Tactical UI (Target Origin Icon): Hide"));
}
break;
default:
break;
}

View File

@ -32,6 +32,7 @@
#include "lib/framework/file.h"
#include "lib/framework/physfs_ext.h"
#include "lib/framework/strres.h"
#include "lib/framework/wzapp_c.h"
#include "lib/ivis_opengl/piemode.h"
#include "lib/ivis_opengl/piestate.h"
#include "lib/ivis_opengl/tex.h"
@ -476,7 +477,7 @@ bool systemInitialise(void)
debug(LOG_ERROR, "Unable to initialise renderer");
return false;
}
if ( war_getSoundEnabled() )
{
if (!audio_Init(droidAudioTrackStopped))
@ -672,7 +673,7 @@ bool frontendInitialise(const char *ResourceFile)
// Set the default uncoloured cursor here, since it looks slightly
// better for menus and such.
pie_SetMouse(CURSOR_DEFAULT);
wzSetCursor(CURSOR_DEFAULT);
SetFormAudioIDs(-1,ID_SOUND_WINDOWCLOSE); // disable the open noise since distorted in 3dfx builds.
@ -871,7 +872,7 @@ bool stageOneShutDown(void)
//free up the gateway stuff?
gwShutDown();
shutdownTerrain();
if (!mapShutdown())
@ -975,7 +976,7 @@ bool stageTwoInitialise(void)
// Set the default uncoloured cursor here, since it looks slightly
// better for menus and such.
pie_SetMouse(CURSOR_DEFAULT);
wzSetCursor(CURSOR_DEFAULT);
SetFormAudioIDs(ID_SOUND_WINDOWOPEN,ID_SOUND_WINDOWCLOSE);

View File

@ -3172,7 +3172,7 @@ void drawRadarBlips(int radarX, int radarY, float pixSizeH, float pixSizeV)
// NOTE: On certain missions (limbo & expand), there is still valid data that is stored outside the
// normal radar/mini-map view. We must now calculate the radar/mini-map's bounding box, and clip
// everything outside the box.
if ( (x+radarX) < width*pixSizeV/2 && (x+radarX) > -width*pixSizeV/2
if ( (x+radarX) < width*pixSizeV/2 && (x+radarX) > -width*pixSizeV/2
&& (y+radarY) < height*pixSizeH/2 && (y+radarY) > -height*pixSizeH/2)
{
// Draw the 'blip'
@ -3186,11 +3186,11 @@ void drawRadarBlips(int radarX, int radarY, float pixSizeH, float pixSizeV)
x = (x / TILE_UNITS - scrollMinX) * pixSizeH;
y = (y / TILE_UNITS - scrollMinY) * pixSizeV;
imageID = imagesEnemy[strobe];
// NOTE: On certain missions (limbo & expand), there is still valid data that is stored outside the
// normal radar/mini-map view. We must now calculate the radar/mini-map's bounding box, and clip
// everything outside the box.
if ( (x+radarX) < width*pixSizeV/2 && (x+radarX) > -width*pixSizeV/2
if ( (x+radarX) < width*pixSizeV/2 && (x+radarX) > -width*pixSizeV/2
&& (y+radarY) < height*pixSizeH/2 && (y+radarY) > -height*pixSizeH/2)
{
// Draw the 'blip'

View File

@ -82,30 +82,30 @@ static const uint16_t MousePointerImageIDs[CURSOR_MAX] =
IMAGE_CURSOR_DEST, // CURSOR_DEST
IMAGE_CURSOR_DEFAULT, // CURSOR_SIGHT
IMAGE_CURSOR_DEFAULT, // CURSOR_TARGET
IMAGE_CURSOR_DEFAULT, // CURSOR_LARROW
IMAGE_CURSOR_DEFAULT, // CURSOR_RARROW
IMAGE_CURSOR_DEFAULT, // CURSOR_DARROW
IMAGE_CURSOR_DEFAULT, // CURSOR_UARROW
IMAGE_CURSOR_DEFAULT, // CURSOR_DEFAULT
IMAGE_CURSOR_DEFAULT, // CURSOR_EDGEOFMAP
IMAGE_CURSOR_ATTACH, // CURSOR_ATTACH
IMAGE_CURSOR_ATTACK, // CURSOR_ATTACK
IMAGE_CURSOR_BOMB, // CURSOR_BOMB
IMAGE_CURSOR_BRIDGE, // CURSOR_BRIDGE
IMAGE_CURSOR_BUILD, // CURSOR_BUILD
IMAGE_CURSOR_EMBARK, // CURSOR_EMBARK
IMAGE_CURSOR_DISEMBARK, // CURSOR_DISEMBARK
IMAGE_CURSOR_FIX, // CURSOR_FIX
IMAGE_CURSOR_GUARD, // CURSOR_GUARD
IMAGE_CURSOR_ECM, // CURSOR_JAM
IMAGE_CURSOR_LOCKON, // CURSOR_LOCKON
IMAGE_CURSOR_SCOUT, // CURSOR_SCOUT
IMAGE_CURSOR_DEFAULT, // CURSOR_MENU
IMAGE_CURSOR_MOVE, // CURSOR_MOVE
IMAGE_CURSOR_NOTPOS, // CURSOR_NOTPOSSIBLE
IMAGE_CURSOR_PICKUP, // CURSOR_PICKUP
IMAGE_CURSOR_REPAIR, // CURSOR_SEEKREPAIR
IMAGE_CURSOR_SELECT, // CURSOR_SELECT
IMAGE_CURSOR_DEFAULT, // CURSOR_LARROW
IMAGE_CURSOR_DEFAULT, // CURSOR_RARROW
IMAGE_CURSOR_DEFAULT, // CURSOR_DARROW
IMAGE_CURSOR_DEFAULT, // CURSOR_UARROW
IMAGE_CURSOR_DEFAULT, // CURSOR_DEFAULT
IMAGE_CURSOR_DEFAULT, // CURSOR_EDGEOFMAP
IMAGE_CURSOR_ATTACH, // CURSOR_ATTACH
IMAGE_CURSOR_ATTACK, // CURSOR_ATTACK
IMAGE_CURSOR_BOMB, // CURSOR_BOMB
IMAGE_CURSOR_BRIDGE, // CURSOR_BRIDGE
IMAGE_CURSOR_BUILD, // CURSOR_BUILD
IMAGE_CURSOR_EMBARK, // CURSOR_EMBARK
IMAGE_CURSOR_DISEMBARK, // CURSOR_DISEMBARK
IMAGE_CURSOR_FIX, // CURSOR_FIX
IMAGE_CURSOR_GUARD, // CURSOR_GUARD
IMAGE_CURSOR_ECM, // CURSOR_JAM
IMAGE_CURSOR_LOCKON, // CURSOR_LOCKON
IMAGE_CURSOR_SCOUT, // CURSOR_SCOUT
IMAGE_CURSOR_DEFAULT, // CURSOR_MENU
IMAGE_CURSOR_MOVE, // CURSOR_MOVE
IMAGE_CURSOR_NOTPOS, // CURSOR_NOTPOSSIBLE
IMAGE_CURSOR_PICKUP, // CURSOR_PICKUP
IMAGE_CURSOR_REPAIR, // CURSOR_SEEKREPAIR
IMAGE_CURSOR_SELECT, // CURSOR_SELECT
};
/** Form frame definition for normal frames. */
@ -174,7 +174,6 @@ TABDEF SmallTab = {
bool imageInitBitmaps(void)
{
IntImages = (IMAGEFILE*)resGetData("IMG", "intfac.img");
pie_InitColourMouse(IntImages, MousePointerImageIDs);
return true;
}

View File

@ -26,6 +26,7 @@
#include "lib/framework/frame.h"
#include "lib/framework/input.h"
#include "lib/framework/strres.h"
#include "lib/framework/wzapp_c.h"
#include "lib/ivis_opengl/pieblitfunc.h"
#include "lib/ivis_opengl/piestate.h" //ivis render code
@ -206,8 +207,8 @@ GAMECODE gameLoop(void)
HandleClosingWindows(); // Needs to be done outside the pause case.
audio_Update();
pie_ShowMouse(true);
wzShowMouse(true);
if (!paused)
{
@ -246,7 +247,7 @@ GAMECODE gameLoop(void)
&& getHQExists(selectedPlayer) ) ) )
{
// Using software cursors (when on) for these menus due to a bug in SDL's SDL_ShowCursor()
pie_SetMouse(CURSOR_DEFAULT);
wzSetCursor(CURSOR_DEFAULT);
intRetVal = INT_INTERCEPT;
}
@ -520,7 +521,7 @@ GAMECODE gameLoop(void)
else // paused
{
// Using software cursors (when on) for these menus due to a bug in SDL's SDL_ShowCursor()
pie_SetMouse(CURSOR_DEFAULT);
wzSetCursor(CURSOR_DEFAULT);
intRetVal = INT_NONE;
@ -778,7 +779,7 @@ void loop_SetVideoPlaybackMode(void)
gameTimeStop();
pie_SetFogStatus(false);
audio_StopAll();
pie_ShowMouse(false);
wzShowMouse(false);
screen_StopBackDrop();
pie_ScreenFlip(CLEAR_BLACK);
}
@ -792,7 +793,7 @@ void loop_ClearVideoPlaybackMode(void)
gameTimeStart();
pie_SetFogStatus(true);
cdAudio_Resume();
pie_ShowMouse(true);
wzShowMouse(true);
ASSERT( videoMode == 0, "loop_ClearVideoPlaybackMode: out of sync." );
}

View File

@ -25,6 +25,7 @@
#include "mission.h"
#include "lib/framework/frame.h"
#include "lib/framework/wzapp_c.h"
#include "lib/framework/math_ext.h"
#include "lib/ivis_opengl/bitimage.h"
#include "lib/ivis_opengl/textdraw.h"
@ -1362,7 +1363,7 @@ static void processMission(void)
psNext = psDroid->psNext;
//reset order - do this to all the droids that are returning from offWorld
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
// clean up visibility
// clean up visibility
visRemoveVisibility((BASE_OBJECT *)psDroid);
//remove out of stored list and add to current Droid list
if (droidRemove(psDroid, apsDroidLists))
@ -2578,7 +2579,7 @@ void intRemoveMissionResultNoAnim(void)
void intRunMissionResult(void)
{
pie_SetMouse(CURSOR_DEFAULT);
wzSetCursor(CURSOR_DEFAULT);
if(bLoadSaveUp)
{

View File

@ -126,7 +126,7 @@ TITLECODE titleLoop(void)
pie_SetDepthBufferStatus(DEPTH_CMP_ALWAYS_WRT_ON);
pie_SetFogStatus(false);
screen_RestartBackDrop();
pie_ShowMouse(true);
wzShowMouse(true);
// When we first init the game, firstcall is true.
if (firstcall)
@ -152,7 +152,7 @@ TITLECODE titleLoop(void)
changeTitleMode(TITLE); // normal game, run main title screen.
}
// Using software cursors (when on) for these menus due to a bug in SDL's SDL_ShowCursor()
pie_SetMouse(CURSOR_DEFAULT);
wzSetCursor(CURSOR_DEFAULT);
}
if (titleMode != MULTIOPTION && titleMode != MULTILIMIT && titleMode != STARTGAME)
@ -256,7 +256,7 @@ TITLECODE titleLoop(void)
NETflush(); // Send any pending network data.
audio_Update();
pie_SetFogStatus(false);
pie_ScreenFlip(CLEAR_BLACK);//title loop
@ -313,7 +313,7 @@ void loadingScreenCallback(void)
// fill buffers with the static screen
void initLoadingScreen( bool drawbdrop )
{
pie_ShowMouse(false);
wzShowMouse(false);
if (!drawbdrop) // fill buffers
{
//just init the load bar with the current screen