[Opentnl-cvs] tnl/zap UIGame.cpp,1.14,1.15 main.cpp,1.14,1.15 ship.cpp,1.21,1.22 winJoystick.cpp,1.5
Brought to you by:
mark_frohnmayer,
s_alanet
From: Mark F. <mar...@us...> - 2004-05-03 02:41:09
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3512/zap Modified Files: UIGame.cpp main.cpp ship.cpp winJoystick.cpp Log Message: Shield is now a circle Added better mouse support on Win32 Changed team colors to Red and Blue in soccer Index: main.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/main.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** main.cpp 2 May 2004 06:27:41 -0000 1.14 --- main.cpp 3 May 2004 02:41:01 -0000 1.15 *************** *** 49,52 **** --- 49,53 ---- bool gIsServer = false; const char *gHostName = "ZAP Game"; + const char *gWindowTitle = "ZAP II - The Return"; U32 gMaxPlayers = 128; const char *gMasterAddressString = "IP:master.opentnl.org:29005"; *************** *** 353,357 **** glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB); ! glutCreateWindow("ZAP II - The Return"); glutDisplayFunc(display); glutReshapeFunc(reshape); --- 354,358 ---- glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB); ! glutCreateWindow(gWindowTitle); glutDisplayFunc(display); glutReshapeFunc(reshape); Index: UIGame.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/UIGame.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** UIGame.cpp 2 May 2004 06:27:41 -0000 1.14 --- UIGame.cpp 3 May 2004 02:41:01 -0000 1.15 *************** *** 99,102 **** --- 99,106 ---- } + #ifdef TNL_OS_WIN32 + extern void checkMousePos(S32 maxdx, S32 maxdy); + #endif + void GameUserInterface::render() { *************** *** 125,132 **** if(!OptionsMenuUserInterface::joystickEnabled) { glPushMatrix(); glTranslatef(400, 300, 0); ! glTranslatef(mMousePoint.x, mMousePoint.y, 0); static U32 cursorSpin = 90; --- 129,148 ---- if(!OptionsMenuUserInterface::joystickEnabled) { + Point realMousePoint = mMousePoint; + + #ifdef TNL_OS_WIN32 + + F32 len = mMousePoint.len(); + checkMousePos(windowWidth * 100 / canvasWidth, + windowHeight * 100 / canvasHeight); + + if(len > 100) + realMousePoint *= 100 / len; + #endif + glPushMatrix(); glTranslatef(400, 300, 0); ! glTranslatef(realMousePoint.x, realMousePoint.y, 0); static U32 cursorSpin = 90; *************** *** 234,237 **** --- 250,259 ---- void GameUserInterface::onMouseMoved(S32 x, S32 y) { + S32 xp = x - windowWidth / 2; + S32 yp = y - windowHeight / 2; + S32 horzMax = 100 * windowWidth / canvasWidth; + S32 vertMax = 100 * windowHeight / canvasHeight; + + mMousePoint = Point(x - windowWidth / 2, y - windowHeight / 2); mMousePoint.x *= canvasWidth / windowWidth; Index: winJoystick.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/winJoystick.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** winJoystick.cpp 27 Apr 2004 22:36:48 -0000 1.5 --- winJoystick.cpp 3 May 2004 02:41:01 -0000 1.6 *************** *** 37,40 **** --- 37,76 ---- { + extern const char *gWindowTitle; + + void checkMousePos(S32 maxdx, S32 maxdy) + { + char windowName[256]; + + HWND theWindow = GetForegroundWindow(); + GetWindowText(theWindow, windowName, sizeof(windowName)); + + if(strcmp(windowName, gWindowTitle)) + return; + + RECT r; + + GetWindowRect(theWindow, &r); + POINT cp; + GetCursorPos(&cp); + + S32 centerX = (r.right + r.left) >> 1; + S32 centerY = (r.bottom + r.top) >> 1; + + cp.x -= centerX; + cp.y -= centerY; + + if(cp.x > maxdx) + cp.x = maxdx; + if(cp.y > maxdy) + cp.y = maxdy; + if(cp.x < -maxdx) + cp.x = -maxdx; + if(cp.y < -maxdy) + cp.y = -maxdy; + + SetCursorPos(int(centerX + cp.x), int(centerY + cp.y)); + } + BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext ); Index: ship.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/ship.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ship.cpp 1 May 2004 19:47:26 -0000 1.21 --- ship.cpp 3 May 2004 02:41:01 -0000 1.22 *************** *** 942,950 **** if(mShield) { glColor4f(1,1,0, alpha); glBegin(GL_LINE_LOOP); ! glVertex2f(-23, -18); ! glVertex2f(0, 27); ! glVertex2f(23, -18); glEnd(); } --- 942,952 ---- if(mShield) { + F32 shieldRadius = mRadius + 3; + glColor4f(1,1,0, alpha); glBegin(GL_LINE_LOOP); ! for(F32 theta = 0; theta <= 2 * 3.1415; theta += 0.3) ! glVertex2f(cos(theta) * shieldRadius, sin(theta) * shieldRadius); ! glEnd(); } |