diff --git a/OpenArena/oa/config/my.cfg b/OpenArena/oa/config/my.cfg index 6e3b063..f3bfebe 100644 --- a/OpenArena/oa/config/my.cfg +++ b/OpenArena/oa/config/my.cfg @@ -29,6 +29,6 @@ set colordepth 16 set fullscreen 0 map intro.map set maxfps 60 -set rollleft w -set rollright e +bind rollleft w +bind rollright e set sound false diff --git a/include/level.h b/include/level.h index b56aaee..5398ff6 100644 --- a/include/level.h +++ b/include/level.h @@ -32,6 +32,8 @@ const float piover180 = 0.0174532925f; const string DEFAULT_TEXTURE_NAME = "oa/textures/default.tga"; const unsigned int MAX_CONSOLE_LINES = 30; //The max number of lines to be displayed in the console const unsigned int MAX_CONSOLE_HISTORY_LINES = MAX_CONSOLE_LINES + 20; //The max number of console lines to store in the history +const unsigned int MAX_CONSOLE_OUTPUT_LINES = MAX_CONSOLE_LINES; +const unsigned int MAX_OUTPUT_TEXT_LINES = 4; //The max number of output lines to be displayed on the screen enum {GL_MY_TEXTURE_CONSOLEBACKGROUND=0, NUM_MENU_TEXTURES}; @@ -41,7 +43,7 @@ public: LEVEL(); ~LEVEL(); bool LoadMap(string mapname); - void LoadMap(); + bool LoadMap(); void SaveMap(string mapname); bool LoadConfig(string cfgname); void LoadConfig(); @@ -92,9 +94,9 @@ public: private: + void ConsolePrint(string); string consoleHistory[MAX_CONSOLE_HISTORY_LINES]; - - - + string consoleOutput[MAX_CONSOLE_OUTPUT_LINES]; + string outputText[MAX_OUTPUT_TEXT_LINES]; }; #endif \ No newline at end of file diff --git a/include/list.h b/include/list.h index 27ad933..92e14c4 100644 --- a/include/list.h +++ b/include/list.h @@ -37,6 +37,7 @@ public: void FirstPosition(); void LastPosition(); void Clear(); + unsigned int Length(); void operator=(const list&); ItemType operator[](LIST_ARRAY_INDEX_TYPE) const; ItemType& operator[](LIST_ARRAY_INDEX_TYPE); @@ -339,4 +340,24 @@ ItemType& list::operator[](LIST_ARRAY_INDEX_TYPE index) } } +template +unsigned int Length() +{ + if (head == NULL) + { + return 0; + } + else + { + int len = 1; + listNode temp = head->next; + while (temp != NULL) + { + temp = temp->next; + len++ + } + return len; + } +} + #endif diff --git a/src/level.cpp b/src/level.cpp index 7804109..eab1a94 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -105,6 +105,10 @@ bool LEVEL::LoadMap(string mapname) delete [] tmpChar; return false; } + else + { + ConsolePrint("map file \"" + mapname + "\" opened successfully"); + } //Gravity input >> readBuffer; @@ -146,6 +150,9 @@ bool LEVEL::LoadMap(string mapname) input >> readBuffer; triangles[i].normal.z = atof(readBuffer.c_str()); } + char lpszNumTriangles[6]; + sprintf(lpszNumTriangles, "%d", numTriangles); + ConsolePrint(lpszNumTriangles + string(" triangles successfully read")); //Number of textures; input >> readBuffer; @@ -157,6 +164,9 @@ bool LEVEL::LoadMap(string mapname) { input >> textureNames[i]; } + char lpszNumTextures[6]; + sprintf(lpszNumTextures, "%d", numTextures); + ConsolePrint(lpszNumTextures + string(" textures successfully read")); //BGM input >> bgm; @@ -165,6 +175,8 @@ bool LEVEL::LoadMap(string mapname) //Build display list if (sound) { + ConsolePrint("Starting sound"); + BASS_Init(-1, 44100, BASS_DEVICE_LEAVEVOL, g_hWnd); BASS_Start(); BASS_CDInit(NULL, BASS_DEVICE_LEAVEVOL); @@ -186,13 +198,15 @@ bool LEVEL::LoadMap(string mapname) BASS_StreamPlay(bgmStream, 1, BASS_SAMPLE_LOOP); } } + + ConsolePrint("Sound init complete"); } return true; } -void LEVEL::LoadMap() +bool LEVEL::LoadMap() { - LoadMap(nextLevel); + return LoadMap(nextLevel); } void LEVEL::SaveMap(string mapname) @@ -263,7 +277,7 @@ void LEVEL::Render() glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); - // Move the camera to where the player is or more precisely move to world so the camer is where the playe is + // Move the camera to where the player is defaultPlayer->camera.Look(); ///* for (uint32 i=0; i0; i--) { consoleHistory[i] = consoleHistory[i-1]; } consoleHistory[0] = ""; + ConsolePrint(consoleHistory[1]); + Execute(tolower(consoleHistory[1])); + } else if(newChar == VK_BACK) { @@ -1059,4 +1182,13 @@ void LEVEL::UpdateConsole(char newChar) MessageBox(NULL, errmsg, "Balls", MB_OK); */ } +} + +void LEVEL::ConsolePrint(string line) +{ + for (int i=MAX_CONSOLE_OUTPUT_LINES - 1; i>0; i--) + { + consoleOutput[i] = consoleOutput[i-1]; + } + consoleOutput[0] = line; } \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 35b459c..ff3a570 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -455,7 +455,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, } else { - level.UpdateConsole('.,'); + level.UpdateConsole('.'); } } else if(wParam == VK_OEM_PLUS) @@ -488,7 +488,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, } else { - level.UpdateConsole('-,'); + level.UpdateConsole('-'); } } else if(isalpha(uint8(wParam)))