Added some console functions (map_load, map_save, config_load, config_save, exec)

Added Bind method to the ControlSchemeClass
This commit is contained in:
2003-10-20 15:22:05 -04:00
parent 1685e64676
commit b512f5dd90
24 changed files with 894 additions and 645 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 22 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 22 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
bass.dll

Binary file not shown.

View File

@@ -3,12 +3,19 @@
#include "list.h" #include "list.h"
#include <windows.h> #include <windows.h>
enum {CTRLS_FORWARD, CTRLS_BACKWARD, CTRLS_LOOKLEFT, CTRLS_LOOKRIGHT, CTRLS_LOOKUP,
CTRLS_LOOKDOWN, CTRLS_MOVELEFT, CTRLS_MOVERIGHT, CTRLS_MOVEUP, CTRLS_MOVEDOWN,
CTRLS_ROLLLEFT, CTRLS_ROLLRIGHT, CTRLS_FIREPRIMARY, CTRLS_FIRESECONDARY,
CTRLS_WEAPONNEXT, CTRLS_WEAPONPREV, CTRLS_TOGGLE_LIGHTS, CTRLS_TOGGLE_FPS,
CTRLS_TOGGLE_CONSOLE, CTRLS_TOGGLE_MOUSELOOK, CTRLS_QUICKMOUSELOOK};
class ControlSchemeClass class ControlSchemeClass
{ {
public: public:
void LoadDefaultControlScheme(); void LoadDefaultControlScheme();
void ClearControlScheme(); void ClearControlScheme();
void Unbind(uint8); void Unbind(uint8);
bool Bind(uint32, uint8);
list<uint8> forward; list<uint8> forward;
list<uint8> backward; list<uint8> backward;

Binary file not shown.

BIN
oa.ncb

Binary file not shown.

2
oa.sln
View File

@@ -1,4 +1,4 @@
Microsoft Visual Studio Solution File, Format Version 7.00 Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "oa", "oa.vcproj", "{6F5D0FF6-A032-4356-932E-865B601E0DD4}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "oa", "oa.vcproj", "{6F5D0FF6-A032-4356-932E-865B601E0DD4}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
EndProjectSection EndProjectSection

BIN
oa.suo

Binary file not shown.

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="7.0" Version="7.10"
Name="oa" Name="oa"
ProjectGUID="{6F5D0FF6-A032-4356-932E-865B601E0DD4}" ProjectGUID="{6F5D0FF6-A032-4356-932E-865B601E0DD4}"
SccProjectName="" SccProjectName=""

View File

@@ -135,3 +135,138 @@ void ControlSchemeClass::Unbind(uint8 key)
weaponNext.Remove(key); weaponNext.Remove(key);
weaponPrev.Remove(key); weaponPrev.Remove(key);
} }
bool ControlSchemeClass::Bind(uint32 action, uint8 key)
{
switch(action)
{
case CTRLS_FORWARD:
{
Unbind(key);
forward.Insert(key);
return true;
}
case CTRLS_BACKWARD:
{
Unbind(key);
backward.Insert(key);
return true;
}
case CTRLS_LOOKLEFT:
{
Unbind(key);
lookLeft.Insert(key);
return true;
}
case CTRLS_LOOKRIGHT:
{
Unbind(key);
lookRight.Insert(key);
return true;
}
case CTRLS_LOOKUP:
{
Unbind(key);
lookUp.Insert(key);
return true;
}
case CTRLS_LOOKDOWN:
{
Unbind(key);
lookDown.Insert(key);
return true;
}
case CTRLS_MOVELEFT:
{
Unbind(key);
moveLeft.Insert(key);
return true;
}
case CTRLS_MOVERIGHT:
{
Unbind(key);
moveRight.Insert(key);
return true;
}
case CTRLS_MOVEUP:
{
Unbind(key);
moveUp.Insert(key);
return true;
}
case CTRLS_MOVEDOWN:
{
Unbind(key);
moveDown.Insert(key);
return true;
}
case CTRLS_ROLLLEFT:
{
Unbind(key);
rollLeft.Insert(key);
return true;
}
case CTRLS_ROLLRIGHT:
{
Unbind(key);
rollRight.Insert(key);
return true;
}
case CTRLS_FIREPRIMARY:
{
Unbind(key);
firePrimary.Insert(key);
return true;
}
case CTRLS_FIRESECONDARY:
{
Unbind(key);
fireSecondary.Insert(key);
return true;
}
case CTRLS_WEAPONNEXT:
{
Unbind(key);
weaponNext.Insert(key);
return true;
}
case CTRLS_WEAPONPREV:
{
Unbind(key);
weaponPrev.Insert(key);
return true;
}
case CTRLS_TOGGLE_LIGHTS:
{
Unbind(key);
toggleLights.Insert(key);
return true;
}
case CTRLS_TOGGLE_FPS:
{
Unbind(key);
toggleFPS.Insert(key);
return true;
}
case CTRLS_TOGGLE_CONSOLE:
{
Unbind(key);
toggleConsole.Insert(key);
return true;
}
case CTRLS_TOGGLE_MOUSELOOK:
{
Unbind(key);
toggleMouseLook.Insert(key);
return true;
}
case CTRLS_QUICKMOUSELOOK:
{
Unbind(key);
quickMouseLook.Insert(key);
return true;
}
default:
return false;
}
}

View File

@@ -492,84 +492,86 @@ void LEVEL::Execute(string cmd)
if(command == "forward") if(command == "forward")
{ {
defaultPlayer->controls.forward.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_FORWARD, KeyName(word(cmd, ++i)));
} }
else if(command == "backward") else if(command == "backward")
{ {
defaultPlayer->controls.backward.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_BACKWARD, KeyName(word(cmd, ++i)));
} }
else if(command == "lookleft") else if(command == "lookleft")
{ {
defaultPlayer->controls.lookLeft.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_LOOKLEFT, KeyName(word(cmd, ++i)));
} }
else if(command == "lookright") else if(command == "lookright")
{ {
defaultPlayer->controls.lookRight.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_LOOKRIGHT, KeyName(word(cmd, ++i)));
} }
else if(command == "lookup") else if(command == "lookup")
{ {
defaultPlayer->controls.lookUp.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_LOOKUP, KeyName(word(cmd, ++i)));
} }
else if(command == "lookdown") else if(command == "lookdown")
{ {
defaultPlayer->controls.lookDown.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_LOOKDOWN, KeyName(word(cmd, ++i)));
} }
else if(command == "moveup") else if(command == "moveup")
{ {
defaultPlayer->controls.moveUp.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_MOVEUP, KeyName(word(cmd, ++i)));
} }
else if(command == "movedown") else if(command == "movedown")
{ {
defaultPlayer->controls.moveDown.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_MOVEDOWN, KeyName(word(cmd, ++i)));
} }
else if(command == "moveleft") else if(command == "moveleft")
{ {
defaultPlayer[0].controls.moveLeft.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_MOVELEFT, KeyName(word(cmd, ++i)));
} }
else if(command == "moveright") else if(command == "moveright")
{ {
defaultPlayer[0].controls.moveRight.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_MOVERIGHT, KeyName(word(cmd, ++i)));
} }
else if(command == "fireprimary") else if(command == "fireprimary")
{ {
defaultPlayer->controls.firePrimary.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_FIREPRIMARY, KeyName(word(cmd, ++i)));
} }
else if(command == "firesecondary") else if(command == "firesecondary")
{ {
defaultPlayer->controls.fireSecondary.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_FIRESECONDARY, KeyName(word(cmd, ++i)));
} }
else if(command == "weapnext") else if(command == "weapnext")
{ {
defaultPlayer->controls.weaponNext.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_WEAPONNEXT, KeyName(word(cmd, ++i)));
} }
else if(command == "weapprev") else if(command == "weapprev")
{ {
defaultPlayer->controls.weaponPrev.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_WEAPONPREV, KeyName(word(cmd, ++i)));
} }
else if(command == "togglelights" || command == "togglelighting") else if(command == "togglelights" || command == "togglelighting")
{ {
defaultPlayer->controls.toggleLights.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_TOGGLE_LIGHTS, KeyName(word(cmd, ++i)));
} }
else if(command == "togglefps") else if(command == "togglefps")
{ {
defaultPlayer->controls.toggleFPS.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_TOGGLE_FPS, KeyName(word(cmd, ++i)));
} }
else if(command == "toggleconsole") else if(command == "toggleconsole")
{ {
defaultPlayer->controls.toggleConsole.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_TOGGLE_CONSOLE, KeyName(word(cmd, ++i)));
} }
else if(command == "togglemouselook") else if(command == "togglemouselook")
{ {
defaultPlayer->controls.toggleMouseLook.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_TOGGLE_MOUSELOOK, KeyName(word(cmd, ++i)));
} }
else if(command == "quickmouselook") else if(command == "quickmouselook")
{ {
defaultPlayer->controls.quickMouseLook.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_QUICKMOUSELOOK, KeyName(word(cmd, ++i)));
} }
} }
else if(command == "map") else if(command == "map" || command == "map_load")
{ {
nextLevel = word(cmd, ++i); nextLevel = word(cmd, ++i);
UnloadMap();
LoadMap();
} }
else if(command == "unbind") else if(command == "unbind")
{ {
@@ -584,6 +586,54 @@ void LEVEL::Execute(string cmd)
defaultPlayer[0].controls.Unbind(KeyName(command)); defaultPlayer[0].controls.Unbind(KeyName(command));
} }
} }
else if(command == "exec" || command == "config_load")
{
command = tolower(word(cmd, ++i));
LoadConfig(command);
}
else if(command == "map_save")
{
command = tolower(word(cmd, ++i));
SaveMap(command);
}
else if(command == "config_save")
{
command = tolower(word(cmd, ++i));
SaveConfig(command);
}
/*
else if(command == "map_add_triangle")
{
if(triangles != NULL)
{
TRIANGLE* temp = triangles;
triangles = new TRIANGLE[numTriangles + 1];
for(int i=0; i<numTriangles; i++)
{
triangles[i] = temp[i];
}
triangles[numTriangles].texID = 0;
for(int i=0; i<3; i++)
{
triangles[numTriangles].vertecies[i].x = 0;
triangles[numTriangles].vertecies[i].y = 0;
triangles[numTriangles].vertecies[i].z = 0;
triangles[numTriangles].texCoords[i].x = 0;
triangles[numTriangles].texCoords[i].y = 0;
}
numTriangles++;
}
else
{
}
}
*/
} }
} }
@@ -628,77 +678,116 @@ void LEVEL::ParseCmds(LPSTR lpCmdLine)
if(command == "forward") if(command == "forward")
{ {
defaultPlayer->controls.forward.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_FORWARD, KeyName(word(cmd, ++i)));
} }
else if(command == "backward") else if(command == "backward")
{ {
defaultPlayer->controls.backward.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_BACKWARD, KeyName(word(cmd, ++i)));
} }
else if(command == "lookleft") else if(command == "lookleft")
{ {
defaultPlayer->controls.lookLeft.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_LOOKLEFT, KeyName(word(cmd, ++i)));
} }
else if(command == "lookright") else if(command == "lookright")
{ {
defaultPlayer->controls.lookRight.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_LOOKRIGHT, KeyName(word(cmd, ++i)));
} }
else if(command == "lookup") else if(command == "lookup")
{ {
defaultPlayer->controls.lookUp.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_LOOKUP, KeyName(word(cmd, ++i)));
} }
else if(command == "lookdown") else if(command == "lookdown")
{ {
defaultPlayer->controls.lookDown.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_LOOKDOWN, KeyName(word(cmd, ++i)));
} }
else if(command == "moveup") else if(command == "moveup")
{ {
defaultPlayer->controls.moveUp.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_MOVEUP, KeyName(word(cmd, ++i)));
} }
else if(command == "movedown") else if(command == "movedown")
{ {
defaultPlayer->controls.moveDown.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_MOVEDOWN, KeyName(word(cmd, ++i)));
}
else if(command == "moveleft")
{
defaultPlayer[0].controls.Bind(CTRLS_MOVELEFT, KeyName(word(cmd, ++i)));
}
else if(command == "moveright")
{
defaultPlayer[0].controls.Bind(CTRLS_MOVERIGHT, KeyName(word(cmd, ++i)));
} }
else if(command == "fireprimary") else if(command == "fireprimary")
{ {
defaultPlayer->controls.firePrimary.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_FIREPRIMARY, KeyName(word(cmd, ++i)));
} }
else if(command == "firesecondary") else if(command == "firesecondary")
{ {
defaultPlayer->controls.fireSecondary.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_FIRESECONDARY, KeyName(word(cmd, ++i)));
} }
else if(command == "weapnext") else if(command == "weapnext")
{ {
defaultPlayer->controls.weaponNext.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_WEAPONNEXT, KeyName(word(cmd, ++i)));
} }
else if(command == "weapprev") else if(command == "weapprev")
{ {
defaultPlayer->controls.weaponPrev.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_WEAPONPREV, KeyName(word(cmd, ++i)));
} }
else if(command == "togglelights" || command == "togglelighting") else if(command == "togglelights" || command == "togglelighting")
{ {
defaultPlayer->controls.toggleLights.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_TOGGLE_LIGHTS, KeyName(word(cmd, ++i)));
} }
else if(command == "togglefps") else if(command == "togglefps")
{ {
defaultPlayer->controls.toggleFPS.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_TOGGLE_FPS, KeyName(word(cmd, ++i)));
} }
else if(command == "toggleconsole") else if(command == "toggleconsole")
{ {
defaultPlayer->controls.toggleConsole.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_TOGGLE_CONSOLE, KeyName(word(cmd, ++i)));
} }
else if(command == "togglemouselook") else if(command == "togglemouselook")
{ {
defaultPlayer->controls.toggleMouseLook.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_TOGGLE_MOUSELOOK, KeyName(word(cmd, ++i)));
} }
else if(command == "quickmouselook") else if(command == "quickmouselook")
{ {
defaultPlayer->controls.quickMouseLook.Insert(KeyName(word(cmd, ++i))); defaultPlayer[0].controls.Bind(CTRLS_QUICKMOUSELOOK, KeyName(word(cmd, ++i)));
} }
} }
else if(command == "+map") else if(command == "+map" || command == "+map_load")
{ {
nextLevel = word(cmd, ++i); nextLevel = word(cmd, ++i);
UnloadMap();
LoadMap();
} }
else if(command == "+unbind")
{
command = tolower(word(cmd, ++i));
if(command == "all")
{
defaultPlayer[0].controls.ClearControlScheme();
}
else
{
defaultPlayer[0].controls.Unbind(KeyName(command));
}
}
else if(command == "+exec" || command == "+config_load")
{
command = tolower(word(cmd, ++i));
LoadConfig(command);
}
else if(command == "+map_save")
{
command = tolower(word(cmd, ++i));
SaveMap(command);
}
else if(command == "+config_save")
{
command = tolower(word(cmd, ++i));
SaveConfig(command);
}
} }
} }

View File

@@ -357,6 +357,10 @@ LRESULT CALLBACK WndProc(HWND hWnd,
{ {
level.UpdateConsole('\n'); level.UpdateConsole('\n');
} }
if(wParam == VK_SHIFT)
{
keys[VK_SHIFT] = true;
}
else if(wParam == VK_SPACE) else if(wParam == VK_SPACE)
{ {
level.UpdateConsole(' '); level.UpdateConsole(' ');
@@ -366,15 +370,27 @@ LRESULT CALLBACK WndProc(HWND hWnd,
level.UpdateConsole(VK_BACK); level.UpdateConsole(VK_BACK);
} }
else if(isalpha(uint8(wParam))) else if(isalpha(uint8(wParam)))
{
if(keys[VK_SHIFT])
{
level.UpdateConsole(wParam);
}
else
{
level.UpdateConsole(tolower(wParam));
}
}
else if(isdigit(uint8(wParam)))
{ {
level.UpdateConsole(wParam); level.UpdateConsole(wParam);
} }
} }
else else
{ {
keys[wParam] = true; keys[wParam] = true;
return 0;
} }
return 0;
} }
case WM_KEYUP: case WM_KEYUP:
{ {
@@ -382,6 +398,8 @@ LRESULT CALLBACK WndProc(HWND hWnd,
keys2[wParam] = false; keys2[wParam] = false;
return 0; return 0;
} }
case WM_SYSKEYDOWN:
break;
case WM_SIZE: case WM_SIZE:
{ {
ReSizeGLScene(LOWORD(lParam),HIWORD(lParam)); ReSizeGLScene(LOWORD(lParam),HIWORD(lParam));
@@ -447,10 +465,10 @@ int WINAPI WinMain( HINSTANCE hInstance,
level.glFont.SetScreenDimensions(g_Screen.width*2, g_Screen.height*2); level.glFont.SetScreenDimensions(g_Screen.width*2, g_Screen.height*2);
//level.glFont.BuildFont("oa\\textures\\menu\\font.bmp");//(level.gamedir + "\\textures\\menu\\font.bmp").c_str()); //level.glFont.BuildFont("oa\\textures\\menu\\font.bmp");//(level.gamedir + "\\textures\\menu\\font.bmp").c_str());
if (level.nextLevel != "") if (level.nextLevel == "")
level.LoadMap(); {
else
level.LoadMap("intro.map"); level.LoadMap("intro.map");
}
if (!CreateGLWindow(g_Screen.name, g_Screen.width, g_Screen.height, g_Screen.bpp, g_Screen.fullscreen)) if (!CreateGLWindow(g_Screen.name, g_Screen.width, g_Screen.height, g_Screen.bpp, g_Screen.fullscreen))
{ {
@@ -781,7 +799,7 @@ int WINAPI WinMain( HINSTANCE hInstance,
} }
//level.Render(); //level.Render();
} }
level.Render(); level.Render();
// //
} }
} }

BIN
vc70.idb

Binary file not shown.