void c4_Persist::LoadAll() { c4_Column walk(this); if (!LoadIt(walk)) return ; if (_strategy._rootLen < 0) { _oldSeek = _strategy._rootPos; _oldBuf = d4_new t4_byte[512]; _oldCurr = _oldLimit = _oldBuf; t4_i32 n = FetchOldValue(); d4_assert(n == 0); n = FetchOldValue(); d4_assert(n > 0); c4_Bytes temp; t4_byte *buf = temp.SetBuffer(n); d4_dbgdef(int n2 = )OldRead(buf, n); d4_assert(n2 == n); c4_String s = "[" + c4_String((const char*)buf, n) + "]"; const char *desc = s; c4_Field *f = d4_new c4_Field(desc); d4_assert(! *desc); //?_root->DefineRoot(); _root->Restructure(*f, false); _root->OldPrepare(); // don't touch data inside while converting the file if (_strategy.FileSize() >= 0) OccupySpace(1, _strategy.FileSize()); } else {
Lod::Lod(int location, char *name, int kind){ Ind=-1; STARTNA(__LINE__, 0) Kind = kind; Location=location; strncpy(Name,name,31); Name[31]=0; Ind=FreeInd; memset(LodTable[Ind],0,0x190); SOD_LOD_ctor(LodTable[Ind],Name); Next=First; First=this; int ret=LoadIt(name); if(ret){ char buf[1024]; sprintf(buf,"Cannot Load LOD file.\nReason : %i\nName : %s\n\nThe game is unstable now!\nPlease fix the problem and run h3WoG.exe again", ret,Name); TError(buf); } else { FreeInd = NextInd[Ind]; if (FreeInd == 0) FreeInd = Ind + 1; ReloadItems(); } RETURNV }
/********************* Start of window procedure **********************/ MRESULT EXPENTRY MyWindowProc( HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2 ) { USHORT command; /* WM_COMMAND command value */ HPS hps; /* Presentation Space handle */ RECTL rc; /* Rectangle coordinates */ POINTL pt; /* String screen coordinates */ switch( msg ) { case WM_CREATE: if( State == RUNNING ) break; /******************************************************************/ /* Window initialization is performed here in WM_CREATE processing*/ /* WinLoadString loads strings from the resource file. */ /******************************************************************/ InitIt( "DSTD32", Hab, hwnd ); ReDraw( hwnd ); break; case WM_COMMAND: /******************************************************************/ /* When the user chooses option 1, 2, or 3 from the Options pull- */ /* down, the text string is set to 1, 2, or 3, and */ /* WinInvalidateRegion sends a WM_PAINT message. */ /* When Exit is chosen, the application posts itself a WM_CLOSE */ /* message. */ /******************************************************************/ command = SHORT1FROMMP(mp1); /* Extract the command value */ switch (command) { case ID_LOAD: if( State == RUNNING ) break; if( State != NONE ) { KillIt(); State = NONE; } if( LoadIt() ) { State = LOADED; } ReDraw( hwnd ); break; case ID_RUN: if( State == RUNNING ) break; State = RUNNING; ReDraw( hwnd ); if( InHardMode ) { WinLockInput( 0, FALSE ); InHardMode = FALSE; } State = RunIt() ? BROKE : TERMINATED; if( HardMode ) { WinLockInput( 0, TRUE ); InHardMode = TRUE; } ReDraw( hwnd ); break; case ID_KILL: if( State == RUNNING ) break; if( InHardMode ) { WinLockInput( 0, FALSE ); InHardMode = FALSE; } if( State != NONE ) { KillIt(); State = NONE; } ReDraw( hwnd ); break; case ID_HARD: if( State == RUNNING ) break; HardMode = !HardMode; TellHardMode( HardMode ? (char)-1 : 0 ); ReDraw( hwnd ); break; case ID_EXITPROG: if( InHardMode ) { WinLockInput( 0, FALSE ); InHardMode = FALSE; } if( State == RUNNING ) break; WinPostMsg( hwnd, WM_CLOSE, 0L, 0L ); break; default: return WinDefWindowProc( hwnd, msg, mp1, mp2 ); } break; case WM_ERASEBACKGROUND: /******************************************************************/ /* Return TRUE to request PM to paint the window background */ /* in SYSCLR_WINDOW. */ /******************************************************************/ return (MRESULT)( TRUE ); case WM_PAINT: /******************************************************************/ /* Window contents are drawn here in WM_PAINT processing. */ /******************************************************************/ /* Create a presentation space */ hps = WinBeginPaint( hwnd, NULL, &rc ); pt.x = 50; pt.y = 50; /* Set the text coordinates, */ GpiSetColor( hps, CLR_NEUTRAL ); /* colour of the text, */ GpiSetBackColor( hps, CLR_BACKGROUND ); /* its background and */ GpiSetBackMix( hps, BM_OVERPAINT ); /* how it mixes, */ /* and draw the string...*/ strcpy( WhatItIs[ State ] +HARD_POS, IsHardMode[ HardMode ] ); GpiCharStringAt( hps, &pt, (LONG)strlen( WhatItIs[ State ] ), WhatItIs[ State ] ); WinEndPaint( hps ); /* Drawing is complete */ break; case WM_CLOSE: /******************************************************************/ /* This is the place to put your termination routines */ /******************************************************************/ if( State == RUNNING ) break; FiniIt(); WinPostMsg( hwnd, WM_QUIT, 0L, 0L ); /* Cause termination */ break; default: /******************************************************************/ /* Everything else comes here. This call MUST exist */ /* in your window procedure. */ /******************************************************************/ return WinDefWindowProc( hwnd, msg, mp1, mp2 ); } return FALSE; }