Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 3,915
» Latest member: znatalieusasd3425
» Forum threads: 5,154
» Forum posts: 41,376

Full Statistics

Online Users
There are currently 28 online users.
» 0 Member(s) | 27 Guest(s)
Bing

Latest Threads
Last Chaos Server Sale
Forum: The Black Market (Buy, Sell, Trade)
Last Post: XWrongX2
01-26-2026, 11:07 PM
» Replies: 3
» Views: 618
All in One Exporter
Forum: Tools
Last Post: Kain88
01-25-2026, 07:04 AM
» Replies: 4
» Views: 440
HELP! ReZasCashServer It ...
Forum: Ep4 Support
Last Post: Kain88
01-24-2026, 03:24 PM
» Replies: 2
» Views: 171
Hi, does anyone know the ...
Forum: Help
Last Post: Desarija
01-21-2026, 11:29 AM
» Replies: 1
» Views: 118
LastChaos Nemesis
Forum: Server Advertising
Last Post: Desarija
01-20-2026, 04:06 PM
» Replies: 3
» Views: 242
Looking for EP4 Guidance
Forum: General Discussion
Last Post: xHypnosiaa
01-19-2026, 08:33 AM
» Replies: 1
» Views: 174
We're in need of creative...
Forum: Project Recruitment
Last Post: RGT
01-16-2026, 12:48 AM
» Replies: 0
» Views: 121
Last Chaos build deployme...
Forum: Ep4 Guides
Last Post: xHypnosiaa
01-08-2026, 11:14 AM
» Replies: 0
» Views: 82
Last Chaos global server ...
Forum: Ep4 Guides
Last Post: xHypnosiaa
01-07-2026, 07:01 PM
» Replies: 0
» Views: 37
EP-2/EP-3 Mixed files
Forum: Archived General Server Releases
Last Post: TeKnodE
01-06-2026, 09:53 PM
» Replies: 1
» Views: 300

 
  Hex Code Collor
Posted by: Anja - 10-25-2012, 07:30 PM - Forum: Coders Talk - Replies (2)

Hey. Say Please Hex code and files who collor name Gueld =)

Print this item

  [Guide] How to get free webhosting
Posted by: jka249 - 10-24-2012, 07:47 AM - Forum: Ep1 Guides - Replies (6)


1. Click 2

2. Sign-up

3. Ether use there built in ftp system or download 2

4. Upload you website/files and you done.

 

Register now and get it all free:

*** 1500 MB of disk space

*** 100 GB of data transfer

*** PHP and MySQL support with no restrictions

*** cPanel control panel

*** Website Builder

*** Absolutely no advertising!

 

thanks for taking the time to read this.

Print this item

  c++ NKSP.EXE
Posted by: CyberClaus - 10-24-2012, 05:24 AM - Forum: Coders Talk - Replies (21)


Hi, im going to leave here the source code of nksp.exe, almost ready to start lastchaos. Im not going to leave credits has i dont know who released it, but if who realeased it sees it here, i say thank you, it gave me a really good help. And now i hope it helps this community too.

 

/*
* Last Chaos
* Copyright © 1998, CroTeam. All rights reserved.
*
*/

#include "StdH.h"
#include <io.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <process.h>
#include <Engine/CurrentVersion.h>
#include <Engine/Templates/Stock_CEntityClass.h>
#include <Engine/Templates/Stock_CFontData.h>
#include <Engine/Interface/UIManager.h> // yjpark
#include <Engine/Interface/UIMouseCursor.h>
#include <Engine/GameState.h>
#include <Engine/GlobalDefinition.h>
#define DECL_DLL
#include <EntitiesMP/Global.h>
#include "resource.h"
//#include "SplashScreen.h"
#include "Mainwindow.h"
#include "GlSettings.h"
//#include "LevelInfo.h"
//#include "LCDDrawing.h"
#include "CmdLine.h"
//#include "Credits.h"
#include <Engine/Base/Protection.h>
#if COPY_PROTECTION
#include <Engine/Base/Protection.cpp>
#endif
#include <Engine/Network/Web.h>
#include <TlHelp32.h>
#include <float.h>
#include <Ext_ipc_event.h> // IPC
ENGINE_API extern cWeb g_web;
extern ENGINE_API char *g_szExitError;
#ifdef XTRAP_SECURE_CKBANG_2010_07_20
#include "xTrapWrapper.h"
#endif
//#undef XTRAP_SECURE_CKBANG_2010_07_20
#ifndef NO_GAMEGUARD
#include <Nksp/GameGuard.h>
#endif
#ifndef NO_GAMEGUARD
extern ENGINE_API CTString g_szHackMsg;
#endif
//CTString _fnmForCDCheck = "Bin\\SeriousSam.exe";
// application state variables by NSP
extern BOOL g_bTcp = TRUE;
// end of ..
extern CGame *_pGame = NULL;
// application state variables
//extern BOOL _bRunning = TRUE;
//extern BOOL _bQuitScreen = TRUE;
//extern BOOL _bMenuActive = FALSE;
//extern BOOL _bMenuRendering = FALSE;
#pragma comment(lib, "SharedMemoryDll.lib")

static PIX _apixRes[][2] = {
640, 480,
800, 500,
800, 600,
1024, 768,
1152, 864,
1280, 800,
1280, 960,
1280, 1024,
1600,1200,
};
extern void enableFPExceptions()
{
int i = _controlfp (0,0);
i &= ~ (EM_ZERODIVIDE);
_controlfp (i, MCW_EM);
}
// helper for limiting window size when changing mode out of full screen
extern void FindMaxResolution( PIX &pixSizeI, PIX &pixSizeJ)
{
const INDEX ctResolutions = ARRAYCOUNT(_apixRes);
for( INDEX iRes=(ctResolutions-1); iRes>=0; iRes--)
{
if( pixSizeI>_apixRes[iRes][0] && pixSizeJ>_apixRes[iRes][1])
{
pixSizeI = _apixRes[iRes][0];
pixSizeJ = _apixRes[iRes][1];
return;
}
} // should not end up here
ASSERTALWAYS( "Desktop resolution too low!");
pixSizeI = _apixRes[0][0];
pixSizeJ = _apixRes[0][1];
}
//extern BOOL _bDefiningKey; // ¿øº».
extern BOOL _bDefiningKey = FALSE;
//static BOOL _bReconsiderInput = FALSE;
extern PIX _pixDesktopWidth = 0;
extern PIX _pixDesktopHeight = 0;
static INDEX sam_iMaxFPSActive = 500;
static INDEX sam_iMaxFPSInactive = 10;
static INDEX sam_bPauseOnMinimize = TRUE; // auto-pause when window has been minimized
extern ENGINE_API INDEX sam_bWideScreen; // yjpark
extern FLOAT sam_fPlayerOffset = 0.0f;
// Window handle
extern ENGINE_API HWND _hwndMain;
// display mode settings
extern ENGINE_API BOOL _bWindowChanging; // yjpark |<--
extern ENGINE_API INDEX sam_bFullScreenActive;
extern ENGINE_API INDEX sam_iScreenSizeI;
extern ENGINE_API INDEX sam_iScreenSizeJ;
extern ENGINE_API INDEX sam_iDisplayDepth;
extern ENGINE_API INDEX sam_iDisplayAdapter;
extern ENGINE_API INDEX sam_iGfxAPI; // 0==OpenGL // yjpark -->|
extern INDEX sam_bFirstStarted = FALSE;
extern FLOAT sam_tmDisplayModeReport = 5.0f;
//extern INDEX sam_bShowAllLevels = FALSE;
//extern INDEX sam_bMentalActivated = FALSE;
// network settings
extern CTString sam_strNetworkSettings = "";
// command line
extern CTString sam_strCommandLine = "";
// 0...app started for the first time
// 1...all ok
// 2...automatic fallback
static INDEX _iDisplayModeChangeFlag = 0;
static TIME _tmDisplayModeChanged = 100.0f; // when display mode was last changed
// rendering preferences for automatic settings
extern INDEX sam_iVideoSetup = 1; // 0==speed, 1==normal, 2==quality, 3==custom
// automatic adjustment of audio quality
extern BOOL sam_bAutoAdjustAudio = TRUE;
extern INDEX sam_bAutoPlayDemos = TRUE;
static INDEX _bInAutoPlayLoop = TRUE;
// menu calling
/*
extern INDEX sam_bMenuSave = FALSE;
extern INDEX sam_bMenuLoad = FALSE;
extern INDEX sam_bMenuControls = FALSE;
extern INDEX sam_bMenuHiScore = FALSE;
*/
extern INDEX sam_bToggleConsole = FALSE;
//extern INDEX sam_iStartCredits = FALSE;
// for mod re-loading
extern CTFileName _fnmModToLoad = CTString("");
extern CTString _strModServerJoin = CTString("");
extern CTString _strURLToVisit = CTString("");

// state variables fo addon execution
// 0 - nothing
// 1 - start (invoke console)
// 2 - console invoked, waiting for one redraw
extern INDEX _iAddonExecState = 0;
extern CTFileName _fnmAddonToExec = CTString("");
// logo textures
//static CTextureObject _toLogoCT;
//static CTextureObject _toLogoODI;
//static CTextureObject _toLogoGSpy;
//static CTextureObject _toLogoEAX;
//extern CTextureObject *_ptoLogoCT = NULL;
//extern CTextureObject *_ptoLogoODI = NULL;
//extern CTextureObject *_ptoLogoGSpy = NULL;
//extern CTextureObject *_ptoLogoEAX = NULL;
extern CTString sam_strVersion = "0.5";
//extern CTString sam_strModName = TRANS("Prologue");
/*
#if _SE_DEMO
extern CTString sam_strFirstLevel = "Levels\\KarnakDemo.wld";
#else
extern CTString sam_strFirstLevel = "Levels\\01_Hatshepsut.wld";
#endif
*/
extern CTString sam_strIntroLevel = "Levels\\Intro.wld";
extern CTString sam_strGameName = "serioussam";
//extern CTString sam_strTechTestLevel = "Levels\\TechTest.wld";
//extern CTString sam_strTrainingLevel = "Levels\\KarnakDemo.wld";
ENGINE_API extern INDEX snd_iFormat;

// main window canvas
/*CDrawPort *pdp;
CDrawPort *pdpNormal;
CDrawPort *pdpWideScreen;
CViewPort *pvpViewPort;
HINSTANCE _hInstance;*/ // ypark
// main window canvas // yjpark
extern ENGINE_API CDrawPort *_pdpMain;
extern ENGINE_API CDrawPort *_pdpNormalMain;
extern ENGINE_API CDrawPort *_pdpWideScreenMain;
extern ENGINE_API CViewPort *_pvpViewPortMain;
extern ENGINE_API HINSTANCE _hInstanceMain;
/*
static void PlayDemo(const CTString &strDemoFilename)
{
// ¾²Ãƒâ‚¬ÃƒÅ’ÃÂö ¾ÃƒÅ Ãƒâ‚¬½.
_gmMenuGameMode = GM_DEMO;
CTFileName fnDemo = "demos\\" + strDemoFilename + ".dem";
extern BOOL LSLoadDemo(const CTFileName &fnm);
LSLoadDemo(fnDemo);
}
*/
ENGINE_API extern INDEX g_iCountry;
// WSS_NPROTECT 070402 -------------------------->>
/*
#ifndef NO_GAMEGUARD
extern ENGINE_API CTString g_szHackMsg;
#endif
/**/
// ----------------------------------------------<<
void GetNM(LPSTR lpCmdLine)
{

// wooss 060209 NetMable_JP
extern BOOL g_bAutoLogin;
extern CTString g_nmVER;
extern CTString g_nmCID;
extern CTString g_nmID;
extern CTString g_nmPW;

// wooss NetMable_JP Auto login 060209
CTString strTemp((CHAR*)lpCmdLine);
// MessageBox(NULL, strTemp, "CommandLine", MB_OK);
for(INDEX ii = 0; ii < 4; ii++)
{
INDEX tempPos = strTemp.FindSubstr(" ");
CTString strInsert = strTemp;
strInsert.TrimRight(tempPos);
switch(ii)
{
case 0 :
g_nmVER.PrintF("%s", strInsert);
break;
case 1 :
g_nmCID.PrintF("%s", strInsert);
break;
case 2 :
g_nmID.PrintF("%s", strInsert);
break;
case 3 :
g_nmPW.PrintF("%s", strTemp);
break;
}
if(ii < 3)
strTemp.DeleteChars(0, tempPos + 1);
}
// MessageBox(NULL, g_nmID, "loginID", MB_OK);
// MessageBox(NULL, g_nmPW, "loginPW", MB_OK);
if(g_nmID.Length()!=0 && g_nmPW.Length()!=0 ) {
switch(g_iCountry)
{
case KOREA :
//if(g_nmCID.IsEqualCaseSensitive("em") || g_nmCID.IsEqualCaseSensitive("nt"))
//if(g_nmCID.IsEqualCaseSensitive("or"))
if(g_nmCID.Length() > 0)
g_bAutoLogin = TRUE;
// MessageBox(NULL, "g_bAutoLogin is True", "autologin", MB_OK);
break;
case TAIWAN :
break;
case CHINA :
break;
case THAILAND :
break;
case TAIWAN2:
break;
case JAPAN :
g_bAutoLogin = TRUE;
break;
case MALAYSIA :
break;
case USA:
break;
case BRAZIL:
break;
case HONGKONG:
g_bAutoLogin = TRUE;
break;
}
}
}
/***********************************************************************************************
* IsRunning()
* ÃÂߺ¹ ½Ãƒâ€¡Ãƒâ€¡ÃƒÂ  ¹ÃƒÂ¦ÃƒÂö ÇÃ‼ö
* ÇöÀç ½Ãƒâ€¡Ãƒâ€¡ÃƒÂ  ÃÂßÀÎ Ç÷μ¼½Ã‚ºÂ¸Â¦ °Ë»öÇÿ© Nksp.exe°¡ ½Ãƒâ€¡Ãƒâ€¡ÃƒÂ Ã‚µÃ‡¾ÃƒÂ® ÀÖ´Â °ÃÂÀÌ ÀÖ´ÂÃÂö È®ÀÎÇÿ© TRUE, FALSE¸¦
* ¸®ÅàÇÑ´Ù.
*************************************************************************************************/
BOOL IsRunning(void)
{
PROCESSENTRY32 peNext;
// â±Ù Ç÷μ¼½Ã‚º ÇÚµéÀ» »ý¼Ã‚ºÃ‡Ã‘´Ù.
HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnapShot == INVALID_HANDLE_VALUE )
{
if( g_iCountry == RUSSIA )
{
MessageBox(NULL, "Îøèáêà çàïóñê?ïðîãðàìì?LastChaos!", "LastChaos Run", MB_OK);
}
else
{
MessageBox(NULL, "Fail Execute LastChaos!", "LastChaos Run", MB_OK);
}
return TRUE;
}
peNext.dwSize = sizeof(PROCESSENTRY32);
int nFindNum = 0;
int nSize = 0;
DWORD dwTemp = GetCurrentProcessId();
BOOL bCurrentProcess = FALSE;
Process32First(hSnapShot, &peNext); // ù¹ÃƒÂ¸Ãƒâ€šÃ‚° Ç÷μ¼½Ã‚ºÂ¸Â¦ °¡Ã®¿Â´Ù.
while(Process32Next(hSnapShot, &peNext)) // ¸ðµç Ç÷μ¼½Ã‚ºÂ¸Â¦ °Ë»öÇÑ´Ù.
{
if (peNext.th32ProcessID == dwTemp)
{
bCurrentProcess = TRUE;
continue;
}
nSize = strlen(peNext.szExeFile);
if ( nSize > 8 ) { nSize -= 8; }
else { nSize = 0; }

if (stricmp(peNext.szExeFile+(nSize), "Nksp.exe") == 0)
{
nFindNum++;
if (nFindNum > 0)
{
CloseHandle(hSnapShot);
return TRUE;
}
}
}
CloseHandle(hSnapShot);
if (!bCurrentProcess)
{
if( g_iCountry == RUSSIA )
{
MessageBox(NULL, "Îøèáêà çàïóñê?ïðîãðàìì?LastChaos!", "LastChaos Run", MB_OK);
}
else
{
MessageBox(NULL, "Fail Execute LastChaos!", "LastChaos Run", MB_OK);
}
return TRUE;
}
return FALSE;
}

static void ApplyRenderingPreferences(void)
{
ApplyGLSettings(TRUE);
}
/*
extern void ApplyVideoMode(void)
{
StartNewMode( (GfxAPIType)sam_iGfxAPI, sam_iDisplayAdapter, sam_iScreenSizeI, sam_iScreenSizeJ,
(enum DisplayDepth)sam_iDisplayDepth, IsFullScreen( sam_bFullScreenActive) );
}
*/
static void BenchMark(void)
{
_pGfx->Benchmark(_pvpViewPortMain, _pdpMain);
}

static void QuitGame(void)
{
_pGameState->Running() = FALSE;
_pGameState->QuitScreen() = FALSE;
}
// check if another app is already running
static HANDLE _hLock = NULL;
static CTFileName _fnmLock;
static void DirectoryLockOn(void)
{
// create lock filename
_fnmLock = _fnmApplicationPath+"nksp.loc";
// try to open lock file
_hLock = CreateFile(
_fnmLock,
GENERIC_WRITE,
0/*no sharing*/,
NULL, // pointer to security attributes
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL|FILE_FLAG_DELETE_ON_CLOSE, // file attributes
NULL);
// if failed
if (_hLock==NULL || GetLastError()!=0) {
// report warning
CPrintF(TRANS("WARNING: Last Chaos didn't shut down properly last time!\n"));
}
}
static void DirectoryLockOff(void)
{
// if lock is open
if (_hLock!=NULL) {
// close it
CloseHandle(_hLock);
}
}
//°­µ¿¹ÃƒÅ½ ¼ÃƒÂ¶ÃƒÂ¤ ½ÃƒÆ’ÀÛ ½ÃƒÆ’½Ã‚ºÃ…Û ¸¶Ã‚¿Ã¬½Ã‚º À۾÷ 09.09
// NOTE : ¾Ãƒâ€“´Ã¸ÞÀ̼Ç Ä¿¼Ã‚­Â¸Â¦ ¸®¼Ãƒâ€™½Ã‚º·ÃƒÅ½Ã‚ºÃŽÃ…àÀþî¿È.
static HCURSOR LoadAnimationCursor(HINSTANCE hInstance, UINT nID)
{
HRSRC hRes = FindResource(hInstance, MAKEINTRESOURCE(nID), "CURSORS");
DWORD dwSize = SizeofResource(hInstance, hRes);
HGLOBAL hGlob = LoadResource(hInstance, hRes);
LPBYTE pBytes = (LPBYTE)LockResource(hGlob);
return (HCURSOR)CreateIconFromResource(pBytes, dwSize, FALSE, 0x00030000);
}
//°­µ¿¹ÃƒÅ½ ¼ÃƒÂ¶ÃƒÂ¤ ³Ã‚¡ ½ÃƒÆ’½Ã‚ºÃ…Û ¸¶Ã‚¿Ã¬½Ã‚º À۾÷ 09.09
void End(void);

// automaticaly manage input enable/disable toggling
//static BOOL _bInputEnabled = FALSE;
/*void UpdateInputEnabledState(void)
{
// do nothing if window is invalid
if( _hwndMain==NULL) return;
// input should be enabled if application is active
// and no menu is active and no console is active
BOOL bShouldBeEnabled = ( !IsIconic(_hwndMain) && !_pGameState->m_bMenuActive && _pGame->gm_csConsoleState==CS_OFF ) || _bDefiningKey;
// if should be turned off
if( (!bShouldBeEnabled && _bInputEnabled) || _bReconsiderInput) {
// disable it and remember new state
_pInput->DisableInput();
_bInputEnabled = FALSE;
}
// if should be turned on
if( bShouldBeEnabled && !_bInputEnabled) {
// enable it and remember new state
_pInput->EnableInput(_hwndMain);
_bInputEnabled = TRUE;
}
_bReconsiderInput = FALSE;
}*/

// automaticaly manage pause toggling
void UpdatePauseState(void)
{
// ¾²Ãƒâ‚¬ÃƒÅ’ÃÂö ¾ÃƒÅ Ã‚´Ã‚ ºÎºÃÂ.
/*
BOOL bShouldPause = ( _gmRunningGameMode == GM_SINGLE_PLAYER ) &&
( _pGameState->m_bMenuActive || _pGame->gm_csConsoleState == CS_ON ||
_pGame->gm_csConsoleState == CS_TURNINGON || _pGame->gm_csConsoleState == CS_TURNINGOFF );
_pNetwork->SetLocalPause(bShouldPause);
*/
}

// limit current frame rate if neeeded
void LimitFrameRate(void)
{
// measure passed time for each loop
static CTimerValue tvLast(-1.0f);
CTimerValue tvNow = _pTimer->GetHighPrecisionTimer();
TIME tmCurrentDelta = (tvNow-tvLast).GetSeconds();
// limit maximum frame rate
sam_iMaxFPSActive = ClampDn( (INDEX)sam_iMaxFPSActive, 1L);
sam_iMaxFPSInactive = ClampDn( (INDEX)sam_iMaxFPSInactive, 1L);
INDEX iMaxFPS = sam_iMaxFPSActive;
if( IsIconic(_hwndMain)) iMaxFPS = sam_iMaxFPSInactive;
/*
if(_pGame->gm_CurrentSplitScreenCfg==CGame::SSC_DEDICATED)
{
iMaxFPS = ClampDn(iMaxFPS, 60L); // never go very slow if dedicated server
}
*/
TIME tmWantedDelta = 1.0f / iMaxFPS;
if( tmCurrentDelta<tmWantedDelta) Sleep( (tmWantedDelta-tmCurrentDelta)*1000.0f);

// remember new time
tvLast = _pTimer->GetHighPrecisionTimer();
}
/*
// load first demo
void StartNextDemo(void)
{
// ¾Ã‚µÂ¸Ã°¾ÃƒÂ¸Ã‚´Ã‚ ºÎºÃÂÀ̹ǷÃŽ ÃÂּ®Ã³Ã‚¸Â®ÂµÃŠ.
if (!sam_bAutoPlayDemos || !_bInAutoPlayLoop) {
_bInAutoPlayLoop = FALSE;
return;
}
// skip if no demos
if(_lhAutoDemos.IsEmpty()) {
_bInAutoPlayLoop = FALSE;
return;
}
// get first demo level and cycle the list
CLevelInfo *pli = LIST_HEAD(_lhAutoDemos, CLevelInfo, li_lnNode);
pli->li_lnNode.Remove();
_lhAutoDemos.AddTail(pli->li_lnNode);
// if intro
if (pli->li_fnLevel==sam_strIntroLevel) {
// start intro
_gmRunningGameMode = GM_NONE;
_pGame->gm_aiStartLocalPlayers[0] = 0;
_pGame->gm_aiStartLocalPlayers[1] = -1;
_pGame->gm_aiStartLocalPlayers[2] = -1;
_pGame->gm_aiStartLocalPlayers[3] = -1;
_pGame->gm_strNetworkProvider = "Local";
_pGame->gm_StartSplitScreenCfg = CGame::SSC_PLAY1;
_pShell->SetINDEX("gam_iStartDifficulty", CSessionProperties::GD_NORMAL);
_pShell->SetINDEX("gam_iStartMode", CSessionProperties::GM_FLYOVER);
CUniversalSessionProperties sp;
_pGame->SetSinglePlayerSession(sp);
_pGame->gm_bFirstLoading = TRUE;
if ( _pGame->PreNewGame() && _pGame->NewGame( sam_strIntroLevel, sam_strIntroLevel, sp)) {
_gmRunningGameMode = GM_INTRO;
}
// if not intro
} else {
// start the demo
_pGame->gm_StartSplitScreenCfg = CGame::SSC_OBSERVER;
_pGame->gm_aiStartLocalPlayers[0] = -1;
_pGame->gm_aiStartLocalPlayers[1] = -1;
_pGame->gm_aiStartLocalPlayers[2] = -1;
_pGame->gm_aiStartLocalPlayers[3] = -1;
// play the demo
_pGame->gm_strNetworkProvider = "Local";
_gmRunningGameMode = GM_NONE;
if( _pGame->StartDemoPlay( pli->li_fnLevel)) {
_gmRunningGameMode = GM_DEMO;
CON_DiscardLastLineTimes();
}
}
if (_gmRunningGameMode==GM_NONE) {
_bInAutoPlayLoop = FALSE;
}
}
// set registry key for GameSpy
void RegisterGameSpy(void)
{
char strExePath[MAX_PATH+1] = "";
// get full path to the exe
GetModuleFileName( NULL, strExePath, sizeof(strExePath)-1);
// create the registry key
HKEY hkey;
DWORD dwDisposition;
LONG lRes = RegCreateKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\GameSpy\\games",0,
"", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwDisposition);
if (lRes!=ERROR_SUCCESS) {
return;
}
// set the value to current application
#if !TECHTESTONLY
#if _SE_DEMO
RegSetValueEx(hkey, "serioussamdemo", 0, REG_SZ, (UBYTE*)strExePath, strlen(strExePath));
#else
RegSetValueEx(hkey, sam_strGameName, 0, REG_SZ, (UBYTE*)strExePath, strlen(strExePath));
#endif
#endif
// close the key
RegCloseKey(hkey);
}
*/
BOOL _bCDPathFound = FALSE;
BOOL FileExistsOnHD(const CTString &strFile)
{
FILE *f = fopen(_fnmApplicationPath+strFile, "rb");
if (f!=NULL) {
fclose(f);
return TRUE;
} else {
return FALSE;
}
}
/*
// find possible cd path
BOOL FindCDPath(void)
{
// if no specified cdpath
if (_fnmCDPath=="")
{
// use default one
_fnmCDPath = CTString("C:\\Install\\");
}
// for each drive
for(INDEX chDrive='C'; chDrive<='Z'; chDrive++)
{
char strDrive[4];
strDrive[0] = chDrive;
strDrive[1] = ':';
strDrive[2] = '\\';
strDrive[3] = 0;
// if not cdrom
if (GetDriveType(strDrive) != DRIVE_CDROM)
{
// skip it
continue;
}
// substitute the drive letter
((char*)(const char*)_fnmCDPath)[0] = chDrive;
// if the path is valid
FILE *f = fopen(_fnmCDPath+_fnmForCDCheck, "rb");
_bCDPathFound = (BOOL)f;
if (f!=NULL)
{
// we have found the cd
fclose(f);
return TRUE;
}
}
return FALSE;
}
BOOL IsCDInDrive(void)
{
CTFileName fnmExpanded;
INDEX iType = ExpandFilePath(EFP_READ, CTString("Setup.exe"), fnmExpanded);
if (iType!=EFP_FILE || fnmExpanded.HasPrefix(_fnmCDPath))
{
return FALSE;
}
fnmExpanded = fnmExpanded.FileDir()+_fnmForCDCheck;
FILE *f = fopen(fnmExpanded, "rb");
if (f==NULL) {
return FALSE;
}
fclose(f);
return TRUE;
}
*/
void TrimString(char *str)
{
int i = strlen(str);
if (str[i-1]=='\n' || str[i-1]=='\r') {
str[i-1]=0;
}
}
/*
BOOL PerformCDCheck(void)
{
// default message
char strTitle[256] = "CD check";
char strMessage[256] = "Please insert the game CD";
// first get the application filename
char strTmpPath[MAX_PATH] = "";
GetModuleFileName( NULL, strTmpPath, sizeof(strTmpPath)-1);
int iLen = strlen(strTmpPath);
// generate 'insert-cd' text filename
strTmpPath[iLen-3] = 'c';
strTmpPath[iLen-2] = 'd';
strTmpPath[iLen-1] = 0;
// try to load the file
FILE *f = fopen(strTmpPath, "rt");
if (f!=NULL)
{
fgets(strTitle, sizeof(strTitle)-1, f); TrimString(strTitle);
fgets(strMessage, sizeof(strMessage)-1, f); TrimString(strMessage);
fclose(f);
}
// repeat
FOREVER{
// if cd path found
if (FindCDPath())
{
// ok
return TRUE;
}
#if !CD_CHECK || _SE_DEMO || TECHTESTONLY
return TRUE;
#endif
// ask user to insert CD
int iResult = MessageBox(_hwndMain, strMessage, strTitle, MB_ICONEXCLAMATION|MB_RETRYCANCEL);
if (iResult!=IDRETRY)
{
return FALSE;
}
Sleep(1000);
}
}
// run web browser and view an url
void RunBrowser(const char *strUrl)
{
int iResult = (int)ShellExecute( _hwndMain, "OPEN", strUrl, NULL, NULL, SW_SHOWMAXIMIZED);
if (iResult<32) {
// should report error?
NOTHING;
}
}
*/
void LoadAndForceTexture(CTextureObject &to, CTextureObject *&pto, const CTFileName &fnm)
{
try
{
to.SetData_t(fnm);
CTextureData *ptd = (CTextureData*)to.GetData();
ptd->Force( TEX_CONSTANT);
ptd = ptd->td_ptdBaseTexture;
if( ptd!=NULL) ptd->Force( TEX_CONSTANT);
pto = &to;
}
catch( char *pchrError)
{
(void*)pchrError;
pto = NULL;
}
}
//¾ÃƒË†Ãƒâ€¦Ãƒâ€šÃƒË†Ãƒâ€  ¼ÃƒÂ¶ÃƒÂ¤ ½ÃƒÆ’ÀÛ //(DevPartner Bug Fix)(2005-01-14)
HMODULE g_hGame = NULL;
//¾ÃƒË†Ãƒâ€¦Ãƒâ€šÃƒË†Ãƒâ€  ¼ÃƒÂ¶ÃƒÂ¤ ³Ã‚¡ //(DevPartner Bug Fix)(2005-01-14)
void InitializeGame(void)
{
try {
#ifndef NDEBUG
#define GAMEDLL ("Bin\\Debug\\Game"+_strModExt+"D.dll")
#else
#define GAMEDLL ("Bin\\Game"+_strModExt+".dll")
#endif
CTFileName fnmExpanded;
ExpandFilePath(EFP_READ, CTString(GAMEDLL), fnmExpanded);
CPrintF(TRANS("Loading game library '%s'...\n"), (const char *)fnmExpanded);
//¾ÃƒË†Ãƒâ€¦Ãƒâ€šÃƒË†Ãƒâ€  ¼ÃƒÂ¶ÃƒÂ¤ ½ÃƒÆ’ÀÛ //(DevPartner Bug Fix)(2005-01-14)
g_hGame = LoadLibrary(fnmExpanded);
if (g_hGame==NULL)
{
ThrowF_t("%s", GetWindowsError(GetLastError()));
}
CGame* (*GAME_Create)(void) = (CGame* (*)(void))GetProcAddress(g_hGame, "GAME_Create");
if (GAME_Create==NULL)
{
ThrowF_t("%s", GetWindowsError(GetLastError()));
}
//¾ÃƒË†Ãƒâ€¦Ãƒâ€šÃƒË†Ãƒâ€  ¼ÃƒÂ¶ÃƒÂ¤ ³Ã‚¡ //(DevPartner Bug Fix)(2005-01-14)
_pGame = GAME_Create();
}
catch (char *strError)
{
FatalError("%s", strError);
}
// init game - this will load persistent symbols
_pGame->Initialize(CTString("Data\\nksp.gms"));
// ENGINE_API extern float g_fGWTimeMul;
// ENGINE_API extern float g_fGWTime; // Game world time
// g_fGWTimeMul = 0.0f;
// g_fGWTime = 100.0f;
}
static char strExePath[MAX_PATH] = "";
static char strDirPath[MAX_PATH] = "";
CEntityClass *g_pPlayer, *g_pWorldBase;
ENGINE_API void CheckEngineVersion();
BOOL Init( HINSTANCE hInstance, int nCmdShow, CTString strCmdLine)
{
// »õ·ÃƒÅ½Ã‚¿Ã® ¹ÃƒÂ¶Ãƒâ‚¬ÃƒÂ¼Ãƒâ‚¬Ãƒâ€¡ Launcher°¡ Àִ°¡ È®ÀÎÇðí ÀÖ´Ù¸é, Laucher¸¦ ¾ÃƒÂ·Ã‚µÂ¥Ã€ÃŒÃ†Â®Ã‡Ã‘´Ù.
// by seo - 40727
// get full path to the exe
char strTmpPath[MAX_PATH] = "";
GetModuleFileName( NULL, strExePath, sizeof(strExePath)-1);
for (int i=0; i < 2; i++) {
for (int j=strlen(strExePath)-1; j > 0; j--) {
if (strExePath[j] == '\\') {
strExePath[j] = '\0';
break;
}
}
}
strcat(strExePath, "\\");
CTFileName fnmLC = strExePath;
CTFileName fnmLCNew = strExePath;
// CTFileName fnmLW = strExePath;
// CTFileName fnmLWNew = strExePath;
CTFileName fnmLccnct = strExePath;
CTFileName fnmLccnctNew = strExePath;
fnmLC = fnmLC + "LC.exe";
fnmLCNew = fnmLCNew + "LCNew.exe";
// õÇôë¶ÃƒÂµÃ‚¿Ã«.
// fnmLW = fnmLW + "LW.exe";
// fnmLWNew = fnmLWNew + "LWNew.exe";
fnmLccnct = fnmLccnct + "lccnct.dta";
fnmLccnctNew = fnmLccnctNew + "lccnctNew.dta";
FILE *fp = fopen (fnmLccnctNew, "rb");
if (fp)
{
fclose(fp);
fclose(fp);
Sleep(1000);
remove (fnmLccnct);
Sleep(1000);
int ret = rename(fnmLccnctNew, fnmLccnct);
}
fp = NULL;
fp = fopen (fnmLCNew, "rb");
if (fp) {
fclose(fp);
Sleep(1000);
remove (fnmLC);
Sleep(1000);
int ret = rename(fnmLCNew, fnmLC);
// Date : 2005-05-17(¿ÀÈÄ 4:44:15), By Lee Ki-hwan Ãß°¡
if (!ret) {
ShowCursor(TRUE);
if( GetSystemDefaultLangID() == 0x0804 ) // ÃÂß±¹ ·ÃƒÅ½Ãƒâ€žÃƒÆ’ÀÇ °æ¿ì ¼ÃƒÂ¶ÃƒÂ¤
{
MessageBox(NULL, "Çëµã»÷È·¶Ã‚¨Â£Â¬Ã–ØÃÂÂÆô¶Ã‚¯ÃÂú»ê¡£", "ÃÂú»ê", MB_OK);
}
else
{
MessageBox(NULL, "Update is completed.\nPlease, restart game.", "Update completed", MB_OK);
}
return 0;
}
}
/*
fp = NULL;
fp = fopen (fnmLWNew, "rb");
if (fp) {
fclose(fp);
Sleep(1000);
remove (fnmLW);
Sleep(1000);
int ret = rename(fnmLWNew, fnmLW);
// Date : 2005-05-17(¿ÀÈÄ 4:44:15), By Lee Ki-hwan Ãß°¡
if (!ret) {
ShowCursor(TRUE);
if( GetSystemDefaultLangID() == 0x0804 ) // ÃÂß±¹ ·ÃƒÅ½Ãƒâ€žÃƒÆ’ÀÇ °æ¿ì ¼ÃƒÂ¶ÃƒÂ¤
{
MessageBox(NULL, "Çëµã»÷È·¶Ã‚¨Â£Â¬Ã–ØÃÂÂÆô¶Ã‚¯ÃÂú»ê¡£", "ÃÂú»ê", MB_OK);
}
else
{
MessageBox(NULL, "Update is completed.\nPlease, restart game.", "Update completed", MB_OK);
}
return 0;
}
}*/
// end.
_hInstanceMain = hInstance;
//0214 ½Ã‚ºÃ‡Ãƒ·Ã‚¡½ÃƒÆ’ ¾ÃƒË†¶ÃƒÂ§Ã‚¿Ã¬Â±Ã¢.
// ShowSplashScreen(hInstance);
// set registry key for GameSpy
// deleted by seo - 40629
//RegisterGameSpy();
// remember desktop dimensions
_pixDesktopWidth = ::GetSystemMetrics(SM_CXSCREEN);
_pixDesktopHeight = ::GetSystemMetrics(SM_CYSCREEN);
#ifdef USE_NEW_LAUNCHER
if(strCmdLine.IsEqualCaseSensitive(CTString("4022")))
#else
if(strCmdLine.IsEqualCaseSensitive(CTString("6574")))
#endif
{
}
else
{
// WSS_NPROTECT 070405 ------------------>><<
// È«ÄáÀÇ °æ¿ì nProtect·ÃƒÅ½ ÃÂߺ¹ °ËÃâ
#ifdef NO_GAMEGUARD
#ifndef MULTI_CLIENT
if (IsRunning())
{
if( g_iCountry == RUSSIA )
{
MessageBox(NULL, "Êëèåíò LastChaos óæ?çàïóùå?", "LastChaos", MB_OK);
}
else
{
MessageBox(NULL, "LastChaos is already running on your system", "LastChaos Run", MB_OK);
}
return FALSE;
}
#endif // MULTI_CLIENT
#endif
#ifndef NKSP_NOT_NICKNAME
const CTString CmpStr("dlwltnr");
char* strPos = '\0';
strPos = strstr(strCmdLine.str_String, CmpStr.str_String);
if (!strPos || !CmpStr.IsEqualCaseSensitive(strPos))
{
if( g_iCountry == RUSSIA )
{
MessageBox(NULL, "Êëèåíò èãðû íå ìîæå?áûòü çàïóùå?ñàìîñò?òåëüíî.", "LastChaos", MB_OK);
}
else
{
MessageBox(NULL, "This program could not be run itself", "LastChaos", MB_OK);
}
return FALSE;
}
#endif
}
// prepare main window
MainWindow_Init();
#ifdef XTRAP_SECURE_CKBANG_2010_07_20
if (XTRAP())
XTRAP()->EngineConfirm();
#endif
OpenMainWindowInvisible();
// parse command line before initializing engine
ParseCommandLine(strCmdLine);
/*#if !_SE_DEMO
if (!PerformCDCheck()) {
return FALSE;
}
#endif*/
// initialize engine
SE_InitEngine(sam_strGameName);
extern BOOL g_bNasTrans;
g_bNasTrans = FALSE;
switch(g_iCountry)
{
case BRAZIL:
SetClassLong( _hwndMain, GCL_HICON, (LONG)LoadIcon( _hInstanceMain, (LPCTSTR)IDI_GUNSOFT ) );
g_bNasTrans = TRUE;
break;
case HONGKONG:
SetClassLong( _hwndMain, GCL_HICON, (LONG)LoadIcon( _hInstanceMain, (LPCTSTR)IDI_FUNMILY ) );
break;
}

// recheck for proper CD now
/*
if (FileExistsOnHD("Bin\\EntitiesMP.dll")) {
_fnmForCDCheck = "Bin\\EntitiesMP.dll";
} else if (FileExistsOnHD("Bin\\Entities.dll")) {
_fnmForCDCheck = "Bin\\Entities.dll";
}
*/
/*#if !_SE_DEMO
if (!PerformCDCheck()) {
return FALSE;
}
#endif*/
#if COPY_PROTECTION
// get full path to the exe
char strExePath[MAX_PATH] = "";
GetModuleFileName( NULL, strExePath, sizeof(strExePath)-1);
char strDrive[] = "C:\\";
strDrive[0] = strExePath[0];
DWORD dwSerial;
GetVolumeInformation(strDrive, NULL, 0, &dwSerial, NULL, NULL, NULL, 0);
CTFileName fnmKey = CTString("TSE.key");
INDEX iSerial = dwSerial;
// init encryption table two times
BLOWFISH_CTX ctx1;
BLOWFISH_CTX ctx2;
CTString strEnKey = _strEngineBuild;
strEnKey.TrimLeft(16);
char aubKey1[16];
char aubKey2[16];
for(INDEX i=0; i<16; i++) {
aubKey1[i] = strEnKey[i];
aubKey2[i] = strEnKey[16-1-i];
}
Blowfish_Init (&ctx1, (unsigned char*)aubKey1, 16);
Blowfish_Init (&ctx2, (unsigned char*)aubKey2, 16);
// if no key
if (!FileExists(fnmKey)) {
// just bail out
FatalError(TRANS("No registration key!\nPlease request registration key for code:\n\n%08X"), iSerial);
return FALSE;
// if key is here
} else {
// load it
CTString strKey;
LoadStringVar(fnmKey, strKey);
__int64 llCodeRead = 0;
strKey.ScanF("%I64x", &llCodeRead);
__int64 llCode1 = llCodeRead;
__int64 llCode2 = llCodeRead;
// decrypt the code
Blowfish_Decrypt(&ctx1, (ULONG*)&llCode1+1, ((ULONG*)&llCode1));
Blowfish_Decrypt(&ctx2, (ULONG*)&llCode2+1, ((ULONG*)&llCode2));
// if not valid
if (llCode1!=iSerial && llCode2!=iSerial) {
// bail out
FatalError(TRANS("Registration key is invalid!"));
return FALSE;
}
}
#endif
// if cd check didn't pass
/*
if (!_bCDPathFound) {
// check current time
SYSTEMTIME st;
GetSystemTime(&st);
// if after 30.3.2001, fail
if (st.wYear>2001) {
return FALSE;
} else if (st.wYear==2001) {
if (st.wMonth>3) {
return FALSE;
} else if (st.wMonth==3) {
if (st.wDay>30) {
return FALSE;
}
}
}
}
*/
SE_LoadDefaultFonts();
// now print the output of command line parsing
// deleted by seo
//CPrintF("%s", cmd_strOutput);
// lock the directory
DirectoryLockOn();
// load all translation tables
InitTranslation();
try {
AddTranslationTablesDir_t(CTString("Data\\Translations\\"), CTString("*.txt"));
FinishTranslationTable();
} catch (char *strError) {
FatalError("%s", strError);
}
// always disable all warnings when in serious sam
_pShell->Execute( "con_bNoWarnings=1;");
// declare shell symbols
// _pShell->DeclareSymbol("user void PlayDemo(CTString);", &PlayDemo);
_pShell->DeclareSymbol("persistent INDEX sam_bFullScreen;", &sam_bFullScreenActive);

// ±âº»ÀÇ ¿øµµ¿ì ¸ðµå ½ÃƒÆ’¿¡ Àüü ¸ðµå·ÃƒÅ½ º¯°æ
/*
if( OLD_WINDOW_MODE != WINDOW_MODE )
if ( sam_bFullScreenActive == OLD_WINDOW_MODE ) sam_bFullScreenActive = FULLSCREEN_MODE;
*/
// Date : 2005-09-13(¿ÀÈÄ 2:58:13), By Lee Ki-hwan
// ´ë¸¸¿¡¼Ã‚­ 񃧯 ¿øµµ¿ì ¸ðµå¸¦ ÃÂö¿øÇøé¼Ã‚­ ÇÊ¿ä¾ÃƒÂ¸¾ÃƒÂ®ÃƒÂü
_pShell->DeclareSymbol("persistent INDEX sam_iScreenSizeI;", &sam_iScreenSizeI);
_pShell->DeclareSymbol("persistent INDEX sam_iScreenSizeJ;", &sam_iScreenSizeJ);
_pShell->DeclareSymbol("persistent INDEX sam_iDisplayDepth;", &sam_iDisplayDepth);
_pShell->DeclareSymbol("persistent INDEX sam_iDisplayAdapter;", &sam_iDisplayAdapter);
_pShell->DeclareSymbol("persistent INDEX sam_iGfxAPI;", &sam_iGfxAPI);
//_pShell->DeclareSymbol("persistent INDEX sam_bFirstStarted;", &sam_bFirstStarted);
_pShell->DeclareSymbol("persistent INDEX sam_bAutoAdjustAudio;", &sam_bAutoAdjustAudio);
_pShell->DeclareSymbol("persistent user INDEX sam_bWideScreen;", &sam_bWideScreen);
_pShell->DeclareSymbol("persistent user FLOAT sam_fPlayerOffset;", &sam_fPlayerOffset);
_pShell->DeclareSymbol("persistent user INDEX sam_bAutoPlayDemos;", &sam_bAutoPlayDemos);
_pShell->DeclareSymbol("persistent user INDEX sam_iMaxFPSActive;", &sam_iMaxFPSActive);
_pShell->DeclareSymbol("persistent user INDEX sam_iMaxFPSInactive;", &sam_iMaxFPSInactive);
_pShell->DeclareSymbol("persistent user INDEX sam_bPauseOnMinimize;", &sam_bPauseOnMinimize);
_pShell->DeclareSymbol("persistent user FLOAT sam_tmDisplayModeReport;", &sam_tmDisplayModeReport);
_pShell->DeclareSymbol("persistent user CTString sam_strNetworkSettings;", &sam_strNetworkSettings);
_pShell->DeclareSymbol("persistent user CTString sam_strIntroLevel;", &sam_strIntroLevel);
_pShell->DeclareSymbol("persistent user CTString sam_strGameName;", &sam_strGameName);
_pShell->DeclareSymbol("user CTString sam_strVersion;", &sam_strVersion);
//_pShell->DeclareSymbol("user CTString sam_strFirstLevel;", &sam_strFirstLevel);
//_pShell->DeclareSymbol("user CTString sam_strModName;", &sam_strModName);
// _pShell->DeclareSymbol("persistent INDEX sam_bShowAllLevels;", &sam_bShowAllLevels);
// _pShell->DeclareSymbol("persistent INDEX sam_bMentalActivated;", &sam_bMentalActivated);
//_pShell->DeclareSymbol("user CTString sam_strTechTestLevel;", &sam_strTechTestLevel);
//_pShell->DeclareSymbol("user CTString sam_strTrainingLevel;", &sam_strTrainingLevel);

_pShell->DeclareSymbol("user void Quit(void);", &QuitGame);
_pShell->DeclareSymbol("persistent user INDEX sam_iVideoSetup;", &sam_iVideoSetup);
_pShell->DeclareSymbol("user void ApplyRenderingPreferences(void);", &ApplyRenderingPreferences);
//_pShell->DeclareSymbol("user void ApplyVideoMode(void);", &ApplyVideoMode);
_pShell->DeclareSymbol("user void Benchmark(void);", &BenchMark);
/*
_pShell->DeclareSymbol("user INDEX sam_bMenuSave;", &sam_bMenuSave);
_pShell->DeclareSymbol("user INDEX sam_bMenuLoad;", &sam_bMenuLoad);
_pShell->DeclareSymbol("user INDEX sam_bMenuControls;", &sam_bMenuControls);
_pShell->DeclareSymbol("user INDEX sam_bMenuHiScore;", &sam_bMenuHiScore);
*/
_pShell->DeclareSymbol("user INDEX sam_bToggleConsole;",&sam_bToggleConsole);
// _pShell->DeclareSymbol("INDEX sam_iStartCredits;", &sam_iStartCredits);
// Obtain player and world base class without releasing it (this will never be released from stock)
g_pPlayer = _pEntityClassStock->Obtain_t(CTString("Classes\\Player.ecl")); // this must not be a dependency!
g_pWorldBase = _pEntityClassStock->Obtain_t(CTString("Classes\\WorldBase.ecl")); // this must not be a dependency!
InitializeGame();
_pNetwork->md_strGameID = sam_strGameName;
//LCDInit();
/*if( sam_bFirstStarted) {
InfoMessage("%s", TRANS(
"SeriousSam is starting for the first time.\n"
"If you experience any problems, please consult\n"
"ReadMe file for troubleshooting information."));
}*/
// initialize sound library
snd_iFormat = Clamp( snd_iFormat, (INDEX)CSoundLibrary::SF_NONE, (INDEX)CSoundLibrary::SF_44100_16);
_pSound->SetFormat( (enum CSoundLibrary::SoundFormat)snd_iFormat);
if (sam_bAutoAdjustAudio)
{
_pShell->Execute("include \"Scripts\\Addons\\SFX-AutoAdjust.ini\"");
}
/*
// execute script given on command line
if (cmd_strScript!="")
{
CPrintF("Command line script: '%s'\n", cmd_strScript);
CTString strCmd;
strCmd.PrintF("include \"%s\"", cmd_strScript);
_pShell->Execute(strCmd);
}
*/

// load logo textures
//LoadAndForceTexture(_toLogoCT, _ptoLogoCT, CTFILENAME("Textures\\Logo\\LogoCT.tex"));
//LoadAndForceTexture(_toLogoODI, _ptoLogoODI, CTFILENAME("Textures\\Logo\\GodGamesLogo.tex"));
//LoadAndForceTexture(_toLogoGSpy, _ptoLogoGSpy, CTFILENAME("Textures\\Logo\\LogoGSpy.tex"));
//LoadAndForceTexture(_toLogoEAX, _ptoLogoEAX, CTFILENAME("Textures\\Logo\\LogoEAX.tex"));
//LoadStringVar(CTString("Data\\Var\\Sam_Version.var"), sam_strVersion);
//LoadStringVar(CTString("Data\\Var\\ModName.var"), sam_strModName);
CPrintF(TRANS("Nksp version: %s\n"), sam_strVersion);
//CPrintF(TRANS("Active mod: %s\n"), sam_strModName);
//InitializeMenus(); // ¿øº».

// if there is a mod
/*if (_fnmMod!="") {
// execute the mod startup script
_pShell->Execute(CTString("include \"Scripts\\Mod_startup.ini\";"));
}*/
// init gl settings module
// deleted by seo
//InitGLSettings();
// init level-info subsystem
// deleted by seo
//LoadLevelsList();
//LoadDemosList();
// apply application mode
StartNewMode( GAT_D3D, sam_iDisplayAdapter, sam_iScreenSizeI, sam_iScreenSizeJ,
(enum DisplayDepth)sam_iDisplayDepth, IsFullScreen( sam_bFullScreenActive) );
_pGameState = new CGameState;
_pUIMgr = new CUIManager; // yjpark
_pUIMgr->Create(); // yjpark
//wooss 050822 add test ui version
// TEST UI¸¦ À§ÇØ Ãß°¡
// TEST ȯ°æÀÌ ¾Ãƒâ€ Ã‚´Ã’ °æ¿ì À̺κÃÂÀ» FALSE·ÃƒÅ½ ó¸®
// TEST ÇðíÀÚ Çô UI º¯°æ½ÃƒÆ’ TYPE ºÎºÃÂÀ» °íÃÄ ÃÂØ´Ù
//------------------------------------------------------------------------------>>

// _pUIMgr->m_testUI_MODE = TRUE;
_pUIMgr->m_testUI_MODE = FALSE;
_pUIMgr->m_testUI_TYPE = UI_SELECTLIST; //wooss UI test variable

//<<------------------------------------------------------------------------------
if(_pUIMgr->m_testUI_MODE) _pUIMgr->SetUIGameState( UGS_UI_TEST);
else _pUIMgr->SetUIGameState( UGS_LOGIN ); // yjpark
_pUIMgr->GetOption()->SetDesktopSize( _pixDesktopWidth, _pixDesktopHeight );
_pUIMgr->SetGameHandle(_pGame);
_pUIMgr->ResetUIPos( _pdpMain );
//°­µ¿¹ÃƒÅ½ ¼ÃƒÂ¶ÃƒÂ¤ ½ÃƒÆ’ÀÛ ½ÃƒÆ’½Ã‚ºÃ…Û ¸¶Ã‚¿Ã¬½Ã‚º À۾÷ 09.09
//#define ANIMATION_CURSOR
#ifdef ANIMATION_CURSOR
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_NORMAL, LoadAnimationCursor( _hInstanceMain, IDC_NORMAL_CURSOR) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_ATT_NORMAL, LoadAnimationCursor( _hInstanceMain, IDC_ATTACK_CURSOR) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_ATT_SKILL, LoadAnimationCursor( _hInstanceMain, IDC_SKILL_CURSOR) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_ATT_MAGIC, LoadAnimationCursor( _hInstanceMain, IDC_MAGIC_CURSOR) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_ATT_BOW, LoadAnimationCursor( _hInstanceMain, IDC_BOW_CURSOR) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_PICK, LoadAnimationCursor( _hInstanceMain, IDC_PICK_CURSOR) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_TALK, LoadAnimationCursor( _hInstanceMain, IDC_TALK_CURSOR) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_PRODUCE, LoadAnimationCursor( _hInstanceMain, IDC_PRODUCE_CURSOR) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_SIZE, LoadAnimationCursor( _hInstanceMain, IDC_SIZE_CURSOR) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_ZOOMIN, LoadAnimationCursor( _hInstanceMain, IDC_ZOOMIN_CURSOR) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_SIGNAL, LoadAnimationCursor( _hInstanceMain, IDC_SIGNAL_CURSOR) );
#else
// FIXME : EngineÀÇ Resource¿¡ *.cur È­ÀÃÂÀ» ³Ãƒâ€“¾ÃƒÂ®ÃƒÂáÀ»¶Ã‚§, ÇØ´ç Ä¿¼Ã‚­Â¸Â¦ ¾ÃƒÂ²¾ÃƒÂ®Ã‚¿Ã€ÃÂö ¸øÇؼ­ À̷±½Ãƒâ€žÃƒâ‚¬Ã‚¸·ÃƒÅ½ ó¸®ÇÃâ€.
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_NORMAL, LoadCursor( _hInstanceMain, MAKEINTRESOURCE(IDC_NORMAL_CURSOR) ) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_ATT_NORMAL, LoadCursor( _hInstanceMain, MAKEINTRESOURCE(IDC_ATTACK_CURSOR) ) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_ATT_SKILL, LoadCursor( _hInstanceMain, MAKEINTRESOURCE(IDC_SKILL_CURSOR) ) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_ATT_MAGIC, LoadCursor( _hInstanceMain, MAKEINTRESOURCE(IDC_MAGIC_CURSOR) ) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_ATT_BOW, LoadCursor( _hInstanceMain, MAKEINTRESOURCE(IDC_BOW_CURSOR) ) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_PICK, LoadCursor( _hInstanceMain, MAKEINTRESOURCE(IDC_PICK_CURSOR) ) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_TALK, LoadCursor( _hInstanceMain, MAKEINTRESOURCE(IDC_TALK_CURSOR) ) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_PRODUCE, LoadCursor( _hInstanceMain, MAKEINTRESOURCE(IDC_PRODUCE_CURSOR) ) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_SIZE, LoadCursor( _hInstanceMain, MAKEINTRESOURCE(IDC_SIZE_CURSOR) ) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_ZOOMIN, LoadCursor( _hInstanceMain, MAKEINTRESOURCE(IDC_ZOOMIN_CURSOR) ) );
_pUIMgr->GetMouseCursor()->SetCursorHandle( UMCT_SIGNAL, LoadCursor( _hInstanceMain, MAKEINTRESOURCE(IDC_SIGNAL_CURSOR) ) );

#endif
//°­µ¿¹ÃƒÅ½ ¼ÃƒÂ¶ÃƒÂ¤ ³Ã‚¡ ½ÃƒÆ’½Ã‚ºÃ…Û ¸¶Ã‚¿Ã¬½Ã‚º À۾÷ 09.09
// set default mode reporting
/*if( sam_bFirstStarted) {
_iDisplayModeChangeFlag = 0;
sam_bFirstStarted = FALSE;
}*/

//0214 ½Ã‚ºÃ‡Ãƒ·Ã‚¡½ÃƒÆ’ ¼ÃƒÂ»Ã‚±Ã¢Â±Ã¢
// HideSplashScreen();
/*
if (cmd_strPassword!="") {
_pShell->SetString("net_strConnectPassword", cmd_strPassword);
}
#if TECHTESTONLY
cmd_strWorld = CTString("Levels\\TechTestElsa.wld");
#endif
if (cmd_strPlayer!="")
{
int iPlayer = atoi(cmd_strPlayer);
_pGame->gm_aiMenuLocalPlayers[0] = Clamp(iPlayer, 0, 7);
}
*/
//0105 42line ÃÂö¿ì±â
/*
// if connecting to server from command line
if (cmd_strServer!="") {
CTString strPort = "";
if (cmd_iPort>0) {
_pShell->SetINDEX("net_iPort", cmd_iPort);
strPort.PrintF(":%d", cmd_iPort);
}
CPrintF(TRANS("Command line connection: '%s%s'\n"), cmd_strServer, strPort);
// go to join menu
_pGame->gam_strJoinAddress = cmd_strServer;
if (cmd_bQuickJoin) {
extern void JoinNetworkGame(void);
JoinNetworkGame();
} else {
StartMenus("join");
}
// if starting world from command line
} else if (cmd_strWorld!="") {
CPrintF(TRANS("Command line world: '%s'\n"), cmd_strWorld);
// try to start the game with that level
try {
if (cmd_iGoToMarker>=0) {
CPrintF(TRANS("Command line marker: %d\n"), cmd_iGoToMarker);
CTString strCommand;
strCommand.PrintF("cht_iGoToMarker = %d;", cmd_iGoToMarker);
_pShell->Execute(strCommand);
}
_pGame->gam_strCustomLevel = cmd_strWorld;
if (cmd_bServer) {
extern void StartNetworkGame(void);
StartNetworkGame();
} else {
extern void StartSinglePlayerGame(void);
StartSinglePlayerGame();
}
} catch (char *strError) {
CPrintF(TRANS("Cannot start '%s': '%s'\n"), cmd_strWorld, strError);
}
// if no relevant starting at command line
} else {
StartNextDemo();
}
*/
//0105
//_pGame->gam_strJoinAddress = "211.56.73.22";
//_pGame->gm_strNetworkProvider = "TCP/IP Client";
/*
_pGame->gam_strJoinAddress = "211.56.73.12"; // by seo 40225
_pGame->gm_strNetworkProvider = "TCP/IP Mmo";

if (_pGame->JoinGame( CNetworkSession( _pGame->gam_strJoinAddress)))
{
_gmRunningGameMode = GM_NETWORK;
}
//..
*/
//_pGameState->m_BackGroundWorld.Load_t(LOGIN_WORLD);
{
/*
_pGame->gm_strNetworkProvider = "Local";
_pGame->gm_aiStartLocalPlayers[0] = 0;
_pGame->gm_CurrentSplitScreenCfg = CGame::SSC_PLAY1;
CSessionProperties sp;
_pGame->SetQuickStartSession(sp);
CPlayerCharacter &pc = _pGame->gm_apcPlayers[0];
pc.pc_iPlayerIndex = 0;
if(!_pGame->PreNewGame() || !_pGame->NewGame( LOGIN_WORLD, LOGIN_WORLD, sp))
{
//DisableLoadingHook();
}
//_pNetwork->ga_World;
//_pGameState->m_BackGroundWorld.Load_t(LOGIN_WORLD);
_pUIMgr->SetBackgroundWorld(&_pNetwork->ga_World);
*/
/*
while(TRUE)
{
GameMainLoop();
pdp->SetAsCurrent();
pdp->Fill(C_BLACK|CT_OPAQUE);
pdp->FillZBuffer(ZBUF_BACK);
GameRedrawView(pdp, GRV_SHOWEXTRAS);
pvp->SwapBuffers();
};
StopGame();
DisableLoadingHook();
*/
}
//¾ÃƒË†Ãƒâ€¦Ãƒâ€šÃƒË†Ãƒâ€  ¼ÃƒÂ¶ÃƒÂ¤ ½ÃƒÆ’ÀÛ //(5th Closed beta)(0.2)
WebAddressInit();
g_web.Begin();
//¾ÃƒË†Ãƒâ€¦Ãƒâ€šÃƒË†Ãƒâ€  ¼ÃƒÂ¶ÃƒÂ¤ ³Ã‚¡ //(5th Closed beta)(0.2)
// 051121 nksp.exe version check on/off
if(strCmdLine.IsEqualCaseSensitive(CTString("6574"))) ;
else {
CheckEngineVersion();
CheckEntityVersion();
}
return TRUE;
}
void End(void)
{
//¾ÃƒË†Ãƒâ€¦Ãƒâ€šÃƒË†Ãƒâ€  ¼ÃƒÂ¶ÃƒÂ¤ ½ÃƒÆ’ÀÛ //(5th Closed beta)(0.2)
g_web.End();
//¾ÃƒË†Ãƒâ€¦Ãƒâ€šÃƒË†Ãƒâ€  ¼ÃƒÂ¶ÃƒÂ¤ ³Ã‚¡ //(5th Closed beta)(0.2)
_pGame->DisableLoadingHook();
// cleanup level-info subsystem
//ClearLevelsList(); // ¿øº».
//ClearDemosList();
_pFontStock->Release(_pfdDisplayFont);
_pfdDisplayFont = NULL;
_pFontStock->Release(_pfdConsoleFont);
_pfdConsoleFont = NULL;
_pEntityClassStock->Release(g_pPlayer);
g_pPlayer = NULL;
_pEntityClassStock->Release(g_pWorldBase);
g_pWorldBase = NULL;

// destroy the main window and its canvas
if (_pvpViewPortMain!=NULL)
{
_pGfx->DestroyWindowCanvas( _pvpViewPortMain);
_pvpViewPortMain = NULL;
_pdpNormalMain = NULL;
}
CloseMainWindow();
MainWindow_End();
//DestroyMenus(); // ¿øº».
_pGame->End();
//LCDEnd();
// unlock the directory
DirectoryLockOff();
SE_EndEngine();

void (*GAME_Destroy)(void) = (void (*)(void))GetProcAddress(g_hGame, "GAME_Destroy");
if (GAME_Destroy==NULL)
{
ThrowF_t("%s", GetWindowsError(GetLastError()));
}
GAME_Destroy();
//¾ÃƒË†Ãƒâ€¦Ãƒâ€šÃƒË†Ãƒâ€  ¼ÃƒÂ¶ÃƒÂ¤ ½ÃƒÆ’ÀÛ //(DevPartner Bug Fix)(2005-01-14)
if(g_hGame) FreeLibrary(g_hGame);
//¾ÃƒË†Ãƒâ€¦Ãƒâ€šÃƒË†Ãƒâ€  ¼ÃƒÂ¶ÃƒÂ¤ ³Ã‚¡ //(DevPartner Bug Fix)(2005-01-14)
}

// print display mode info if needed
void PrintDisplayModeInfo(void)
{
// skip if timed out
if( _pTimer->GetRealTimeTick() > (_tmDisplayModeChanged+sam_tmDisplayModeReport)) return;
// cache some general vars
SLONG slDPWidth = _pdpMain->GetWidth();
SLONG slDPHeight = _pdpMain->GetHeight();
if( _pdpMain->IsDualHead()) slDPWidth/=2;
if( _pdpMain->IsTripleHead()) slDPWidth/=3;
CDisplayMode dm;
dm.dm_pixSizeI = slDPWidth;
dm.dm_pixSizeJ = slDPHeight;
// determine proper text scale for statistics display
FLOAT fTextScale = (FLOAT)slDPHeight/480.0f/2;
// get resolution
CTString strRes;
extern CTString _strPreferencesDescription;
strRes.PrintF( "%dx%dx%s", slDPWidth, slDPHeight, _pGfx->gl_dmCurrentDisplayMode.DepthString());
if( dm.IsDualHead()) strRes += TRANS(" DualMonitor");
if( dm.IsTripleHead()) strRes += TRANS(" TripleMonitor");
if( dm.IsWideScreen()) strRes += TRANS(" WideScreen");
if( _pGfx->gl_eCurrentAPI==GAT_OGL) strRes += " (OpenGL)";
else
if( _pGfx->gl_eCurrentAPI==GAT_D3D) strRes += " (Direct3D)";
CTString strDescr;
strDescr.PrintF("\n%s (%s)\n", _strPreferencesDescription, RenderingPreferencesDescription(sam_iVideoSetup));
strRes += strDescr;
// tell if application is started for the first time, or failed to set mode
if( _iDisplayModeChangeFlag==0)
{
strRes += TRANS("Display mode set by default!");
}
else if( _iDisplayModeChangeFlag==2)
{
strRes += TRANS("Last mode set failed!");
}
// print it all
_pdpMain->SetFont( _pfdDisplayFont);
_pdpMain->SetTextScaling( fTextScale);
_pdpMain->SetTextShadow( +2);
_pdpMain->SetTextAspect( 1.0f);
const FLOAT fPosMul = _pdpMain->IsTripleHead() ? 1.05f : 0.05f;
//pdp->PutText( strRes, slDPWidth*fPosMul, slDPHeight*0.85f, LCDGetColor(C_GREEN|255, "display mode")); // ¿øº».
_pdpMain->PutText( strRes, slDPWidth*fPosMul, slDPHeight*0.85f);
}
// do the main game loop and render screen
void DoGame(void)
{
// set flag if not in game
if( !_pGame->gm_bGameOn)
//_gmRunningGameMode = GM_NONE; // ¿øº».
_pGameState->GetGameMode() = CGameState::GM_NONE;
// °Ãâ€Ãƒâ‚¬Ãƒâ€œ ¸ðµå°¡ µ¥¸ð¸ðµåÀö§...
/*
if( _gmRunningGameMode==GM_DEMO && _pNetwork->IsDemoPlayFinished()
||_gmRunningGameMode==GM_INTRO && _pNetwork->IsGameFinished())
{
_pGame->StopGame();
_gmRunningGameMode = GM_NONE;
// load next demo
StartNextDemo();
if (!_bInAutoPlayLoop) {
// start menu
StartMenus();
}
}
*/
/*
// do the main game loop
if( _gmRunningGameMode == GM_LOGIN){
_pNetwork->
}
else*/

// °Ãâ€Ãƒâ‚¬Ãƒâ€œ ½Ãƒâ€¡Ãƒâ€¡ÃƒÂ ÃƒÂßÀö§ »óÅÂ!
//_pGameState->m_bMenuActive 0
//_pGameState->m_bMenuRendering 1
//_gmMenuGameMode GM_NONE
//_gmRunningGameMode GM_NETWORK
//_pGame->gm_bGameOn 1
//_pGame->gm_bMenuOn 0
// °Ãâ€Ãƒâ‚¬Ãƒâ€œÃƒâ‚¬ÃƒÅ’ ½Ãƒâ€¡Ãƒâ€¡ÃƒÂ ÃƒÂßÀö§¸¸ È£ÃâµÇ´Â ºÎºÃÂ.
//if( _gmRunningGameMode != GM_NONE)
//if( _gmRunningGameMode != GM_NONE) // ¿øº».
if( _pGameState->GetGameMode() != CGameState::GM_NONE) // ¿øº».
{
_pGame->GameMainLoop();
//0215
// CSoundObject soMusic;
// soMusic.Play_t(CTFILENAME("Music\\Credits.mp3"), SOF_NONGAME|SOF_MUSIC|SOF_LOOP);
//
// if game is not started
}
else
{
// just handle broadcast messages
_pNetwork->GameInactive();
}
// redraw the view
if( !IsIconic(_hwndMain) && _pdpMain!=NULL && _pdpMain->Lock())
{
// ¸Þ´º°¡ ºñȰ¼Ã‚ºÃˆÂ­ µÇ¾ÃƒÂºÃ‚°Ã­, °Ãâ€Ãƒâ‚¬Ãƒâ€œ ½Ãƒâ€¡Ãƒâ€¡ÃƒÂ ÃƒÂßÀö§???
//if( _gmRunningGameMode!=GM_NONE && !_pGameState->m_bMenuActive )
//if( _gmRunningGameMode!=GM_NONE && !_pGameState->m_bMenuActive ) // ¿øº».
int iState = _pGameState->GetGameMode();
//BOOL bState = _pGameState->m_bMenuActive;
if( _pGameState->GetGameMode() != CGameState::GM_NONE) // ¿øº».
{
// handle pretouching of textures and shadowmaps
_pdpMain->Unlock();
// °á±¹Ãƒâ‚¬Ã‚º RenderView()¸¦ È£ÃâÇÃâ€.
_pGame->GameRedrawView( _pdpMain, (_pGame->gm_csConsoleState!=CS_OFF)?0:GRV_SHOWEXTRAS);
_pdpMain->Lock();
}
else
{
//pdp->Fill( LCDGetColor(C_dGREEN|CT_OPAQUE, "bcg fill")); // ¿øº».
_pdpMain->Fill(C_dGREEN|CT_OPAQUE);
}
// do menu
/*
if( _pGameState->m_bMenuRendering) {
// clear z-buffer
pdp->FillZBuffer( ZBUF_BACK);
// remember if we should render menus next tick
_pGameState->m_bMenuRendering = DoMenu(pdp);
}
*/
//_pUIMgr->SetBackgroundWorld(&_pGameState->m_BackGroundWorld);
//pdp->FillZBuffer( ZBUF_BACK);
/*
TIME tmTickNow = _pTimer->GetRealTimeTick();

while( _tmMenuLastTickDone < tmTickNow)
{
_pTimer->SetCurrentTick(_tmMenuLastTickDone);
_tmMenuLastTickDone += _pTimer->TickQuantum;
}

SetMenuLerping();
*/
//if(_pGameState->m_bMenuRendering)
// Render User interface
//_pUIMgr->Render( _pdpMain ); // yjpark
//0609 kwon
_pGame->GameRedrawCursor( _pdpMain, (_pGame->gm_csConsoleState!=CS_OFF)?0:GRV_SHOWEXTRAS);
// print display mode info if needed
//PrintDisplayModeInfo();
// render console
// ÄܼÖ⠷»´õ¸µ.
_pGame->ConsoleRender(_pdpMain);
// done with all
_pdpMain->Unlock();
// clear upper and lower parts of screen if in wide screen mode
/*
if( _pdpMain==_pdpWideScreenMain && _pdpNormalMain->Lock()) {
const PIX pixWidth = _pdpWideScreenMain->GetWidth();
const PIX pixHeight = (_pdpNormalMain->GetHeight() - _pdpWideScreenMain->GetHeight()) /2;
const PIX pixJOfs = pixHeight + _pdpWideScreenMain->GetHeight()-1;
_pdpNormalMain->Fill( 0, 0, pixWidth, pixHeight, C_BLACK|CT_OPAQUE);
_pdpNormalMain->Fill( 0, pixJOfs, pixWidth, pixHeight, C_BLACK|CT_OPAQUE);
_pdpNormalMain->Unlock();
}
*/
// show
_pvpViewPortMain->SwapBuffers();
}
}

/*
void TeleportPlayer(int iPosition)
{
CTString strCommand;
strCommand.PrintF( "cht_iGoToMarker = %d;", iPosition);
_pShell->Execute(strCommand);
}
*/

CTextureObject _toStarField;
static FLOAT _fLastVolume = 1.0f;
void RenderStarfield(CDrawPort *pdp, FLOAT fStrength)
{
CTextureData *ptd = (CTextureData *)_toStarField.GetData();
// skip if no texture
if(ptd==NULL) return;
PIX pixSizeI = pdp->GetWidth();
PIX pixSizeJ = pdp->GetHeight();
FLOAT fStretch = pixSizeJ / 480.0f;
fStretch *= FLOAT(ptd->GetPixWidth()) / ptd->GetWidth();
PIXaabbox2D boxScreen(PIX2D(0,0), PIX2D(pixSizeI, pixSizeJ));
MEXaabbox2D boxTexture(MEX2D(0, 0), MEX2D(pixSizeI/fStretch, pixSizeJ/fStretch));
pdp->PutTexture(&_toStarField, boxScreen, boxTexture, LerpColor(C_BLACK, C_WHITE, fStrength)|CT_OPAQUE);
}

FLOAT RenderQuitScreen(CDrawPort *pdp, CViewPort *pvp)
{
CDrawPort dpQuit(pdp, 0);
CDrawPort dpWide;
dpQuit.MakeWideScreen(&dpWide);
// redraw the view
if (!dpWide.Lock()) {
return 0;
}
dpWide.Fill(C_BLACK|CT_OPAQUE);
RenderStarfield(&dpWide, _fLastVolume);

// FLOAT fVolume = Credits_Render(&dpWide);
// _fLastVolume = fVolume;
_fLastVolume = 1.0f;
dpWide.Unlock();
pvp->SwapBuffers();
return _fLastVolume;
}
// þ·ÃƒÂ¡½ÃƒÆ’ Credit º¸¿©ÃÂÖ´Â ºÎºÃÂ.
void QuitScreenLoop(void)
{
// Credits_On(3);
CSoundObject soMusic;
try
{
_toStarField.SetData_t(CTFILENAME("Textures\\Background\\Night01\\Stars01.tex"));
//0603 kwon ȏæ.
// soMusic.Play_t(CTFILENAME("Music\\Credits.mp3"), SOF_NONGAME|SOF_MUSIC|SOF_LOOP);
}
catch (char *strError)
{
CPrintF("%s\n", strError);
}
// while it is still running
FOREVER
{
FLOAT fVolume = RenderQuitScreen(_pdpMain, _pvpViewPortMain);
if (fVolume<=0)
{
return;
}
// assure we can listen to non-3d sounds
soMusic.SetVolume(fVolume, fVolume);
_pSound->UpdateSounds();
// while there are any messages in the message queue
MSG msg;
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
// if it is not a keyboard or mouse message
if(msg.message==WM_LBUTTONDOWN||
msg.message==WM_RBUTTONDOWN||
msg.message==WM_KEYDOWN)
{
return;
}
}
//Sleep(5);
}
}
// reverses string
void StrRev( char *str) {
char ctmp;
char *pch0 = str;
char *pch1 = str+strlen(str)-1;
while( pch1>pch0) {
ctmp = *pch0;
*pch0 = *pch1;
*pch1 = ctmp;
pch0++;
pch1--;
}
}
void GetLCModulePathName(char* Path)
{
char strTmpPath[MAX_PATH] = "";
GetModuleFileName(NULL, strTmpPath, MAX_PATH);
StrRev(strTmpPath);
char *pstr = strchr( strTmpPath, '\\');
if( strnicmp( pstr, "\\gubed", 6)==0) pstr += 6;
if( pstr[0] = '\\') pstr++;
char *pstrFin = strchr( pstr, '\\');
if( pstrFin==NULL) {
strcpy( pstr, "\\");
pstrFin = pstr;
}
StrRev(pstrFin);
strncpy(strTmpPath, pstrFin, MAX_PATH-1);
strcpy(Path, strTmpPath);
}
int SubMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
(void)hPrevInstance;
#ifdef USE_NEW_LAUNCHER
CTString strparam = CTString(lpCmdLine);
IPCEventInfo EventInfo;
memset(EventInfo.ulParameter2, 0, sizeof(EventInfo.ulParameter2));
//////////////////////////////////////////////////////////////////////////
//
char strPathName[MAX_PATH] = "";
GetLCModulePathName(strPathName);
CTFileName fnmBatch(strPathName);
fnmBatch = fnmBatch + "LAUNCHER.BAT";
FILE* fp = NULL;
BOOL bExistNewLauncher = FALSE;
int nLoopCount = 0;
// launcher patch process change. [8/27/2010 rumist]
if ((fp = fopen(fnmBatch, "rb")) != NULL)
{
fclose(fp);
// MessageBox(NULL, "Update is completed.\nPlease, restart game.", "Update completed", MB_OK);
// ShellExecute(NULL, "open", fnmBatch, NULL, strPathName, SW_HIDE);
// return TRUE;
bExistNewLauncher = TRUE;
}
if (!strparam.IsEqualCaseSensitive(CTString("4022")))
{
// IPC //////////////////////////////////////////////////////////////////////////
XExtIPCManager<IPCEventInfo> IPCMgr;
int Ret = IPCMgr.XExtIPCEventCreate(1, FALSE);
if (Ret < 0)
{
MessageBox(NULL, "This program could not be run itself", "LastChaos", MB_OK);
IPCMgr.XExtIPCEventRelease(FALSE);
return TRUE;
}
do
{
EventInfo.EventID = 0;
Ret = IPCMgr.XExtIPCEventQueryIPCEvent(&EventInfo, NULL);
++nLoopCount;
if (Ret > 0)
{
IPCEventInfo SendEventInfo;

if (bExistNewLauncher)
{
SendEventInfo.EventID = -1;
SendEventInfo.DestProcessID = 0;
SendEventInfo.ulParameter1 = 0;
memset(SendEventInfo.ulParameter2, 0, sizeof(SendEventInfo.ulParameter2));
IPCMgr.XExtIPCEventPost(&SendEventInfo);
IPCMgr.XExtIPCEventRelease(FALSE);
MessageBox(NULL, "Update is completed.\nPlease, restart game.", "Update completed", MB_OK);
ShellExecute(NULL, "open", fnmBatch, NULL, strPathName, SW_HIDE);
return TRUE;
}
else if (EventInfo.EventID != 100)
{
SendEventInfo.EventID = -1;
SendEventInfo.DestProcessID = 0;
SendEventInfo.ulParameter1 = 0;
memset(SendEventInfo.ulParameter2, 0, sizeof(SendEventInfo.ulParameter2));
IPCMgr.XExtIPCEventPost(&SendEventInfo);
MessageBox(NULL, "This program could not be run itself", "LastChaos", MB_OK);
IPCMgr.XExtIPCEventRelease(FALSE);
return TRUE;
}
if (SE_GetEngineDllRefCnt() > 1 || IsRunning() )// ¸ÖƼ Ŭ¶ÃƒÂ³Ãƒâ‚¬ÃƒÅ’¾ÃƒÂ°Ãƒâ€ Ã‚® ¸·Ã‚±Ã¢. [2/4/2010 rumist]
{
SendEventInfo.EventID = -1;
SendEventInfo.DestProcessID = 0;
SendEventInfo.ulParameter1 = 0;
memset(SendEventInfo.ulParameter2, 0, sizeof(SendEventInfo.ulParameter2));
IPCMgr.XExtIPCEventPost(&SendEventInfo);
MessageBox(NULL, "Already Executive Game.", "LastChaos", MB_OK);
IPCMgr.XExtIPCEventRelease(FALSE);
return TRUE;
}
else
{
SendEventInfo.EventID = 100;
SendEventInfo.DestProcessID = 0;
SendEventInfo.ulParameter1 = 0;
memset(SendEventInfo.ulParameter2, 0, sizeof(SendEventInfo.ulParameter2));
IPCMgr.XExtIPCEventPost(&SendEventInfo);
IPCMgr.XExtIPCEventRelease(FALSE);
//MessageBox(NULL, "Send Event message", "LastChaos", MB_OK);
}
break;
}
} while( nLoopCount != 1000 );
}
GetNM(EventInfo.ulParameter2);
#else
if (strlen(lpCmdLine) <= 0) {
if( g_iCountry == RUSSIA )
{
MessageBox(NULL, "Êëèåíò èãðû íå ìîæå?áûòü çàïóùå?ñàìîñò?òåëüíî.", "LastChaos", MB_OK);
}
else
{
MessageBox(NULL, "This program could not be run itself", "LastChaos", MB_OK);
}
return TRUE;
}

GetNM(lpCmdLine);
#endif

ShowCursor(FALSE);

if( !Init( hInstance, nCmdShow, lpCmdLine )) return FALSE;
BOOL bInit = TRUE;
// WSS_NPROTECT 070402 ------------------------------->>
#ifndef NO_GAMEGUARD
// CPrintF("[ ---->> GameGuard Init...Start <<---- ] - %lu\n",timeGetTime());
//bInit = _pNetwork->Init_nProtect();
//_pGameState->Running() = bInit;
//WinMain ÃÖ»ó´Ü¿¡ ³Ãƒâ€“¾ÃƒÂºÃƒâ‚¬Ã‚¸³Ã‚ª string ó¸® ºÎºÃÂÀÌ uimanager¿¡ À־î¼Ã‚­ uimanagerÀ» »ý¼Ã‚º ÈÄ Ã³Ã‚¸Â®Ã‡Ã˜¾ÃƒÅ¸ µÈ´Ù.
CREATE_GAMEGUARD_WRAPPER();
bInit = GAME_GUARD()->Init();
// CPrintF("[ ---->> GameGuard Init...End <<---- ] - %lu\n",timeGetTime());
#endif
// ---------------------------------------------------<<

// initialy, application is running and active, console and menu are off
//_bRunning = TRUE;
//_bQuitScreen = TRUE;
if(g_szExitError == NULL && bInit)
{
_pGameState->Running() = TRUE;
_pGameState->QuitScreen() = TRUE;
}
_pGame->gm_csConsoleState = CS_OFF;
//_pGame->gm_csComputerState = CS_OFF;
// _pGameState->m_bMenuActive = FALSE;
//_pGameState->m_bMenuRendering = FALSE;
// while it is still running

#if _DEBUG
// enableFPExceptions();
#endif
//_pGame->QuickTest(LOGIN_WORLD, pdp, pvpViewPort);
//#define AUTO_LOGIN
#ifndef AUTO_LOGIN
if(_pGameState->Running())
{
_pGame->LoginGame(LOGIN_WORLD);
}
#else
if(_pGameState->Running())
{
g_slZone = 0;
_pGame->LoginGame(START_WORLD);
}
#endif

ShowCursor(TRUE);

// À̱âȯ ¼ÃƒÂ¶ÃƒÂ¤ ½ÃƒÆ’ÀÛ (11. 15) : IME »óÅ â æ°Å
SendMessage ( _hwndMain, WM_IME_NOTIFY, IMN_CLOSESTATUSWINDOW, NULL );
// À̱âȯ ¼ÃƒÂ¶ÃƒÂ¤ ³Ã‚¡

//¾ÃƒË†Ãƒâ€¦Ãƒâ€šÃƒË†Ãƒâ€  ¼ÃƒÂ¶ÃƒÂ¤ ½ÃƒÆ’ÀÛ //(5th Closed beta)(0.2)
FLOAT tmPrev = 0;
FLOAT tmNow = 0;
INDEX cntFrame = 0;
FLOAT tmLastSndMute = 0;
//¾ÃƒË†Ãƒâ€¦Ãƒâ€šÃƒË†Ãƒâ€  ¼ÃƒÂ¶ÃƒÂ¤ ³Ã‚¡ //(5th Closed beta)(0.2)
// WSS_NPROTECT 070402 ------------------------------->>
// À©µµ¿ì ÇÚµé »ý¼Ã‚º ÀÌÈÄ ¸ðµç ±×·Ã‚¡Ã‡Ãˆ UI°ü·ÃƒÆ’ ÃʱâÈ­°¡ ³Ã‚¡³Ã‚­ ÈÄ SetHwnd() È£Ãâ
// ÀÌ ÇÃ‼ö·ÃƒÅ½ ºÎÅàCallBack ÇÃ‼ö°¡ È£ÃÃÂ

Print this item

  [Delete & Replace] Navicat Queries
Posted by: Kotetsu - 10-23-2012, 08:23 PM - Forum: Ep1 Guides - No Replies


1. Replace some things.

UPDATE <table> SET <column A> = '<value A>' WHERE <column B> = '<value B>';

Exemple : I want replace all mobs to the zone 0 by 127 when the NPC is '126' and the zone_num = 0

So : UPDATE t_npc_regen SET a_npc_idx = '127' WHERE a_zone_num ='0' AND a_npc_idx = '126';

 

In words :

Update the database to set column A = the value A when column B = the value B.

 

2.Delete some records.

 

DELETE FROM '<table>' WHERE '<column A>' = '<value A>';

Exemple : I want delete all mobs in t_npc_regen when the zone is 18.

DELETE FROM `t_npc_regen` WHERE `a_zone_num` = '18' ;

 

In words :

Delete the records from table when column A have the value A.

 

I hope i have helped

Its just a fast tutorial.

 

Cordially, Kotetsu.

Print this item

  [GUIDE] Other Payment system
Posted by: XxMachaxX - 10-23-2012, 01:41 AM - Forum: Ep1 Guides - Replies (22)


PaymentWall is finished

But we have other solutions for you

 

I know 2 solutions, i give you :

 

1. You can used 2 (French System but Security and working 100%)

2. You can used 2 (International System but i don't know if in USA it's OK...)

 

Phone, SMS, Internet +, Paypal, NeoSurf and bank card.

 

 

the player must send you the code and login.

Then you will check out the site.

Then, if all is his words,

you manually added cash Navicat> newproject_db_auth> bg_user> Cash

 

You can choose the transaction prices and thus in a corner that it pays

 

(it is preferable to also note on the site).

 

You can change a langage for you application.

 

SCREEN FOR EXEMPLE >> 2 << SCREEN FOR EXEMPLE

 

VIDEO TUTO :

 

Print this item

  WoodenTomb
Posted by: YnVnZ2VyX2F - 10-21-2012, 06:19 PM - Forum: Client Side - Replies (4)



Screen

 

Download

 

http://www.2shared.com/file/V_4FSNI6/WoodenTomb.html

 

 

By KaKoke

Print this item

  [Guide] How to avoid Items making crash when sealing
Posted by: TheEvilAnt - 10-21-2012, 11:00 AM - Forum: Ep1 Guides - Replies (8)



 

Well is just a simple guide but some ppl got this problem and if I answer on shout box tomorrow will be more people asking for the same thing so I decided to make a post.

 

What you will need:

ItemAll editor

How to do it:

Open ItemAll editor
 

Write "Wing" on search
 

Go item per item and where appear Wearing Pos: Wing And/Or Sub type: Wing Change by the following:

Sub Type: Shield
Wearing Pos: Shield Slot

 

That will solve it at least with mine work if not just change the flag to this:

 

134743100

Print this item

  [C++]
Posted by: Nikolee - 10-20-2012, 11:26 PM - Forum: Coders Talk - Replies (2)


Well i was boring and was searching for something to hook the GS with C#

 

I found a Tutorial what is Explaining something and i wanna try it out^^ Link : 2

 

They say i need to Creat a .dll in C++ to run the .Net runtime

 

the code looks so :

// InjectDLL.h

#pragma once
#include "MSCorEE.h"
#include "InjectDLL.h"

using namespace System;

namespace InjectDLL {

public ref class Class1
{

void StartTheDotNetRuntime()
{

// Bind to the CLR runtime..
ICLRRuntimeHost *pClrHost = NULL;
HRESULT hr = CorBindToRuntimeEx(
NULL, L"wks", 0, CLSID_CLRRuntimeHost,
IID_ICLRRuntimeHost, (PVOID*)&pClrHost);

// Push the big START button shown above
hr = pClrHost->Start();

// Okay, the CLR is up and running in this (previously native) process.
// Now call a method on our managed C# class library.
DWORD dwRet = 0;
hr = pClrHost->ExecuteInDefaultAppDomain(
L"c:\\PathToYourManagedAssembly\\MyManagedAssembly.dll",
L"MyNamespace.MyClass", L"MyMethod", L"MyParameter", &dwRet);

// Optionally stop the CLR runtime (we could also leave it running)
hr = pClrHost->Stop();

// Don't forget to clean up.
pClrHost->Release();

return;
}

};

}

 

Well i can compile this, but did i need to Call the Function now or not?

Because then i try to call it i get errors so maybe i dont need to call them?^^

Print this item

  Give Working Link Plzzzz
Posted by: byNec - 10-20-2012, 10:39 PM - Forum: General Discussion - Replies (1)


Give Working Link Plzzzz

2

Print this item

  Offsets for NPCRegen
Posted by: byNec - 10-20-2012, 02:14 PM - Forum: Ep1 Guides - Replies (1)


Hi guys,

Somebody can tell me how to find offsets for wizatek's program?

2

Thanks.

Print this item