* Remove CursorSnap code; it was this code that was responsible for "snapping" the mouse cursor when switching menus
* This removes csnap.[ch] (removed from automake/autoconf, Code::Blocks, MSVC) Patch #789 by Ken Rushia (with some minor additions & changes by me) git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2344 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
0c942e2413
commit
fc8ab2c14e
|
@ -13,7 +13,7 @@ bin_PROGRAMS = warzone2100
|
|||
noinst_HEADERS = action.h advvis.h ai.h aiexperience.h anim_id.h \
|
||||
arrow.h astar.h atmos.h basedef.h bridge.h bucket3d.h \
|
||||
projectiledef.h cdspan.h cheat.h clparse.h cluster.h cmddroid.h \
|
||||
cmddroiddef.h combat.h component.h configuration.h console.h csnap.h data.h \
|
||||
cmddroiddef.h combat.h component.h configuration.h console.h data.h \
|
||||
deliverance.h design.h difficulty.h display.h display3d.h display3ddef.h \
|
||||
displaydef.h drive.h droid.h droiddef.h e3demo.h edit3d.h effects.h \
|
||||
environ.h feature.h featuredef.h findpath.h formation.h formationdef.h fpath.h \
|
||||
|
@ -43,7 +43,7 @@ warzone2100_SOURCES = scriptvals_parser.tab.c scriptvals_lexer.lex.c \
|
|||
raycast.c research.c scores.c scriptai.c scriptcb.c scriptextern.c scriptfuncs.c \
|
||||
scriptobj.c scripttabs.c scriptvals.c selection.c stats.c text.c texture.c \
|
||||
transporter.c visibility.c warcam.c wrappers.c arrow.c aud.c \
|
||||
bucket3d.c clparse.c configuration.c csnap.c display3d.c drive.c function.c game.c \
|
||||
bucket3d.c clparse.c configuration.c display3d.c drive.c function.c game.c \
|
||||
ingameop.c keyedit.c loadsave.c mission.c multigifts.c multijoin.c multilimit.c \
|
||||
multiplay.c multistruct.c oprint.c power.c projectile.c seqdisp.c structure.c \
|
||||
target.c warzoneconfig.c
|
||||
|
|
|
@ -90,7 +90,6 @@ SRC=ai.c \
|
|||
bucket3d.c \
|
||||
clparse.c \
|
||||
configuration.c \
|
||||
csnap.c \
|
||||
display3d.c \
|
||||
drive.c \
|
||||
function.c \
|
||||
|
|
450
src/csnap.c
450
src/csnap.c
|
@ -1,450 +0,0 @@
|
|||
/*
|
||||
This file is part of Warzone 2100.
|
||||
Copyright (C) 1999-2004 Eidos Interactive
|
||||
Copyright (C) 2005-2007 Warzone Resurrection 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
|
||||
*/
|
||||
/*
|
||||
* Cursor handling for keyboard/dpad control
|
||||
* Pumpkin Studios 98
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lib/framework/frame.h"
|
||||
#include "lib/framework/input.h"
|
||||
#include "lib/widget/widget.h"
|
||||
#include "deliverance.h"
|
||||
#include "lib/framework/fractions.h"
|
||||
|
||||
#include "lib/ivis_common/piestate.h"
|
||||
#include "lib/ivis_common/pieclip.h"
|
||||
|
||||
#include "csnap.h"
|
||||
|
||||
#define V_BIAS 8
|
||||
#define H_BIAS 8
|
||||
|
||||
|
||||
SNAPBIAS DefaultBias =
|
||||
{
|
||||
1,1, // Nearest
|
||||
8,1, // Up
|
||||
1,8, // Right
|
||||
8,1, // Down
|
||||
1,8, // Left
|
||||
};
|
||||
|
||||
|
||||
SNAPBIAS FrontendBias =
|
||||
{
|
||||
1,1, // Nearest
|
||||
1,1, // Up
|
||||
1,1, // Right
|
||||
1,1, // Down
|
||||
1,1, // Left
|
||||
};
|
||||
|
||||
|
||||
SNAPBIAS ReticuleBias =
|
||||
{
|
||||
1,1, // Nearest
|
||||
1,1, // Up
|
||||
1,1, // Right
|
||||
1,1, // Down
|
||||
1,1, // Left
|
||||
};
|
||||
|
||||
|
||||
SNAPBIAS TabBias =
|
||||
{
|
||||
1,1, // Nearest
|
||||
1,8, // Up
|
||||
1,1, // Right
|
||||
1,8, // Down
|
||||
1,1, // Left
|
||||
};
|
||||
|
||||
|
||||
static SDWORD MaxXDist = 64;
|
||||
static SDWORD MaxYDist = 64;
|
||||
|
||||
static UDWORD EnabledFormID = 0;
|
||||
extern W_SCREEN *psWScreen; //The widget screen
|
||||
|
||||
|
||||
void SetMaxDist(SDWORD MaxX,SDWORD MaxY)
|
||||
{
|
||||
MaxXDist = MaxX;
|
||||
MaxYDist = MaxY;
|
||||
}
|
||||
|
||||
|
||||
void snapInitVars(void)
|
||||
{
|
||||
EnabledFormID = 0;
|
||||
}
|
||||
|
||||
|
||||
void AllocateSnapBuffer(CURSORSNAP *SnapBuffer,UWORD MaxSnaps)
|
||||
{
|
||||
SnapBuffer->SnapCoords = (SNAPCOORD*)malloc(sizeof(CURSORSNAP)*MaxSnaps);
|
||||
SnapBuffer->MaxSnaps = MaxSnaps;
|
||||
SnapBuffer->NumSnaps = 0;
|
||||
SnapBuffer->CurrentSnap = 0;
|
||||
SnapBuffer->NewCurrentFormID = 0;
|
||||
SnapBuffer->NewCurrentID = 0;
|
||||
}
|
||||
|
||||
|
||||
void ReleaseSnapBuffer(CURSORSNAP *SnapBuffer)
|
||||
{
|
||||
free(SnapBuffer->SnapCoords);
|
||||
}
|
||||
|
||||
|
||||
void StartCursorSnap(CURSORSNAP *SnapBuffer)
|
||||
{
|
||||
SnapBuffer->NumSnaps = 0;
|
||||
// SnapBuffer->CurrentSnap = 0;
|
||||
}
|
||||
|
||||
|
||||
void InitCursorSnap(CURSORSNAP *SnapBuffer,UWORD NumSnaps)
|
||||
{
|
||||
SnapBuffer->NumSnaps = NumSnaps;
|
||||
SnapBuffer->CurrentSnap = 0;
|
||||
}
|
||||
|
||||
|
||||
void AddCursorSnap(CURSORSNAP *SnapBuffer,SWORD PosX,SWORD PosY,UDWORD FormID,UDWORD ID,SNAPBIAS *Bias)
|
||||
{
|
||||
// UWORD i;
|
||||
int Index = -1;
|
||||
|
||||
#ifdef SNAP_ERASABLE
|
||||
for(i=0; i<SnapBuffer->NumSnaps; i++) {
|
||||
if(SnapBuffer->SnapCoords[i].FormID == 0) {
|
||||
Index = i;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(Index < 0) {
|
||||
ASSERT( SnapBuffer->NumSnaps < SnapBuffer->MaxSnaps,"AddCursorSnap: MAXCURSORSNAPS Exceeded" );
|
||||
Index = SnapBuffer->NumSnaps;
|
||||
SnapBuffer->NumSnaps++;
|
||||
}
|
||||
|
||||
SnapBuffer->SnapCoords[Index].SnapX = PosX;
|
||||
SnapBuffer->SnapCoords[Index].SnapY = PosY;
|
||||
SnapBuffer->SnapCoords[Index].FormID = FormID;
|
||||
SnapBuffer->SnapCoords[Index].ID = ID;
|
||||
if(Bias == NULL) {
|
||||
SnapBuffer->SnapCoords[Index].Bias = &DefaultBias;
|
||||
} else {
|
||||
SnapBuffer->SnapCoords[Index].Bias = Bias;
|
||||
}
|
||||
|
||||
// If a new current snap was requested then see if this one meets its requirements.
|
||||
if(SnapBuffer->NewCurrentFormID) {
|
||||
if(FormID == SnapBuffer->NewCurrentFormID) {
|
||||
SnapBuffer->NewCurrentFormID = 0;
|
||||
SnapBuffer->CurrentSnap = Index;
|
||||
}
|
||||
} else if(SnapBuffer->NewCurrentID) {
|
||||
if(ID == SnapBuffer->NewCurrentID) {
|
||||
// DBPRINTF(("Found New ID %d\n",SnapBuffer->NewCurrentID);
|
||||
SnapBuffer->NewCurrentID = 0;
|
||||
SnapBuffer->CurrentSnap = Index;
|
||||
GotoSnap(SnapBuffer);
|
||||
} else {
|
||||
// DBPRINTF(("Not Found New ID %d\n",SnapBuffer->NewCurrentID);
|
||||
}
|
||||
}
|
||||
// DBPRINTF(("%d : %d,%d\n",Index,SnapBuffer->SnapCoords[Index].SnapX,SnapBuffer->SnapCoords[Index].SnapY);
|
||||
}
|
||||
|
||||
|
||||
void RemoveCursorSnap(CURSORSNAP *SnapBuffer,UDWORD FormID)
|
||||
{
|
||||
#ifdef SNAP_ERASABLE
|
||||
int i;
|
||||
|
||||
for(i=0; i<SnapBuffer->NumSnaps; i++) {
|
||||
if(SnapBuffer->SnapCoords[i].FormID == FormID) {
|
||||
SnapBuffer->SnapCoords[i].FormID = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// Given a widget id get it's screen extents.
|
||||
// NOTE that this function is slow and should be called infrequently,
|
||||
// ideally only during widget initialisation.
|
||||
//
|
||||
static BOOL widgGetScreenExtents(UDWORD ID,int *sx,int *sy,int *sw,int *sh)
|
||||
{
|
||||
WIDGET *psWidget = widgGetFromID(psWScreen,ID);
|
||||
|
||||
if(psWidget != NULL) {
|
||||
int x,y,w,h;
|
||||
|
||||
x = psWidget->x;
|
||||
y = psWidget->y;
|
||||
w = psWidget->width;
|
||||
h = psWidget->height;
|
||||
|
||||
while(psWidget->formID) {
|
||||
WIDGET *psParent = widgGetFromID(psWScreen,psWidget->formID);
|
||||
if(psParent) {
|
||||
x += psParent->x;
|
||||
y += psParent->y;
|
||||
}
|
||||
|
||||
psWidget = psParent;
|
||||
}
|
||||
|
||||
*sx = x; *sy = y;
|
||||
*sw = w; *sh = h;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
// Given a widget id, make the snap that matches it the current one next frame.
|
||||
//
|
||||
void SetCurrentSnapID(CURSORSNAP *SnapBuffer,UDWORD ID)
|
||||
{
|
||||
{
|
||||
int x,y,w,h;
|
||||
|
||||
SnapBuffer->NewCurrentID = ID;
|
||||
if(ID) {
|
||||
// Get the screen extents of the specified widget and move the mouse there.
|
||||
if(widgGetScreenExtents(ID,&x,&y,&w,&h) == TRUE) {
|
||||
// DBPRINTF(("%d %d,%d %d\n",x,y,w,h);
|
||||
SetMousePos(x + w / 2, y + h / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EnableAllCursorSnaps(void)
|
||||
{
|
||||
EnabledFormID = 0;
|
||||
}
|
||||
|
||||
|
||||
void DisableCursorSnapsExcept(UDWORD FormID)
|
||||
{
|
||||
EnabledFormID = FormID;
|
||||
}
|
||||
|
||||
|
||||
void SetCursorSnap(CURSORSNAP *SnapBuffer,UWORD Index,SWORD PosX,SWORD PosY,UDWORD FormID,UDWORD ID)
|
||||
{
|
||||
ASSERT( Index < SnapBuffer->NumSnaps,"SetCursorSnap: Index out of range" );
|
||||
|
||||
SnapBuffer->SnapCoords[Index].SnapX = PosX;
|
||||
SnapBuffer->SnapCoords[Index].SnapY = PosY;
|
||||
SnapBuffer->SnapCoords[Index].FormID = FormID;
|
||||
SnapBuffer->SnapCoords[Index].ID = ID;
|
||||
}
|
||||
|
||||
|
||||
void GotoSnap(CURSORSNAP *SnapBuffer)
|
||||
{
|
||||
if(SnapBuffer->NumSnaps > 0) {
|
||||
SetMousePos(SnapBuffer->SnapCoords[SnapBuffer->CurrentSnap].SnapX,
|
||||
SnapBuffer->SnapCoords[SnapBuffer->CurrentSnap].SnapY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GotoNextSnap(CURSORSNAP *SnapBuffer)
|
||||
{
|
||||
if(SnapBuffer->NumSnaps > 0) {
|
||||
SnapBuffer->CurrentSnap++;
|
||||
if(SnapBuffer->CurrentSnap >= SnapBuffer->NumSnaps) {
|
||||
SnapBuffer->CurrentSnap = 0;
|
||||
}
|
||||
}
|
||||
|
||||
SetMousePos(SnapBuffer->SnapCoords[SnapBuffer->CurrentSnap].SnapX,
|
||||
SnapBuffer->SnapCoords[SnapBuffer->CurrentSnap].SnapY);
|
||||
}
|
||||
|
||||
|
||||
void GotoPreviousSnap(CURSORSNAP *SnapBuffer)
|
||||
{
|
||||
if(SnapBuffer->NumSnaps > 0) {
|
||||
SnapBuffer->CurrentSnap--;
|
||||
if(SnapBuffer->CurrentSnap <0) {
|
||||
SnapBuffer->CurrentSnap = SnapBuffer->NumSnaps-1;
|
||||
}
|
||||
}
|
||||
|
||||
SetMousePos(SnapBuffer->SnapCoords[SnapBuffer->CurrentSnap].SnapX,
|
||||
SnapBuffer->SnapCoords[SnapBuffer->CurrentSnap].SnapY);
|
||||
}
|
||||
|
||||
|
||||
void GotoDirectionalSnap(CURSORSNAP *SnapBuffer,SNAPDIRECTION Direction,SWORD CurrX,SWORD CurrY)
|
||||
{
|
||||
UWORD i;
|
||||
UWORD CurrentSnap = SnapBuffer->CurrentSnap;
|
||||
SWORD ThisX = SnapBuffer->SnapCoords[CurrentSnap].SnapX;
|
||||
SWORD ThisY = SnapBuffer->SnapCoords[CurrentSnap].SnapY;
|
||||
SWORD NearestSnap = -1;
|
||||
SWORD NearestDist = 32767;
|
||||
SWORD dx,dy;
|
||||
SWORD Dist;
|
||||
|
||||
|
||||
if(SnapBuffer->CurrentSnap < 0) {
|
||||
SnapBuffer->CurrentSnap = SnapBuffer->NumSnaps-1;
|
||||
}
|
||||
if(SnapBuffer->CurrentSnap >= SnapBuffer->NumSnaps) {
|
||||
SnapBuffer->CurrentSnap = 0;
|
||||
}
|
||||
|
||||
// DBPRINTF(("NumSnaps %d %d %d\n",SnapBuffer->NumSnaps,Direction,EnabledFormID);
|
||||
|
||||
for(i=0; i<SnapBuffer->NumSnaps; i++) {
|
||||
SNAPBIAS *Bias = SnapBuffer->SnapCoords[CurrentSnap].Bias; //i].Bias;
|
||||
|
||||
#ifdef SNAP_ERASABLE
|
||||
if( ((i != CurrentSnap) || (Direction == SNAP_NEAREST)) && (SnapBuffer->SnapCoords[i].FormID) ) {
|
||||
#else
|
||||
if( ((i != CurrentSnap) || (Direction == SNAP_NEAREST)) &&
|
||||
((SnapBuffer->SnapCoords[i].FormID == EnabledFormID) || (EnabledFormID == 0)) ) {
|
||||
#endif
|
||||
dx = SnapBuffer->SnapCoords[i].SnapX - ThisX;
|
||||
dy = SnapBuffer->SnapCoords[i].SnapY - ThisY;
|
||||
|
||||
if(Direction == SNAP_NEAREST) {
|
||||
|
||||
dx = SnapBuffer->SnapCoords[i].SnapX - CurrX;
|
||||
dy = SnapBuffer->SnapCoords[i].SnapY - CurrY;
|
||||
|
||||
Dist = abs(dx*Bias->NDxBias) + abs(dy*Bias->NDyBias);
|
||||
if(Dist < NearestDist) {
|
||||
NearestSnap = i;
|
||||
NearestDist = Dist;
|
||||
}
|
||||
|
||||
} else if(Direction == SNAP_UP) {
|
||||
|
||||
if(dy >= 0) {
|
||||
// DBPRINTF(("Skip SNAP_UP\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
dx = abs(dx);
|
||||
dy = abs(dy);
|
||||
|
||||
Dist = dx*Bias->UDxBias + dy*Bias->UDyBias;
|
||||
//DBPRINTF(("SNAP_UP %d %d : %d %d : %d\n",abs(dx),abs(dy),abs(dx*Bias->UDxBias),abs(dy*Bias->UDyBias),Dist);
|
||||
if((Dist < NearestDist) && (dx < MaxXDist)) {
|
||||
NearestSnap = i;
|
||||
NearestDist = Dist;
|
||||
}
|
||||
|
||||
} else if(Direction == SNAP_RIGHT) {
|
||||
|
||||
if(dx <= 0) {
|
||||
// DBPRINTF(("Skip SNAP_RIGHT\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
dx = abs(dx);
|
||||
dy = abs(dy);
|
||||
|
||||
Dist = dx*Bias->RDxBias + dy*Bias->RDyBias;
|
||||
//DBPRINTF(("SNAP_RIGHT %d %d : %d %d : %d\n",abs(dx),abs(dy),abs(dx*Bias->RDxBias),abs(dy*Bias->RDyBias),Dist);
|
||||
if((Dist < NearestDist) && (dy < MaxYDist)) {
|
||||
NearestSnap = i;
|
||||
NearestDist = Dist;
|
||||
}
|
||||
|
||||
} else if(Direction == SNAP_DOWN) {
|
||||
|
||||
if(dy <= 0) {
|
||||
// DBPRINTF(("Skip SNAP_DOWN\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
dx = abs(dx);
|
||||
dy = abs(dy);
|
||||
|
||||
Dist = dx*Bias->DDxBias + dy*Bias->DDyBias;
|
||||
//DBPRINTF(("SNAP_DOWN %d %d : %d %d : %d\n",abs(dx),abs(dy),abs(dx*Bias->DDxBias),abs(dy*Bias->DDyBias),Dist));
|
||||
if((Dist < NearestDist) && (dx < MaxXDist)) {
|
||||
NearestSnap = i;
|
||||
NearestDist = Dist;
|
||||
}
|
||||
|
||||
} else if(Direction == SNAP_LEFT) {
|
||||
|
||||
if(dx >= 0) {
|
||||
// DBPRINTF(("Skip SNAP_LEFT\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
dx = abs(dx);
|
||||
dy = abs(dy);
|
||||
Dist = dx*Bias->LDxBias + dy*Bias->LDyBias;
|
||||
//DBPRINTF(("SNAP_LEFT %d %d : %d %d : %d\n",abs(dx),abs(dy),abs(dx*Bias->LDxBias),abs(dy*Bias->LDyBias),Dist);
|
||||
if((Dist < NearestDist) && (dy < MaxYDist)) {
|
||||
NearestSnap = i;
|
||||
NearestDist = Dist;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(NearestSnap >= 0) {
|
||||
SnapBuffer->CurrentSnap = NearestSnap;
|
||||
SetMousePos(SnapBuffer->SnapCoords[NearestSnap].SnapX,
|
||||
SnapBuffer->SnapCoords[NearestSnap].SnapY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SnapToID(CURSORSNAP *SnapBuffer,UWORD snp)
|
||||
{
|
||||
SnapBuffer->CurrentSnap = snp;
|
||||
}
|
||||
|
||||
|
||||
UDWORD SnapGetFormID(CURSORSNAP *SnapBuffer)
|
||||
{
|
||||
return SnapBuffer->SnapCoords[SnapBuffer->CurrentSnap].FormID;
|
||||
}
|
||||
|
||||
|
||||
UDWORD SnapGetID(CURSORSNAP *SnapBuffer)
|
||||
{
|
||||
return SnapBuffer->SnapCoords[SnapBuffer->CurrentSnap].ID;
|
||||
}
|
94
src/csnap.h
94
src/csnap.h
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
This file is part of Warzone 2100.
|
||||
Copyright (C) 1999-2004 Eidos Interactive
|
||||
Copyright (C) 2005-2007 Warzone Resurrection 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
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_CSNAP_
|
||||
#define _INCLUDED_CSNAP_
|
||||
|
||||
//#define SNAP_ERASABLE
|
||||
|
||||
|
||||
typedef enum {
|
||||
SNAP_UP,
|
||||
SNAP_RIGHT,
|
||||
SNAP_DOWN,
|
||||
SNAP_LEFT,
|
||||
SNAP_NEAREST,
|
||||
} SNAPDIRECTION;
|
||||
|
||||
typedef struct {
|
||||
SWORD NDxBias,NDyBias;
|
||||
SWORD UDxBias,UDyBias;
|
||||
SWORD RDxBias,RDyBias;
|
||||
SWORD DDxBias,DDyBias;
|
||||
SWORD LDxBias,LDyBias;
|
||||
} SNAPBIAS;
|
||||
|
||||
typedef struct {
|
||||
UDWORD FormID;
|
||||
UDWORD ID;
|
||||
SWORD SnapX;
|
||||
SWORD SnapY;
|
||||
SNAPBIAS *Bias;
|
||||
} SNAPCOORD;
|
||||
|
||||
typedef struct {
|
||||
UWORD MaxSnaps;
|
||||
SWORD NumSnaps;
|
||||
SWORD CurrentSnap;
|
||||
UDWORD NewCurrentFormID;
|
||||
UDWORD NewCurrentID;
|
||||
SNAPCOORD *SnapCoords;
|
||||
} CURSORSNAP;
|
||||
|
||||
extern SNAPBIAS DefaultBias;
|
||||
extern SNAPBIAS FrontendBias;
|
||||
extern SNAPBIAS ReticuleBias;
|
||||
extern SNAPBIAS TabBias;
|
||||
|
||||
void SetMaxDist(SDWORD MaxX,SDWORD MaxY);
|
||||
|
||||
void snapInitVars(void);
|
||||
|
||||
void AllocateSnapBuffer(CURSORSNAP *SnapBuffer,UWORD MaxSnaps);
|
||||
void ReleaseSnapBuffer(CURSORSNAP *SnapBuffer);
|
||||
|
||||
void StartCursorSnap(CURSORSNAP *SnapBuffer);
|
||||
void AddCursorSnap(CURSORSNAP *SnapBuffer,SWORD PosX,SWORD PosY,UDWORD FormID,UDWORD ID,SNAPBIAS *Bias);
|
||||
void RemoveCursorSnap(CURSORSNAP *SnapBuffer,UDWORD FormID);
|
||||
void EnableAllCursorSnaps(void);
|
||||
void DisableCursorSnapsExcept(UDWORD FormID);
|
||||
|
||||
void InitCursorSnap(CURSORSNAP *SnapBuffer,UWORD NumSnaps);
|
||||
void SetCursorSnap(CURSORSNAP *SnapBuffer,UWORD Index,SWORD PosX,SWORD PosY,UDWORD FormID,UDWORD ID);
|
||||
|
||||
void GotoSnap(CURSORSNAP *SnapBuffer);
|
||||
void GotoNextSnap(CURSORSNAP *SnapBuffer);
|
||||
void GotoPreviousSnap(CURSORSNAP *SnapBuffer);
|
||||
void GotoDirectionalSnap(CURSORSNAP *SnapBuffer,SNAPDIRECTION Direction,SWORD CurrX,SWORD CurrY);
|
||||
void SetCurrentSnap(CURSORSNAP *SnapBuffer,UDWORD FormID);
|
||||
void SetCurrentSnapID(CURSORSNAP *SnapBuffer,UDWORD ID);
|
||||
void SnapToID(CURSORSNAP *SnapBuffer,UWORD snp);
|
||||
|
||||
extern void intSetCurrentCursorPosition(CURSORSNAP *Snap,UDWORD id);
|
||||
|
||||
#endif
|
||||
|
||||
UDWORD SnapGetFormID(CURSORSNAP *SnapBuffer);
|
||||
UDWORD SnapGetID(CURSORSNAP *SnapBuffer);
|
|
@ -34,7 +34,6 @@
|
|||
#include "map.h"
|
||||
#include "loop.h"
|
||||
#include "atmos.h" // temporary only for here
|
||||
#include "csnap.h"
|
||||
/* Includes direct access to render library */
|
||||
#include "lib/ivis_common/piedef.h"
|
||||
#include "lib/ivis_common/piestate.h"
|
||||
|
|
127
src/frontend.c
127
src/frontend.c
|
@ -109,71 +109,6 @@ BOOL CancelPressed(void)
|
|||
|
||||
return FALSE;
|
||||
}
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// for cursorsnap stuff on pc
|
||||
|
||||
void processFrontendSnap(BOOL bHideCursor)
|
||||
{
|
||||
static Vector2i point = {0, 0}, old_point = {0, 0};
|
||||
|
||||
point.x = mouseX();
|
||||
point.y = mouseY();
|
||||
|
||||
if(point.x != old_point.x || point.y != old_point.y)
|
||||
{
|
||||
bUsingKeyboard = FALSE;
|
||||
}
|
||||
|
||||
if(!bUsingSlider)
|
||||
{
|
||||
if(keyPressed(KEY_RIGHTARROW))
|
||||
{
|
||||
bUsingKeyboard = TRUE;
|
||||
GotoDirectionalSnap(&InterfaceSnap, SNAP_RIGHT, 0, 0);
|
||||
}
|
||||
else if(keyPressed(KEY_LEFTARROW))
|
||||
{
|
||||
bUsingKeyboard = TRUE;
|
||||
GotoDirectionalSnap(&InterfaceSnap, SNAP_LEFT, 0, 0);
|
||||
}
|
||||
}
|
||||
if(keyPressed(KEY_UPARROW))
|
||||
{
|
||||
bUsingKeyboard = TRUE;
|
||||
bUsingSlider = FALSE;
|
||||
GotoDirectionalSnap(&InterfaceSnap, SNAP_UP, 0, 0);
|
||||
}
|
||||
else if(keyPressed(KEY_DOWNARROW))
|
||||
{
|
||||
bUsingKeyboard = TRUE;
|
||||
bUsingSlider = FALSE;
|
||||
GotoDirectionalSnap(&InterfaceSnap, SNAP_DOWN, 0, 0);
|
||||
}
|
||||
|
||||
if (!keyDown(KEY_LALT) && !keyDown(KEY_RALT)/* Check for toggling display mode */
|
||||
&& (psWScreen->psFocus == NULL))
|
||||
{
|
||||
if(keyPressed(KEY_RETURN) )
|
||||
{
|
||||
bUsingKeyboard = TRUE;
|
||||
setMouseDown(MOUSE_LMB);
|
||||
}
|
||||
|
||||
if(keyReleased(KEY_RETURN) )
|
||||
{
|
||||
bUsingKeyboard = TRUE;
|
||||
setMouseUp(MOUSE_LMB);
|
||||
}
|
||||
}
|
||||
|
||||
if(!bHideCursor)
|
||||
{
|
||||
bUsingKeyboard = FALSE;
|
||||
}
|
||||
|
||||
old_point.x = mouseX();
|
||||
old_point.y = mouseY();
|
||||
}
|
||||
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -303,9 +238,6 @@ BOOL startTitleMenu(void)
|
|||
|
||||
addSideText(FRONTEND_SIDETEXT, FRONTEND_SIDEX, FRONTEND_SIDEY, _("MAIN MENU"));
|
||||
|
||||
SetMousePos(320, FRONTEND_BOTFORMY + FRONTEND_POS2Y);
|
||||
SnapToID(&InterfaceSnap, 4);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -314,8 +246,6 @@ BOOL runTitleMenu(void)
|
|||
{
|
||||
UDWORD id;
|
||||
|
||||
processFrontendSnap(TRUE);
|
||||
|
||||
id = widgRunScreen(psWScreen); // Run the current set of widgets
|
||||
|
||||
switch(id)
|
||||
|
@ -339,7 +269,6 @@ BOOL runTitleMenu(void)
|
|||
break;
|
||||
}
|
||||
|
||||
StartCursorSnap(&InterfaceSnap);
|
||||
widgDisplayScreen(psWScreen); // show the widgets currently running
|
||||
|
||||
return TRUE;
|
||||
|
@ -362,10 +291,6 @@ BOOL startTutorialMenu(void)
|
|||
// TRANSLATORS: "Return", in this context, means "return to previous screen/menu"
|
||||
addMultiBut(psWScreen,FRONTEND_BOTFORM,FRONTEND_QUIT,10,10,30,29, P_("menu", "Return"),IMAGE_RETURN,IMAGE_RETURN_HI,TRUE);
|
||||
|
||||
SetCurrentSnapID(&InterfaceSnap,FRONTEND_FASTPLAY);
|
||||
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -373,7 +298,6 @@ BOOL runTutorialMenu(void)
|
|||
{
|
||||
UDWORD id;
|
||||
|
||||
processFrontendSnap(TRUE);
|
||||
id = widgRunScreen(psWScreen); // Run the current set of widgets
|
||||
switch(id)
|
||||
{
|
||||
|
@ -402,7 +326,6 @@ BOOL runTutorialMenu(void)
|
|||
changeTitleMode(TITLE);
|
||||
}
|
||||
|
||||
StartCursorSnap(&InterfaceSnap);
|
||||
widgDisplayScreen(psWScreen); // show the widgets currently running
|
||||
|
||||
return TRUE;
|
||||
|
@ -422,7 +345,6 @@ void startSinglePlayerMenu(void)
|
|||
addTextButton(FRONTEND_NEWGAME, FRONTEND_POS3X,FRONTEND_POS3Y,_("New Campaign") ,FALSE,FALSE);
|
||||
|
||||
addSideText (FRONTEND_SIDETEXT ,FRONTEND_SIDEX,FRONTEND_SIDEY,_("SINGLE PLAYER"));
|
||||
SetCurrentSnapID(&InterfaceSnap,FRONTEND_LOADGAME);
|
||||
addMultiBut(psWScreen,FRONTEND_BOTFORM,FRONTEND_QUIT,10,10,30,29, P_("menu", "Return"),IMAGE_RETURN,IMAGE_RETURN_HI,TRUE);
|
||||
}
|
||||
|
||||
|
@ -452,39 +374,29 @@ static void frontEndNewGame( void )
|
|||
|
||||
void loadOK( void )
|
||||
{
|
||||
|
||||
if(strlen(sRequestResult))
|
||||
{
|
||||
strcpy(saveGameName,sRequestResult);
|
||||
changeTitleMode(LOADSAVEGAME);
|
||||
}
|
||||
SetCurrentSnapID(&InterfaceSnap,FRONTEND_LOADGAME);
|
||||
|
||||
}
|
||||
|
||||
BOOL runSinglePlayerMenu(void)
|
||||
{
|
||||
UDWORD id;
|
||||
|
||||
processFrontendSnap(TRUE);
|
||||
|
||||
|
||||
if(bLoadSaveUp)
|
||||
{
|
||||
if(runLoadSave(FALSE))// check for file name.
|
||||
{
|
||||
loadOK();
|
||||
SetCurrentSnapID(&InterfaceSnap,FRONTEND_LOADGAME);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
id = widgRunScreen(psWScreen); // Run the current set of widgets
|
||||
|
||||
|
||||
|
||||
switch(id)
|
||||
{
|
||||
case FRONTEND_NEWGAME:
|
||||
|
@ -525,14 +437,11 @@ BOOL runSinglePlayerMenu(void)
|
|||
|
||||
if(CancelPressed())
|
||||
{
|
||||
|
||||
changeTitleMode(TITLE);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
StartCursorSnap(&InterfaceSnap);
|
||||
|
||||
if(!bLoadSaveUp) // if save/load screen is up
|
||||
{
|
||||
|
@ -564,8 +473,6 @@ BOOL startMultiPlayerMenu(void)
|
|||
|
||||
addMultiBut(psWScreen,FRONTEND_BOTFORM,FRONTEND_QUIT,10,10,30,29, P_("menu", "Return"),IMAGE_RETURN,IMAGE_RETURN_HI,TRUE);
|
||||
|
||||
SetMousePos(320, FRONTEND_BOTFORMY + FRONTEND_POS3Y);
|
||||
SnapToID(&InterfaceSnap,3);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -573,8 +480,6 @@ BOOL runMultiPlayerMenu(void)
|
|||
{
|
||||
UDWORD id;
|
||||
|
||||
processFrontendSnap(TRUE);
|
||||
|
||||
id = widgRunScreen(psWScreen); // Run the current set of widgets
|
||||
switch(id)
|
||||
{
|
||||
|
@ -606,7 +511,6 @@ BOOL runMultiPlayerMenu(void)
|
|||
break;
|
||||
}
|
||||
|
||||
StartCursorSnap(&InterfaceSnap);
|
||||
widgDisplayScreen(psWScreen); // show the widgets currently running
|
||||
|
||||
return TRUE;
|
||||
|
@ -628,9 +532,6 @@ BOOL startOptionsMenu(void)
|
|||
addTextButton(FRONTEND_KEYMAP, FRONTEND_POS5X,FRONTEND_POS5Y, _("Key Mappings"),FALSE,FALSE);
|
||||
addMultiBut(psWScreen,FRONTEND_BOTFORM,FRONTEND_QUIT,10,10,30,29, P_("menu", "Return"),IMAGE_RETURN,IMAGE_RETURN_HI,TRUE);
|
||||
|
||||
SetMousePos(320, FRONTEND_BOTFORMY + FRONTEND_POS3Y);
|
||||
SnapToID(&InterfaceSnap,3);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -639,8 +540,6 @@ BOOL runOptionsMenu(void)
|
|||
{
|
||||
UDWORD id;
|
||||
|
||||
processFrontendSnap(TRUE);
|
||||
|
||||
id = widgRunScreen(psWScreen); // Run the current set of widgets
|
||||
switch(id)
|
||||
{
|
||||
|
@ -683,7 +582,6 @@ BOOL runOptionsMenu(void)
|
|||
|
||||
}
|
||||
|
||||
StartCursorSnap(&InterfaceSnap);
|
||||
widgDisplayScreen(psWScreen); // show the widgets currently running
|
||||
|
||||
return TRUE;
|
||||
|
@ -800,8 +698,6 @@ BOOL runGameOptions2Menu(void)
|
|||
{
|
||||
UDWORD id;
|
||||
|
||||
processFrontendSnap(FALSE);
|
||||
|
||||
id = widgRunScreen(psWScreen); // Run the current set of widgets
|
||||
switch(id)
|
||||
{
|
||||
|
@ -911,7 +807,6 @@ BOOL runGameOptions2Menu(void)
|
|||
changeTitleMode(OPTIONS);
|
||||
}
|
||||
|
||||
StartCursorSnap(&InterfaceSnap);
|
||||
widgDisplayScreen(psWScreen); // show the widgets currently running
|
||||
|
||||
return TRUE;
|
||||
|
@ -952,8 +847,6 @@ BOOL runGameOptions3Menu(void)
|
|||
{
|
||||
UDWORD id;
|
||||
|
||||
processFrontendSnap(FALSE);
|
||||
|
||||
id = widgRunScreen(psWScreen); // Run the current set of widgets
|
||||
switch(id)
|
||||
{
|
||||
|
@ -961,7 +854,6 @@ BOOL runGameOptions3Menu(void)
|
|||
case FRONTEND_FX:
|
||||
case FRONTEND_3D_FX:
|
||||
case FRONTEND_MUSIC:
|
||||
SetMousePos(FRONTEND_BOTFORMX + FRONTEND_POS1M + 5, mouseY() - 3); // move mouse
|
||||
break;
|
||||
|
||||
case FRONTEND_FX_SL:
|
||||
|
@ -990,7 +882,6 @@ BOOL runGameOptions3Menu(void)
|
|||
changeTitleMode(TITLE);
|
||||
}
|
||||
|
||||
StartCursorSnap(&InterfaceSnap);
|
||||
widgDisplayScreen(psWScreen); // show the widgets currently running
|
||||
|
||||
return TRUE;
|
||||
|
@ -1060,15 +951,12 @@ BOOL runGameOptionsMenu(void)
|
|||
{
|
||||
UDWORD id;
|
||||
|
||||
processFrontendSnap(FALSE);
|
||||
|
||||
id = widgRunScreen(psWScreen); // Run the current set of widgets
|
||||
switch(id)
|
||||
{
|
||||
|
||||
// case FRONTEND_GAMMA:
|
||||
case FRONTEND_SCROLLSPEED:
|
||||
SetMousePos(FRONTEND_BOTFORMX + FRONTEND_POS1M + 5, mouseY() - 3); // move mouse
|
||||
break;
|
||||
|
||||
/* case FRONTEND_FOGTYPE:
|
||||
|
@ -1186,7 +1074,6 @@ BOOL runGameOptionsMenu(void)
|
|||
changeTitleMode(TITLE);
|
||||
}
|
||||
|
||||
StartCursorSnap(&InterfaceSnap);
|
||||
widgDisplayScreen(psWScreen); // show the widgets currently running
|
||||
|
||||
return TRUE;
|
||||
|
@ -1481,20 +1368,6 @@ void displayTextOption(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD
|
|||
|
||||
iV_DrawText( psBut->pText, fx, fy);
|
||||
|
||||
|
||||
|
||||
if(!greyOut) // dont snap to unavailable buttons.
|
||||
{
|
||||
// AddCursorSnap(&InterfaceSnap, (SWORD)(fx+10) ,(short) fy,psWidget->formID,psWidget->id,NULL);
|
||||
if (psWidget->style & WBUT_TXTCENTRE) { //check for centering, calculate offset.
|
||||
// DBPRINTF(("%d : %s\n",fx+fw/2,psBut->pText);
|
||||
AddCursorSnap(&InterfaceSnap, (SWORD)(fx+fw/2) ,(short) fy,psWidget->formID,psWidget->id,&FrontendBias);
|
||||
} else {
|
||||
// DBPRINTF(("%d : %s\n",fx+10,psBut->pText);
|
||||
AddCursorSnap(&InterfaceSnap, (SWORD)(fx+10) ,(short) fy,psWidget->formID,psWidget->id,&FrontendBias);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
28
src/hci.c
28
src/hci.c
|
@ -69,8 +69,6 @@
|
|||
#include "winmain.h"
|
||||
#include "wrappers.h"
|
||||
|
||||
#define MAX_INTERFACE_SNAPS 64
|
||||
#define MAX_RADAR_SNAPS 1
|
||||
|
||||
#define RETXOFFSET (0)// Reticule button offset
|
||||
#define RETYOFFSET (0)
|
||||
|
@ -141,8 +139,6 @@ BOOL ClosingTransDroids = FALSE;
|
|||
BOOL ReticuleUp = FALSE;
|
||||
BOOL Refreshing = FALSE;
|
||||
|
||||
CURSORSNAP InterfaceSnap;
|
||||
|
||||
|
||||
/***************************************************************************************/
|
||||
/* Widget ID numbers */
|
||||
|
@ -532,9 +528,6 @@ BOOL intInitialise(void)
|
|||
{
|
||||
UDWORD comp, inc;
|
||||
|
||||
AllocateSnapBuffer(&InterfaceSnap,MAX_INTERFACE_SNAPS);
|
||||
|
||||
|
||||
|
||||
intInitialiseReticule();
|
||||
|
||||
|
@ -780,8 +773,6 @@ void intShutDown(void)
|
|||
// widgEndScreen(psWScreen);
|
||||
widgReleaseScreen(psWScreen);
|
||||
|
||||
ReleaseSnapBuffer(&InterfaceSnap);
|
||||
|
||||
free(apsStructStatsList);
|
||||
free(ppResearchList);
|
||||
free(pList);
|
||||
|
@ -823,11 +814,6 @@ void intRefreshScreen(void)
|
|||
}
|
||||
|
||||
|
||||
void intSetCurrentCursorPosition(CURSORSNAP *Snap,UDWORD id)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BOOL intIsRefreshing(void)
|
||||
{
|
||||
return Refreshing;
|
||||
|
@ -1707,10 +1693,6 @@ INT_RETVAL intRunWidgets(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(InGameOpUp)
|
||||
{
|
||||
intRunInGameOptions();
|
||||
}
|
||||
|
||||
if (MissionResUp) {
|
||||
intRunMissionResult();
|
||||
|
@ -3297,8 +3279,6 @@ void intDisplayWidgets(void)
|
|||
//draw the proximity blips onto the world - done as buttons on the interface now
|
||||
//drawProximityBlips();
|
||||
|
||||
StartCursorSnap(&InterfaceSnap);
|
||||
|
||||
widgDisplayScreen(psWScreen);
|
||||
|
||||
if(bLoadSaveUp)
|
||||
|
@ -4916,14 +4896,9 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
objStatID = statID;
|
||||
intAddObjectStats(psSelected, statID);
|
||||
intMode = INT_STAT;
|
||||
if(!bForceStats) {
|
||||
intSetCurrentCursorPosition(&InterfaceSnap,statID);
|
||||
}
|
||||
|
||||
} else {
|
||||
widgSetButtonState(psWScreen, statID, WBUT_CLICKLOCK);
|
||||
intMode = INT_OBJECT;
|
||||
intSetCurrentCursorPosition(&InterfaceSnap,statID);
|
||||
}
|
||||
}
|
||||
else if (psSelected)
|
||||
|
@ -4940,12 +4915,10 @@ static BOOL intAddObjectWindow(BASE_OBJECT *psObjects, BASE_OBJECT *psSelected,B
|
|||
widgSetButtonState(psWScreen, statID, WBUT_CLICKLOCK);
|
||||
|
||||
intMode = INT_CMDORDER;
|
||||
intSetCurrentCursorPosition(&InterfaceSnap,statID);
|
||||
}
|
||||
else
|
||||
{
|
||||
intMode = INT_OBJECT;
|
||||
intSetCurrentCursorPosition(&InterfaceSnap,statID);
|
||||
}
|
||||
|
||||
|
||||
|
@ -5937,7 +5910,6 @@ donelab:
|
|||
{
|
||||
widgSetTabs(psWScreen, IDSTAT_TABFORM, (UWORD)statForm, 0);
|
||||
widgSetButtonState(psWScreen, statID, WBUT_CLICKLOCK);
|
||||
intSetCurrentCursorPosition(&InterfaceSnap,statID);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "lib/widget/widget.h"
|
||||
|
||||
#include "cdspan.h"
|
||||
#include "csnap.h"
|
||||
#include "message.h"
|
||||
|
||||
// store the objects that are being used for the object bar
|
||||
|
@ -317,8 +316,6 @@ as big as Pie View in Research Msg now*/
|
|||
/* pointer to hold the imd to use for a new template in the design screen */
|
||||
extern iIMDShape *pNewDesignIMD;
|
||||
|
||||
extern CURSORSNAP InterfaceSnap;
|
||||
|
||||
extern BOOL ClosingMessageView;
|
||||
extern BOOL ClosingIntelMap;
|
||||
extern BOOL ClosingTrans;
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "scriptextern.h" // for tutorial
|
||||
#include "keybind.h"
|
||||
#include "multiplay.h"
|
||||
#include "csnap.h"
|
||||
#include "ingameop.h"
|
||||
#include "mission.h"
|
||||
#include "transporter.h"
|
||||
|
@ -94,8 +93,6 @@ static BOOL addQuitOptions(void)
|
|||
W_FORMINIT sFormInit;
|
||||
// UWORD WindowWidth;
|
||||
|
||||
DisableCursorSnapsExcept(INTINGAMEOP);
|
||||
|
||||
if (widgGetFromID(psWScreen,INTINGAMEOP))
|
||||
{
|
||||
widgDelete(psWScreen, INTINGAMEOP); // get rid of the old stuff.
|
||||
|
@ -122,14 +119,9 @@ static BOOL addQuitOptions(void)
|
|||
//resume
|
||||
addIGTextButton(INTINGAMEOP_RESUME, INTINGAMEOP_1_Y, _("Resume Game"), OPALIGN);
|
||||
|
||||
|
||||
SetCurrentSnapID(&InterfaceSnap,INTINGAMEOP_RESUME);
|
||||
|
||||
// quit
|
||||
addIGTextButton(INTINGAMEOP_QUIT_CONFIRM, INTINGAMEOP_2_Y, _("Quit"), OPALIGN);
|
||||
|
||||
SetMousePos(INTINGAMEOP3_X + INTINGAMEOP_1_X, INTINGAMEOP3_Y + INTINGAMEOP_1_Y); // move mouse to resume.
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -138,8 +130,6 @@ static BOOL _addSlideOptions(void)
|
|||
{
|
||||
W_FORMINIT sFormInit;
|
||||
|
||||
DisableCursorSnapsExcept(INTINGAMEOP);
|
||||
|
||||
if (widgGetFromID(psWScreen,INTINGAMEOP))
|
||||
{
|
||||
widgDelete(psWScreen, INTINGAMEOP); // get rid of the old stuff.
|
||||
|
@ -178,8 +168,6 @@ static BOOL _addSlideOptions(void)
|
|||
addFESlider(INTINGAMEOP_CDVOL_S, INTINGAMEOP, INTINGAMEOP_MID, INTINGAMEOP_3_Y-5,
|
||||
AUDIO_VOL_MAX, (int)(sound_GetMusicVolume() * 100), INTINGAMEOP_CDVOL);
|
||||
|
||||
SetCurrentSnapID(&InterfaceSnap, INTINGAMEOP_RESUME);
|
||||
|
||||
/*
|
||||
// gamma
|
||||
if (pie_GetRenderEngine() == ENGINE_GLIDE)
|
||||
|
@ -219,7 +207,6 @@ static BOOL _intAddInGameOptions(void)
|
|||
|
||||
|
||||
setWidgetsStatus(TRUE);
|
||||
DisableCursorSnapsExcept(INTINGAMEOP);
|
||||
|
||||
//if already open, then close!
|
||||
if (widgGetFromID(psWScreen,INTINGAMEOP))
|
||||
|
@ -283,8 +270,6 @@ static BOOL _intAddInGameOptions(void)
|
|||
// add 'resume'
|
||||
addIGTextButton(INTINGAMEOP_RESUME, INTINGAMEOP_1_Y, _("Resume Game"), OPALIGN);
|
||||
|
||||
SetCurrentSnapID(&InterfaceSnap,INTINGAMEOP_RESUME);
|
||||
|
||||
// add 'options'
|
||||
addIGTextButton(INTINGAMEOP_OPTIONS, INTINGAMEOP_2_Y, _("Options"), OPALIGN);
|
||||
|
||||
|
@ -299,8 +284,8 @@ static BOOL _intAddInGameOptions(void)
|
|||
|
||||
intMode = INT_INGAMEOP; // change interface mode.
|
||||
InGameOpUp = TRUE; // inform interface.
|
||||
SetMousePos(INTINGAMEOP_X + INTINGAMEOP_1_X, INTINGAMEOP_Y + INTINGAMEOP_1_Y); // move mouse to resume.
|
||||
|
||||
// TODO: find out if the line below is needed (may be for old csnap stuff)
|
||||
frameSetCursorFromRes(IDC_DEFAULT); // reset cursor (sw)
|
||||
|
||||
return TRUE;
|
||||
|
@ -328,7 +313,6 @@ static void ProcessOptionFinished(void)
|
|||
}
|
||||
|
||||
|
||||
EnableAllCursorSnaps();
|
||||
}
|
||||
|
||||
void intCloseInGameOptionsNoAnim(BOOL bResetMissionWidgets)
|
||||
|
@ -391,15 +375,6 @@ BOOL intCloseInGameOptions(BOOL bPutUpLoadSave, BOOL bResetMissionWidgets)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// In Game Options house keeping stuff.
|
||||
BOOL intRunInGameOptions(void)
|
||||
{
|
||||
|
||||
processFrontendSnap(FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// process clicks made by user.
|
||||
|
@ -451,7 +426,6 @@ void intProcessInGameOptions(UDWORD id)
|
|||
case INTINGAMEOP_3DFXVOL:
|
||||
case INTINGAMEOP_CDVOL:
|
||||
// case INTINGAMEOP_GAMMA:
|
||||
SetMousePos(INTINGAMEOP2_X + INTINGAMEOP_MID + 5, mouseY()); // move mouse
|
||||
break;
|
||||
|
||||
|
||||
|
|
|
@ -672,7 +672,6 @@ BOOL InitialiseGlobals(void)
|
|||
radarInitVars();
|
||||
Edit3DInitVars();
|
||||
|
||||
snapInitVars();
|
||||
driveInitVars(TRUE);
|
||||
|
||||
return TRUE;
|
||||
|
@ -1342,9 +1341,6 @@ BOOL stageOneInitialise(void)
|
|||
//need to reset the event timer too - AB 14/01/99
|
||||
eventTimeReset(gameTime/SCR_TICKRATE);
|
||||
|
||||
// Set the cursor snap max distances.
|
||||
SetMaxDist(64,64);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1620,7 +1616,6 @@ BOOL stageThreeInitialise(void)
|
|||
|
||||
// Re-inititialise some static variables.
|
||||
|
||||
snapInitVars();
|
||||
driveInitVars(FALSE);
|
||||
displayInitVars();
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@
|
|||
#include "console.h"
|
||||
#include "cmddroid.h"
|
||||
#include "group.h"
|
||||
#include "csnap.h"
|
||||
#include "text.h"
|
||||
#include "transporter.h"
|
||||
#include "mission.h"
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
#include "lib/sound/cdaudio.h"
|
||||
|
||||
#include "scriptextern.h"
|
||||
#include "csnap.h"
|
||||
|
||||
#define NO_VIDEO
|
||||
|
||||
|
@ -423,8 +422,6 @@ static BOOL intAddMessageForm(BOOL playCurrent)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
intSetCurrentCursorPosition(&InterfaceSnap,sBFormInit.id);
|
||||
|
||||
/* if the current message matches psSelected lock the button */
|
||||
if (psMessage == psCurrentMsg)
|
||||
{
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "init.h"
|
||||
#include "loadsave.h"
|
||||
#include "keymap.h"
|
||||
#include "csnap.h"
|
||||
#include "intimage.h"
|
||||
#include "lib/ivis_common/bitimage.h"
|
||||
#include "intdisplay.h"
|
||||
|
@ -277,7 +276,6 @@ BOOL runKeyMapEditor(void)
|
|||
}
|
||||
}
|
||||
|
||||
StartCursorSnap(&InterfaceSnap);
|
||||
widgDisplayScreen(psWScreen); // show the widgets currently running
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -83,7 +83,6 @@
|
|||
#include "edit3d.h"
|
||||
#include "drive.h"
|
||||
#include "target.h"
|
||||
#include "csnap.h"
|
||||
#include "fpath.h"
|
||||
#include "scriptextern.h"
|
||||
#include "cluster.h"
|
||||
|
@ -452,7 +451,6 @@ GAMECODE gameLoop(void)
|
|||
|
||||
if(InGameOpUp) // ingame options menu up, run it!
|
||||
{
|
||||
intRunInGameOptions();
|
||||
widgval = widgRunScreen(psWScreen);
|
||||
intProcessInGameOptions(widgval);
|
||||
if(widgval == INTINGAMEOP_QUIT_CONFIRM)
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include "group.h"
|
||||
#include "text.h"
|
||||
#include "frontend.h" // for displaytextoption.
|
||||
#include "csnap.h" // cursor snapping
|
||||
#include "intdisplay.h"
|
||||
#include "winmain.h"
|
||||
#include "display.h"
|
||||
|
@ -3383,7 +3382,6 @@ static BOOL _intAddMissionResult(BOOL result, BOOL bPlaySuccess)
|
|||
sButInit.y = MISSION_2_Y-8;
|
||||
sButInit.pText = _("Quit To Main Menu");
|
||||
widgAddButton(psWScreen, &sButInit);
|
||||
intSetCurrentCursorPosition(&InterfaceSnap,sButInit.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3392,7 +3390,6 @@ static BOOL _intAddMissionResult(BOOL result, BOOL bPlaySuccess)
|
|||
sButInit.id = IDMISSIONRES_CONTINUE;
|
||||
sButInit.pText = _("Continue Game");//"Continue Game";
|
||||
widgAddButton(psWScreen, &sButInit);
|
||||
intSetCurrentCursorPosition(&InterfaceSnap,sButInit.id);
|
||||
}
|
||||
|
||||
/* Only add save option if in the game for real, ie, not fastplay.
|
||||
|
@ -3406,7 +3403,6 @@ static BOOL _intAddMissionResult(BOOL result, BOOL bPlaySuccess)
|
|||
sButInit.y = MISSION_1_Y;
|
||||
sButInit.pText = _("Save Game");//"Save Game";
|
||||
widgAddButton(psWScreen, &sButInit);
|
||||
intSetCurrentCursorPosition(&InterfaceSnap,sButInit.id);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -3417,7 +3413,6 @@ static BOOL _intAddMissionResult(BOOL result, BOOL bPlaySuccess)
|
|||
sButInit.y = MISSION_1_Y;
|
||||
sButInit.pText = _("Load Saved Game");//"Load Saved Game";
|
||||
widgAddButton(psWScreen, &sButInit);
|
||||
intSetCurrentCursorPosition(&InterfaceSnap,sButInit.id);
|
||||
//quit
|
||||
sButInit.id = IDMISSIONRES_QUIT;
|
||||
sButInit.x = MISSION_2_X;
|
||||
|
@ -3482,7 +3477,6 @@ void intRemoveMissionResultNoAnim(void)
|
|||
void intRunMissionResult(void)
|
||||
{
|
||||
|
||||
processFrontendSnap(FALSE);
|
||||
frameSetCursorFromRes(IDC_DEFAULT);
|
||||
|
||||
if(bLoadSaveUp)
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
#include "intdisplay.h"
|
||||
#include "design.h"
|
||||
#include "hci.h"
|
||||
#include "csnap.h"
|
||||
#include "power.h"
|
||||
#include "loadsave.h" // for blueboxes.
|
||||
// FIXME Direct iVis implementation include!
|
||||
|
@ -429,8 +428,6 @@ void runConnectionScreen(void )
|
|||
static char addr[128];
|
||||
void * finalconnection;
|
||||
|
||||
processFrontendSnap(TRUE);
|
||||
|
||||
if(SettingsUp ==1)
|
||||
{
|
||||
id = widgRunScreen(psConScreen); // Run the current set of widgets
|
||||
|
@ -511,8 +508,6 @@ void runConnectionScreen(void )
|
|||
}
|
||||
}
|
||||
|
||||
StartCursorSnap(&InterfaceSnap);
|
||||
|
||||
widgDisplayScreen(psWScreen); // show the widgets currently running
|
||||
if(SettingsUp == 1)
|
||||
{
|
||||
|
@ -598,8 +593,6 @@ void runGameFind(void )
|
|||
addGames(); //redraw list
|
||||
}
|
||||
|
||||
processFrontendSnap(FALSE);
|
||||
|
||||
id = widgRunScreen(psWScreen); // Run the current set of widgets
|
||||
|
||||
if(id == CON_CANCEL) // ok
|
||||
|
@ -643,8 +636,6 @@ void runGameFind(void )
|
|||
|
||||
FAIL:
|
||||
|
||||
StartCursorSnap(&InterfaceSnap);
|
||||
|
||||
widgDisplayScreen(psWScreen); // show the widgets currently running
|
||||
if(safeSearch)
|
||||
{
|
||||
|
@ -2232,8 +2223,6 @@ void runMultiOptions(void)
|
|||
KEY_CODE k;
|
||||
char str[3];
|
||||
|
||||
processFrontendSnap(FALSE);
|
||||
|
||||
frontendMultiMessages();
|
||||
|
||||
|
||||
|
@ -2377,8 +2366,6 @@ void runMultiOptions(void)
|
|||
processMultiopWidgets(id);
|
||||
}
|
||||
|
||||
StartCursorSnap(&InterfaceSnap);
|
||||
|
||||
widgDisplayScreen(psWScreen); // show the widgets currently running
|
||||
|
||||
if(multiRequestUp)
|
||||
|
@ -2663,10 +2650,6 @@ void displayChatEdit(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *p
|
|||
UDWORD y = yOffset+psWidget->y -4; // 4 is the magic number.
|
||||
iV_Line(x, y, x+psWidget->width , y, iV_PaletteNearestColour(100,100,160) );
|
||||
|
||||
AddCursorSnap(&InterfaceSnap,
|
||||
(SWORD)(x+(psWidget->width/2)) ,
|
||||
(SWORD)(y+(psWidget->height/2)) ,psWidget->formID,psWidget->id,NULL);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2755,9 +2738,6 @@ void displayRemoteGame(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD
|
|||
iV_DrawText(tmp, x + 17, y + 33);
|
||||
}
|
||||
|
||||
AddCursorSnap(&InterfaceSnap,
|
||||
(SWORD)(x+(psWidget->width/2)),
|
||||
(SWORD)(y+(psWidget->height/2)),psWidget->formID,psWidget->id,NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3040,9 +3020,6 @@ void displayPlayer(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pCo
|
|||
// iV_DrawImage(FrontImages,IMAGE_PLAYER_PC,x+2,y+9);
|
||||
//}
|
||||
}
|
||||
AddCursorSnap(&InterfaceSnap,
|
||||
(SWORD)(x+(psWidget->width/2)),
|
||||
(SWORD)(y+(psWidget->height/2)),psWidget->formID,psWidget->id,NULL);
|
||||
|
||||
}
|
||||
|
||||
|
@ -3079,9 +3056,6 @@ void displayMultiEditBox(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWOR
|
|||
pie_UniTransBoxFill(x,y, x+psWidget->width+psWidget->height ,y+psWidget->height,(FILLRED<<16) | (FILLGREEN<<8) | FILLBLUE, FILLTRANS);
|
||||
}
|
||||
|
||||
AddCursorSnap(&InterfaceSnap,
|
||||
(SWORD)(x+(psWidget->width/2)),
|
||||
(SWORD)(y+(psWidget->height/2)),psWidget->formID,psWidget->id,NULL);
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -3182,11 +3156,6 @@ void displayMultiBut(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *p
|
|||
if (Grey) {
|
||||
// disabled, render something over it!
|
||||
iV_TransBoxFill(x,y,x+psWidget->width,y+psWidget->height);
|
||||
} else {
|
||||
// add a snap.
|
||||
AddCursorSnap(&InterfaceSnap,
|
||||
(SWORD)(x+(psWidget->width/2)),
|
||||
(SWORD)(y+(psWidget->height/2)),psWidget->formID,psWidget->id,NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "lib/framework/frame.h"
|
||||
#include "lib/framework/frameresource.h"
|
||||
#include "lib/framework/strres.h"
|
||||
#include "csnap.h"
|
||||
#include "lib/widget/widget.h"
|
||||
#include "hci.h"
|
||||
#include "text.h"
|
||||
|
@ -263,7 +262,6 @@ void runLimitScreen(void)
|
|||
{
|
||||
UDWORD id,statid;
|
||||
|
||||
processFrontendSnap(FALSE);
|
||||
frontendMultiMessages(); // network stuff.
|
||||
|
||||
id = widgRunScreen(psWScreen); // Run the current set of widgets
|
||||
|
@ -314,8 +312,6 @@ void runLimitScreen(void)
|
|||
}
|
||||
}
|
||||
|
||||
StartCursorSnap(&InterfaceSnap);
|
||||
|
||||
widgDisplayScreen(psWScreen); // show the widgets currently running
|
||||
}
|
||||
|
||||
|
@ -458,8 +454,5 @@ static void displayStructureBar(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset
|
|||
sprintf(str,"%d",((W_SLIDER*)(widgGetFromID(psWScreen,psWidget->id+1)))->pos);
|
||||
iV_DrawText(str, x+270, y+(psWidget->height/2)+3);
|
||||
|
||||
// add snap
|
||||
AddCursorSnap(&InterfaceSnap,(SWORD)(x+10) , (SWORD)(y+10) , psWidget->formID,psWidget->id,NULL);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include "loadsave.h" // for drawbluebox
|
||||
#include "console.h"
|
||||
#include "ai.h"
|
||||
#include "csnap.h"
|
||||
#include "frend.h"
|
||||
#include "lib/netplay/netplay.h"
|
||||
#include "multiplay.h"
|
||||
|
@ -273,8 +272,6 @@ void displayRequestOption(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWO
|
|||
iV_DrawImage(FrontImages,IMAGE_WEE_GUY,(x+(6*count)+6),y+16);
|
||||
}
|
||||
|
||||
AddCursorSnap(&InterfaceSnap, (SWORD)(x+5),(SWORD)(y+5),psWidget->formID,psWidget->id,NULL);
|
||||
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -56,9 +56,6 @@
|
|||
|
||||
#include "multiplay.h"
|
||||
|
||||
|
||||
#include "csnap.h"
|
||||
|
||||
//#define IDTRANS_FORM 9000 //The Transporter base form
|
||||
#define IDTRANS_TABFORM 9001 //The Transporter tabbed form
|
||||
#define IDTRANS_CLOSE 9002 //The close button icon
|
||||
|
@ -443,9 +440,6 @@ BOOL intAddTransporterContents(void)
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
if(!AlreadyUp) {
|
||||
intSetCurrentCursorPosition(&InterfaceSnap,sButFInit.id);
|
||||
}
|
||||
}
|
||||
|
||||
if (!intAddTransContentsForm())
|
||||
|
@ -793,7 +787,6 @@ BOOL intAddTransContentsForm(void)
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
// intSetCurrentCursorPosition(&InterfaceSnap,sBFormInit.id);
|
||||
|
||||
/* Update the init struct for the next button */
|
||||
sBFormInit.id += 1;
|
||||
|
@ -1055,11 +1048,6 @@ BOOL intAddDroidsAvailForm(void)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
// Snap to the first button in the form.
|
||||
if(sBFormInit.id == IDTRANS_DROIDSTART) {
|
||||
intSetCurrentCursorPosition(&InterfaceSnap,sBFormInit.id);
|
||||
}
|
||||
|
||||
//add bar to indicate stare of repair
|
||||
sBarInit.size = (UWORD) PERCENT(psDroid->body, psDroid->originalBody);
|
||||
if(sBarInit.size > 100)
|
||||
|
|
|
@ -476,10 +476,6 @@
|
|||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="src/console.h" />
|
||||
<Unit filename="src/csnap.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="src/csnap.h" />
|
||||
<Unit filename="src/data.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
|
|
|
@ -589,10 +589,6 @@
|
|||
RelativePath="..\src\console.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\csnap.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\data.c"
|
||||
>
|
||||
|
@ -1156,10 +1152,6 @@
|
|||
RelativePath="..\src\console.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\csnap.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lib\framework\cursors.h"
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue