diff --git a/IanOut/DDEX4.001 b/IanOut/DDEX4.001 new file mode 100644 index 0000000..0d2f41a --- /dev/null +++ b/IanOut/DDEX4.001 @@ -0,0 +1,262 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +!IF "$(CFG)" == "" +CFG=ddex4 - Win32 Debug +!MESSAGE No configuration specified. Defaulting to ddex4 - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "ddex4 - Win32 Release" && "$(CFG)" != "ddex4 - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "ddex4.mak" CFG="ddex4 - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ddex4 - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "ddex4 - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "ddex4 - Win32 Debug" +MTL=mktyplib.exe +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ddex4 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "$(OUTDIR)\ddex4.exe" + +CLEAN : + -@erase "$(INTDIR)\ddex4.obj" + -@erase "$(INTDIR)\ddex4.res" + -@erase "$(INTDIR)\ddutil.obj" + -@erase "$(OUTDIR)\ddex4.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D\ + "_WINDOWS" /Fp"$(INTDIR)/ddex4.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Release/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/ddex4.res" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/ddex4.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 dxguid.lib ddraw.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386 +LINK32_FLAGS=dxguid.lib ddraw.lib kernel32.lib user32.lib gdi32.lib\ + winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib\ + uuid.lib /nologo /subsystem:windows /incremental:no\ + /pdb:"$(OUTDIR)/ddex4.pdb" /machine:I386 /out:"$(OUTDIR)/ddex4.exe" +LINK32_OBJS= \ + "$(INTDIR)\ddex4.obj" \ + "$(INTDIR)\ddex4.res" \ + "$(INTDIR)\ddutil.obj" + +"$(OUTDIR)\ddex4.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "ddex4 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\Debug +INTDIR=.\Debug + +ALL : "$(OUTDIR)\ddex4.exe" + +CLEAN : + -@erase "$(INTDIR)\ddex4.obj" + -@erase "$(INTDIR)\ddex4.res" + -@erase "$(INTDIR)\ddutil.obj" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(OUTDIR)\ddex4.exe" + -@erase "$(OUTDIR)\ddex4.ilk" + -@erase "$(OUTDIR)\ddex4.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D\ + "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/ddex4.pch" /YX /Fo"$(INTDIR)/"\ + /Fd"$(INTDIR)/" /c +CPP_OBJS=.\Debug/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/ddex4.res" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/ddex4.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 +# ADD LINK32 dxguid.lib ddraw.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 +LINK32_FLAGS=dxguid.lib ddraw.lib kernel32.lib user32.lib gdi32.lib\ + winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib\ + uuid.lib /nologo /subsystem:windows /incremental:yes\ + /pdb:"$(OUTDIR)/ddex4.pdb" /debug /machine:I386 /out:"$(OUTDIR)/ddex4.exe" +LINK32_OBJS= \ + "$(INTDIR)\ddex4.obj" \ + "$(INTDIR)\ddex4.res" \ + "$(INTDIR)\ddutil.obj" + +"$(OUTDIR)\ddex4.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "ddex4 - Win32 Release" +# Name "ddex4 - Win32 Debug" + +!IF "$(CFG)" == "ddex4 - Win32 Release" + +!ELSEIF "$(CFG)" == "ddex4 - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\ddex4.cpp +DEP_CPP_DDEX4=\ + "..\..\include\ddutil.h"\ + ".\resource.h"\ + + +"$(INTDIR)\ddex4.obj" : $(SOURCE) $(DEP_CPP_DDEX4) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\ddex4.rc +DEP_RSC_DDEX4_=\ + ".\ALL.BMP"\ + ".\resource.h"\ + + +"$(INTDIR)\ddex4.res" : $(SOURCE) $(DEP_RSC_DDEX4_) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\ddutil.cpp +DEP_CPP_DDUTI=\ + "..\..\include\ddutil.h"\ + + +"$(INTDIR)\ddutil.obj" : $(SOURCE) $(DEP_CPP_DDUTI) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\ddutil.h + +!IF "$(CFG)" == "ddex4 - Win32 Release" + +!ELSEIF "$(CFG)" == "ddex4 - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\resource.h + +!IF "$(CFG)" == "ddex4 - Win32 Release" + +!ELSEIF "$(CFG)" == "ddex4 - Win32 Debug" + +!ENDIF + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/IanOut/DDEX4.DEF b/IanOut/DDEX4.DEF new file mode 100644 index 0000000..ac66347 --- /dev/null +++ b/IanOut/DDEX4.DEF @@ -0,0 +1,10 @@ +NAME ddex4.exe + +DESCRIPTION 'Direct Draw Example Program 4 (C) Microsoft 1995-1999' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/IanOut/DDEX4.DSW b/IanOut/DDEX4.DSW new file mode 100644 index 0000000..a16c47a --- /dev/null +++ b/IanOut/DDEX4.DSW @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "ddex4"=.\ddex4.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/IanOut/DDEX4.MAK b/IanOut/DDEX4.MAK new file mode 100644 index 0000000..0d2f41a --- /dev/null +++ b/IanOut/DDEX4.MAK @@ -0,0 +1,262 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +!IF "$(CFG)" == "" +CFG=ddex4 - Win32 Debug +!MESSAGE No configuration specified. Defaulting to ddex4 - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "ddex4 - Win32 Release" && "$(CFG)" != "ddex4 - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "ddex4.mak" CFG="ddex4 - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ddex4 - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "ddex4 - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "ddex4 - Win32 Debug" +MTL=mktyplib.exe +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ddex4 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "$(OUTDIR)\ddex4.exe" + +CLEAN : + -@erase "$(INTDIR)\ddex4.obj" + -@erase "$(INTDIR)\ddex4.res" + -@erase "$(INTDIR)\ddutil.obj" + -@erase "$(OUTDIR)\ddex4.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D\ + "_WINDOWS" /Fp"$(INTDIR)/ddex4.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Release/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/ddex4.res" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/ddex4.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 dxguid.lib ddraw.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386 +LINK32_FLAGS=dxguid.lib ddraw.lib kernel32.lib user32.lib gdi32.lib\ + winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib\ + uuid.lib /nologo /subsystem:windows /incremental:no\ + /pdb:"$(OUTDIR)/ddex4.pdb" /machine:I386 /out:"$(OUTDIR)/ddex4.exe" +LINK32_OBJS= \ + "$(INTDIR)\ddex4.obj" \ + "$(INTDIR)\ddex4.res" \ + "$(INTDIR)\ddutil.obj" + +"$(OUTDIR)\ddex4.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "ddex4 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\Debug +INTDIR=.\Debug + +ALL : "$(OUTDIR)\ddex4.exe" + +CLEAN : + -@erase "$(INTDIR)\ddex4.obj" + -@erase "$(INTDIR)\ddex4.res" + -@erase "$(INTDIR)\ddutil.obj" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(OUTDIR)\ddex4.exe" + -@erase "$(OUTDIR)\ddex4.ilk" + -@erase "$(OUTDIR)\ddex4.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D\ + "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/ddex4.pch" /YX /Fo"$(INTDIR)/"\ + /Fd"$(INTDIR)/" /c +CPP_OBJS=.\Debug/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/ddex4.res" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/ddex4.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 +# ADD LINK32 dxguid.lib ddraw.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 +LINK32_FLAGS=dxguid.lib ddraw.lib kernel32.lib user32.lib gdi32.lib\ + winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib\ + uuid.lib /nologo /subsystem:windows /incremental:yes\ + /pdb:"$(OUTDIR)/ddex4.pdb" /debug /machine:I386 /out:"$(OUTDIR)/ddex4.exe" +LINK32_OBJS= \ + "$(INTDIR)\ddex4.obj" \ + "$(INTDIR)\ddex4.res" \ + "$(INTDIR)\ddutil.obj" + +"$(OUTDIR)\ddex4.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "ddex4 - Win32 Release" +# Name "ddex4 - Win32 Debug" + +!IF "$(CFG)" == "ddex4 - Win32 Release" + +!ELSEIF "$(CFG)" == "ddex4 - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\ddex4.cpp +DEP_CPP_DDEX4=\ + "..\..\include\ddutil.h"\ + ".\resource.h"\ + + +"$(INTDIR)\ddex4.obj" : $(SOURCE) $(DEP_CPP_DDEX4) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\ddex4.rc +DEP_RSC_DDEX4_=\ + ".\ALL.BMP"\ + ".\resource.h"\ + + +"$(INTDIR)\ddex4.res" : $(SOURCE) $(DEP_RSC_DDEX4_) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\ddutil.cpp +DEP_CPP_DDUTI=\ + "..\..\include\ddutil.h"\ + + +"$(INTDIR)\ddutil.obj" : $(SOURCE) $(DEP_CPP_DDUTI) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\ddutil.h + +!IF "$(CFG)" == "ddex4 - Win32 Release" + +!ELSEIF "$(CFG)" == "ddex4 - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\resource.h + +!IF "$(CFG)" == "ddex4 - Win32 Release" + +!ELSEIF "$(CFG)" == "ddex4 - Win32 Debug" + +!ENDIF + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/IanOut/DDEX4.PLG b/IanOut/DDEX4.PLG new file mode 100644 index 0000000..e9f6cf5 --- /dev/null +++ b/IanOut/DDEX4.PLG @@ -0,0 +1,31 @@ + + +
+

Build Log

+

+--------------------Configuration: ddex4 - Win32 Release-------------------- +

+

Command Lines

+Creating command line "rc.exe /l 0x409 /fo".\Release/ddex4.res" /d "NDEBUG" /d "_AFXDLL" "E:\IanOut\ddex4.rc"" +Creating temporary file "C:\DOCUME~1\sztupy\LOCALS~1\Temp\RSP3.tmp" with contents +[ +dxguid.lib ddraw.lib dinput.lib msimg32.lib /nologo /subsystem:windows /incremental:no /pdb:".\Release/IanOut.pdb" /machine:I386 /out:".\Release/IanOut.exe" +.\Release\ddex4.obj +.\Release\ddutil.obj +.\Release\ItemObj.obj +.\Release\utils.obj +.\Release\FRMGraph.obj +.\Release\ddex4.res +] +Creating command line "link.exe @C:\DOCUME~1\sztupy\LOCALS~1\Temp\RSP3.tmp" +

Output Window

+Compiling resources... +Linking... + + + +

Results

+IanOut.exe - 0 error(s), 0 warning(s) +
+ + diff --git a/IanOut/DDUTIL.CPP b/IanOut/DDUTIL.CPP new file mode 100644 index 0000000..ef98f42 --- /dev/null +++ b/IanOut/DDUTIL.CPP @@ -0,0 +1,559 @@ +//----------------------------------------------------------------------------- +// File: ddutil.cpp +// +// Desc: Routines for loading bitmap and palettes from resources +// +// +// Copyright (c) 1995-1999 Microsoft Corporation. All rights reserved. +//----------------------------------------------------------------------------- + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +//----------------------------------------------------------------------------- +// Include files +//----------------------------------------------------------------------------- +#include "ddutil.h" +#include +#include +#include +#include + +extern "C" +HRESULT BlitTo(LPDIRECTDRAWSURFACE7 Blit,int Sx1, int Sy1, int Sx2, int Sy2, int Dx, int Dy, DWORD flags, LPDIRECTDRAWSURFACE7 surf) +{ + DDBLTFX ddbltfx; + RECT rcRect; + HRESULT hRet; + int iw1; + int iw2; + int BltX; + int BltY; + + hRet = DD_OK; + ZeroMemory(&ddbltfx, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(ddbltfx); + ddbltfx.dwFillColor = 0; + + rcRect.left = Sx1; + rcRect.top = Sy1; + rcRect.right = Sx2; + rcRect.bottom = Sy2; + + iw1 = Sx2-Sx1; + iw2 = Sy2-Sy1; + + BltX = Dx; + BltY = Dy; + + if (!((Dx>640) || (Dy>480) || (Dx+iw1<0) || (Dy+iw2<0))) + { + if (Dx+iw1>640) {iw1 = iw1-(Dx+iw1-640);} + if (Dy+iw2>480) {iw2 = iw2-(Dy+iw2-480);} + + Sx2 = Sx1+iw1; + Sy2 = Sy1+iw2; + + if (Dx<0) { Sx1+=(-Dx);BltX=0;} + if (Dy<0) { Sy1+=(-Dy);BltY=0;} + + rcRect.left = Sx1; + rcRect.top = Sy1; + rcRect.right = Sx2; + rcRect.bottom = Sy2; + + + while (TRUE) + { + hRet = Blit->BltFast(BltX,BltY,surf,&rcRect,flags); + + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + // hRet = RestoreAll();if (hRet != DD_OK) + return hRet; + } + if (hRet != DDERR_WASSTILLDRAWING) + return hRet; + } + if (hRet != DD_OK) + return hRet; + } + + return hRet; +} + +extern "C" +HRESULT BlitToAlpha(LPDIRECTDRAWSURFACE7 Blit,int Sx1, int Sy1, int Sx2, int Sy2, int Dx, int Dy, DWORD flags, LPDIRECTDRAWSURFACE7 surf, int alpha) +{ + RECT rcRect; + HRESULT hRet; + int iw1; + int iw2; + int BltX; + int BltY; + + HDC HDCBlit; + HDC HDCSurf; + + BLENDFUNCTION BLDF; + + hRet = DD_OK; + + rcRect.left = Sx1; + rcRect.top = Sy1; + rcRect.right = Sx2; + rcRect.bottom = Sy2; + + iw1 = Sx2-Sx1; + iw2 = Sy2-Sy1; + + BltX = Dx; + BltY = Dy; + + if (!((Dx>640) || (Dy>480) || (Dx+iw1<0) || (Dy+iw2<0))) + { + if (Dx+iw1>640) {iw1 = iw1-(Dx+iw1-640);} + if (Dy+iw2>480) {iw2 = iw2-(Dy+iw2-480);} + + Sx2 = Sx1+iw1; + Sy2 = Sy1+iw2; + + if (Dx<0) { Sx1+=(-Dx);BltX=0;} + if (Dy<0) { Sy1+=(-Dy);BltY=0;} + + rcRect.left = Sx1; + rcRect.top = Sy1; + rcRect.right = Sx2; + rcRect.bottom = Sy2; + + while (TRUE) + { + hRet = Blit->GetDC(&HDCBlit); + if (!FAILED(hRet)) { + hRet = surf->GetDC(&HDCSurf); + if (!FAILED(hRet)) { + iw1 = Sx2-Sx1; + iw2 = Sy2-Sy1; + BLDF.BlendOp=0; //AC_SRC_OVER; + BLDF.BlendFlags=0; + BLDF.SourceConstantAlpha=alpha; + BLDF.AlphaFormat=0; + AlphaBlend(HDCBlit,BltX,BltY,iw1,iw2,HDCSurf,Sx1,Sy1,iw1,iw2,BLDF); + + hRet = surf->ReleaseDC(HDCSurf); + } + hRet = Blit->ReleaseDC(HDCBlit); + } + + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + // hRet = RestoreAll();if (hRet != DD_OK) + return hRet; + } + if (hRet != DDERR_WASSTILLDRAWING) + return hRet; + } + if (hRet != DD_OK) + return hRet; + } + + return hRet; +} + +extern "C" +void ClearSurface(LPDIRECTDRAWSURFACE7 Surf, int r, int g, int b) +{ + DDBLTFX ddbltfx; + + ZeroMemory(&ddbltfx, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(ddbltfx); + ddbltfx.dwFillColor = RGB(r,g,b); + Surf->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); +} + +/*extern "C" +HRESULT BlitTo(LPDIRECTDRAWSURFACE7 Blit,int Sx1, int Sy1, int Sx2, int Sy2, int Dx, int Dy, DWORD flags, LPDIRECTDRAWSURFACE7 surf) +{ + RECT rcRect; + HRESULT hRet; + int iw1; + int iw2; + int BltX; + int BltY; + DDSURFACEDESC2 ddsd,ddsd2; + + hRet = DD_OK; + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + + ZeroMemory(&ddsd2, sizeof(ddsd2)); + ddsd2.dwSize = sizeof(ddsd2); + + rcRect.left = Sx1; + rcRect.top = Sy1; + rcRect.right = Sx2; + rcRect.bottom = Sy2; + + iw1 = Sx2-Sx1; + iw2 = Sy2-Sy1; + + BltX = Dx; + BltY = Dy; + + if (!((Dx>640) || (Dy>480) || (Dx+iw1<0) || (Dy+iw2<0))) + { + if (Dx+iw1>640) {iw1 = iw1-(Dx+iw1-640);} + if (Dy+iw2>480) {iw2 = iw2-(Dy+iw2-480);} + + Sx2 = Sx1+iw1; + Sy2 = Sy1+iw2; + + if (Dx<0) { Sx1+=(-Dx);BltX=0;} + if (Dy<0) { Sy1+=(-Dy);BltY=0;} + + rcRect.left = Sx1; + rcRect.top = Sy1; + rcRect.right = Sx2; + rcRect.bottom = Sy2; + + LPSTR Buf1,Buf2; + + hRet = Blit->Lock(NULL,&ddsd,0,NULL); + hRet = surf->Lock(NULL,&ddsd2,0,NULL); + + Buf1 = (LPSTR)ddsd.lpSurface; + Buf2 = (LPSTR)ddsd2.lpSurface; + + int x,y; + int y2; + + y2=Sy1; + + Buf1=(LPSTR)ddsd.lpSurface+y*ddsd.lPitch+BltX; + Buf2=(LPSTR)ddsd2.lpSurface+y2*ddsd2.lPitch+Sx1; + + iw1 = Sy2-Sy1; + iw2 = Sx2-Sx1; + + for (y=BltY; yUnlock(NULL); + hRet = Blit->Unlock(NULL); + } + return hRet; +}*/ + +//----------------------------------------------------------------------------- +// Name: DDLoadBitmap() +// Desc: Create a DirectDrawSurface from a bitmap resource. +//----------------------------------------------------------------------------- +extern "C" IDirectDrawSurface7 * +DDLoadBitmap(IDirectDraw7 * pdd, LPCSTR szBitmap, int dx, int dy, HRESULT *hRet, const long caps ) +{ + HBITMAP hbm; + BITMAP bm; + DDSURFACEDESC2 ddsd; + IDirectDrawSurface7 *pdds; + + // + // Try to load the bitmap as a resource, if that fails, try it as a file + // + *hRet = DDERR_NOTLOADED; + + hbm = (HBITMAP) LoadImage(GetModuleHandle(NULL), szBitmap, IMAGE_BITMAP, dx, + dy, LR_CREATEDIBSECTION); + if (hbm == NULL) + hbm = (HBITMAP) LoadImage(NULL, szBitmap, IMAGE_BITMAP, dx, dy, + LR_LOADFROMFILE | LR_CREATEDIBSECTION); + if (hbm == NULL) + return NULL; + // + // Get size of the bitmap + // + GetObject(hbm, sizeof(bm), &bm); + // + // Create a DirectDrawSurface for this bitmap + // + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + ddsd.ddsCaps.dwCaps = caps; + ddsd.dwWidth = bm.bmWidth; + ddsd.dwHeight = bm.bmHeight; + if (( *hRet = pdd->CreateSurface(&ddsd, &pdds, NULL) ) != DD_OK) + return NULL; + DDCopyBitmap(pdds, hbm, 0, 0, 0, 0); + DeleteObject(hbm); + return pdds; +} + + + + +//----------------------------------------------------------------------------- +// Name: DDReLoadBitmap() +// Desc: Load a bitmap from a file or resource into a directdraw surface. +// normaly used to re-load a surface after a restore. +//----------------------------------------------------------------------------- +HRESULT +DDReLoadBitmap(IDirectDrawSurface7 * pdds, LPCSTR szBitmap) +{ + HBITMAP hbm; + HRESULT hr; + + // + // Try to load the bitmap as a resource, if that fails, try it as a file + // + hbm = (HBITMAP) LoadImage(GetModuleHandle(NULL), szBitmap, IMAGE_BITMAP, 0, + 0, LR_CREATEDIBSECTION); + if (hbm == NULL) + hbm = (HBITMAP) LoadImage(NULL, szBitmap, IMAGE_BITMAP, 0, 0, + LR_LOADFROMFILE | LR_CREATEDIBSECTION); + if (hbm == NULL) + { + OutputDebugString("handle is null\n"); + return E_FAIL; + } + hr = DDCopyBitmap(pdds, hbm, 0, 0, 0, 0); + if (hr != DD_OK) + { + OutputDebugString("ddcopybitmap failed\n"); + } + DeleteObject(hbm); + return hr; +} + + + + +//----------------------------------------------------------------------------- +// Name: DDCopyBitmap() +// Desc: Draw a bitmap into a DirectDrawSurface +//----------------------------------------------------------------------------- +extern "C" HRESULT +DDCopyBitmap(IDirectDrawSurface7 * pdds, HBITMAP hbm, int x, int y, + int dx, int dy) +{ + HDC hdcImage; + HDC hdc; + BITMAP bm; + DDSURFACEDESC2 ddsd; + HRESULT hr; + + if (hbm == NULL || pdds == NULL) + return E_FAIL; + // + // Make sure this surface is restored. + // + pdds->Restore(); + // + // Select bitmap into a memoryDC so we can use it. + // + hdcImage = CreateCompatibleDC(NULL); + if (!hdcImage) + OutputDebugString("createcompatible dc failed\n"); + SelectObject(hdcImage, hbm); + // + // Get size of the bitmap + // + GetObject(hbm, sizeof(bm), &bm); + dx = dx == 0 ? bm.bmWidth : dx; // Use the passed size, unless zero + dy = dy == 0 ? bm.bmHeight : dy; + // + // Get size of surface. + // + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_HEIGHT | DDSD_WIDTH; + pdds->GetSurfaceDesc(&ddsd); + + if ((hr = pdds->GetDC(&hdc)) == DD_OK) + { + StretchBlt(hdc, 0, 0, ddsd.dwWidth, ddsd.dwHeight, hdcImage, x, y, + dx, dy, SRCCOPY); + pdds->ReleaseDC(hdc); + } + DeleteDC(hdcImage); + return hr; +} + + + + +//----------------------------------------------------------------------------- +// Name: DDLoadPalette() +// Desc: Create a DirectDraw palette object from a bitmap resource +// if the resource does not exist or NULL is passed create a +// default 332 palette. +//----------------------------------------------------------------------------- +extern "C" IDirectDrawPalette * +DDLoadPalette(IDirectDraw7 * pdd, LPCSTR szBitmap) +{ + IDirectDrawPalette *ddpal; + int i; + int n; + int fh; + HRSRC h; + LPBITMAPINFOHEADER lpbi; + PALETTEENTRY ape[256]; + RGBQUAD *prgb; + + // + // Build a 332 palette as the default. + // + for (i = 0; i < 256; i++) + { + ape[i].peRed = (BYTE) (((i >> 5) & 0x07) * 255 / 7); + ape[i].peGreen = (BYTE) (((i >> 2) & 0x07) * 255 / 7); + ape[i].peBlue = (BYTE) (((i >> 0) & 0x03) * 255 / 3); + ape[i].peFlags = (BYTE) 0; + } + // + // Get a pointer to the bitmap resource. + // + if (szBitmap && (h = FindResource(NULL, szBitmap, RT_BITMAP))) + { + lpbi = (LPBITMAPINFOHEADER) LockResource(LoadResource(NULL, h)); + if (!lpbi) + OutputDebugString("lock resource failed\n"); + prgb = (RGBQUAD *) ((BYTE *) lpbi + lpbi->biSize); + if (lpbi == NULL || lpbi->biSize < sizeof(BITMAPINFOHEADER)) + n = 0; + else if (lpbi->biBitCount > 8) + n = 0; + else if (lpbi->biClrUsed == 0) + n = 1 << lpbi->biBitCount; + else + n = lpbi->biClrUsed; + // + // A DIB color table has its colors stored BGR not RGB + // so flip them around. + // + for (i = 0; i < n; i++) + { + ape[i].peRed = prgb[i].rgbRed; + ape[i].peGreen = prgb[i].rgbGreen; + ape[i].peBlue = prgb[i].rgbBlue; + ape[i].peFlags = 0; + } + } + else if (szBitmap && (fh = _lopen(szBitmap, OF_READ)) != -1) + { + BITMAPFILEHEADER bf; + BITMAPINFOHEADER bi; + + _lread(fh, &bf, sizeof(bf)); + _lread(fh, &bi, sizeof(bi)); + _lread(fh, ape, sizeof(ape)); + _lclose(fh); + if (bi.biSize != sizeof(BITMAPINFOHEADER)) + n = 0; + else if (bi.biBitCount > 8) + n = 0; + else if (bi.biClrUsed == 0) + n = 1 << bi.biBitCount; + else + n = bi.biClrUsed; + // + // A DIB color table has its colors stored BGR not RGB + // so flip them around. + // + for (i = 0; i < n; i++) + { + BYTE r = ape[i].peRed; + + ape[i].peRed = ape[i].peBlue; + ape[i].peBlue = r; + } + } + pdd->CreatePalette(DDPCAPS_8BIT, ape, &ddpal, NULL); + return ddpal; +} + + + + +//----------------------------------------------------------------------------- +// Name: DDColorMatch() +// Desc: Convert a RGB color to a pysical color. +// We do this by leting GDI SetPixel() do the color matching +// then we lock the memory and see what it got mapped to. +//----------------------------------------------------------------------------- +extern "C" DWORD +DDColorMatch(IDirectDrawSurface7 * pdds, COLORREF rgb) +{ + COLORREF rgbT; + HDC hdc; + DWORD dw = CLR_INVALID; + DDSURFACEDESC2 ddsd; + HRESULT hres; + + // + // Use GDI SetPixel to color match for us + // + if (rgb != CLR_INVALID && pdds->GetDC(&hdc) == DD_OK) + { + rgbT = GetPixel(hdc, 0, 0); // Save current pixel value + SetPixel(hdc, 0, 0, rgb); // Set our value + pdds->ReleaseDC(hdc); + } + // + // Now lock the surface so we can read back the converted color + // + ddsd.dwSize = sizeof(ddsd); + while ((hres = pdds->Lock(NULL, &ddsd, 0, NULL)) == DDERR_WASSTILLDRAWING) + ; + if (hres == DD_OK) + { + dw = *(DWORD *) ddsd.lpSurface; // Get DWORD + if (ddsd.ddpfPixelFormat.dwRGBBitCount < 32) + dw &= (1 << ddsd.ddpfPixelFormat.dwRGBBitCount) - 1; // Mask it to bpp + pdds->Unlock(NULL); + } + // + // Now put the color that was there back. + // + if (rgb != CLR_INVALID && pdds->GetDC(&hdc) == DD_OK) + { + SetPixel(hdc, 0, 0, rgbT); + pdds->ReleaseDC(hdc); + } + return dw; +} + + + + +//----------------------------------------------------------------------------- +// Name: DDSetColorKey() +// Desc: Set a color key for a surface, given a RGB. +// If you pass CLR_INVALID as the color key, the pixel +// in the upper-left corner will be used. +//----------------------------------------------------------------------------- +extern "C" HRESULT +DDSetColorKey(IDirectDrawSurface7 * pdds, COLORREF rgb) +{ + DDCOLORKEY ddck; + + ddck.dwColorSpaceLowValue = DDColorMatch(pdds, rgb); + ddck.dwColorSpaceHighValue = ddck.dwColorSpaceLowValue; + return pdds->SetColorKey(DDCKEY_SRCBLT, &ddck); +} + + diff --git a/IanOut/DDUTIL.H b/IanOut/DDUTIL.H new file mode 100644 index 0000000..137fa01 --- /dev/null +++ b/IanOut/DDUTIL.H @@ -0,0 +1,31 @@ +/*========================================================================== + * + * Copyright (C) 1998-1999 Microsoft Corporation. All Rights Reserved. + * + * File: ddutil.cpp + * Content: Routines for loading bitmap and palettes from resources + * + ***************************************************************************/ +#ifndef __ddutil_h +#define __ddutil_h + +#include "ddraw.h" + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +extern IDirectDrawPalette *DDLoadPalette(IDirectDraw7 *pdd, LPCSTR szBitmap); +extern IDirectDrawSurface7 *DDLoadBitmap(IDirectDraw7 *pdd, LPCSTR szBitmap, int dx, int dy, HRESULT *hRet, const long caps); +extern HRESULT DDReLoadBitmap(IDirectDrawSurface7 *pdds, LPCSTR szBitmap); +extern HRESULT DDCopyBitmap(IDirectDrawSurface7 *pdds, HBITMAP hbm, int x, int y, int dx, int dy); +extern DWORD DDColorMatch(IDirectDrawSurface7 *pdds, COLORREF rgb); +extern HRESULT DDSetColorKey(IDirectDrawSurface7 *pdds, COLORREF rgb); +extern HRESULT BlitTo(LPDIRECTDRAWSURFACE7 Blit,int Sx1, int Sy1, int Sx2, int Sy2, int Dx, int Dy, DWORD flags, LPDIRECTDRAWSURFACE7 surf); +extern HRESULT BlitToAlpha(LPDIRECTDRAWSURFACE7 Blit,int Sx1, int Sy1, int Sx2, int Sy2, int Dx, int Dy, DWORD flags, LPDIRECTDRAWSURFACE7 surf, int alpha); +extern void ClearSurface(LPDIRECTDRAWSURFACE7 Surf, int r, int g, int b); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif \ No newline at end of file diff --git a/IanOut/Ddex4.cpp b/IanOut/Ddex4.cpp new file mode 100644 index 0000000..552957c --- /dev/null +++ b/IanOut/Ddex4.cpp @@ -0,0 +1,6 @@ +#include "ddex4_1.h" +#include "ddex4_2.h" +#include "ddex4_f.h" +#include "ddex4_u.h" +#include "ddex4_i.h" + diff --git a/IanOut/DirectX.ico b/IanOut/DirectX.ico new file mode 100644 index 0000000..458ed61 Binary files /dev/null and b/IanOut/DirectX.ico differ diff --git a/IanOut/FONT.DAT b/IanOut/FONT.DAT new file mode 100644 index 0000000..863b657 --- /dev/null +++ b/IanOut/FONT.DAT @@ -0,0 +1,2 @@ +/* *_* * * *!* *"* *#* *$* *%* *&* *'* *(* *)* *** *+* *,* *-* *.* */* *0* *1* *2* *3* *4* *5* *6* *7* *8* *9* *:* *;* *<* *=* *>* *?* *@* *A* *B* *C* *D* *E* *F* *G* *H* *I* *J* *K* *L* *M* *N* *O* *P* *Q* *R* *S* *T* *U* *V* *W* *X* *Y* *Z* *[* *\* *]* *^* *_* *`* *a* *b* *c* *d* *e* *f* *g* *h* *i* *j* *k* *l* *m* *n* *o* *p* *q* *r* *s* *t* *u* *v* *w* *x* *y* *z* *{* *|* *}* *~* */ + 0, 6, 10, 17, 26, 34, 44, 53, 58, 64, 70, 77, 84, 88, 96,100,110,118,124,132,140,148,156,164,172,180,188,192,196,205,213,222,230,239,249,258,266,275,283,291,300,309,313,322,331,339,348,357,366,375,384,393,402,410,419,429,438,448,458,467,473,483,489,498,507,512,520,528,535,543,551,558,566,574,578,585,593,597,606,614,622,630,638,645,653,661,669,677,686,694,702,710,716,720,726,735 \ No newline at end of file diff --git a/IanOut/FPS.C b/IanOut/FPS.C new file mode 100644 index 0000000..8f2e7ee --- /dev/null +++ b/IanOut/FPS.C @@ -0,0 +1,38 @@ +DWORD dwFrameCount; +DWORD dwFrameTime; +DWORD dwFrames; +DWORD dwFramesLast; + + +void DisplayFrameRate( void ) +{ + DWORD time2; + char buff[256]; + + dwFrameCount++; + time2 = timeGetTime() - dwFrameTime; + if( time2 > 1000 ) + { + dwFrames = (dwFrameCount*1000)/time2; + dwFrameTime = timeGetTime(); + dwFrameCount = 0; + } + if( dwFrames == 0 ) + { + return; + } + + if (dwFrames != dwFramesLast) + { + dwFramesLast = dwFrames; + } + + if( dwFrames > 99 ) + { + dwFrames = 99; + } + buff[0] = (char)((dwFrames / 10) + '0'); + buff[1] = (char)((dwFrames % 10) + '0'); + buff[2] = '\0'; + bltScore(buff, ScreenX/2-25, 10); +} diff --git a/IanOut/FRMGr_1.h b/IanOut/FRMGr_1.h new file mode 100644 index 0000000..891faac --- /dev/null +++ b/IanOut/FRMGr_1.h @@ -0,0 +1,138 @@ +// --- TFRMAnim --- +// +// ---------------- + +int TFRMAnim::LoadFRM(int stream, LPVOID LoadIn, int x, int y, int p) +{ + LPSTR PointTo; + int i; + + PointTo = (LPSTR)LoadIn; + for (i=0; iInsert( new TFRM() ); + + FRMDat = (PFRM)(FRMList->FLast); + hRet = g_pDD->CreateSurface(&ddsd, &FRMDat->FRM, NULL); + if (hRet != DD_OK) return hRet; + + FRMDat->FRM->Lock(NULL, &ddsd, 0 , NULL); + LoadFRM(stream, ddsd.lpSurface, ddsd.dwWidth, ddsd.dwHeight, ddsd.lPitch); + FRMDat->FRM->Unlock(NULL); + + FRMDat->x = x; + FRMDat->y = y; + + FRMDat->bx = movetabl[i-1][0]; + FRMDat->by = movetabl[i-1][1]; + + + DDSetColorKey(FRMDat->FRM, RGB(0,0,0)); + + //FRMList->Insert( FRMDat ); + } + +/* Counter = (FRMList->FLast);*/ + Counter = FRMList->First(); + + _close(stream); + + return DD_OK; +} + + +void TFRMAnim::NextFrame() +{ + Counter = FRMList->RNext(Counter); +} + +PFRM TFRMAnim::GetCurFrame() +{ + PFRM Lista; + Lista = (PFRM)Counter; + return Lista; +} + +TFRMAnim::~TFRMAnim() +{ + if (FRMList) + { + PFRM Lista; + Lista = (PFRM)FRMList->First(); + while (Lista) + { + Lista->FRM->Release(); + Lista = (PFRM)FRMList->Next(Lista); + } + delete FRMList; + } + +} diff --git a/IanOut/FRMGr_2.h b/IanOut/FRMGr_2.h new file mode 100644 index 0000000..328f2b0 --- /dev/null +++ b/IanOut/FRMGr_2.h @@ -0,0 +1,154 @@ +// --- TFRMAnim6 --- +// +// ----------------- + +TFRMAnim6::~TFRMAnim6() +{ + int i; + for (i=0; i<6; i++) + { + if (FRMList6[i]) + { + PFRM Lista; + Lista = (PFRM)FRMList6[i]->First(); + while (Lista) + { + Lista->FRM->Release(); + Lista = (PFRM)FRMList6[i]->Next(Lista); + } + delete FRMList6[i]; + } + } +} + +TFRMAnim6::TFRMAnim6() +{ + int i; + for (i=0; i<6; i++) + { + FRMList6[i] = new TList(); + } +} + +HRESULT TFRMAnim6::Load(HWND hWnd, LPDIRECTDRAW7 g_pDD,char* filename) +{ + char buf[100]; + unsigned char framedat[12]; + unsigned char framecount[2]; + DDSURFACEDESC2 ddsd; + HRESULT hRet; + PFRM FRMDat; + int stream; + int stream2; + char filename2[100]; + signed short movetabl[100][2]; + int x, y; + int i,i2; + + wsprintf(filename2,"%s",filename); + i = lstrlen(filename2); + filename2[i-1] = 'p'; + filename2[i-2] = 's'; + filename2[i-3] = 'h'; + + if ((stream2 = _open( filename2,_O_BINARY)) == -1) + return InitFail(hWnd,DDERR_NOTLOADED,"File open error: %s",filename2); + + _read(stream2,movetabl,sizeof(movetabl)); + _close(stream2); + + if ((stream = _open( filename,_O_BINARY)) == -1) + return InitFail(hWnd,DDERR_NOTLOADED,"File open error: %s",filename); + + _read(stream,buf,9); + _read(stream,framecount,1); + _read(stream,buf,52); + framecounter = framecount[0]; + for (i2=0; i2<6; i2++) + for (i=1; i<=framecount[0]; i++) + { + _read(stream,framedat,12); + x=framedat[0]*256+framedat[1]; + y=framedat[2]*256+framedat[3]; + + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PITCH; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN /*| DDSCAPS_SYSTEMMEMORY */; + + ddsd.dwWidth = x; + ddsd.dwHeight = y; + ddsd.lPitch = x; + + FRMList6[i2]->Insert( new TFRM() ); + + FRMDat = (PFRM)(FRMList6[i2]->FLast); + hRet = g_pDD->CreateSurface(&ddsd, &FRMDat->FRM, NULL); + if (hRet != DD_OK) return hRet; + + FRMDat->FRM->Lock(NULL, &ddsd, 0 , NULL); + LoadFRM(stream, ddsd.lpSurface, ddsd.dwWidth, ddsd.dwHeight, ddsd.lPitch); + FRMDat->FRM->Unlock(NULL); + + FRMDat->x = x; + FRMDat->y = y; + + FRMDat->bx = movetabl[i2*framecount[0]+i-1][0]; + FRMDat->by = movetabl[i2*framecount[0]+i-1][1]; + + DDSetColorKey(FRMDat->FRM, RGB(0,0,0)); + + } + + for (i2=0; i2<6; i2++) Counter6[i2] = FRMList6[i2]->First(); + dir = 0; + + _close(stream); + + return DD_OK; +} + +void TFRMAnim6::FirstFrame() +{ + int i2; + for (i2=0; i2<6; i2++) { Counter6[i2] = FRMList6[i2]->First(); } +} + +void TFRMAnim6::NextFrame() +{ + Counter6[dir] = FRMList6[dir]->RNext(Counter6[dir]); +} + +PFRM TFRMAnim6::GetCurFrame() +{ + PFRM Lista; + Lista = (PFRM)Counter6[dir]; + return Lista; +} + +void TFRMAnim6::SetDir(int i_dir) +{ + dir = i_dir; +} + +/* - TFRMCommunicator - */ + +TFRMCommunicator::TFRMCommunicator(PFRMAnim6 FRMAssign) +{ + Animation = FRMAssign; + dir = 0; + FirstFrame(); +} + +void TFRMCommunicator::FirstFrame() +{ + int i2; + for (i2=0; i2<6; i2++) { Count6[i2] = Animation->FRMList6[i2]->First(); } +} + +PFRM TFRMCommunicator::GetCurFrame() +{ + PFRM Lista; + Lista = (PFRM)Count6[dir]; + return Lista; +} diff --git a/IanOut/FRMGr_3.h b/IanOut/FRMGr_3.h new file mode 100644 index 0000000..3cb250d --- /dev/null +++ b/IanOut/FRMGr_3.h @@ -0,0 +1,304 @@ +// --- TFRMSingle --- +// +// ------------------ + +HRESULT TFRMSingle::Load(HWND hWnd, LPDIRECTDRAW7 g_pDD, char* filename, int framenum) +{ + char buf[100]; + char buf2[50]; + unsigned char framedat[12]; + DDSURFACEDESC2 ddsd; + HRESULT hRet; + int stream; + int x, y; + int i; + LPVOID ize; + + wsprintf(buf2,"%s",filename); + wsprintf(fname,"%s",filename); + + if ((stream = _open( buf2,_O_BINARY)) == -1) + return InitFail(hWnd,DDERR_NOTLOADED,"File open error: %s",buf2); + + _read(stream,buf,62); + + for (i=1; i<=framenum; i++) + { + _read(stream,framedat,12); + x=framedat[0]*256+framedat[1]; + y=framedat[2]*256+framedat[3]; + if (i!=framenum) { + ize = malloc(x*y); + LoadFRM(stream,ize,x,y,x); + free(ize); + } + } + + //wsprintf( buf, "(%d, %d) %d %d %d %d", + // x,y,framedat[0],framedat[1],framedat[2],framedat[3]); + + //MessageBox(hWnd, buf, "Hiba", MB_OK); + + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PITCH; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN /*| DDSCAPS_SYSTEMMEMORY */; + + ddsd.dwWidth = x; + ddsd.dwHeight = y; + ddsd.lPitch = x; + + if (FRM) {FRM->FRM->Release();delete FRM;}; + + FRM = new TFRM(); + + hRet = g_pDD->CreateSurface(&ddsd, &FRM->FRM, NULL); + if (hRet != DD_OK) return hRet; + + FRM->FRM->Lock(NULL, &ddsd, 0 , NULL); + LoadFRM(stream, ddsd.lpSurface, ddsd.dwWidth, ddsd.dwHeight, ddsd.lPitch); + FRM->FRM->Unlock(NULL); + + FRM->x = x; + FRM->y = y; + + DDSetColorKey(FRM->FRM, RGB(0,0,0)); + + _close(stream); + + return DD_OK; +} + + +int TFRMSingle::LoadFRM(int stream, LPVOID LoadIn, int x, int y, int p) +{ + LPSTR PointTo; + int i; + + PointTo = (LPSTR)LoadIn; + for (i=0; iLoad(hWnd,g_pDD,buf,1); + if (hRet!=DD_OK) return InitFail(hWnd,hRet,"ERROR"); + + } + + fclose(stre); + return DD_OK; +} + +TIanMap::~TIanMap() +{ + int x; + for (x=0; x<10; x++) + { + if (Tiles[x]) + { + delete Tiles[x]; + } + } +} + + +// --- TIanWall --- +// +// ---------------- + +HRESULT TIanWall::LoadMap(HWND hWnd,char* filename) +{ + int x,y; + int stream; + + if ((stream = _open(filename,_O_BINARY)) == -1) + return InitFail(hWnd,DDERR_NOTLOADED,"LoadWall FAILED"); + + for (x=0; x<171; x++) + for (y=0; y<151; y++) + { + _read(stream,&Map[x][y],1); + } + _close(stream); + return DD_OK; +} + +HRESULT TIanWall::LoadWalls(HWND hWnd, LPDIRECTDRAW7 g_pDD) +{ + int x; + HRESULT hRet; + FILE* stre; + int numb = 0; + char buf[50]; + + hRet= DD_OK; + stre = fopen("master.dat\\proto\\walls.pro","r"); + if (stre == NULL) + return InitFail(hWnd,DDERR_NOTLOADED,"LoadMap FAILED"); + + wsprintf(buf,"d"); + fscanf(stre,"%i",&numb); + + for (x=0; x<50; x++) + { + if (xLoad(hWnd,g_pDD,buf,1); + if (hRet!=DD_OK) return InitFail(hWnd,hRet,"ERROR"); + + } + + fclose(stre); + return DD_OK; +} + +TIanWall::~TIanWall() +{ + int x; + for (x=0; x<50; x++) + { + if (Tiles[x]) + { + delete Tiles[x]; + } + } +} + +// --- TIanItems --- +// +// ----------------- + +HRESULT TIanItems::LoadMap(HWND hWnd,char* filename) +{ + int x,y; + int stream; + + if ((stream = _open(filename,_O_BINARY)) == -1) + return InitFail(hWnd,DDERR_NOTLOADED,"LoadItems FAILED"); + + for (x=0; x<171; x++) + for (y=0; y<151; y++) + { + _read(stream,&Map[x][y],1); + } + _close(stream); + return DD_OK; +} + +HRESULT TIanItems::LoadItems(HWND hWnd, LPDIRECTDRAW7 g_pDD) +{ + int x; + HRESULT hRet; + FILE* stre; + int numb = 0; + char buf[50]; + + hRet= DD_OK; + stre = fopen("master.dat\\proto\\items.pro","r"); + if (stre == NULL) + return InitFail(hWnd,DDERR_NOTLOADED,"LoadMap FAILED"); + + wsprintf(buf,"d"); + fscanf(stre,"%i",&numb); + + for (x=0; x<50; x++) + { + if (xLoad(hWnd,g_pDD,buf,1); + if (hRet!=DD_OK) return InitFail(hWnd,hRet,"ERROR"); + + } + + fclose(stre); + return DD_OK; +} + +TIanItems::~TIanItems() +{ + int x; + for (x=0; x<50; x++) + { + if (Tiles[x]) + { + delete Tiles[x]; + } + } +} diff --git a/IanOut/FRMGraph.cpp b/IanOut/FRMGraph.cpp new file mode 100644 index 0000000..2a8354f --- /dev/null +++ b/IanOut/FRMGraph.cpp @@ -0,0 +1,289 @@ +#include "FRMGraph.h" +#include "io.h" +#include +#include "ddutil.h" +#include "utils.h" +#include "math.h" + +#include "FRMGr_1.h" +#include "FRMGr_2.h" +#include "FRMGr_3.h" + +// --- TFRMPlayer --- +// +// ------------------ + +void TFRMPlayer::LoadPlayer(PlayerDefAnim PDefAni) +{ + if (Player.bIdle) + { + if (Idle) delete Idle; + Idle = new TFRMCommunicator(PDefAni.AIdle); + } + if (Player.bMove) + { + if (Moving) delete Moving; + Moving = new TFRMCommunicator(PDefAni.AMoving); + } +} + +void TFRMPlayer::GenerateTree(int tx, int ty, BlockType Block) +{ + int ix,iy,i,i2; + int ix2,iy2,tx2,ty2; + int Long[6][3]; + BOOL Mehet; + BOOL Ok; + + for (ix=0; ix<170; ix++) + for (iy=0; iy<150; iy++) + { + Table[ix][iy] = 111; + } + Table[x][y] = 1; + i = 1; + Mehet = TRUE; + while (Mehet) + { + for (ix=2; ix<163; ix++) + for (iy=1; iy<143; iy++) + { + if (Table[ix][iy] == i) + { + if ((Table[ix-1][iy-1] > i+1) && (Block[ix-1][iy-1]!=1)) Table[ix-1][iy-1] = i+1; + if ((Table[ix+1][iy-1] > i+1) && (Block[ix+1][iy-1]!=1)) Table[ix+1][iy-1] = i+1; + if ((Table[ix-1][iy+1] > i+1) && (Block[ix-1][iy+1]!=1)) Table[ix-1][iy+1] = i+1; + if ((Table[ix+1][iy+1] > i+1) && (Block[ix+1][iy+1]!=1)) Table[ix+1][iy+1] = i+1; + + if ((Table[ix-2][iy ] > i+1) && (Block[ix-1][iy ]!=1) && (Block[ix-2][iy ]!=1)) Table[ix-2][iy ] = i+1; + if ((Table[ix+2][iy ] > i+1) && (Block[ix+1][iy ]!=1) && (Block[ix+2][iy ]!=1)) Table[ix+2][iy ] = i+1; + } + } + i++; + if (i>100) Mehet=FALSE; + if (Table[tx][ty]!=111) Mehet=FALSE; + } + + if ((tx==x) && (ty==y)) {i=101;}; + + if (i<100) + { + PosIt[0][0]=i; + PosIt[0][1]=i; + PosIt[i][0]=tx; + PosIt[i][1]=ty; + + Mehet = TRUE; + while (Mehet) + { + i--; + for (i2=0; i2<6; i2++) + { + Long[i2][0] = -1; + Long[i2][1] = -1; + Long[i2][2] = -1; + } + i2=0; + if (i<1) {Mehet=FALSE;i=1;} + for (ix=2; ix<163; ix++) + for (iy=1; iy<143; iy++) + { + if (Table[ix][iy] == i) + { + Ok = FALSE; + if ((ix+2 == PosIt[i+1][0]) && + (iy == PosIt[i+1][1])) { Ok = TRUE; } + if ((ix-2 == PosIt[i+1][0]) && + (iy == PosIt[i+1][1])) { Ok = TRUE; } + if ((ix+1 == PosIt[i+1][0]) && + (iy+1 == PosIt[i+1][1])) { Ok = TRUE; } + if ((ix+1 == PosIt[i+1][0]) && + (iy-1 == PosIt[i+1][1])) { Ok = TRUE; } + if ((ix-1 == PosIt[i+1][0]) && + (iy+1 == PosIt[i+1][1])) { Ok = TRUE; } + if ((ix-1 == PosIt[i+1][0]) && + (iy-1 == PosIt[i+1][1])) { Ok = TRUE; } + + if (Ok) + { + Long[i2][0]=ix; + Long[i2][1]=iy; + ix2 = ix*14; + iy2 = iy*12; + tx2 = tx*14; + ty2 = ty*12; + Long[i2][2]=(int)sqrt(abs(ix2-tx2)*abs(ix2-tx2) + abs(iy2-ty2)*abs(iy2-ty2)); + i2++; + } + } + } + iy2=9999; + tx2=0; + for (ix2=0; ix21) + { + tx2 = PosIt[1][0]; + ty2 = PosIt[1][1]; + ix2 = PosIt[2][0]; + iy2 = PosIt[2][1]; + if ((tx2+1==ix2) && (ty2+1==iy2)) { dir =2; } + if ((tx2+1==ix2) && (ty2-1==iy2)) { dir =0; } + if ((tx2+2==ix2) && (ty2 ==iy2)) { dir =1; } + if ((tx2-2==ix2) && (ty2 ==iy2)) { dir =4; } + if ((tx2-1==ix2) && (ty2+1==iy2)) { dir =3; } + if ((tx2-1==ix2) && (ty2-1==iy2)) { dir =5; } + curth=1; + } else curth=0; + + ox = x; + oy = y; + if (i2>1) + { + PosIt[0][1]--; + x = PosIt[PosIt[0][0]+1-PosIt[0][1]][0]; + y = PosIt[PosIt[0][0]+1-PosIt[0][1]][1]; + } + + framenum=0; + fr2 = rand()%100; + fr3=0; + Moving->FirstFrame(); + Idle->FirstFrame(); + Labpos = FALSE; + +} + +void TFRMPlayer::Move(BlockType Block) +{ + int i; + if (PosIt[0][0] != -1) + { + if (PosIt[0][1] == 1) + { + PosIt[0][0] = -1; + PosIt[0][1] = -1; + curth = 0; + framenum =0; + fr2 = rand()%100; + fr3=0; + Idle->FirstFrame(); + } else + { + PosIt[0][1]--; + ox = x; + oy = y; + x = PosIt[PosIt[0][0]+1-PosIt[0][1]][0]; + y = PosIt[PosIt[0][0]+1-PosIt[0][1]][1]; + + if ((ox==x+1) && (oy==y+1)) { dir =5; } + if ((ox==x+1) && (oy==y-1)) { dir =3; } + if ((ox==x+2) && (oy==y )) { dir =4; } + if ((ox==x-2) && (oy==y )) { dir =1; } + if ((ox==x-1) && (oy==y+1)) { dir =0; } + if ((ox==x-1) && (oy==y-1)) { dir =2; } + Labpos = !Labpos; + Moving->SetDir(dir); + Moving->FirstFrame(); + if (Labpos == TRUE) + { + for (i=0; i<4; i++) + { + Moving->NextFrame(); + } + } + } + } else + { + curth = 0; + framenum =0; + fr2 = rand()%100; + fr3=0; + Idle->FirstFrame(); + } +} + +int TFRMPlayer::GetDir() +{ + int ox,oy,nx,ny; + ox = x; + oy = y; + nx = PosIt[PosIt[0][0]+1-PosIt[0][1]-1][0]; + ny = PosIt[PosIt[0][0]+1-PosIt[0][1]-1][1]; + if ((ox+1==nx) && (oy+1==ny)) { return 5; } + if ((ox+1==nx) && (oy-1==ny)) { return 3; } + if ((ox+2==nx) && (oy ==ny)) { return 4; } + if ((ox-2==nx) && (oy ==ny)) { return 1; } + if ((ox-1==nx) && (oy+1==ny)) { return 0; } + if ((ox-1==nx) && (oy-1==ny)) { return 2; } + return 0; +} + +void TFRMPlayer::Next(BlockType Block) +{ + int ix,iy; + if (curth == 1) + { + //dir = GetDir(); + framenum++; + Moving->NextFrame(); + if (framenum>Moving->Animation->framecounter/2-1) { framenum=0;Move(Block); } + } + if (curth == 0) + { + framenum++; + fr3++; + if ((framenum>fr2) && (fr3%2==0)) {Idle->NextFrame();} + if (framenum>fr2+Idle->Animation->framecounter*2) {framenum=0;Idle->FirstFrame();fr2 = rand()%100;} + if ((rand()%100==0) && (Player.bComputer)) + { + ix=rand()%3+1; + iy=rand()%3+1; + switch (rand()%6) + { + case 0:GenerateTree(x-ix,y-iy,Block);break; + case 1:GenerateTree(x-ix,y+iy,Block);break; + case 2:GenerateTree(x-ix*2,y,Block);break; + case 3:GenerateTree(x+ix*2,y,Block);break; + case 4:GenerateTree(x+ix,y-iy,Block);break; + case 5:GenerateTree(x+ix,y+iy,Block);break; + } + } + } +} + +void TFRMPlayer::Draw(LPDIRECTDRAWSURFACE7 g_pDDSBack, int TerX, int TerY) +{ + PFRM Lista; + switch (curth) + { + case 0: + Idle->SetDir(dir); + Lista = (PFRM)Idle->Count6[dir]; + BlitTo(g_pDDSBack,0,0,Lista->x,Lista->y,TerX+(x+226)*16+Lista->bx,TerY+(y)*12+Lista->by,DDBLTFAST_SRCCOLORKEY,Lista->FRM); + break; + case 1: + Moving->SetDir(dir); + Lista = (PFRM)Moving->Count6[dir]; + BlitTo(g_pDDSBack,0,0,Lista->x,Lista->y,TerX+(ox+226)*16+Lista->bx,TerY+(oy)*12+Lista->by,DDBLTFAST_SRCCOLORKEY,Lista->FRM); + break; + } +} \ No newline at end of file diff --git a/IanOut/FRMGraph.h b/IanOut/FRMGraph.h new file mode 100644 index 0000000..09ca3f2 --- /dev/null +++ b/IanOut/FRMGraph.h @@ -0,0 +1,213 @@ +#include "ItemObj.h" +#include +#include +#include + +#ifndef __FRMGRAPH_H +#define __FRMGRAPH_H + +class TFRM; +class TFRMAnim; +class TFRMAnim6; +class TFRMSingle; + +class TFRMCommunicator; +class TFRMPlayer; + +class TIanMap; +class TIanWall; +class TIanItems; + +typedef TFRM *PFRM; +typedef TFRMAnim *PFRMAnim; +typedef TFRMAnim6 *PFRMAnim6; +typedef TFRMSingle *PFRMSingle; + +typedef TFRMCommunicator *PFRMCommunicator; +typedef TFRMPlayer *PFRMPlayer; + +typedef TIanWall *PIanWall; +typedef TIanMap *PIanMap; +typedef TIanItems *PIanItems; + +typedef unsigned char MapInfo[100][100]; +typedef unsigned char WallInfo[171][151]; +typedef unsigned char BlockType[171][151]; + +typedef struct __PDF +{ + BOOL bIdle; + BOOL bMove; + BOOL bComputer; + char name[10]; + int maxtaunt; + char taunt[10][30]; +} PlayerDef; + + +typedef struct __PDFAnim +{ + PFRMAnim6 AIdle; + PFRMAnim6 AMoving; +} PlayerDefAnim; + +class TFRM : public TItem +{ +public: + TFRM(void) {}; + ~TFRM(void) {}; +//protected: + int x,y; + int bx,by; + LPDIRECTDRAWSURFACE7 FRM; + +// friend class TFRMAnim; +}; + +class TFRMAnim : public TItem +{ +public: + TFRMAnim() { FRMList = new TList(); }; + ~TFRMAnim(); + + virtual HRESULT Load(HWND hWnd, LPDIRECTDRAW7 g_pDD, char* filename); + + virtual void NextFrame(); + virtual PFRM GetCurFrame(); + + int framecounter; +protected: + virtual int LoadFRM(int stream, LPVOID LoadIn, int x, int y, int p); + PItem Counter; + +private: + PList FRMList; + +}; + +class TFRMAnim6 : public TFRMAnim +{ +public: + TFRMAnim6(); + ~TFRMAnim6(); + virtual HRESULT Load(HWND hWnd, LPDIRECTDRAW7 g_pDD, char* filename); + + virtual void FirstFrame(); + virtual void NextFrame(); + virtual PFRM GetCurFrame(); + virtual void SetDir(int i_dir); + + int dir; + PItem Counter6[6]; + PList FRMList6[6]; +}; + +class TFRMSingle : public TItem +{ +public: + PFRM FRM; + TFRMSingle() {FRM = NULL;}; + ~TFRMSingle() { if (FRM) {FRM->FRM->Release();delete FRM;}}; + + HRESULT Load(HWND hWnd, LPDIRECTDRAW7 g_pDD, char* filename, int framenum); + + char fname[80]; +protected: + int LoadFRM(int stream, LPVOID LoadIn, int x, int y, int p); +}; + +class TIanMap : public TItem +{ +public: + TIanMap() {}; + ~TIanMap(); + + HRESULT LoadMap(HWND hWnd,char* filename); + HRESULT LoadTiles(HWND hWnd, LPDIRECTDRAW7 g_pDD); + + MapInfo Map; + PFRMSingle Tiles[10]; +}; + +class TIanWall : public TItem +{ +public: + TIanWall() {}; + ~TIanWall(); + + HRESULT LoadMap(HWND hWnd,char* filename); + HRESULT LoadWalls(HWND hWnd, LPDIRECTDRAW7 g_pDD); + + WallInfo Map; + PFRMSingle Tiles[50]; +}; + +class TIanItems : public TItem +{ +public: + TIanItems() {}; + ~TIanItems(); + + HRESULT LoadMap(HWND hWnd,char* filename); + HRESULT LoadItems(HWND hWnd, LPDIRECTDRAW7 g_pDD); + + WallInfo Map; + PFRMSingle Tiles[50]; +}; + +class TFRMCommunicator : public TItem +{ +public: + TFRMCommunicator(PFRMAnim6 FRMAssign); + ~TFRMCommunicator() {}; + + virtual void FirstFrame(); + virtual void NextFrame() { Count6[dir] = Animation->FRMList6[dir]->RNext(Count6[dir]);}; + virtual PFRM GetCurFrame(); + virtual void SetDir(int i_dir) {dir = i_dir;}; + + int dir; + PItem Count6[6]; + + PFRMAnim6 Animation; +}; + +class TFRMPlayer : public TItem +{ +public: + TFRMPlayer(PlayerDef PDef) + { + curth = 0; + dir = 0; + framenum = 0; + Player = PDef; + fr2 = 0; + fr3 = 0; + }; + ~TFRMPlayer() { if (Idle) delete Idle; if (Moving) delete Moving;}; + + void LoadPlayer(PlayerDefAnim PDefAni); + + void Draw(LPDIRECTDRAWSURFACE7 g_pDDSBack,int TerX, int TerY); + void GenerateTree(int tx, int ty, BlockType Block); + void MoveTo(int t_x, int t_y) {x = t_x; y=t_y; }; + void Next(BlockType Block); + void Move(BlockType Block); + int GetDir(); + + int x,y; + int ox,oy; + int curth; + int framenum; + int fr2,fr3; + int dir; + BOOL Labpos; + PlayerDef Player; + + short Table[170][150]; + short PosIt[101][2]; + PFRMCommunicator Idle; /* 0 */ + PFRMCommunicator Moving; /* 1 */ +}; + +#endif // __FRMGRAPH_H \ No newline at end of file diff --git a/IanOut/FRMGraph_Source_0.4.doc b/IanOut/FRMGraph_Source_0.4.doc new file mode 100644 index 0000000..a7979f8 Binary files /dev/null and b/IanOut/FRMGraph_Source_0.4.doc differ diff --git a/IanOut/IanOut.exe b/IanOut/IanOut.exe new file mode 100644 index 0000000..054ade1 Binary files /dev/null and b/IanOut/IanOut.exe differ diff --git a/IanOut/IanOut.ico b/IanOut/IanOut.ico new file mode 100644 index 0000000..458ed61 Binary files /dev/null and b/IanOut/IanOut.ico differ diff --git a/IanOut/Ianout-The-First-Documentation-Hungarian.doc b/IanOut/Ianout-The-First-Documentation-Hungarian.doc new file mode 100644 index 0000000..d40dabc Binary files /dev/null and b/IanOut/Ianout-The-First-Documentation-Hungarian.doc differ diff --git a/IanOut/ItemObj.cpp b/IanOut/ItemObj.cpp new file mode 100644 index 0000000..2cf7769 --- /dev/null +++ b/IanOut/ItemObj.cpp @@ -0,0 +1,112 @@ +#include "stdio.h" +#include "ItemObj.h" + +////////////////////////////////////////////////////////////////// +// +// TItem + +PItem TItem::Prev() +{ + PItem Item; + Item = this; + while ( Item->FNext != this ) + Item = Item->FNext; + return Item; +} + +////////////////////////////////////////////////////////////////// +// +// TList + +TList::TList() +{ + FLast = NULL; +} + +Boolean TList::Exists(PItem Item) +{ + PItem Cur; + + if ( Empty() ) + return False; + + Cur = FLast->FNext; + while (Cur != Item && Cur!= FLast ) + Cur = Cur->FNext; + + return Cur == Item ? True : False; +} + +void TList::Insert(PItem Item) +{ + if (!Item ) + return; + + if ( Empty() ) + Item->FNext = Item; + else + { + Item->FNext = FLast->FNext; + FLast->FNext = Item; + } + FLast = Item; +} + +Boolean TList::Disconnect(PItem Item) +{ + PItem Cur; + if ( Empty() ) return False; + + Cur = FLast; + while (Cur->FNext != Item && Cur->FNext != FLast ) + Cur = Cur -> FNext; + + if ( Cur->FNext == Item) + { + Cur ->FNext = Item->FNext; + if (FLast == Item) + if ( Cur == Item) + FLast = NULL; + else + FLast = Cur; + return True; + } + return False; +} + +void TList::Delete(PItem Item) +{ + if ( Disconnect(Item) ) delete Item; +} + +void TList::DeleteAll() +{ + while (!Empty()) Delete(First()); +} + +void TList::Each(ItemProcedure DoToItem) +{ + PItem Item; + + Item = First(); + while ( Item ) + { + DoToItem(Item); + Item = Next(Item); + } +} + +PItem TList::GetItem() +{ + Current = First(); + + while ( Current && !Found() ) + Current = Next(Current); + + return Current; +} + +TList::~TList() +{ + DeleteAll(); +} \ No newline at end of file diff --git a/IanOut/ItemObj.h b/IanOut/ItemObj.h new file mode 100644 index 0000000..2875011 --- /dev/null +++ b/IanOut/ItemObj.h @@ -0,0 +1,76 @@ +#include "stdio.h" + +#ifndef __ULIST_H +#define __ULIST_H + +#define Boolean int +#define True 1 +#define False 0 + +class TItem; +class TList; + +typedef TItem *PItem; +typedef TList *PList; + +typedef void (*ItemProcedure)(PItem Item); + +////////////////////////////////////////////////////////////////// +// +// TItem + +class TItem +{ +public: + TItem() {}; + virtual ~TItem() {}; + + PItem Next() { return FNext; }; + PItem Prev(); + +private: + PItem FNext; + + friend class TList; + friend class TFRMList; + friend class TFRMChr; +}; + +////////////////////////////////////////////////////////////////// +// +// TList + +class TList : public TItem +{ +public: + TList(); + ~TList(); + Boolean Empty() { return FLast == NULL ? True : False; }; + PItem First() { return Empty () == True ? NULL : FLast->FNext; }; + PItem Last() { return FLast; }; + PItem Next(PItem Item) { return Item == FLast ? NULL : Item->FNext; }; + PItem RNext(PItem Item) { return Item->FNext; } ; + PItem Prev(PItem Item) { return Item == First() ? NULL : Item->Prev(); }; + PItem RPrev(PItem Item) { return Item->Prev(); } ; + + Boolean Exists(PItem Item); + Boolean Disconnect(PItem Item); + void Delete(PItem Item); + void DeleteAll(); + void Each(ItemProcedure DoToItem); + PItem GetItem(); + + virtual void Insert(PItem Item); + virtual Boolean Found() { return True; }; + +public: + PItem Current; + +//private: + PItem FLast; + + friend class TFRMChr; +}; + +#endif //__ULIST_H + diff --git a/IanOut/MAKEFILE b/IanOut/MAKEFILE new file mode 100644 index 0000000..e6edd31 --- /dev/null +++ b/IanOut/MAKEFILE @@ -0,0 +1,39 @@ +proj=DDex4 + +INCLUDE=$(INCLUDE);$(DXSDKROOT)\samples\multimedia\ddraw\include; + +!if "$(nodebug)" == "1" +OBJ_DIR = Retail +!else +OBJ_DIR = Debug +!endif + +!include "$(DXSDKROOT)\include\dxsdk.inc" + +mycflags= + +OBJ_LIST = $(OBJ_DIR)\$(proj).obj $(OBJ_DIR)\ddutil.obj + +all: mkdir $(OBJ_DIR)\$(proj).exe + +$(OBJ_DIR)\$(proj).obj: $(proj).cpp + $(cc) $(cdebug) $(cflags) $(mycflags) $(outobj)$(OBJ_DIR)\$(proj).obj $(proj).cpp + +$(OBJ_DIR)\ddutil.obj: ddutil.cpp + $(cc) $(cdebug) $(cflags) $(mycflags) $(outobj)$(OBJ_DIR)\ddutil.obj ddutil.cpp + +$(OBJ_DIR)\$(proj).res: $(proj).rc resource.h + $(rc) $(rcflags) $(OBJ_DIR)\$(proj).res $(proj).rc + +$(OBJ_DIR)\$(proj).exe: $(OBJ_LIST) $(OBJ_DIR)\$(proj).res + $(link) $(linkdebug) $(linkflags) $(OBJ_LIST) $(borobjs) $(commas) $(outexe)$(OBJ_DIR)\$(proj).exe $(commas) $(commas) $(deflibs) ddraw.lib dxguid.lib $(commas) $(commas) $(OBJ_DIR)\$(proj).res + +mkdir: + @if not exist $(OBJ_DIR)\NUL md $(OBJ_DIR) + +# Rules for cleaning out those old files +clean: + -@echo y | del Retail + -@echo y | del Debug + -@rd Retail + -@rd Debug diff --git a/IanOut/RESOURCE.H b/IanOut/RESOURCE.H new file mode 100644 index 0000000..27e2a4d --- /dev/null +++ b/IanOut/RESOURCE.H @@ -0,0 +1,3 @@ +#define IDI_MAIN_ICON 101 +#define IDR_MENU 102 +#define IDM_EXIT 40001 diff --git a/IanOut/d.rc b/IanOut/d.rc new file mode 100644 index 0000000..714e16e --- /dev/null +++ b/IanOut/d.rc @@ -0,0 +1,46 @@ +#include "resource.h" + +ALL BITMAP MOVEABLE PURE "ALL.BMP" + +IDR_MENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", IDM_EXIT + END +END + +IDI_MAIN_ICON ICON DISCARDABLE "DirectX.ico" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,4,1,1 + PRODUCTVERSION 0,4,1,1 + FILEFLAGSMASK 0x3fL + FILEFLAGS 0x0L + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040e04b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Kék eper neoszürrealista társulat\0" + VALUE "FileDescription", "IanOut\0" + VALUE "FileVersion", "0,4,1,1\0" + VALUE "InternalName", "IanOut\0" + VALUE "LegalCopyright", "Copyright Š 2000-2002\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "IanOut.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "IanOut - A Post-Nuclear Ian-Playing Game\0" + VALUE "ProductVersion", "0,4,1,1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x40e, 1200 + END +END \ No newline at end of file diff --git a/IanOut/ddex4.aps b/IanOut/ddex4.aps new file mode 100644 index 0000000..4c3c5cb Binary files /dev/null and b/IanOut/ddex4.aps differ diff --git a/IanOut/ddex4.dsp b/IanOut/ddex4.dsp new file mode 100644 index 0000000..5c2e6dc --- /dev/null +++ b/IanOut/ddex4.dsp @@ -0,0 +1,212 @@ +# Microsoft Developer Studio Project File - Name="ddex4" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=ddex4 - Win32 Release +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "ddex4.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "ddex4.mak" CFG="ddex4 - Win32 Release" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ddex4 - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "ddex4 - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ddex4 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir ".\Release" +# PROP BASE Intermediate_Dir ".\Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 2 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir ".\Release" +# PROP Intermediate_Dir ".\Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 dxguid.lib ddraw.lib dinput.lib msimg32.lib /nologo /subsystem:windows /machine:I386 /out:".\Release/IanOut.exe" +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "ddex4 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir ".\Debug" +# PROP BASE Intermediate_Dir ".\Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 2 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir ".\Debug" +# PROP Intermediate_Dir ".\Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /YX /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 +# ADD LINK32 dxguid.lib ddraw.lib /nologo /subsystem:windows /debug /machine:I386 + +!ENDIF + +# Begin Target + +# Name "ddex4 - Win32 Release" +# Name "ddex4 - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90" +# Begin Source File + +SOURCE=.\ddex4.cpp +# End Source File +# Begin Source File + +SOURCE=.\ddex4.rc +# End Source File +# Begin Source File + +SOURCE=.\ddutil.cpp +# End Source File +# Begin Source File + +SOURCE=.\ItemObj.cpp +# End Source File +# Begin Source File + +SOURCE=.\utils.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" +# Begin Group "FRMGraph headers" + +# PROP Default_Filter "h" +# Begin Source File + +SOURCE=.\FRMGr_1.h +# End Source File +# Begin Source File + +SOURCE=.\FRMGr_2.h +# End Source File +# Begin Source File + +SOURCE=.\FRMGr_3.h +# End Source File +# End Group +# Begin Group "Ddex headers" + +# PROP Default_Filter "h" +# Begin Source File + +SOURCE=.\ddex4_1.h +# End Source File +# Begin Source File + +SOURCE=.\ddex4_2.h +# End Source File +# Begin Source File + +SOURCE=.\ddex4_f.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\ddutil.h +# End Source File +# Begin Source File + +SOURCE=.\ItemObj.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\utils.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\ALL.BMP +# End Source File +# Begin Source File + +SOURCE=.\directx.ico +# End Source File +# End Group +# Begin Group "Recently" + +# PROP Default_Filter "c;cpp;h" +# Begin Source File + +SOURCE=.\ddex4_i.h +# End Source File +# Begin Source File + +SOURCE=.\ddex4_u.h +# End Source File +# Begin Source File + +SOURCE=.\ddex4_u2.h +# End Source File +# Begin Source File + +SOURCE=.\ddex4_u3.h +# End Source File +# Begin Source File + +SOURCE=.\FRMGraph.cpp +# End Source File +# Begin Source File + +SOURCE=.\FRMGraph.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\temp.txt +# End Source File +# End Target +# End Project diff --git a/IanOut/ddex4.rc b/IanOut/ddex4.rc new file mode 100644 index 0000000..714e16e --- /dev/null +++ b/IanOut/ddex4.rc @@ -0,0 +1,46 @@ +#include "resource.h" + +ALL BITMAP MOVEABLE PURE "ALL.BMP" + +IDR_MENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", IDM_EXIT + END +END + +IDI_MAIN_ICON ICON DISCARDABLE "DirectX.ico" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,4,1,1 + PRODUCTVERSION 0,4,1,1 + FILEFLAGSMASK 0x3fL + FILEFLAGS 0x0L + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040e04b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Kék eper neoszürrealista társulat\0" + VALUE "FileDescription", "IanOut\0" + VALUE "FileVersion", "0,4,1,1\0" + VALUE "InternalName", "IanOut\0" + VALUE "LegalCopyright", "Copyright Š 2000-2002\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "IanOut.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "IanOut - A Post-Nuclear Ian-Playing Game\0" + VALUE "ProductVersion", "0,4,1,1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x40e, 1200 + END +END \ No newline at end of file diff --git a/IanOut/ddex4_1.h b/IanOut/ddex4_1.h new file mode 100644 index 0000000..37d504d --- /dev/null +++ b/IanOut/ddex4_1.h @@ -0,0 +1,145 @@ + + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +//----------------------------------------------------------------------------- +// Include files +//----------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include "itemobj.h" +#include "resource.h" +#include "ddutil.h" +#include "FRMGraph.h" +#include "utils.h" +#include + +//----------------------------------------------------------------------------- +// Local definitions +//----------------------------------------------------------------------------- +#define NAME "IanOut" +#define TITLE "IanOut: A Post-Nuclear Ian-Playing Game" + +#define VERSIONNUM "0.4a" + +//----------------------------------------------------------------------------- +// Local data +//----------------------------------------------------------------------------- +const int FontMap[] = { +// * *_* * * *!* *"* *#* *$* *%* *&* *'* *(* *)* *** *+* *,* *-* *.* */* *0* *1* *2* *3* *4* *5* *6* *7* *8* *9* *:* *;* *<* *=* *>* *?* *@* *A* *B* *C* *D* *E* *F* *G* *H* *I* *J* *K* *L* *M* *N* *O* *P* *Q* *R* *S* *T* *U* *V* *W* *X* *Y* *Z* *[* *\* *]* *^* *_* *`* *a* *b* *c* *d* *e* *f* *g* *h* *i* *j* *k* *l* *m* *n* *o* *p* *q* *r* *s* *t* *u* *v* *w* *x* *y* *z* *{* *|* *}* *~* *o* + 0, 6, 10, 17, 26, 34, 44, 53, 58, 64, 70, 77, 84, 88, 96,100,110,118,124,132,140,148,156,164,172,180,188,192,196,205,213,222,230,239,249,258,266,275,283,291,300,309,313,322,331,339,348,357,366,375,384,393,402,410,419,429,438,448,458,467,473,483,489,498,507,512,520,528,535,543,551,558,566,574,578,585,593,597,606,614,622,630,638,645,653,661,669,677,686,694,702,710,716,720,726,735,742 +}; + +const int WallMap[][2] = { {0,-120},{0,-120},{0,-120},{0,-120},{-22,-120},{0,0},{0,0},{0,-120},{0,-120},{0,-120},{0,-120},{0,-120},{0,-120},{-2,-100},{0,-120}, +/*b*/ {0,0},{0,-108},{0,-100},{0,-108},{0,-100},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,-108},{0,-100},{0,-108},{0,-117},{0,-76 },{0,-84 },{0,-76 },{0,-84 }, +/*b*/ {0,-76 },{0,-84 },{0,-76 },{0,-84 },{0,-84 },{0,-84 },{0,-84 },{0,-84 },{0,-80} +}; + +const int ItemMap[][2] = { {3,-13},{-30,-95},{-11,-60},{2,-38},{-36,-70},{-11,-63},{0,-95},{-4,-28},{-13,-68},{-18,-88},{-22,-71},{9,-119},{6,-119},{6,-79} +}; + + +DWORD dwFrameCount; +DWORD dwFrameTime; +DWORD dwFrames; +DWORD dwFramesLast; + +// Name of our bitmap resource. +static char szBitmap[] = "ALL"; + +struct Alap +{ + int primary[7]; + int secondary[10]; + int HP; + int skills[18]; +}; + +struct Skills // Declare PERSON struct type +{ + int primary[7]; + int secondary[10]; + int HP; + int skills[18]; + BOOL beteg[7]; + BOOL tagSk[18]; + BOOL perktra[50]; + Alap AlapSk; +} IanSkill; + +//----------------------------------------------------------------------------- +// Global data +//----------------------------------------------------------------------------- + + +LPDIRECTDRAW7 g_pDD = NULL; // DirectDraw object +LPDIRECTDRAWSURFACE7 g_pDDSPrimary = NULL; // DirectDraw primary surface +LPDIRECTDRAWSURFACE7 g_pDDSBack = NULL; // DirectDraw back surface +LPDIRECTDRAWSURFACE7 g_pDDSOne = NULL; // Offscreen surface 1 + +//LPDIRECTDRAWCLIPPER g_pDClip = NULL; // The Clipper +LPDIRECTDRAWPALETTE g_pDDPal = NULL; // The primary surface palette +LPVOID lpSurface = NULL; +BOOL g_bActive = FALSE; // Is application active? + +DIMOUSESTATE dims; // DirectInput mouse state structure +DIMOUSESTATE olddims; // DirectInput mouse state structure +IDirectInput* g_pDI = NULL; +IDirectInputDevice* g_pMouse = NULL; + +int MousX = 320; +int MousY = 240; + +int TerX = 0; +int TerY = 0; + +PFRMSingle FullScreen = NULL; +PFRMSingle FullScreen2 = NULL; +PFRMSingle Mouse = NULL; +PFRMSingle Mouse2 = NULL; +PFRMSingle KezeloP = NULL; +PFRMSingle MenuUp = NULL; +PFRMSingle MenuDown = NULL; +PFRMSingle Select = NULL; +PFRMSingle Select2 = NULL; +PFRMSingle SkillDex = NULL; +PFRMSingle MouseScr[8][2]; +PFRMSingle Buttons[2]; + +PIanMap MapInf; +PIanWall WallInf; +PIanItems ItemInf; + +PFRMPlayer Ian = NULL; +PFRMPlayer Aradesh = NULL; +PFRMPlayer Paraszt[10]; + +PALETTEENTRY pe[256]; +PALETTEENTRY pe2[256]; + +PList PlyAnim; + +double gamma = 1.5; + +int gameSpeed = 40; + +HWND hWnd; + +int GamePos = 3; + + +int wallpos[6][2]; +int current; +BlockType BlockDat; + +CString szoveg[50]; +int szovegnum; + +TIniStr *LINIStr[75]; +int Selected = 1; diff --git a/IanOut/ddex4_2.h b/IanOut/ddex4_2.h new file mode 100644 index 0000000..fd73b1d --- /dev/null +++ b/IanOut/ddex4_2.h @@ -0,0 +1,307 @@ +//----------------------------------------------------------------------------- +// Name: ReleaseAllObjects() +// Desc: Finished with all objects we use; release them +//----------------------------------------------------------------------------- + +void Nullaz(Skills *_Sk) +{ + int i; + for (i=0; i<7; i++) _Sk->AlapSk.primary[i]=5; + for (i=0; i<10; i++) _Sk->secondary[i]=0; + for (i=0; i<18; i++) { _Sk->skills[i]=0; _Sk->tagSk[i]=FALSE; } + for (i=0; i<50; i++) _Sk->perktra[i]=FALSE; + for (i=0; i<7; i++) _Sk->beteg[i]=FALSE; + _Sk->HP = 0; + _Sk->AlapSk.HP = 10; +} + +void CountSk(Skills *ISkill) +{ +int i; + +for (i=0; i<7; i++) ISkill->primary[i] = ISkill->AlapSk.primary[i]; + +#define I_ST (ISkill->primary[0]) +#define I_PE (ISkill->primary[1]) +#define I_EN (ISkill->primary[2]) +#define I_CH (ISkill->primary[3]) +#define I_IN (ISkill->primary[4]) +#define I_AG (ISkill->primary[5]) +#define I_LK (ISkill->primary[6]) +#define SKI(i,i2) (ISkill->skills[(i)]+=(i2)) +#define SEKI(i,i2) (ISkill->secondary[(i)]+=(i2)) + +if (ISkill->perktra[1]) { + I_ST++; + I_AG--; +} +if (ISkill->perktra[2]) { + I_AG++; +} +if (ISkill->perktra[15]) { + I_ST++;I_PE++;I_EN++;I_CH++;I_IN++;I_AG++;I_LK++; +} + +ISkill->AlapSk.skills[0] = (5+(I_AG)*4); +ISkill->AlapSk.skills[1] = (0+(I_AG)*2); +ISkill->AlapSk.skills[2] = (0+(I_AG)*2); +ISkill->AlapSk.skills[3] = (30+(I_AG+I_ST)*2); +ISkill->AlapSk.skills[4] = (20+(I_AG+I_ST)*2); +ISkill->AlapSk.skills[5] = (0+(I_AG)*4); +ISkill->AlapSk.skills[6] = (0+(I_PE+I_IN)*2); +ISkill->AlapSk.skills[7] = (5+(I_PE+I_IN)); +ISkill->AlapSk.skills[8] = (5+(I_AG)*3); +ISkill->AlapSk.skills[9] = (10+(I_PE+I_AG)); +ISkill->AlapSk.skills[10] = (0+(I_AG)*3); +ISkill->AlapSk.skills[11] = (10+(I_PE+I_AG)); +ISkill->AlapSk.skills[12] = (0+(I_IN)*4); +ISkill->AlapSk.skills[13] = (0+(I_IN)*3); +ISkill->AlapSk.skills[14] = (0+(I_CH)*5); +ISkill->AlapSk.skills[15] = (0+(I_CH)*4); +ISkill->AlapSk.skills[16] = (0+(I_LK)*5); +ISkill->AlapSk.skills[17] = (0+(I_EN+I_IN)*2); + +ISkill->AlapSk.secondary[0] = 5+I_AG/2+I_AG%2; +ISkill->AlapSk.secondary[1] = 5+I_AG/2; +ISkill->AlapSk.secondary[2] = 100+(I_ST-4)*25; +ISkill->AlapSk.secondary[3] = I_ST/2; +ISkill->AlapSk.secondary[4] = (I_ST+I_PE+I_EN+I_AG); +ISkill->AlapSk.secondary[5] = (I_EN+I_AG)*2; +ISkill->AlapSk.secondary[6] = 5+I_IN*3; +ISkill->AlapSk.secondary[7] = I_AG/2; +ISkill->AlapSk.secondary[8] = (I_ST+I_EN)/3; +ISkill->AlapSk.secondary[9] = I_ST+I_LK; + +ISkill->AlapSk.HP = 15+(I_ST*I_EN)/4; + +for (i=0; i<18; i++) ISkill->skills[i] = ISkill->AlapSk.skills[i]; +for (i=0; i<10; i++) ISkill->secondary[i] = ISkill->AlapSk.secondary[i]; + +if (ISkill->perktra[0]) { SEKI(5,-10); SEKI(8,3); } +if (ISkill->perktra[2]) { SEKI(2,-25); } +if (ISkill->perktra[3]) { SKI(0,25); SKI(1,-15); } +if (ISkill->perktra[5]) { SEKI(0,-10); SEKI(7,5); } +if (ISkill->perktra[6]) { SEKI(9,-10); SKI(3,25); } +if (ISkill->perktra[7]) { SKI(0,-15); SKI(1,-30); SKI(2,-30); } +if (ISkill->perktra[10]) { SKI(0,-10); SKI(1,-20);SKI(2,-20); SKI(6,10); SKI(7,10); SKI(14,10); SKI(15,10); } +if (ISkill->perktra[11]) { SEKI(5,-10); SEKI(8,3); } +if (ISkill->perktra[12]) { SEKI(5,10); SEKI(8,-3); } +if (ISkill->perktra[14]) { SEKI(6,5); for (i=0; i<18; i++) { SKI(i,10); } } +if (ISkill->perktra[15]) { for (i=0; i<18; i++) { SKI(i,-10); } SEKI(6,-5); } + +for (i=0; i<18; i++) if (ISkill->tagSk[i]) ISkill->skills[i]=(int)((double)(ISkill->skills[i])*2); +for (i=0; i<18; i++) if (ISkill->skills[i]<=0) ISkill->skills[i]=1; +for (i=0; i<18; i++) if (ISkill->secondary[i]<=0) ISkill->secondary[i]=1; + +#undef I_ST +#undef I_PE +#undef I_EN +#undef I_CH +#undef I_IN +#undef I_AG +#undef I_LK +#undef SKI +#undef SEKI + +} + +HRESULT +InitFail(HWND hWnd, HRESULT hRet, LPCTSTR szError,...); + +HRESULT InitDirectInput( HWND hDlg,HINSTANCE g_hInst ) +{ + HRESULT hr; + + hr = DirectInputCreate( g_hInst, DIRECTINPUT_VERSION, &g_pDI, NULL ); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"DirectInputCreate Failed"); + hr = g_pDI->CreateDevice( GUID_SysMouse, &g_pMouse, NULL ); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"CreateDevice (mouse) failed"); + hr = g_pMouse->SetDataFormat( &c_dfDIMouse ); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"SetDataFormat (mouse) failed"); + hr = g_pMouse->SetCooperativeLevel( hDlg, + DISCL_EXCLUSIVE | DISCL_FOREGROUND); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"SetCooperativeLevel (mouse) failed"); + + return S_OK; +} + +BOOL MouseIn(int x1,int y1,int x2,int y2) +{ + return ((MousX>=x1) && (MousX<=x2) && (MousY>=y1) && (MousY<=y2)); +} + +BOOL Pressed(int i) +{ + if ((i>=0) && (i<=2)) + return ((dims.rgbButtons[i] & 0x80) && !(olddims.rgbButtons[i] & 0x80)); else + return ((olddims.rgbButtons[i-3] & 0x80) && !(dims.rgbButtons[i-3] & 0x80)); +} + +BOOL MInPr(int x1,int y1, int x2, int y2,int i) +{ + return (MouseIn(x1,y1,x2,y2) && (Pressed(i))); +} + +//----------------------------------------------------------------------------- +// Function: SetAcquire +// +// Description: +// Acquire or unacquire the mouse, depending on if the app is active +// Input device must be acquired before the GetDeviceState is called +// +//----------------------------------------------------------------------------- +HRESULT SetAcquire( ) +{ + + if (NULL == g_pMouse) + return S_FALSE; + + if (g_bActive) + { + g_pMouse->Acquire(); + } + else + { + g_pMouse->Unacquire(); + } + + return S_OK; +} + + + + +//----------------------------------------------------------------------------- +// Function: UpdateInputState +// +// Description: +// Get the input device's state and display it. +// +//----------------------------------------------------------------------------- +HRESULT UpdateInputState( ) +{ + + if (NULL != g_pMouse) + { + HRESULT hr; + + hr = DIERR_INPUTLOST; + + while ( DIERR_INPUTLOST == hr ) + { + + hr = g_pMouse->GetDeviceState( sizeof(DIMOUSESTATE), &dims ); + + if ( hr == DIERR_INPUTLOST ) + { + hr = g_pMouse->Acquire(); + if ( FAILED(hr) ) + return hr; + } + } + + if ( FAILED(hr) ) + return hr; + + } + + return S_OK; +} + + + + +//----------------------------------------------------------------------------- +// Function: FreeDirectInput +// +// Description: +// Initialize the DirectInput variables. +// +//----------------------------------------------------------------------------- +HRESULT FreeDirectInput() +{ + if (NULL != g_pMouse) + { + + g_pMouse->Release(); + g_pMouse = NULL; + } + + if (NULL != g_pDI) + { + g_pDI->Release(); + g_pDI = NULL; + } + + return S_OK; +} + + +static void +ReleaseAllObjects(void) +{ + int i; + if (g_pDD != NULL) + { + if (g_pDDSPrimary != NULL) + { + g_pDDSPrimary->Release(); + g_pDDSPrimary = NULL; + } + if (g_pDDSOne != NULL) + { + g_pDDSOne->Release(); + g_pDDSOne = NULL; + } + if (g_pDDPal != NULL) + { + g_pDDPal->Release(); + g_pDDPal = NULL; + } + + if (Mouse) delete Mouse; + if (Mouse2) delete Mouse2; + if (KezeloP) delete KezeloP; + if (FullScreen) delete FullScreen; + if (FullScreen2) delete FullScreen2; + if (MenuUp) delete MenuUp; + if (Select) delete Select; + if (Select2) delete Select2; + if (Ian) delete Ian; + if (Aradesh) delete Aradesh; + if (MenuDown) delete MenuDown; + if (SkillDex) delete SkillDex; + + if (MapInf) delete MapInf; + if (WallInf) delete WallInf; + if (ItemInf) delete ItemInf; + for (i=0; i<10; i++) + { + if (Paraszt[i]) delete Paraszt[i]; + } + for (i=0; i<8; i++) + { + if (MouseScr[i][0]) delete MouseScr[i][0]; + if (MouseScr[i][1]) delete MouseScr[i][1]; + } + for (i=0; i<2; i++) + { + if (Buttons[i]) delete Buttons[i]; + } + + g_pDD->Release(); + g_pDD = NULL; + } + + for (i=0; i<75; i++) + { + LINIStr[i]->~TIniStr(); + LINIStr[i] = NULL; + } + delete PlyAnim; + FreeDirectInput(); +} diff --git a/IanOut/ddex4_f.h b/IanOut/ddex4_f.h new file mode 100644 index 0000000..6bf1fc1 --- /dev/null +++ b/IanOut/ddex4_f.h @@ -0,0 +1,957 @@ +void SetPaletteBl(int Frame) +{ + int i; + int Blue; + int Green; + int Red; + if (Frame>255) Frame=255; + if (Frame<0) Frame=0; + for ( i = 0; i<=255; i++) + { + Blue = Frame; + Green = Frame; + Red = Frame; + + if (Blue>(int)(pe[i].peBlue*gamma)) Blue = (int)(pe[i].peBlue*gamma); + if (Red>(int)(pe[i].peRed*gamma)) Red = (int)(pe[i].peRed*gamma); + if (Green>(int)(pe[i].peGreen*gamma)) Green = (int)(pe[i].peGreen*gamma); + + if (Blue>255) Blue=255; + if (Red>255) Red=255; + if (Green>255) Green=255; + if (Blue<0) Blue=0; + if (Red<0) Red=0; + if (Green<0) Green=0; + + pe2[i].peBlue = Blue; + pe2[i].peRed = Red; + pe2[i].peGreen = Green; + + } + if (g_pDDPal->SetEntries(0, 0, 256, pe2) != DD_OK) + return; +} + +HRESULT RestoreAll(); + +void FadeOut() +{ + int i; + HRESULT hRet; + + //g_pDDSPrimary->Blt(NULL,g_pDDSBack,NULL,0,NULL); + g_pDDSBack->Blt(NULL,g_pDDSPrimary,NULL,0,NULL); + + for (i=255; i>0; i-=4) + { + SetPaletteBl(i); + while (TRUE) + { + hRet = g_pDDSPrimary->Flip(NULL, 0); + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + hRet = RestoreAll(); + if (hRet != DD_OK) + break; + } + if (hRet != DDERR_WASSTILLDRAWING) + break; + } + + } + +} + +void FadeIn() +{ + int i; + HRESULT hRet; + + //g_pDDSPrimary->Blt(NULL,g_pDDSBack,NULL,0,NULL); + g_pDDSBack->Blt(NULL,g_pDDSPrimary,NULL,0,NULL); + + for (i=0; i<255; i+=4) + { + SetPaletteBl(i); + while (TRUE) + { + hRet = g_pDDSPrimary->Flip(NULL, 0); + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + hRet = RestoreAll(); + if (hRet != DD_OK) + break; + } + if (hRet != DDERR_WASSTILLDRAWING) + break; + } + + } + +} + + +void SetPaletteNo() +{ + g_pDDPal->SetEntries(0, 0, 256, pe); +} + + +void SetPaletteWh(int Frame) +{ + int i; + int Blue; + int Green; + int Red; + if (Frame>255) Frame=255; + if (Frame<0) Frame=0; + for ( i = 0; i<=255; i++) + { + Blue = 255-Frame; + Green = 255-Frame; + Red = 255-Frame; + + if (Blue<(int)(pe[i].peBlue*gamma)) Blue = (int)(pe[i].peBlue*gamma); + if (Red<(int)(pe[i].peRed*gamma)) Red = (int)(pe[i].peRed*gamma); + if (Green<(int)(pe[i].peGreen*gamma)) Green = (int)(pe[i].peGreen*gamma); + + if (Blue>255) Blue=255; + if (Red>255) Red=255; + if (Green>255) Green=255; + if (Blue<0) Blue=0; + if (Red<0) Red=0; + if (Green<0) Green=0; + + pe2[i].peBlue = Blue; + pe2[i].peRed = Red; + pe2[i].peGreen = Green; + } + + if (g_pDDPal->SetEntries(0, 0, 256, pe2) != DD_OK) + return; +} + +void FadeOutWh() +{ + int i; + HRESULT hRet; + + //g_pDDSPrimary->Blt(NULL,g_pDDSBack,NULL,0,NULL); + g_pDDSBack->Blt(NULL,g_pDDSPrimary,NULL,0,NULL); + + for (i=255; i>0; i-=4) + { + SetPaletteWh(i); + while (TRUE) + { + hRet = g_pDDSPrimary->Flip(NULL, 0); + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + hRet = RestoreAll(); + if (hRet != DD_OK) + break; + } + if (hRet != DDERR_WASSTILLDRAWING) + break; + } + + } + +} + +HRESULT +RestoreAll(void) +{ + HRESULT hRet; + + hRet = g_pDDSPrimary->Restore(); + if (hRet == DD_OK) + { + hRet = g_pDDSOne->Restore(); + if (hRet == DD_OK) + { + DDReLoadBitmap(g_pDDSOne, szBitmap); + } + } + return hRet; +} + + +void DrawChar( + int x, + int y, + int co, + char c) +{ + RECT rcRect; + + rcRect.left = FontMap[(c-32)]+1; + rcRect.top = (co*24)+1; + rcRect.right = FontMap[(c-31)]+1; + rcRect.bottom = (co*24)+12; + + if (rcRect.left>467) + { + rcRect.left-=468; + rcRect.right-=468; + rcRect.top+=12; + rcRect.bottom+=12; + } + + BlitTo(g_pDDSBack,rcRect.left,rcRect.top,rcRect.right,rcRect.bottom,x,y,DDBLTFAST_SRCCOLORKEY ,g_pDDSOne); +} + + +void IanOutText(int x, int y, int co, CString str) +{ + int i; + int jelenx = x; + int sor = y+3; + int length = str.GetLength(); + int maxjelenx = 0; + int maxsor = 0; + HRESULT hRet; + HDC hdc; + + if (co==11) + { + + hRet = g_pDDSBack->GetDC(&hdc); + if (!FAILED(hRet)) + { + + SetBkMode(hdc,TRANSPARENT); + SetTextColor(hdc,RGB(0,0,0)); + TextOut(hdc, x,y,str,length); + g_pDDSBack->ReleaseDC(hdc); + } + } + + for (i=0 ; i=' ') && (str[i]<='~'+1))) + + { + DrawChar(jelenx,sor,co,str[i]); + jelenx += FontMap[str[i]-31]-FontMap[str[i]-32]; + } else + if (str[i]=='\n') + { + sor += 12; + jelenx=x; + } else + if (str[i]=='á') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'a'); + jelenx += FontMap['a'-31]-FontMap['a'-32]; + } else + if (str[i]=='é') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'e'); + jelenx += FontMap['e'-31]-FontMap['e'-32]; + } else + if (str[i]=='í') + { + DrawChar(jelenx-1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'i'); + jelenx += FontMap['i'-31]-FontMap['i'-32]; + }else + if (str[i]=='ó') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'o'); + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if (str[i]=='ú') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'u'); + jelenx += FontMap['u'-31]-FontMap['u'-32]; + }else + if ((str[i]=='ö') || (str[i]=='ő')) + { + DrawChar(jelenx-1,sor-1,co,'"'); + DrawChar(jelenx,sor,co,'o'); + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if ((str[i]=='ü') || (str[i]=='ű')) + { + DrawChar(jelenx-1,sor-1,co,'"'); + DrawChar(jelenx,sor,co,'u'); + jelenx += FontMap['u'-31]-FontMap['u'-32]; + } else + if (str[i]=='Á') + { + DrawChar(jelenx+5,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'A'); + jelenx += FontMap['A'-31]-FontMap['A'-32]; + } else + if (str[i]=='É') + { + DrawChar(jelenx+2,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'E'); + jelenx += FontMap['E'-31]-FontMap['E'-32]; + } else + if (str[i]=='Í') + { + DrawChar(jelenx,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'I'); + jelenx += FontMap['I'-31]-FontMap['I'-32]; + }else + if (str[i]=='Ó') + { + DrawChar(jelenx+2,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'O'); + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if (str[i]=='Ú') + { + DrawChar(jelenx+2,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'U'); + jelenx += FontMap['U'-31]-FontMap['U'-32]; + }else + if ((str[i]=='Ö') || (str[i]=='Ő')) + { + DrawChar(jelenx,sor-3,co,'"'); + DrawChar(jelenx,sor,co,'O'); + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if ((str[i]=='Ü') || (str[i]=='Ű')) + { + DrawChar(jelenx,sor-3,co,'"'); + DrawChar(jelenx,sor,co,'U'); + jelenx += FontMap['U'-31]-FontMap['U'-32]; + } + if (jelenx>maxjelenx) maxjelenx=jelenx; + if (sor+13>maxsor) maxsor=sor+13; + } + +} + +void IanOutTextC(int x, int y, int co, CString str) +{ + int i; + int jelenx = 0; + int sor = y+3; + int length = str.GetLength(); + int kihossz = 0; + int maxjelenx = 0; + int maxsor = 0; + + for (i=0 ; i=' ') && (str[i]<='~'+1))) + + { + jelenx += FontMap[str[i]-31]-FontMap[str[i]-32]; + } else + if (str[i]=='á') + { + jelenx += FontMap['a'-31]-FontMap['a'-32]; + } else + if (str[i]=='é') + { + jelenx += FontMap['e'-31]-FontMap['e'-32]; + } else + if (str[i]=='í') + { + jelenx += FontMap['i'-31]-FontMap['i'-32]; + }else + if (str[i]=='ó') + { + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if (str[i]=='ú') + { + jelenx += FontMap['u'-31]-FontMap['u'-32]; + }else + if (str[i]=='ö') + { + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if (str[i]=='ü') + { + jelenx += FontMap['u'-31]-FontMap['u'-32]; + } else + if (str[i]=='Á') + { + jelenx += FontMap['A'-31]-FontMap['A'-32]; + } else + if (str[i]=='É') + { + jelenx += FontMap['E'-31]-FontMap['E'-32]; + } else + if (str[i]=='Í') + { + jelenx += FontMap['I'-31]-FontMap['I'-32]; + }else + if (str[i]=='Ó') + { + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if (str[i]=='Ú') + { + jelenx += FontMap['U'-31]-FontMap['U'-32]; + }else + if (str[i]=='Ö') + { + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if (str[i]=='Ü') + { + jelenx += FontMap['U'-31]-FontMap['U'-32]; + } + } + + kihossz = jelenx; + jelenx = x-kihossz/2; + for (i=0 ; i=' ') && (str[i]<='~'+1))) + + { + DrawChar(jelenx,sor,co,str[i]); + jelenx += FontMap[str[i]-31]-FontMap[str[i]-32]; + } else + if (str[i]=='á') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'a'); + jelenx += FontMap['a'-31]-FontMap['a'-32]; + } else + if (str[i]=='é') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'e'); + jelenx += FontMap['e'-31]-FontMap['e'-32]; + } else + if (str[i]=='í') + { + DrawChar(jelenx-1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'i'); + jelenx += FontMap['i'-31]-FontMap['i'-32]; + }else + if (str[i]=='ó') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'o'); + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if (str[i]=='ú') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'u'); + jelenx += FontMap['u'-31]-FontMap['u'-32]; + }else + if (str[i]=='ö') + { + DrawChar(jelenx-1,sor-1,co,'"'); + DrawChar(jelenx,sor,co,'o'); + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if (str[i]=='ü') + { + DrawChar(jelenx-1,sor-1,co,'"'); + DrawChar(jelenx,sor,co,'u'); + jelenx += FontMap['u'-31]-FontMap['u'-32]; + } else + if (str[i]=='Á') + { + DrawChar(jelenx+5,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'A'); + jelenx += FontMap['A'-31]-FontMap['A'-32]; + } else + if (str[i]=='É') + { + DrawChar(jelenx+2,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'E'); + jelenx += FontMap['E'-31]-FontMap['E'-32]; + } else + if (str[i]=='Í') + { + DrawChar(jelenx,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'I'); + jelenx += FontMap['I'-31]-FontMap['I'-32]; + }else + if (str[i]=='Ó') + { + DrawChar(jelenx+2,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'O'); + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if (str[i]=='Ú') + { + DrawChar(jelenx+2,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'U'); + jelenx += FontMap['U'-31]-FontMap['U'-32]; + }else + if (str[i]=='Ö') + { + DrawChar(jelenx,sor-3,co,'"'); + DrawChar(jelenx,sor,co,'O'); + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if (str[i]=='Ü') + { + DrawChar(jelenx,sor-3,co,'"'); + DrawChar(jelenx,sor,co,'U'); + jelenx += FontMap['U'-31]-FontMap['U'-32]; + } + if (jelenx>maxjelenx) maxjelenx=jelenx; + if (sor+13>maxsor) maxsor=sor+13; + } +} + + +void DisplayFrameRate(void) +{ + DWORD time2; + char buff[256]; + + dwFrameCount++; + time2 = GetTickCount() - dwFrameTime; + if( time2 > 1000 ) + { + dwFrames = (dwFrameCount*1000)/time2; + dwFrameTime = GetTickCount(); + dwFrameCount = 0; + } + if( dwFrames == 0 ) + { + return; + } + + if (dwFrames != dwFramesLast) + { + dwFramesLast = dwFrames; + } + + if( dwFrames > 99 ) + { + dwFrames = 99; + } + buff[0] = (char)((dwFrames / 10) + '0'); + buff[1] = (char)((dwFrames % 10) + '0'); + buff[2] = ' '; + buff[3] = 'F'; + buff[4] = 'P'; + buff[5] = 'S'; + buff[6] = '\0'; + IanOutText(0,0,3,buff); +} + +void IanOutTextR(int x, int y, int co, CString str) +{ + int i; + int jelenx = 0; + int sor = y+3; + int length = str.GetLength(); + int kihossz = 0; + int maxjelenx = 0; + int maxsor = 0; + + for (i=0 ; i=' ') && (str[i]<='~'+1))) + + { + jelenx += FontMap[str[i]-31]-FontMap[str[i]-32]; + } else + if (str[i]=='á') + { + jelenx += FontMap['a'-31]-FontMap['a'-32]; + } else + if (str[i]=='é') + { + jelenx += FontMap['e'-31]-FontMap['e'-32]; + } else + if (str[i]=='í') + { + jelenx += FontMap['i'-31]-FontMap['i'-32]; + }else + if (str[i]=='ó') + { + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if (str[i]=='ú') + { + jelenx += FontMap['u'-31]-FontMap['u'-32]; + }else + if (str[i]=='ö') + { + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if (str[i]=='ü') + { + jelenx += FontMap['u'-31]-FontMap['u'-32]; + } else + if (str[i]=='Á') + { + jelenx += FontMap['A'-31]-FontMap['A'-32]; + } else + if (str[i]=='É') + { + jelenx += FontMap['E'-31]-FontMap['E'-32]; + } else + if (str[i]=='Í') + { + jelenx += FontMap['I'-31]-FontMap['I'-32]; + }else + if (str[i]=='Ó') + { + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if (str[i]=='Ú') + { + jelenx += FontMap['U'-31]-FontMap['U'-32]; + }else + if (str[i]=='Ö') + { + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if (str[i]=='Ü') + { + jelenx += FontMap['U'-31]-FontMap['U'-32]; + } + } + + kihossz = jelenx; + jelenx = x-kihossz; + for (i=0 ; i=' ') && (str[i]<='~'+1))) + + { + DrawChar(jelenx,sor,co,str[i]); + jelenx += FontMap[str[i]-31]-FontMap[str[i]-32]; + } else + if (str[i]=='á') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'a'); + jelenx += FontMap['a'-31]-FontMap['a'-32]; + } else + if (str[i]=='é') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'e'); + jelenx += FontMap['e'-31]-FontMap['e'-32]; + } else + if (str[i]=='í') + { + DrawChar(jelenx-1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'i'); + jelenx += FontMap['i'-31]-FontMap['i'-32]; + }else + if (str[i]=='ó') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'o'); + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if (str[i]=='ú') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'u'); + jelenx += FontMap['u'-31]-FontMap['u'-32]; + }else + if (str[i]=='ö') + { + DrawChar(jelenx-1,sor-1,co,'"'); + DrawChar(jelenx,sor,co,'o'); + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if (str[i]=='ü') + { + DrawChar(jelenx-1,sor-1,co,'"'); + DrawChar(jelenx,sor,co,'u'); + jelenx += FontMap['u'-31]-FontMap['u'-32]; + } else + if (str[i]=='Á') + { + DrawChar(jelenx+5,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'A'); + jelenx += FontMap['A'-31]-FontMap['A'-32]; + } else + if (str[i]=='É') + { + DrawChar(jelenx+2,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'E'); + jelenx += FontMap['E'-31]-FontMap['E'-32]; + } else + if (str[i]=='Í') + { + DrawChar(jelenx,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'I'); + jelenx += FontMap['I'-31]-FontMap['I'-32]; + }else + if (str[i]=='Ó') + { + DrawChar(jelenx+2,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'O'); + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if (str[i]=='Ú') + { + DrawChar(jelenx+2,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'U'); + jelenx += FontMap['U'-31]-FontMap['U'-32]; + }else + if (str[i]=='Ö') + { + DrawChar(jelenx,sor-3,co,'"'); + DrawChar(jelenx,sor,co,'O'); + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if (str[i]=='Ü') + { + DrawChar(jelenx,sor-3,co,'"'); + DrawChar(jelenx,sor,co,'U'); + jelenx += FontMap['U'-31]-FontMap['U'-32]; + } + if (jelenx>maxjelenx) maxjelenx=jelenx; + if (sor+13>maxsor) maxsor=sor+13; + } +} + + + +void IanOutNum1(int x, int y, int c,CString str) +{ + int i; + int length = str.GetLength(); + int be; + + for (i=0; i='0') && (str[i]<='9'+2)) + { + be = (str[i]-'0')*14; + if (c==7) be+=168; + BlitTo(g_pDDSBack,be,144,be+14,168,x+i*14,y,0,g_pDDSOne); + } + } +} + +void IanOutNum2(int x, int y, int c,CString str) +{ + int i; + int length = str.GetLength(); + int be; + + for (i=0; i='0') && (str[i]<='9'+2)) + { + be = (str[i]-'0')*9; + if (c==9) be+=120; + if (c==10) be+=240; + BlitTo(g_pDDSBack,be,169,be+9,186,x+i*9,y,0,g_pDDSOne); + } + if ((str[i]=='-')) + { + be = 12*9; + if (c==9) be+=120; + if (c==10) be+=240; + BlitTo(g_pDDSBack,be,169,be+9,186,x+i*9,y,0,g_pDDSOne); + } + } +} + +void DisplayNum(int x, int y, int c,short i, short count) +{ + char buff[256]; + int i2,i3; + i2=0; + for (i3=1; i3<=count;i3++) + { + i2=i2*10; + i2=i2+1; + } + i2=9*i2; + + buff[0]=' '; + if( i > i2 ) + { + i = i2; + } + if (i<-i2) + { + i = -i2; + } + if (i<0) { buff[0] = '-'; i =-i;}; + + switch(count) + { + case 1: + buff[1]=(char)i+'0'; + break; + case 2: + buff[1] = (char)((i / 10) + '0'); + buff[2] = (char)((i % 10) + '0'); + break; + case 3: + buff[1] = (char)((i / 100) + '0');i-=i/100*100; + buff[2] = (char)((i / 10) + '0'); + buff[3] = (char)((i % 10) + '0'); + break; + case 4: + buff[1] = (char)((i / 1000) + '0');i-=i/1000*1000; + buff[2] = (char)((i / 100) + '0');i-=i/100*100; + buff[3] = (char)((i / 10) + '0'); + buff[4] = (char)((i % 10) + '0'); + break; + case 5: + buff[1] = (char)((i / 10000) + '0');i-=i/10000*10000; + buff[2] = (char)((i / 1000) + '0');i-=i/1000*1000; + buff[3] = (char)((i / 100) + '0');i-=i/100*100; + buff[4] = (char)((i / 10) + '0'); + buff[5] = (char)((i % 10) + '0'); + break; + } + buff[count+1] = '\0'; + if ((c>=0) && (c<=5)) IanOutText(x,y,c,buff); + if ((c>=6) && (c<=7)) IanOutNum1(x,y,c,buff); + if ((c>=8) && (c<=10)) IanOutNum2(x,y,c,buff); +} + +void WriteFromProf(int x,int y,int c,int i3,CString fnam,CString master,CString slave) +{ + int i,i2; + char buf[80]; + i2=-1; + for (i=0; i<75; i++) + { + if (LINIStr[i]->FindIt(fnam,master,slave) == 0) i2=i; + } + if (i2!=-1) + { + wsprintf(buf,"%s",LINIStr[i2]->Get()); + if (i3==1) IanOutText(x,y,c,buf); + if (i3==2) IanOutTextC(x,y,c,buf); + if (i3==3) IanOutTextR(x,y,c,buf); + } else + { + GetPrivateProfileString(master,slave,"",buf,80,fnam); + for (i=1; i<75; i++) + { + LINIStr[i-1]->Set(LINIStr[i]->fname,LINIStr[i]->master,LINIStr[i]->slave,LINIStr[i]->buffer); + } + LINIStr[74]->Set(fnam,master,slave,buf); + if (i3==1) IanOutText(x,y,c,buf); + if (i3==2) IanOutTextC(x,y,c,buf); + if (i3==3) IanOutTextR(x,y,c,buf); + } +} + +CString GetFromProf(CString fnam,CString master,CString slave) +{ + int i,i2; + char buf[80]; + i2=-1; + for (i=0; i<75; i++) + { + if (LINIStr[i]->FindIt(fnam,master,slave) == 0) i2=i; + } + if (i2!=-1) + { + wsprintf(buf,"%s",LINIStr[i2]->Get()); + return buf; + } else + { + GetPrivateProfileString(master,slave,"",buf,80,fnam); + for (i=1; i<75; i++) + { + LINIStr[i-1]->Set(LINIStr[i]->fname,LINIStr[i]->master,LINIStr[i]->slave,LINIStr[i]->buffer); + } + LINIStr[74]->Set(fnam,master,slave,buf); + return buf; + } +} \ No newline at end of file diff --git a/IanOut/ddex4_i.h b/IanOut/ddex4_i.h new file mode 100644 index 0000000..8c4b8cd --- /dev/null +++ b/IanOut/ddex4_i.h @@ -0,0 +1,502 @@ + +//----------------------------------------------------------------------------- +// Name: WindowProc() +// Desc: The Main Window Procedure +//----------------------------------------------------------------------------- + +HRESULT AddAnim(HWND hWnd, char filename[10]) +{ + PFRMAnim6 TheAnim; + HRESULT hRet; + char buf[100]; + TheAnim = new TFRMAnim6(); + wsprintf(buf,"master.dat\\art\\critter\\%s.frm",filename); + hRet = TheAnim->Load(hWnd,g_pDD,buf); + if (hRet != DD_OK) return hRet; + PlyAnim->Insert(TheAnim); + return hRet; +} + +long FAR PASCAL +WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_ACTIVATE: + // Pause if minimized + g_bActive = !((BOOL)HIWORD(wParam)); + return 0L; + + case WM_DESTROY: + // Clean up and close the app + ReleaseAllObjects(); + PostQuitMessage(0); + return 0L; + + + case WM_KEYDOWN: + // Handle any non-accelerated key commands + switch (wParam) + { + case VK_PAUSE: + PostMessage(hWnd, WM_CLOSE, 0, 0); + return 0L; + case VK_UP: + if ((Selected>1) && (Selected<=7)) Selected--; + if ((Selected>8) && (Selected<=25)) Selected--; + if ((Selected>26) && (Selected<=41)) Selected--; + if ((Selected>42) && (Selected<=59)) Selected--; + break; + case VK_DOWN: + if ((Selected>=1) && (Selected<7)) Selected++; + if ((Selected>=8) && (Selected<25)) Selected++; + if ((Selected>=26) && (Selected<41)) Selected++; + if ((Selected>=42) && (Selected<59)) Selected++; + break; + case 'N': + if (GamePos==1) { Ian->dir++; if (Ian->dir>5) Ian->dir=0; } + break; + case 'M': + if (GamePos==1) { Ian->dir--; if (Ian->dir<0) Ian->dir=5; } + break; + case VK_ADD: + if (gamma>=1) gamma+=0.1; + else gamma+=0.05; + if (gamma>4) gamma = 4; + SetPaletteBl(255); + break; + case VK_SUBTRACT: + if (gamma>=1) gamma-=0.1; + else gamma-=0.05; + if (gamma<0.2) gamma = 0.2; + SetPaletteBl(255); + break; + case VK_MULTIPLY: + gameSpeed-=5; + if (gameSpeed<0) gameSpeed=0; + break; + case VK_DIVIDE: + gameSpeed+=5; + if (gameSpeed>100) gameSpeed=100; + break; + + } + break; + + case WM_SETCURSOR: + // Turn off the cursor since this is a full-screen app + SetCursor(NULL); + return TRUE; + } + + return DefWindowProc(hWnd, message, wParam, lParam); +} + + +void CreateIanPalette() +{ + int i; + FILE *stream; + + + if( (stream = fopen( "master.dat\\pal.pal", "rb" )) != NULL ) + { + for (i=0; i < 256; i++) + { + fread(&pe[i].peRed, 1, 1, stream); + fread(&pe[i].peGreen, 1, 1, stream); + fread(&pe[i].peBlue, 1, 1, stream); + } + + fclose( stream ); + } +} + +IDirectDrawPalette * LoadSplashScreen(LPDIRECTDRAWSURFACE7 g_pDDSB) +{ + IDirectDrawPalette *ddpal; + PALETTEENTRY ape[256]; + DDSURFACEDESC2 ddsd; + HRESULT hRet; + + int x,y; + int r,g,b; + int stream; + char buf[80]; + + x=(rand()%7); + wsprintf(buf,"master.dat\\art\\splash\\splash%i.rix",x); + //InitFail(hWnd,DD_OK,buf); + stream = _open(buf,_O_BINARY); + + for (x=0; x<10; x++) _read(stream,&y,1); + for (x=0; x<256; x++) + { + _read(stream,&r,1); + _read(stream,&g,1); + _read(stream,&b,1); + ape[x].peRed = 0; + ape[x].peGreen = 0; + ape[x].peBlue = 0; + pe[x].peRed = r*4; + pe[x].peGreen = g*4; + pe[x].peBlue = b*4; + } + ape[0].peRed=0;ape[0].peGreen=0;ape[0].peBlue=0; + ape[1].peRed=255;ape[1].peGreen=255;ape[1].peBlue=255; + + pe[0].peRed=0;pe[0].peGreen=0;pe[0].peBlue=0; + pe[1].peRed=255;pe[1].peGreen=255;pe[1].peBlue=255; + + + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + + hRet = g_pDD->CreatePalette(DDPCAPS_8BIT | DDPCAPS_ALLOW256 , ape, &ddpal, NULL); + if (hRet != DD_OK) InitFail(hWnd,hRet,"Baj2"); + hRet = g_pDDSPrimary->SetPalette(ddpal); + if (hRet != DD_OK) InitFail(hWnd,hRet,"Baj3"); + + ddpal->SetEntries(0,0,256,ape); + + hRet = g_pDDSB->Lock(NULL,&ddsd,0,NULL); + if (hRet != DD_OK) InitFail(hWnd,hRet,"Baj"); + + LPSTR Buffer; + Buffer = (LPSTR)ddsd.lpSurface; + + for (y=0;y<(int)ddsd.dwHeight;y++) + { + _read(stream,Buffer+(y*ddsd.lPitch),ddsd.dwWidth); + } + g_pDDSB->Unlock(NULL); + + g_pDDSPrimary->Blt(NULL,g_pDDSBack,NULL,0,NULL); + + while (TRUE) + { + hRet = g_pDDSPrimary->Flip(NULL, 0); + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + hRet = RestoreAll(); + if (hRet != DD_OK) + break; + } + if (hRet != DDERR_WASSTILLDRAWING) + break; + } + + _close(stream); + return ddpal; +} + +static HRESULT +InitApp(HINSTANCE hInstance, int nCmdShow) +{ + WNDCLASS wc; + DDSURFACEDESC2 ddsd; + DDSCAPS2 ddscaps; + HRESULT hRet; + char buf[100]; + int i,i2; + PlayerDef PLoad; + PlayerDefAnim PLoadAni; + + srand( (unsigned)time( NULL ) ); + + // Set up and register window class + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = WindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MAIN_ICON)); + wc.hCursor = LoadCursor(NULL, IDC_WAIT); + wc.hbrBackground = (HBRUSH )GetStockObject(BLACK_BRUSH); + wc.lpszMenuName = NAME; + wc.lpszClassName = NAME; + RegisterClass(&wc); + + // Create a window + hWnd = CreateWindowEx(WS_EX_TOPMOST, + NAME, + TITLE, + WS_POPUP, + 0, + 0, + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), + NULL, + NULL, + hInstance, + NULL); + if (!hWnd) + return FALSE; + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + SetFocus(hWnd); + + InitDirectInput(hWnd, hInstance); + SetAcquire(); + + + /////////////////////////////////////////////////////////////////////////// + // Create the main DirectDraw object + /////////////////////////////////////////////////////////////////////////// + hRet = DirectDrawCreateEx(NULL, (VOID**)&g_pDD, IID_IDirectDraw7, NULL); + if (hRet != DD_OK) + return InitFail(hWnd, hRet, "DirectDrawCreateEx FAILED"); + + + // Get exclusive mode + hRet = g_pDD->SetCooperativeLevel(hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + if (hRet != DD_OK) + return InitFail(hWnd, hRet, "SetCooperativeLevel FAILED"); + + // Set the video mode to 640x480x8 + hRet = g_pDD->SetDisplayMode(640, 480, 8, 0, 0); + if (hRet != DD_OK) + return InitFail(hWnd, hRet, "SetDisplayMode FAILED"); + + // Create the primary surface with 1 back buffer + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | + DDSCAPS_FLIP | + DDSCAPS_COMPLEX; + ddsd.dwBackBufferCount = 1; + hRet = g_pDD->CreateSurface(&ddsd, &g_pDDSPrimary, NULL); + if (hRet != DD_OK) + return InitFail(hWnd, hRet, "CreateSurface FAILED"); + + // Get a pointer to the back buffer + ZeroMemory(&ddscaps, sizeof(ddscaps)); + ddscaps.dwCaps = DDSCAPS_BACKBUFFER; + hRet = g_pDDSPrimary->GetAttachedSurface(&ddscaps, &g_pDDSBack); + if (hRet != DD_OK) + return InitFail(hWnd, hRet, "GetAttachedSurface FAILED"); + + g_pDDPal=LoadSplashScreen(g_pDDSBack); + FadeIn(); + + MapInf = new TIanMap(); + + MapInf->LoadMap(hWnd,"master.dat\\maps\\shady.map"); + MapInf->LoadTiles(hWnd,g_pDD); + + WallInf = new TIanWall(); + if (WallInf == NULL) return InitFail(hWnd,hRet,"Baj"); + + WallInf->LoadMap(hWnd,"master.dat\\maps\\shady.wal"); + WallInf->LoadWalls(hWnd,g_pDD); + + ItemInf = new TIanItems(); + if (ItemInf == NULL) return InitFail(hWnd,hRet,"Baj"); + + ItemInf->LoadMap(hWnd,"master.dat\\maps\\shady.ite"); + ItemInf->LoadItems(hWnd,g_pDD); + + + //g_pDDSBack->SetClipper(g_pDClip); + + hRet = LoadFRMSingle(&Mouse, hWnd, "master.dat\\art\\interface\\stdarrow.frm",1); + if (hRet!=DD_OK) return hRet; + + hRet = LoadFRMSingle(&Mouse2, hWnd, "master.dat\\art\\interface\\actarrow.frm",1); + if (hRet!=DD_OK) return hRet; + + hRet = LoadFRMSingle(&KezeloP, hWnd, "master.dat\\art\\interface\\iface.frm",1); + if (hRet!=DD_OK) return hRet; + + hRet = LoadFRMSingle(&FullScreen, hWnd, "master.dat\\art\\interface\\mainmenu.frm",1); + if (hRet!=DD_OK) return hRet; + + hRet = LoadFRMSingle(&FullScreen2, hWnd, "master.dat\\art\\interface\\mainmenu.frm",1); + if (hRet!=DD_OK) return hRet; + + hRet = LoadFRMSingle(&MenuUp, hWnd, "master.dat\\art\\interface\\menuup.frm",1); + if (hRet!=DD_OK) return hRet; + + hRet = LoadFRMSingle(&MenuDown, hWnd, "master.dat\\art\\interface\\menudown.frm",1); + if (hRet!=DD_OK) return hRet; + + hRet = LoadFRMSingle(&Select, hWnd, "master.dat\\art\\interface\\msef000.frm",1); + if (hRet!=DD_OK) return hRet; + hRet = LoadFRMSingle(&Select2, hWnd, "master.dat\\art\\interface\\msef001.frm",1); + if (hRet!=DD_OK) return hRet; + + hRet = LoadFRMSingle(&Buttons[0], hWnd, "master.dat\\art\\interface\\tgskloff.frm",1); + if (hRet!=DD_OK) return hRet; + hRet = LoadFRMSingle(&Buttons[1], hWnd, "master.dat\\art\\interface\\tgsklon.frm",1); + if (hRet!=DD_OK) return hRet; + + hRet = LoadFRMSingle(&SkillDex,hWnd, "master.dat\\art\\skilldex\\generic.frm",1); + if (hRet!=DD_OK) return hRet; + + for (i=0; i<8; i++) + { + wsprintf(buf,"master.dat\\art\\interface\\scr%i.frm",i+1); + hRet = LoadFRMSingle(&MouseScr[i][0], hWnd, buf,1); + if (hRet!=DD_OK) return hRet; + wsprintf(buf,"master.dat\\art\\interface\\scr%ix.frm",i+1); + hRet = LoadFRMSingle(&MouseScr[i][1], hWnd, buf,1); + if (hRet!=DD_OK) return hRet; + } + + PlyAnim = new TList(); + + AddAnim(hWnd,"nmmaxxaa"); + PLoadAni.AIdle=(PFRMAnim6)PlyAnim->Last(); + AddAnim(hWnd,"nmmaxxab"); + PLoadAni.AMoving=(PFRMAnim6)PlyAnim->Last(); + + PLoad.bIdle = TRUE; + PLoad.bMove = TRUE; + PLoad.bComputer = FALSE; + PLoad.maxtaunt = 0; + wsprintf(PLoad.name,"nmmaxx"); + Ian = new TFRMPlayer(PLoad); + Ian->LoadPlayer(PLoadAni); + if (hRet!=DD_OK) return InitFail(hWnd, hRet, "Ian FAILED"); + Ian->MoveTo(44,26); + + AddAnim(hWnd,"narobeaa"); + PLoadAni.AIdle=(PFRMAnim6)PlyAnim->Last(); + AddAnim(hWnd,"narobeab"); + PLoadAni.AMoving=(PFRMAnim6)PlyAnim->Last(); + + PLoad.bIdle = TRUE; + PLoad.bMove = TRUE; + PLoad.bComputer = TRUE; + PLoad.maxtaunt = 2; + wsprintf(PLoad.taunt[0],"Aradesh vagyok"); + wsprintf(PLoad.taunt[1],"Ez egy felirat"); + wsprintf(PLoad.name,"narobe"); + Aradesh = new TFRMPlayer(PLoad); + Aradesh->LoadPlayer(PLoadAni); + if (hRet!=DD_OK) return InitFail(hWnd, hRet, "Aradesh FAILED"); + Aradesh->MoveTo(45,25); + + AddAnim(hWnd,"nfpeasaa"); + PLoadAni.AIdle=(PFRMAnim6)PlyAnim->Last(); + AddAnim(hWnd,"nfpeasab"); + PLoadAni.AMoving=(PFRMAnim6)PlyAnim->Last(); + + for (i=0; i<10; i++) + { + PLoad.bIdle = TRUE; + PLoad.bMove = TRUE; + PLoad.bComputer = TRUE; + PLoad.maxtaunt = 2; + wsprintf(PLoad.taunt[0],"Shady Sands a kiráj"); + wsprintf(PLoad.taunt[1],"Paraszt vagyok"); + wsprintf(PLoad.name,"nfpeas"); + Paraszt[i] = new TFRMPlayer(PLoad); + Paraszt[i]->LoadPlayer(PLoadAni); + if (hRet!=DD_OK) return InitFail(hWnd, hRet, "Paraszt%i FAILED",i+1); + i2 = 5+rand()%30; + Paraszt[i]->MoveTo(50+(rand()%20*2)+i2%2,i2); + } + + for (i=0 ; i<256; i++) + { + pe2[i].peBlue = 0; + pe2[i].peRed = 0; + pe2[i].peGreen = 0; + } + + int x,y; + int stream; + + if ((stream = _open("master.dat\\maps\\shady.blk",_O_BINARY)) == -1) + return InitFail(hWnd,DDERR_NOTLOADED,"LoadBlock FAILED"); + + for (x=0; x<171; x++) + for (y=0; y<151; y++) + { + _read(stream,&BlockDat[x][y],1); + } + _close(stream); + + FadeOut(); + ClearSurface(g_pDDSBack,0,0,0); ClearSurface(g_pDDSPrimary,0,0,0); + CreateIanPalette(); + + SetPaletteBl(255); + + g_pDDSOne = DDLoadBitmap(g_pDD, szBitmap, 0, 0, &hRet, DDSCAPS_OFFSCREENPLAIN); + if (g_pDDSOne == NULL) + return InitFail(hWnd, hRet, "DDLoadBitmap FAILED"); + DDSetColorKey(g_pDDSOne, CLR_INVALID); + + szovegnum=0; + + for (i=0; i<75; i++) LINIStr[i] = new TIniStr(); + + Nullaz(&IanSkill); + + return DD_OK; +} + + + + +//----------------------------------------------------------------------------- +// Name: WinMain() +// Desc: Initialization, message loop +//----------------------------------------------------------------------------- +int PASCAL +WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + if (InitApp(hInstance, nCmdShow) != DD_OK) + return FALSE; + + while (TRUE) + { + if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) + { + if (!GetMessage(&msg, NULL, 0, 0)) + return msg.wParam; + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else if (g_bActive) + { + switch (GamePos) + { + case 0: + MainMenu(); + break; + case 1: + UpdateFrame(); + break; + case 2: + Credits(); + break; + case 3: + Intro(); + break; + case 4: + CreateChar(); + break; + case 5: + Talk(); + break; + } + } + else + { + // Make sure we go to sleep if we have nothing else to do + WaitMessage(); + } + } +} + diff --git a/IanOut/ddex4_u.h b/IanOut/ddex4_u.h new file mode 100644 index 0000000..145127c --- /dev/null +++ b/IanOut/ddex4_u.h @@ -0,0 +1,697 @@ +#include "ddex4_u3.h" + +//----------------------------------------------------------------------------- +// Name: UpdateFrame() +// Desc: Decide what needs to be blitted next, wait for flip to complete, +// then flip the buffers. +//----------------------------------------------------------------------------- + +void +UpdateFrame(void) +{ + int x,y; + HRESULT hRet; + PFRM FrmCucc; + static int Frame = 0; + static DWORD ThisTick; + static DWORD LastTick = 0; + static int mousetyp = 0; + int i; + BOOL kintvan; + BOOL oldal[4]; + BlockType BlDat; + + int i2,ix,iy; + + for (x=0; x<170; x++) + for (y=0; y<150; y++) + { + BlDat[x][y] = BlockDat[x][y]; + } + + BlDat[Ian->x][Ian->y] = 1; + BlDat[Aradesh->x][Aradesh->y] = 1; + for (i=0; i<10; i++) BlDat[Paraszt[i]->x][Paraszt[i]->y] = 1; + + if ((mousetyp>0) && (mousetyp<9)) mousetyp=0; + ThisTick = GetTickCount(); + + if ((ThisTick - LastTick) > (DWORD)gameSpeed) + { + LastTick = ThisTick; + + Ian->Next(BlDat); + Aradesh->Next(BlDat); + + for (i=0; i<10; i++) { Paraszt[i]->Next(BlDat);} + } + +// ------------------------------------------------------------------- + olddims=dims; // + UpdateInputState(); // + if ((dims.lX == olddims.lX) && (dims.lY == olddims.lY)) Frame++; else Frame=0; + if ((dims.rgbButtons[1] & 0x80) && !(olddims.rgbButtons[1] & 0x80)) + if (mousetyp==0) { mousetyp=9; } else { mousetyp=0; } + // + MousX += dims.lX; // + MousY += dims.lY; // + // + if ((MousX>=640) && (MousY<=0)) {mousetyp = 2;} else // + if ((MousX>=640) && (MousY>=480)) {mousetyp = 4;} else // + if ((MousX<=0) && (MousY<=0)) {mousetyp = 8;} else // + if ((MousX<=0) && (MousY>=480)) {mousetyp = 6;} else // + if (MousX>=640) {mousetyp = 3;} else // + if (MousX<=0) {mousetyp = 7;} else // + if (MousY>=480) {mousetyp = 5;} else // + if (MousY<=0) {mousetyp = 1;} // + // + kintvan=FALSE; // + oldal[0]=FALSE;oldal[2]=FALSE; // + oldal[1]=FALSE;oldal[3]=FALSE; // + // + if (MousX>=640) { MousX=640; TerX-=15; } // + if (MousX<=0) { MousX=0; TerX+=15; } // + if (MousY>=480) { MousY=480; TerY-=15; } // + if (MousY<=0) { MousY=0; TerY+=15; } // + // + if (TerY>0) {TerY=0;oldal[0]=TRUE;kintvan=TRUE;} // + if (TerY<-1210) {TerY=-1210;oldal[1]=TRUE;kintvan=TRUE;} // + // + if (TerX>-3640) {TerX=-3640;oldal[2]=TRUE;kintvan=TRUE;} // + if (TerX<-5240) {TerX=-5240;oldal[3]=TRUE;kintvan=TRUE;} // + if ((mousetyp == 2) && (oldal[0] != oldal[3])) kintvan=FALSE; // + if ((mousetyp == 4) && (oldal[1] != oldal[3])) kintvan=FALSE; // + if ((mousetyp == 6) && (oldal[2] != oldal[1])) kintvan=FALSE; // + if ((mousetyp == 8) && (oldal[2] != oldal[0])) kintvan=FALSE; // + // +// ------------------------------------------------------------------- + + + if (((-TerY+MousY)%24)<12) + { + y = (-TerY+MousY)/12; + x = (-TerX+MousX)/16-226; + if (x%2==1) x--; + } else + { + y = (-TerY+MousY)/12; + x = (-TerX+MousX)/16-1-226; + if (x%2==0) x++; + } + + DrawTerep(mousetyp,x,y); + + if ((mousetyp==9) && (Pressed(3))) + { + for (i2=0; i2<145; i2++) + for (ix=0; ix<165; ix++) + { + iy = i2; + if ((Aradesh->x == ix) && (Aradesh->y == iy)) { + FrmCucc = (PFRM)Aradesh->Idle->Animation->FRMList6[Aradesh->dir]->First(); + if (MouseIn(TerX+(ix+226)*16+FrmCucc->bx, + TerY+(iy)*12+FrmCucc->by, + TerX+(ix+226)*16+FrmCucc->bx+FrmCucc->x, + TerY+(iy)*12+FrmCucc->by+FrmCucc->y)) + { + GamePos=5; + } + }; + FrmCucc=NULL; + } + + } + + if ((mousetyp==9) && (Frame==40)) + { + for (i2=0; i2<145; i2++) + for (ix=0; ix<165; ix++) + { + iy = i2; + i = ItemInf->Map[ix][iy]; + if ((i > 0) && (i<50)) + { + i--; + if (MouseIn(TerX+(ix+226)*16+ItemMap[i][0], + TerY+(iy)*12+ItemMap[i][1], + TerX+(ix+226)*16+ItemMap[i][0]+ItemInf->Tiles[i]->FRM->x, + TerY+(iy)*12+ItemMap[i][1]+ItemInf->Tiles[i]->FRM->y)) + { + switch (i) + { + case 0:AddString("You see: Láda",1);break; + case 1:AddString("You see: Tage",1);AddString("Ez egy felirat",0);break; + case 2:AddString("You see: Asztal",1);AddString("Egy fa asztal",0);break; + case 3:AddString("You see: Szék",1);break; + case 4:AddString("You see: Ágy",1);break; + case 5:AddString("You see: Kályha",1);AddString("Kicsit rozsdás",0);break; + case 6:AddString("You see: Utcai lámpa",1);AddString("Valószínüleg már nem",0);AddString("müködik",0);break; + case 7:AddString("You see: WC",1);break; + case 8:AddString("You see: Fa",1);break; + case 9:AddString("You see: Fa",1);break; + case 10:AddString("You see: Fa",1);break; + case 11:AddString("You see: Fa",1);break; + case 12:AddString("You see: FA",1);break; + case 13:AddString("You see: Kút",1);AddString("De víz már nincs benne",0);break; + } + + } + } + if ((Aradesh->x == ix) && (Aradesh->y == iy)) { + FrmCucc = (PFRM)Aradesh->Idle->Animation->FRMList6[Aradesh->dir]->First(); + if (MouseIn(TerX+(ix+226)*16+FrmCucc->bx, + TerY+(iy)*12+FrmCucc->by, + TerX+(ix+226)*16+FrmCucc->bx+FrmCucc->x, + TerY+(iy)*12+FrmCucc->by+FrmCucc->y)) + { + AddString("You see: Aradesh",1); + } + }; + FrmCucc=NULL; + for (i=0; i<10;i++) + if ((Paraszt[i]->x == ix) && (Paraszt[i]->y == iy)) + { + FrmCucc = (PFRM)Paraszt[i]->Idle->Animation->FRMList6[Paraszt[i]->dir]->First(); + if (MouseIn(TerX+(ix+226)*16+FrmCucc->bx, + TerY+(iy)*12+FrmCucc->by, + TerX+(ix+226)*16+FrmCucc->bx+FrmCucc->x, + TerY+(iy)*12+FrmCucc->by+FrmCucc->y)) + { + AddString("You see: Lakos",1); + } + + }; + + } + + } + + if (MouseIn(0,0,640,380)) + { + if (mousetyp==0) BlitTo(g_pDDSBack,0,0,32,16,TerX+(x+226)*16,TerY+(y)*12,DDBLTFAST_SRCCOLORKEY,Select2->FRM->FRM); + if ((mousetyp==0) && (BlDat[x][y] == 1) && (Frame>40) && !((x==Ian->x) && (y==Ian->y))) IanOutTextC(TerX+(x+226)*16+16,TerY+y*12,4,"X"); + BlitTo(g_pDDSBack, 0,0,640,99,0,381,0,KezeloP->FRM->FRM); + DrawStuff(); + if (mousetyp==9) BlitTo(g_pDDSBack,0,0,Mouse2->FRM->x,Mouse2->FRM->y,MousX,MousY,DDBLTFAST_SRCCOLORKEY,Mouse2->FRM->FRM); + } else + { + BlitTo(g_pDDSBack, 0,0,640,99,0,381,0,KezeloP->FRM->FRM); + DrawStuff(); + if ((mousetyp<1) || (mousetyp>8)) BlitTo(g_pDDSBack,0,0,Mouse->FRM->x, Mouse->FRM->y,MousX,MousY,DDBLTFAST_SRCCOLORKEY,Mouse->FRM->FRM); + } + + if ((mousetyp>0) && (mousetyp<9)) + { + if (kintvan) i=1; else i=0; + x = MouseScr[mousetyp-1][i]->FRM->x; + y = MouseScr[mousetyp-1][i]->FRM->y; + if ((mousetyp==1) || (mousetyp>6)) + BlitTo(g_pDDSBack,0,0,x,y,MousX,MousY,DDBLTFAST_SRCCOLORKEY, + MouseScr[mousetyp-1][i]->FRM->FRM); + if (mousetyp==2) + BlitTo(g_pDDSBack,0,0,x,y,MousX-x,MousY,DDBLTFAST_SRCCOLORKEY, + MouseScr[mousetyp-1][i]->FRM->FRM); + if (mousetyp==3) + BlitTo(g_pDDSBack,0,0,x,y,MousX-x,MousY,DDBLTFAST_SRCCOLORKEY, + MouseScr[mousetyp-1][i]->FRM->FRM); + if (mousetyp==4) + BlitTo(g_pDDSBack,0,0,x,y,MousX-x,MousY-y,DDBLTFAST_SRCCOLORKEY, + MouseScr[mousetyp-1][i]->FRM->FRM); + if (mousetyp==5) + BlitTo(g_pDDSBack,0,0,x,y,MousX,MousY-y,DDBLTFAST_SRCCOLORKEY, + MouseScr[mousetyp-1][i]->FRM->FRM); + if (mousetyp==6) + BlitTo(g_pDDSBack,0,0,x,y,MousX,MousY-y,DDBLTFAST_SRCCOLORKEY, + MouseScr[mousetyp-1][i]->FRM->FRM); + + + } + + DisplayNum(70,0,1,x,3); + DisplayNum(100,0,1,y,3); + DisplayNum(130,0,1,gameSpeed,2); + DisplayFrameRate(); + + if (MouseIn(0,0,640,379) && (mousetyp==0) && (dims.rgbButtons[0] & 0x80) && !(olddims.rgbButtons[0] & 0x80)) Ian->GenerateTree(x,y,BlDat); + + + // Flip the surfaces + while (TRUE) + { + hRet = g_pDDSPrimary->Flip(NULL, 0); + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + hRet = RestoreAll(); + if (hRet != DD_OK) + break; + } + if (hRet != DDERR_WASSTILLDRAWING) + break; + } + +} + +void Talk(void) +{ + HRESULT hRet; + CString VLista[15]; + int GoToList[15]; + CString DoList[15]; + int NumList[15]; + + char buf1[80]; + char buf2[80]; + + static char filename[80] = "master.dat\\text\\talk\\duma.sve"; + + static int curpos = 1; + static int page = 1; + + int i,i2,i3,ib,ie; + + /*DDBLTFX ddbltfx; + + ZeroMemory(&ddbltfx, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(ddbltfx); + ddbltfx.dwFillColor = RGB(255,255,255); + g_pDDSBack->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);*/ + + if ((lstrcmpi(FullScreen->fname,"master.dat\\art\\interface\\alltlk.frm"))) + { + LoadFRMSingle(&FullScreen,hWnd,"master.dat\\art\\interface\\alltlk.frm",1); + } + + olddims = dims; + UpdateInputState(); + + MousX += dims.lX; + MousY += dims.lY; + + if (MousX>=640) { MousX=640;} + if (MousX<=0) { MousX=0; } + if (MousY>=480) { MousY=480;} + if (MousY<=0) { MousY=0; } + + BlitTo(g_pDDSBack,0,0,640,480,0,0,0,FullScreen->FRM->FRM); + + wsprintf(buf1,"text%i",curpos); + + i2=1; + i3=1; + for (i=0; i<15; i++) + { + wsprintf(buf2,"cho%i_%i",i2,i3); + if (GetFromProf(filename,buf1,buf2) == "") + { + NumList[i2]=i3-1; + i3=1; + i2++; + wsprintf(buf2,"cho%i_%i",i2,i3); + } + VLista[i]=GetFromProf(filename,buf1,buf2); + if ((i3==1) && (VLista[i]!="")) + { + VLista[i]=char(' ')+VLista[i]; + VLista[i]=char('~'+1)+VLista[i]; + } else + { + VLista[i]=char(' ')+VLista[i]; + VLista[i]=char(' ')+VLista[i]; + } + wsprintf(buf2,"cho%ia",i2); + GoToList[i]=atoi(GetFromProf(filename,buf1,buf2)); + wsprintf(buf2,"cho%ib",i2); + DoList[i]=GetFromProf(filename,buf1,buf2); + i3++; + } + + for (i=1; i<=4; i++) + { + wsprintf(buf2,"text%i",(page-1)*4+i); + WriteFromProf(140,230+(i-1)*10,1,1,filename,buf1,buf2); + } + + i2=0; + i3=0;ib=-1;ie=-1; + for (i=0; i<15; i++) + { + i3++; + if (MouseIn(130,330+i2*12,515,329+(i2+NumList[i3])*12)) + { + ib=i2;ie=i2+NumList[i3]-1; + } + i2+=NumList[i3]; + DisplayNum(0,i*12,1,NumList[i],3); + DisplayNum(40,i*12,1,i,3); + } + + /*for (i=0; i<15; i++) + { + if (MouseIn(130,330+i*12,515,340+i*12)) + { + IanOutText(130,330+i*12,2,VLista[i]); + if ((Pressed(0)) && (GoToList[i]!=0)) + { + page = 1; + curpos = GoToList[i]; + } + } else + { + IanOutText(130,330+i*12,1,VLista[i]); + } + }*/ + + for (i=0; i<15; i++) + { + if ((i>=ib) && (i<=ie)) + { + IanOutText(120+i,330+i*12,0,VLista[i]); + if ((Pressed(0)) && !((GoToList[i]==0) && (DoList[i]==""))) + { + if (GoToList[i]==0) + { + if (DoList[i]=="EXIT") + { + page = 1; + curpos = 1; + GamePos=1; + } + if (DoList[i]=="KILL") + { + page = 1; + curpos = 1; + GamePos=1; + } + } else + { + page = 1; + curpos = GoToList[i]; + } + } + } else + { + IanOutText(120+i,330+i*12,1,VLista[i]); + } + } + + if (MouseIn(140,270,520,280)) + { + BlitTo(g_pDDSBack,0,0,MouseScr[4][0]->FRM->x, MouseScr[4][0]->FRM->y,MousX-MouseScr[4][0]->FRM->x/2,MousY-MouseScr[4][0]->FRM->y,DDBLTFAST_SRCCOLORKEY,MouseScr[4][0]->FRM->FRM); + wsprintf(buf2,"text%i",(page)*4+1); + if ((Pressed(0)) && (GetFromProf(filename,buf1,buf2)!="")) page++; + } else + if (MouseIn(140,230,520,240)) + { + BlitTo(g_pDDSBack,0,0,MouseScr[0][0]->FRM->x, MouseScr[0][0]->FRM->y,MousX-MouseScr[0][0]->FRM->x/2,MousY,DDBLTFAST_SRCCOLORKEY,MouseScr[0][0]->FRM->FRM); + if (Pressed(0)) page--; + } else + { + BlitTo(g_pDDSBack,0,0,Mouse->FRM->x, Mouse->FRM->y,MousX,MousY,DDBLTFAST_SRCCOLORKEY,Mouse->FRM->FRM); + } + + if (page<1) page=1; + + while (TRUE) + { + hRet = g_pDDSPrimary->Flip(NULL, 0); + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + hRet = RestoreAll(); + if (hRet != DD_OK) + break; + } + if (hRet != DDERR_WASSTILLDRAWING) + break; + } + +} + +void +CreateChar(void) +{ + HRESULT hRet; + + static int Frame = -25; + static DWORD ThisTick; + static DWORD LastTick = 0; + char buf[80]; + char buf2[80]; + int i,i2; + static int Points = 5; + + CountSk(&IanSkill); + + + ThisTick = GetTickCount(); + + if ((lstrcmpi(FullScreen->fname,"master.dat\\art\\interface\\edtrcrte.frm"))) + { + LoadFRMSingle(&FullScreen,hWnd,"master.dat\\art\\interface\\edtrcrte.frm",1); + } + + if ((ThisTick - LastTick) > 0) + { + LastTick = ThisTick; + + Frame+=3; + + } + + olddims = dims; + UpdateInputState(); + + MousX += dims.lX; + MousY += dims.lY; + + if (MousX>=640) { MousX=640;} + if (MousX<=0) { MousX=0; } + if (MousY>=480) { MousY=480;} + if (MousY<=0) { MousY=0; } + + BlitTo(g_pDDSBack,0,0,640,480,0,0,0,FullScreen->FRM->FRM); + + for (i=0; i<7; i++) + { + if ((IanSkill.primary[i]>10) || (IanSkill.primary[i]<1)) + DisplayNum(44,37+i*33,7,IanSkill.primary[i],2); else + DisplayNum(44,37+i*33,6,IanSkill.primary[i],2); + + wsprintf(buf,"typ%i",IanSkill.primary[i]); + if (Selected==i+1) WriteFromProf(100,37+i*33+3,0,1,".\\master.dat\\text\\dialog\\char.sve","Primaryskill",buf); + else WriteFromProf(100,37+i*33+3,1,1,".\\master.dat\\text\\dialog\\char.sve","Primaryskill",buf); + if ((MInPr(152,37+i*33,165,45+i*33,0)) && (Points>=1) && (IanSkill.primary[i]<10)) + { IanSkill.AlapSk.primary[i]++; Points--; } + if ((MInPr(152,46+i*33,165,57+i*33,0)) && (IanSkill.primary[i]>1)) + { IanSkill.AlapSk.primary[i]--; Points++; } + if (MInPr(20,38+i*33,166,60+i*33,0)) Selected = i+1; + + } + + DisplayNum(111,282,6,Points,2); + DisplayNum(508,228,6,3,2); + + WriteFromProf(86,8,2,2,".\\master.dat\\text\\dialog\\char.sve","Global","def1"); + WriteFromProf(195,8,2,2,".\\master.dat\\text\\dialog\\char.sve","Global","def2"); + WriteFromProf(274,8,2,2,".\\master.dat\\text\\dialog\\char.sve","Global","def3"); + + WriteFromProf(355,8,2,1,".\\master.dat\\text\\dialog\\char.sve","Global","def4"); + WriteFromProf(355,233,2,1,".\\master.dat\\text\\dialog\\char.sve","Global","def5"); + + WriteFromProf(22,286,2,1,".\\master.dat\\text\\dialog\\char.sve","Global","def6"); + WriteFromProf(25,330,2,1,".\\master.dat\\text\\dialog\\char.sve","Global","def7"); + + if (MInPr(190,43,320,55,0)) Selected=8; + if (Selected==8) + WriteFromProf(190,43,0,1,".\\master.dat\\text\\dialog\\char.sve","Health","hea1"); else + WriteFromProf(190,43,1,1,".\\master.dat\\text\\dialog\\char.sve","Health","hea1"); + + IanSkill.HP = IanSkill.AlapSk.HP; + wsprintf(buf,"%i/%i",IanSkill.HP,IanSkill.AlapSk.HP); + IanOutText(190+64,43,1,buf); + + for (i=1; i<8; i++) + { + wsprintf(buf,"hea%i",i+1); + if (MInPr(190,43+i*13,320,55+i*13,0)) Selected=8+i; + if (Selected==8+i) + WriteFromProf(190,43+i*13,0,1,".\\master.dat\\text\\dialog\\char.sve","Health",buf); else + WriteFromProf(190,43+i*13,2,1,".\\master.dat\\text\\dialog\\char.sve","Health",buf); + } + + for (i=0; i<10; i++) + { + wsprintf(buf,"sec%i",i+1); + if (MInPr(190,177+i*13,320,177+12+i*13,0)) Selected=16+i; + if (Selected==16+i) + WriteFromProf(190,177+i*13,0,1,".\\master.dat\\text\\dialog\\char.sve","Secondary",buf); else + WriteFromProf(190,177+i*13,1,1,".\\master.dat\\text\\dialog\\char.sve","Secondary",buf); + if ((i==4) || (i==5) || (i==9)) + wsprintf(buf,"%i%%",IanSkill.secondary[i]); else + wsprintf(buf,"%i",IanSkill.secondary[i]); + IanOutText(285,177+i*13,1,buf); + } + + for (i=0; i<18; i++) + { + wsprintf(buf,"ski%i",i+1); + if (MInPr(346,24+11*i,600,24+11*i+10,0)) Selected=42+i; + if (MInPr(346,26+11*i,346+17,26+11*i+10,0)) IanSkill.tagSk[i]=!IanSkill.tagSk[i]; + if ((IanSkill.tagSk[i]) && !(Selected==42+i)) + WriteFromProf(375,24+11*i,3,1,".\\master.dat\\text\\dialog\\char.sve","Skills",buf); else + if ((Selected==42+i) && !(IanSkill.tagSk[i])) + WriteFromProf(375,24+11*i,0,1,".\\master.dat\\text\\dialog\\char.sve","Skills",buf); else + if (Selected==42+i) + WriteFromProf(375,24+11*i,2,1,".\\master.dat\\text\\dialog\\char.sve","Skills",buf); else + WriteFromProf(375,24+11*i,1,1,".\\master.dat\\text\\dialog\\char.sve","Skills",buf); + if ((MouseIn(346,26+11*i,346+17,26+11*i+10)) && (dims.rgbButtons[0] & 0x80)) + { + i2=1; + } else + { + i2=0; + } + BlitTo(g_pDDSBack,0,0,Buttons[i2]->FRM->x,Buttons[i2]->FRM->y,346,26+11*i,0,Buttons[i2]->FRM->FRM); + } + for (i=0; i<18; i++) + { + wsprintf(buf,"%i%%",IanSkill.skills[i]); + IanOutText(575,24+11*i,1,buf); + } + + for (i=0; i<8; i++) + { + wsprintf(buf,"tra%i",i+1); + + if (MInPr(25,350+13*i,168,350+13*i+12,0)) Selected=26+i; + if (MInPr(25,350+13*i,25+17,350+13*i+12,0)) IanSkill.perktra[i]=!IanSkill.perktra[i]; + if ((Selected==26+i) || (IanSkill.perktra[i])) + WriteFromProf(47,350+13*i,0,1,".\\master.dat\\text\\dialog\\char.sve","Traits",buf); else + WriteFromProf(47,350+13*i,1,1,".\\master.dat\\text\\dialog\\char.sve","Traits",buf); + + if (MInPr(168,350+13*i,317,350+13*i+12,0)) Selected=34+i; + if (MInPr(300,350+13*i,317,350+13*i+12,0)) IanSkill.perktra[i+8]=!IanSkill.perktra[i+8]; + wsprintf(buf,"tra%i",i+9); + if ((Selected==34+i) || (IanSkill.perktra[i+8])) + WriteFromProf(290,350+13*i,0,3,".\\master.dat\\text\\dialog\\char.sve","Traits",buf); else + WriteFromProf(290,350+13*i,1,3,".\\master.dat\\text\\dialog\\char.sve","Traits",buf); + + if ((MouseIn(25,353+13*i,25+17,353+13*i+10)) && (dims.rgbButtons[0] & 0x80)) + { i2=1; } else { i2=0; } + BlitTo(g_pDDSBack,0,0,Buttons[i2]->FRM->x,Buttons[i2]->FRM->y,25,353+13*i,0,Buttons[i2]->FRM->FRM); + if ((MouseIn(300,353+13*i,317,353+13*i+10)) && (dims.rgbButtons[0] & 0x80)) + { i2=1; } else { i2=0; } + BlitTo(g_pDDSBack,0,0,Buttons[i2]->FRM->x,Buttons[i2]->FRM->y,300,353+13*i,0,Buttons[i2]->FRM->FRM); + } + + wsprintf(buf2,"generic.frm"); + switch (Selected) + { + case 1:wsprintf(buf2,"strength.frm");break; + case 2:wsprintf(buf2,"perceptn.frm");break; + case 3:wsprintf(buf2,"endur.frm");break; + case 4:wsprintf(buf2,"charisma.frm");break; + case 5:wsprintf(buf2,"intel.frm");break; + case 6:wsprintf(buf2,"agility.frm");break; + case 7:wsprintf(buf2,"luck.frm");break; + + case 8:wsprintf(buf2,"hitpoint.frm");break; + case 9:case 10:case 11: + case 12:case 13:case 14: + case 15:wsprintf(buf2,"poisoned.frm");break; + case 16:wsprintf(buf2,"armorcls.frm");break; + case 17:wsprintf(buf2,"actionpt.frm");break; + case 18:wsprintf(buf2,"carryamt.frm");break; + case 19:wsprintf(buf2,"meleedam.frm");break; + case 20:wsprintf(buf2,"damresis.frm");break; + case 21:wsprintf(buf2,"poisnres.frm");break; + case 22:wsprintf(buf2,"here&now.frm");break; + case 23:wsprintf(buf2,"sequence.frm");break; + case 24:wsprintf(buf2,"healrate.frm");break; + case 25:wsprintf(buf2,"critchnc.frm");break; + + case 26:wsprintf(buf2,"fastmeta.frm");break; + case 27:wsprintf(buf2,"bruiser.frm");break; + case 28:wsprintf(buf2,"smlframe.frm");break; + case 29:wsprintf(buf2,"onehand.frm");break; + case 30:wsprintf(buf2,"stranger.frm");break; + case 31:wsprintf(buf2,"kamikaze.frm");break; + case 32:wsprintf(buf2,"heavyhnd.frm");break; + case 33:wsprintf(buf2,"fastshot.frm");break; + + case 34:wsprintf(buf2,"bldmess.frm");break; + case 35:wsprintf(buf2,"jinxed.frm");break; + case 36:wsprintf(buf2,"goodnatr.frm");break; + case 37:wsprintf(buf2,"addict.frm");break; + case 38:wsprintf(buf2,"drugrest.frm");break; + case 39:wsprintf(buf2,"empathy.frm");break; + case 40:wsprintf(buf2,"skilled.frm");break; + case 41:wsprintf(buf2,"gifted.frm");break; + + case 42:wsprintf(buf2,"gunsml.frm");break; + case 43:wsprintf(buf2,"gunbig.frm");break; + case 44:wsprintf(buf2,"energywp.frm");break; + case 45:wsprintf(buf2,"unarmed.frm");break; + case 46:wsprintf(buf2,"melee.frm");break; + case 47:wsprintf(buf2,"throwing.frm");break; + case 48:wsprintf(buf2,"firstaid.frm");break; + case 49:wsprintf(buf2,"doctor.frm");break; + case 50:wsprintf(buf2,"sneak.frm");break; + case 51:wsprintf(buf2,"lockpick.frm");break; + case 52:wsprintf(buf2,"steal.frm");break; + case 53:wsprintf(buf2,"traps.frm");break; + case 54:wsprintf(buf2,"science.frm");break; + case 55:wsprintf(buf2,"repair.frm");break; + case 56:wsprintf(buf2,"speech.frm");break; + case 57:wsprintf(buf2,"barter.frm");break; + case 58:wsprintf(buf2,"gambling.frm");break; + case 59:wsprintf(buf2,"outdoors.frm");break; + } + wsprintf(buf,"master.dat\\art\\skilldex\\%s",buf2); + if ((lstrcmpi(SkillDex->fname,buf))) + { + LoadFRMSingle(&SkillDex,hWnd,buf,1); + } + BlitTo(g_pDDSBack,0,0,140,117,480,310,0,SkillDex->FRM->FRM); + + for (i=0; i<10; i++) + { + wsprintf(buf,"de%i_%i",Selected,i); + WriteFromProf(350,280+i*14,11,1,".\\master.dat\\text\\dialog\\chard.sve","Dialog",buf); + } + + if ((dims.rgbButtons[0] & 0x80) && MouseIn(457,450,457+26,450+26)) + { + BlitTo(g_pDDSBack,0,0,MenuDown->FRM->x,MenuDown->FRM->y,457,450,DDBLTFAST_SRCCOLORKEY,MenuDown->FRM->FRM); + } else + { + BlitTo(g_pDDSBack,0,0,MenuUp->FRM->x,MenuUp->FRM->y,457,450,DDBLTFAST_SRCCOLORKEY,MenuUp->FRM->FRM); + } + IanOutText(457+30,457,2,"Vége"); + + DisplayFrameRate(); + BlitTo(g_pDDSBack,0,0,Mouse->FRM->x, Mouse->FRM->y,MousX,MousY,DDBLTFAST_SRCCOLORKEY,Mouse->FRM->FRM); + + // Flip the surfaces + while (TRUE) + { + hRet = g_pDDSPrimary->Flip(NULL, 0); + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + hRet = RestoreAll(); + if (hRet != DD_OK) + break; + } + if (hRet != DDERR_WASSTILLDRAWING) + break; + } + if (MInPr(457,450,457+26,450+26,0)) { FadeOutWh(); ClearSurface(g_pDDSBack,0,0,0); ClearSurface(g_pDDSPrimary,0,0,0); GamePos = 1; SetPaletteBl(255); } +} + + +#include "ddex4_u2.h" \ No newline at end of file diff --git a/IanOut/ddex4_u2.h b/IanOut/ddex4_u2.h new file mode 100644 index 0000000..1a8e694 --- /dev/null +++ b/IanOut/ddex4_u2.h @@ -0,0 +1,435 @@ +void Credits(void) +{ + HRESULT hRet; + DDBLTFX ddbltfx; + + CString Dumcsi[200]; + + + int i,c; + static int Frame = -20; + static DWORD ThisTick; + static DWORD LastTick = 0; + char buf[80]; + //char buf2[80]; + //time_t ltime,ltime2; + //tm pointtm; + int Stringnumb; + FILE* stream; + + Stringnumb=0; + stream = fopen("master.dat\\text\\credits.txt","rt"); + + while (!(feof(stream))) + { + Stringnumb++; +// wsprintf(buf,"%i",Stringnumb); +// MessageBox(hWnd,buf,buf,MB_OK); + + //fscanf(stream,"%s",buf); + fgets(buf,80,stream); + Dumcsi[Stringnumb-1]=buf; + } + /*pointtm.tm_hour=9; + pointtm.tm_isdst=0; + pointtm.tm_mday=3; + pointtm.tm_min=30; + pointtm.tm_mon=0; + pointtm.tm_sec=0; + pointtm.tm_yday=3; + pointtm.tm_year=2001; + ltime2=mktime(&pointtm); + time( <ime ); + Dumcsi[Stringnumb]="0"; + Dumcsi[Stringnumb+1]="2Statisztikai adatok a játékról"; + Dumcsi[Stringnumb+2]="0"; + Dumcsi[Stringnumb+3]="1A játék újraindítása óta eltelt idő:"; + _gcvt(difftime(ltime2,ltime),20,buf); + wsprintf(buf2,"3%s másodperc",buf); + Dumcsi[Stringnumb+4]=buf2; + Stringnumb+=5;*/ + fclose(stream); + + + ThisTick = GetTickCount(); + + if ((ThisTick - LastTick) > 40) + { + Frame++;//(ThisTick - LastTick)/40; + LastTick = ThisTick; + + } + + ZeroMemory(&ddbltfx, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(ddbltfx); + ddbltfx.dwFillColor = RGB(0,0,0); + g_pDDSBack->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); + + for (i=0; i-15)) + { + wsprintf(buf,"%s",Dumcsi[i]); + c=0; + switch (buf[0]) { + case '1':c = 1;break; + case '2':c = 2;break; + case '3':c = 3;break; + case '4':c = 4;break; + case '5':c = 5;break; + case 'A':c = 0;break; + case 'B':c = 1;break; + case 'C':c = 2;break; + case 'D':c = 3;break; + case 'E':c = 4;break; + case 'F':c = 5;break; + } + if ((buf[0]>='A') && (buf[0]<='F')) + { + buf[0]=' '; + IanOutText(0,i*12+480-Frame,c,buf); + } else + { + buf[0]=' '; + IanOutTextC(315,i*12+480-Frame,c,buf); + } + } + } + DisplayFrameRate(); + olddims = dims; + MousX = 200; + UpdateInputState(); + if (dims.rgbButtons[1] & 0x80) Frame--; + if (((Stringnumb*12+480-Frame)<-15) || (dims.rgbButtons[0] & 0x80)) { Frame = -20; GamePos=0; FadeOut(); /*SetPaletteBl(255);*/return;} + + + while (TRUE) + { + hRet = g_pDDSPrimary->Flip(NULL, 0); + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + hRet = RestoreAll(); + if (hRet != DD_OK) + break; + } + if (hRet != DDERR_WASSTILLDRAWING) + break; + } + + if (Frame<-10) SetPaletteBl(255); + +} + +void +MainMenu(void) +{ + HRESULT hRet; + //DDBLTFX ddbltfx; + + static int Frame = -25; + static DWORD ThisTick; + static DWORD LastTick = 0; + //int i; + + if ((lstrcmpi(FullScreen->fname,"master.dat\\art\\interface\\mainmenu.frm"))) + { + LoadFRMSingle(&FullScreen,hWnd,"master.dat\\art\\interface\\mainmenu.frm",1); + + } + + ThisTick = GetTickCount(); + + if ((ThisTick - LastTick) > 0) + { + LastTick = ThisTick; + + Frame+=3; + + } + + olddims = dims; + UpdateInputState(); + + MousX += dims.lX; + MousY += dims.lY; + + if (MousX>=640) { MousX=640;} + if (MousX<=0) { MousX=0; } + if (MousY>=480) { MousY=480;} + if (MousY<=0) { MousY=0; } + + BlitTo(g_pDDSBack,0,0,640,480,0,0,0,FullScreen->FRM->FRM); + + if ((dims.rgbButtons[0] & 0x80) && MouseIn(30,20,56,46)) + { + BlitTo(g_pDDSBack,0,0,MenuDown->FRM->x,MenuDown->FRM->y,30,20,DDBLTFAST_SRCCOLORKEY,MenuDown->FRM->FRM); + } else + { + BlitTo(g_pDDSBack,0,0,MenuUp->FRM->x,MenuUp->FRM->y,30,20,DDBLTFAST_SRCCOLORKEY,MenuUp->FRM->FRM); + } + IanOutTextC(123,25,2,"Intro"); + if ((dims.rgbButtons[0] & 0x80) && MouseIn(30,61,56,93)) + { + BlitTo(g_pDDSBack,0,0,MenuDown->FRM->x,MenuDown->FRM->y,30,61,DDBLTFAST_SRCCOLORKEY,MenuDown->FRM->FRM); + } else + { + BlitTo(g_pDDSBack,0,0,MenuUp->FRM->x,MenuUp->FRM->y,30,61,DDBLTFAST_SRCCOLORKEY,MenuUp->FRM->FRM); + } + IanOutTextC(123,66,2,"Nyú gáme"); + if ((dims.rgbButtons[0] & 0x80) && MouseIn(30,102,56,134)) + { + BlitTo(g_pDDSBack,0,0,MenuDown->FRM->x,MenuDown->FRM->y,30,102,DDBLTFAST_SRCCOLORKEY,MenuDown->FRM->FRM); + } else + { + BlitTo(g_pDDSBack,0,0,MenuUp->FRM->x,MenuUp->FRM->y,30,102,DDBLTFAST_SRCCOLORKEY,MenuUp->FRM->FRM); + } + IanOutTextC(123,107,2,"Betöltés"); + if ((dims.rgbButtons[0] & 0x80) && MouseIn(30,143,56,175)) + { + BlitTo(g_pDDSBack,0,0,MenuDown->FRM->x,MenuDown->FRM->y,30,143,DDBLTFAST_SRCCOLORKEY,MenuDown->FRM->FRM); + } else + { + BlitTo(g_pDDSBack,0,0,MenuUp->FRM->x,MenuUp->FRM->y,30,143,DDBLTFAST_SRCCOLORKEY,MenuUp->FRM->FRM); + } + IanOutTextC(123,148,2,"Beállítások"); + if ((dims.rgbButtons[0] & 0x80) && MouseIn(30,184,56,210)) + { + BlitTo(g_pDDSBack,0,0,MenuDown->FRM->x,MenuDown->FRM->y,30,184,DDBLTFAST_SRCCOLORKEY,MenuDown->FRM->FRM); + } else + { + BlitTo(g_pDDSBack,0,0,MenuUp->FRM->x,MenuUp->FRM->y,30,184,DDBLTFAST_SRCCOLORKEY,MenuUp->FRM->FRM); + } + IanOutTextC(123,189,2,"Készítök"); + + if ((dims.rgbButtons[0] & 0x80) && MouseIn(30,225,56,250)) + { + BlitTo(g_pDDSBack,0,0,MenuDown->FRM->x,MenuDown->FRM->y,30,225,DDBLTFAST_SRCCOLORKEY,MenuDown->FRM->FRM); + } else + { + BlitTo(g_pDDSBack,0,0,MenuUp->FRM->x,MenuUp->FRM->y,30,225,DDBLTFAST_SRCCOLORKEY,MenuUp->FRM->FRM); + } + IanOutTextC(123,230,2,"Kilépés"); + + DisplayFrameRate(); + + IanOutText(0,465,1,"IanOut - A Post-Nuclear Ian-Playing Game v"VERSIONNUM); + IanOutText(455,465,4,"Copyright (c) Sztupy corp."); + + if (Frame<256) SetPaletteBl(Frame); + + if ((olddims.rgbButtons[0] & 0x80) && !(dims.rgbButtons[0] & 0x80) && MouseIn(30,20,56,46)) + { GamePos=3; MousX=150;Frame = -25; FadeOut(); return;} + if ((olddims.rgbButtons[0] & 0x80) && !(dims.rgbButtons[0] & 0x80) && MouseIn(30,61,56,93)) + { GamePos=4; Frame=-25;FadeOut(); ClearSurface(g_pDDSBack,0,0,0); ClearSurface(g_pDDSPrimary,0,0,0);SetPaletteBl(255);return;} + if ((olddims.rgbButtons[0] & 0x80) && !(dims.rgbButtons[0] & 0x80) && MouseIn(30,184,56,210)) + { GamePos=2; Frame = -25; FadeOut(); return;} + if ((olddims.rgbButtons[0] & 0x80) && !(dims.rgbButtons[0] & 0x80) && MouseIn(30,225,56,250)) + { FadeOut(); ClearSurface(g_pDDSBack,0,0,0); ClearSurface(g_pDDSPrimary,0,0,0); PostMessage(hWnd, WM_CLOSE, 0, 0); return;} + + + BlitTo(g_pDDSBack,0,0,Mouse->FRM->x, Mouse->FRM->y,MousX,MousY,DDBLTFAST_SRCCOLORKEY,Mouse->FRM->FRM); + + // Flip the surfaces + while (TRUE) + { + hRet = g_pDDSPrimary->Flip(NULL, 0); + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + hRet = RestoreAll(); + if (hRet != DD_OK) + break; + } + if (hRet != DDERR_WASSTILLDRAWING) + break; + } + +} + +void Intro() +{ + HRESULT hRet; + DDBLTFX ddbltfx; + RECT rcRect; + + static int Fram = -255; + static double Lines[25]; + static double Linpe[25]; + static int Lince[25]; + static int Linti[25]; + int Frame; + static DWORD ThisTick; + static DWORD LastTick = 0; + char buf[150]; + char buf2[10]; + int stringnumb; + int i; + + GetPrivateProfileString("Intro","text","0",buf,80,".\\master.dat\\text\\dialog\\intro.sve"); + stringnumb = atoi(buf); + ThisTick = GetTickCount(); + + if (Fram==-255) + { + for (i=0; i<25; i++) + { + Lines[i]=rand()%540+50; + Linpe[i]=((double)(rand()%80-40))/20; + Lince[i]=rand()%4+11; + Linti[i]=rand()%150; + } + } + + if (Fram<=0) { Fram+=5; } else + if ((ThisTick - LastTick) > 70) + { + Fram++; + LastTick = ThisTick; + } + + for (i=0; i<25; i++) { + Lines[i]+=Linpe[i]; + Linti[i]-=3; + if ((Lince[i]<5) || (Lines[i]<50) || (Lines[i]>590)) + { + Lines[i]=rand()%540+50; + Linpe[i]=((double)(rand()%80-40))/20; + Lince[i]=rand()%4+11; + Linti[i]=rand()%150; + } + if (Linti[i]<0) Lince[i]--; + } + + Frame = Fram; + if (Frame<0) Frame=0; + SetPaletteBl(Fram+255); + ZeroMemory(&ddbltfx, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(ddbltfx); + ddbltfx.dwFillColor = RGB(0,0,0); + g_pDDSBack->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); + + ZeroMemory(&ddbltfx, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(ddbltfx); + ddbltfx.dwFillColor = 5; + + rcRect.top=50; + rcRect.left=50; + rcRect.bottom=450; + rcRect.right=590; + g_pDDSBack->Blt(&rcRect, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); + + wsprintf(buf2,"text%i",(Frame/50)+1); + GetPrivateProfileString("Intro",buf2,"--",buf,80,".\\master.dat\\text\\dialog\\intro.sve"); + IanOutTextC(320,460,0,buf); + + if ((Frame>=-255) && (Frame<=325)) + { + if ((lstrcmpi(FullScreen->fname,"master.dat\\art\\interface\\intro1.frm"))) + { + LoadFRMSingle(&FullScreen,hWnd,"master.dat\\art\\interface\\intro1.frm",1); + } + BlitTo(g_pDDSBack,0,0,540,400,50,50,0,FullScreen->FRM->FRM); + } + + if ((Frame>=321) && (Frame<=665)) + { + if ((lstrcmpi(FullScreen2->fname,"master.dat\\art\\interface\\intro2.frm"))) + { + LoadFRMSingle(&FullScreen2,hWnd,"master.dat\\art\\interface\\intro2.frm",1); + } + if ((Frame>=321) && (Frame<=325)) + { + BlitToAlpha(g_pDDSBack,0,0,540,400,50,50,0,FullScreen2->FRM->FRM,(50*(Frame-321))); + } else + { + BlitTo(g_pDDSBack,0,0,540,400,50,50,0,FullScreen2->FRM->FRM); + } + } + + if ((Frame>=661) && (Frame<=825)) + { + if ((lstrcmpi(FullScreen->fname,"master.dat\\art\\interface\\intro4.frm"))) + { + LoadFRMSingle(&FullScreen,hWnd,"master.dat\\art\\interface\\intro4.frm",1); + } + if ((Frame>=661) && (Frame<=665)) + { + BlitToAlpha(g_pDDSBack,0,0,540,400,50,50,0,FullScreen->FRM->FRM,(50*(Frame-661))); + } else + { + BlitTo(g_pDDSBack,0,0,540,400,50,50,0,FullScreen->FRM->FRM); + } + } + + if ((Frame>=821) && (Frame<=1000)) + { + if ((lstrcmpi(FullScreen2->fname,"master.dat\\art\\interface\\intro3.frm"))) + { + LoadFRMSingle(&FullScreen2,hWnd,"master.dat\\art\\interface\\intro3.frm",1); + } + if ((Frame>=821) && (Frame<=825)) + { + BlitToAlpha(g_pDDSBack,0,0,540,400,50,50,0,FullScreen2->FRM->FRM,(50*(Frame-821))); + } else + { + BlitTo(g_pDDSBack,0,0,540,400,50,50,0,FullScreen2->FRM->FRM); + } + } + + if ((Frame>=0 ) && (Frame<150)) + {IanOutTextC(260,200,0,"IanOut");} + if ((Frame>150) && (Frame<300)) + {IanOutTextC(450,400,0,"Program:"); + IanOutTextC(450,412,0,"Sztupák Szilárd");} + if ((Frame>300) && (Frame<450)) + {IanOutTextC(430,150,0,"Ötlet:"); + IanOutTextC(430,162,0,"Czehelszki Levente"); + IanOutTextC(430,174,0,"Sztupák Szilárd");} + if ((Frame>450) && (Frame<600)) + {IanOutTextC(200,350,0,"Szöveg:"); + IanOutTextC(200,362,0,"Czehelszki Levente");} + if ((Frame>600) && (Frame<750)) + {IanOutTextC(400,300,0,"Grafika:"); + IanOutTextC(400,312,0,"Sztupák Szilárd"); + IanOutTextC(400,324,0,"Black Isle Studio");} + if ((Frame>750) && (Frame<900)) + {IanOutTextC(250,180,0,"Zene:"); + IanOutTextC(250,192,0,"Még nincs");} + + DisplayFrameRate(); + + for (i=0; i<10; i++) + { + ZeroMemory(&ddbltfx, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(ddbltfx); + ddbltfx.dwFillColor = Lince[i]; + rcRect.top=50; + rcRect.left=(int)Lines[i]; + rcRect.bottom=450; + rcRect.right=(int)Lines[i]+1; + g_pDDSBack->Blt(&rcRect, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); + } + + UpdateInputState(); + if (((Frame/50)+1)>stringnumb) { Fram = -255; GamePos=0; FadeOut(); /*SetPaletteBl(255);*/return;} + if ((dims.rgbButtons[0] & 0x80)) { Fram = -255; GamePos=0; FadeOut(); /*SetPaletteBl(255);*/return;} + + while (TRUE) + { + hRet = g_pDDSPrimary->Flip(NULL, 0); + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + hRet = RestoreAll(); + if (hRet != DD_OK) + break; + } + if (hRet != DDERR_WASSTILLDRAWING) + break; + } + +} \ No newline at end of file diff --git a/IanOut/ddex4_u3.h b/IanOut/ddex4_u3.h new file mode 100644 index 0000000..3fc9042 --- /dev/null +++ b/IanOut/ddex4_u3.h @@ -0,0 +1,81 @@ +HRESULT LoadFRMSingle(PFRMSingle *LoadIn, HWND hWnd, char* filename, int i) +{ + HRESULT hRet; + + *LoadIn = new TFRMSingle(); + if ((hRet = (*LoadIn)->Load(hWnd, g_pDD, filename, i)) != DD_OK) + return InitFail(hWnd,hRet,"%s FAILED",filename); else return DD_OK; +} + +void AddString(CString duma,int i2) +{ + int i; + for (i=0; i<49; i++) + { + szoveg[i]=szoveg[i+1]; + } + char dumaelo; + if (i2==1) dumaelo = '~'+1; + szoveg[49]=dumaelo+duma; +} + +void DrawStuff() +{ + int i; + for (i=44; i<50; i++) + { + IanOutText(28+(i-50),462+(i-50)*10,1,szoveg[i]); + } +} + +void DrawTerep(int mousetyp,int x,int y) +{ + int i2,iy,ix,i; + DDBLTFX ddbltfx; + + ZeroMemory(&ddbltfx, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(ddbltfx); + ddbltfx.dwFillColor = RGB(21,21,21); + g_pDDSBack->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); + + for (ix=0; ix<100; ix++) { + for (iy=0; iy<100; iy++) { + BlitTo(g_pDDSBack,0,0,80,35,ix*48+iy*32+TerX+9,iy*24-ix*12+TerY-5,DDBLTFAST_SRCCOLORKEY,MapInf->Tiles[(unsigned char)MapInf->Map[iy][ix]]->FRM->FRM); + } + } + + for (i2=0; i2<145; i2++) + for (ix=0; ix<165; ix++) + { + iy = i2; + if ((x==ix) && (y==iy)) + if ((mousetyp==0) && (MouseIn(0,0,640,380))) BlitTo(g_pDDSBack,0,0,32,16,TerX+(x+226)*16,TerY+(y)*12,DDBLTFAST_SRCCOLORKEY,Select->FRM->FRM); + i = WallInf->Map[ix][iy]; + if ((i > 0) && (i<50)) + { + i--; + BlitTo(g_pDDSBack,0,0,WallInf->Tiles[i]->FRM->x,WallInf->Tiles[i]->FRM->y,TerX+(ix+226)*16+WallMap[i][0],TerY+(iy)*12+WallMap[i][1],DDBLTFAST_SRCCOLORKEY,WallInf->Tiles[i]->FRM->FRM); + + } + i = ItemInf->Map[ix][iy]; + if ((i > 0) && (i<50)) + { + i--; + BlitTo(g_pDDSBack,0,0,ItemInf->Tiles[i]->FRM->x,ItemInf->Tiles[i]->FRM->y,TerX+(ix+226)*16+ItemMap[i][0],TerY+(iy)*12+ItemMap[i][1],DDBLTFAST_SRCCOLORKEY,ItemInf->Tiles[i]->FRM->FRM); + + } + if ((Ian->curth == 1) && (Ian->dir == 5)) + { + if ((Ian->ox == ix) && (Ian->oy == iy)) Ian->Draw(g_pDDSBack,TerX,TerY); + } else + { + if ((Ian->x == ix) && (Ian->y == iy)) Ian->Draw(g_pDDSBack,TerX,TerY); + } + if ((Aradesh->x == ix) && (Aradesh->y == iy)) Aradesh->Draw(g_pDDSBack,TerX,TerY); + for (i=0; i<10;i++) + { + if ((Paraszt[i]->x == ix) && (Paraszt[i]->y == iy)) Paraszt[i]->Draw(g_pDDSBack,TerX,TerY); + } + + } +} \ No newline at end of file diff --git a/IanOut/font.h b/IanOut/font.h new file mode 100644 index 0000000..f2136af --- /dev/null +++ b/IanOut/font.h @@ -0,0 +1,18 @@ +#ifndef __font_h +#define __font_h + +#include "ddraw.h" +#include "afx.h" + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +extern void DisplayNum(int x, int y, int c,unsigned char i,LPDIRECTDRAWSURFACE7 g_pDDSText, LPDIRECTDRAWSURFACE7 g_pDDSOne, LPDIRECTDRAWSURFACE7 g_pDDSBack); +extern void DisplayFrameRate(LPDIRECTDRAWSURFACE7 g_pDDSText, LPDIRECTDRAWSURFACE7 g_pDDSOne, LPDIRECTDRAWSURFACE7 g_pDDSBack ); +extern void IanOutText(int x, int y, int co, CString str, LPDIRECTDRAWSURFACE7 g_pDDSText, LPDIRECTDRAWSURFACE7 g_pDDSOne, LPDIRECTDRAWSURFACE7 g_pDDSBack); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif \ No newline at end of file diff --git a/IanOut/resrc1.h b/IanOut/resrc1.h new file mode 100644 index 0000000..913a942 --- /dev/null +++ b/IanOut/resrc1.h @@ -0,0 +1,15 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by ddex4.rc +// + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/IanOut/temp.txt b/IanOut/temp.txt new file mode 100644 index 0000000..1da5e9b --- /dev/null +++ b/IanOut/temp.txt @@ -0,0 +1,497 @@ +//----------------------------------------------------------------------------- +// Name: InitApp() +// Desc: Do work required for every instance of the application: +// Create the window, initialize data +//----------------------------------------------------------------------------- + +int GetFRMData(char dat) +{ + FILE *stream; + char buf[74]; + DWORD i; + DWORD ki; + + + if( (stream = fopen( "test.frm", "r" )) != NULL ) + { + if (dat=='W') { + fread(&buf, 62, 1, stream); + } + else + { + fread(&buf, 64, 1, stream); + } + // ki = 0; + i = fgetc( stream); + ki=i*256; + i = fgetc( stream); + ki+=i; + fclose( stream ); + } + + return i; +} + +int LoadFRM(HWND hWnd, LPVOID LoadInto, int x, int y, int pitch) +{ + char buf[100]; + LPSTR PointTo; + int i; + int stream; + + PointTo = (LPSTR)LoadInto; + if( (stream = _open( "test.frm",_O_BINARY)) != -1 ) + { + _read(stream, &buf, 74); + + for (i=0; iBltFast(x, y, g_pDDSOne, + &rcRect, DDBLTFAST_SRCCOLORKEY); + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + hRet = RestoreAll(); + if (hRet != DD_OK) + return; + } + if (hRet != DDERR_WASSTILLDRAWING) + return; + } + + +void IanOutText(int x, int y, int co, CString str) +{ + int i; + int jelenx = 0; + int sor = 0; + int length = str.GetLength(); + for (i=0 ; iCreateDevice( GUID_SysMouse, &g_pMouse, NULL ); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"CreateDevice (mouse) failed"); + + /*hr = g_pDI->CreateDevice( GUID_SysKeyboard, &g_pKeyb, NULL ); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"CreateDevice (keyboard) failed");;*/ + + // Set the data format to "mouse format" - a predefined data format + // + // A data format specifies which controls on a device we + // are interested in, and how they should be reported. + // + // This tells DirectInput that we will be passing a + // DIMOUSESTATE structure to IDirectInputDevice::GetDeviceState. + hr = g_pMouse->SetDataFormat( &c_dfDIMouse ); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"SetDataFormat (mouse) failed"); + + /*hr = g_pKeyb->SetDataFormat( &c_dfDIKeyboard ); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"SetDataFormat (keyb) failed");;*/ + + // Set the cooperativity level to let DirectInput know how + // this device should interact with the system and with other + // DirectInput applications. + hr = g_pMouse->SetCooperativeLevel( hDlg, + DISCL_EXCLUSIVE | DISCL_FOREGROUND); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"SetCooperativeLevel (mouse) failed"); + + /*hr = g_pKeyb->SetCooperativeLevel( hDlg, + DISCL_EXCLUSIVE | DISCL_FOREGROUND); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"SetCooperativeLevel (keyb) failed");*/ + + return S_OK; +} + + + + +//----------------------------------------------------------------------------- +// Function: SetAcquire +// +// Description: +// Acquire or unacquire the mouse, depending on if the app is active +// Input device must be acquired before the GetDeviceState is called +// +//----------------------------------------------------------------------------- +HRESULT SetAcquire( ) +{ + + // nothing to do if g_pMouse is NULL + if (NULL == g_pMouse) + return S_FALSE; + + if (g_bActive) + { + // acquire the input device + g_pMouse->Acquire(); + //g_pKeyb->Acquire(); + } + else + { + + // unacquire the input device + g_pMouse->Unacquire(); + //g_pKeyb->Unacquire(); + } + + return S_OK; +} + + + + +//----------------------------------------------------------------------------- +// Function: UpdateInputState +// +// Description: +// Get the input device's state and display it. +// +//----------------------------------------------------------------------------- +HRESULT UpdateInputState( ) +{ + + if (NULL != g_pMouse) + { + HRESULT hr; + + hr = DIERR_INPUTLOST; + + // if input is lost then acquire and keep trying + while ( DIERR_INPUTLOST == hr ) + { + // get the input's device state, and put the state in dims + hr = g_pMouse->GetDeviceState( sizeof(DIMOUSESTATE), &dims ); + + if ( hr == DIERR_INPUTLOST ) + { + // DirectInput is telling us that the input stream has + // been interrupted. We aren't tracking any state + // between polls, so we don't have any special reset + // that needs to be done. We just re-acquire and + // try again. + hr = g_pMouse->Acquire(); + if ( FAILED(hr) ) + return hr; + } + } + + if ( FAILED(hr) ) + return hr; + + + /*int i; + + for (i=0; i<255; i++) + { + olddim[i] = keybdim[i]; + } + hr = g_pKeyb->GetDeviceState(sizeof(keybdim),(LPVOID)&keybdim); + if FAILED(hr) + { + return hr; + } */ + + + // The dims structure now has the state of the mouse, so + // display mouse coordinates (x, y, z) and buttons. + /*wsprintf( szNewText, "(%d, %d, %d) %c %c %c %c", + dims.lX, dims.lY, dims.lZ, + (dims.rgbButtons[0] & 0x80) ? '0' : ' ', + (dims.rgbButtons[1] & 0x80) ? '1' : ' ', + (dims.rgbButtons[2] & 0x80) ? '2' : ' ', + (dims.rgbButtons[3] & 0x80) ? '3' : ' '); +*/ + // if anything changed then repaint - avoid flicker + + } + + return S_OK; +} + + + + +//----------------------------------------------------------------------------- +// Function: FreeDirectInput +// +// Description: +// Initialize the DirectInput variables. +// +//----------------------------------------------------------------------------- +HRESULT FreeDirectInput() +{ + // Unacquire and release any DirectInputDevice objects. + if (NULL != g_pMouse) + { + // Unacquire the device one last time just in case + // the app tried to exit while the device is still acquired. + g_pMouse->Unacquire(); + + g_pMouse->Release(); + g_pMouse = NULL; + } + + /*if (NULL != g_pKeyb) + { + g_pKeyb->Unacquire(); + + g_pKeyb->Release(); + g_pKeyb = NULL; + }*/ + // Release any DirectInput objects. + if (NULL != g_pDI) + { + g_pDI->Release(); + g_pDI = NULL; + } + + return S_OK; +} + +pe2[i].peBlue = Frame; + pe2[i].peGreen = Frame; + pe2[i].peRed = Frame; + if (pe2[i].peBlue>(int)(pe[i].peBlue*gamma)) pe2[i].peBlue = (int)(pe[i].peBlue*gamma); + if (pe2[i].peRed>(int)(pe[i].peRed*gamma)) pe2[i].peRed = (int)(pe[i].peRed*gamma); + if (pe2[i].peGreen>(int)(pe[i].peGreen*gamma)) pe2[i].peGreen = (int)(pe[i].peGreen*gamma); + if (pe2[i].peBlue>255) pe2[i].peBlue=255; + if (pe2[i].peRed>255) pe2[i].peRed=255; + if (pe2[i].peGreen>255) pe2[i].peGreen=255; + + + +//DisplayNum(0,70,2,-TerX+MousX,4); + //DisplayNum(70,70,2,-TerY+MousY,4); + + for (x=0; x<160; x++) { + for (y=0; y<150; y++) { + if ((y%2==x%2) && (Ian->Table[x][y] != 111)) + DisplayNum(TerX+(x+226)*14, TerY+y*12, 2, Ian->Table[x][y],2); + + } + } + + + if (i<100) + { + PosIt[0][0]=1; + PosIt[0][1]=i; + PosIt[1][0]=tx; + PosIt[1][1]=ty; + + Mehet = TRUE; + while (Mehet) + { + i--; + if (i<1) {Mehet=FALSE;i=1;} + for (ix=2; ix<170; ix++) + for (iy=1; iy<150; iy++) + { + if (Table[ix][iy] == i) + { + if ((ix+2 == PosIt[i-1][0]) && + (iy == PosIt[i-1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix-2 == PosIt[i-1][0]) && + (iy == PosIt[i-1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix+1 == PosIt[i-1][0]) && + (iy+1 == PosIt[i-1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix+1 == PosIt[i-1][0]) && + (iy-1 == PosIt[i-1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix-1 == PosIt[i-1][0]) && + (iy+1 == PosIt[i-1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix-1 == PosIt[i-1][0]) && + (iy-1 == PosIt[i-1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + } + } + } + + } else + { + PosIt[0][0]=-1; + PosIt[0][1]=-1; + } + + + + i--; + if (i<1) {Mehet=FALSE;i=1;} + for (ix=2; ix<163; ix++) + for (iy=1; iy<143; iy++) + { + if (Table[ix][iy] == i) + { + if ((ix+2 == PosIt[i+1][0]) && + (iy == PosIt[i+1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix-2 == PosIt[i+1][0]) && + (iy == PosIt[i+1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix+1 == PosIt[i+1][0]) && + (iy+1 == PosIt[i+1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix+1 == PosIt[i+1][0]) && + (iy-1 == PosIt[i+1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix-1 == PosIt[i+1][0]) && + (iy+1 == PosIt[i+1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix-1 == PosIt[i+1][0]) && + (iy-1 == PosIt[i+1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + } + } + + +extern "C" +HRESULT BlitTo(LPDIRECTDRAWSURFACE7 Blit,int Sx1, int Sy1, int Sx2, int Sy2, int Dx, int Dy, DWORD flags, LPDIRECTDRAWSURFACE7 surf) +{ + DDBLTFX ddbltfx; + RECT rcRect; + RECT rcDest; + HRESULT hRet; + int iw1; + int iw2; + + hRet = DD_OK; + ZeroMemory(&ddbltfx, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(ddbltfx); + ddbltfx.dwFillColor = 0; + + rcRect.left = Sx1; + rcRect.top = Sy1; + rcRect.right = Sx2; + rcRect.bottom = Sy2; + + iw1 = Sx2-Sx1; + iw2 = Sy2-Sy1; + + if (!((Dx>640) || (Dy>480) || (Dx+iw1<0) || (Dy+iw2<0))) { + + rcDest.left = Dx; + rcDest.top = Dy; + rcDest.right = Dx+iw1; + rcDest.bottom = Dy+iw2; + + while (TRUE) + { + hRet = Blit->Blt(&rcDest, surf, &rcRect, flags, &ddbltfx); + + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + /* hRet = RestoreAll(); + if (hRet != DD_OK)*/ + return hRet; + } + if (hRet != DDERR_WASSTILLDRAWING) + return hRet; + } + if (hRet != DD_OK) + return hRet; + } + return hRet; +} diff --git a/IanOut/utils.cpp b/IanOut/utils.cpp new file mode 100644 index 0000000..320d8df --- /dev/null +++ b/IanOut/utils.cpp @@ -0,0 +1,141 @@ +#include "ddraw.h" +#include +#include + +extern "C" HRESULT +InitFail(HWND hWnd, HRESULT hRet, LPCTSTR szError,...) +{ + char szBuff[128]; + char szBuff2[128]; + char szBuff3[50]; + va_list vl; + + va_start(vl, szError); + vsprintf(szBuff, szError, vl); + if (hRet == DD_OK) wsprintf(szBuff3,"DDERR_UNKNOWN"); + if (hRet == DDERR_ALREADYINITIALIZED ) wsprintf(szBuff3,"DDERR_ALREADYINITIALIZED "); + if (hRet == DDERR_BLTFASTCANTCLIP ) wsprintf(szBuff3,"DDERR_BLTFASTCANTCLIP "); + if (hRet == DDERR_CANNOTATTACHSURFACE ) wsprintf(szBuff3,"DDERR_CANNOTATTACHSURFACE "); + if (hRet == DDERR_CANNOTDETACHSURFACE ) wsprintf(szBuff3,"DDERR_CANNOTDETACHSURFACE "); + if (hRet == DDERR_CANTCREATEDC ) wsprintf(szBuff3,"DDERR_CANTCREATEDC "); + if (hRet == DDERR_CANTDUPLICATE ) wsprintf(szBuff3,"DDERR_CANTDUPLICATE "); + if (hRet == DDERR_CANTLOCKSURFACE ) wsprintf(szBuff3,"DDERR_CANTLOCKSURFACE "); + if (hRet == DDERR_CANTPAGELOCK ) wsprintf(szBuff3,"DDERR_CANTPAGELOCK "); + if (hRet == DDERR_CANTPAGEUNLOCK ) wsprintf(szBuff3,"DDERR_CANTPAGEUNLOCK "); + if (hRet == DDERR_CLIPPERISUSINGHWND ) wsprintf(szBuff3,"DDERR_CLIPPERISUSINGHWND "); + if (hRet == DDERR_COLORKEYNOTSET ) wsprintf(szBuff3,"DDERR_COLORKEYNOTSET "); + if (hRet == DDERR_CURRENTLYNOTAVAIL ) wsprintf(szBuff3,"DDERR_CURRENTLYNOTAVAIL "); + if (hRet == DDERR_DDSCAPSCOMPLEXREQUIRED ) wsprintf(szBuff3,"DDERR_DDSCAPSCOMPLEXREQUIRED "); + if (hRet == DDERR_DCALREADYCREATED ) wsprintf(szBuff3,"DDERR_DCALREADYCREATED "); + if (hRet == DDERR_DEVICEDOESNTOWNSURFACE ) wsprintf(szBuff3,"DDERR_DEVICEDOESNTOWNSURFACE "); + if (hRet == DDERR_DIRECTDRAWALREADYCREATED ) wsprintf(szBuff3,"DDERR_DIRECTDRAWALREADYCREATED "); + if (hRet == DDERR_EXCEPTION ) wsprintf(szBuff3,"DDERR_EXCEPTION "); + if (hRet == DDERR_EXCLUSIVEMODEALREADYSET ) wsprintf(szBuff3,"DDERR_EXCLUSIVEMODEALREADYSET "); + if (hRet == DDERR_EXPIRED ) wsprintf(szBuff3,"DDERR_EXPIRED "); + if (hRet == DDERR_GENERIC ) wsprintf(szBuff3,"DDERR_GENERIC "); + if (hRet == DDERR_HEIGHTALIGN ) wsprintf(szBuff3,"DDERR_HEIGHTALIGN "); + if (hRet == DDERR_HWNDALREADYSET ) wsprintf(szBuff3,"DDERR_HWNDALREADYSET "); + if (hRet == DDERR_HWNDSUBCLASSED ) wsprintf(szBuff3,"DDERR_HWNDSUBCLASSED "); + if (hRet == DDERR_IMPLICITLYCREATED ) wsprintf(szBuff3,"DDERR_IMPLICITLYCREATED "); + if (hRet == DDERR_INCOMPATIBLEPRIMARY ) wsprintf(szBuff3,"DDERR_INCOMPATIBLEPRIMARY "); + if (hRet == DDERR_INVALIDCAPS ) wsprintf(szBuff3,"DDERR_INVALIDCAPS "); + if (hRet == DDERR_INVALIDCLIPLIST ) wsprintf(szBuff3,"DDERR_INVALIDCLIPLIST "); + if (hRet == DDERR_INVALIDDIRECTDRAWGUID ) wsprintf(szBuff3,"DDERR_INVALIDDIRECTDRAWGUID "); + if (hRet == DDERR_INVALIDMODE ) wsprintf(szBuff3,"DDERR_INVALIDMODE "); + if (hRet == DDERR_INVALIDOBJECT ) wsprintf(szBuff3,"DDERR_INVALIDOBJECT "); + if (hRet == DDERR_INVALIDPARAMS ) wsprintf(szBuff3,"DDERR_INVALIDPARAMS "); + if (hRet == DDERR_INVALIDPIXELFORMAT ) wsprintf(szBuff3,"DDERR_INVALIDPIXELFORMAT "); + if (hRet == DDERR_INVALIDPOSITION ) wsprintf(szBuff3,"DDERR_INVALIDPOSITION "); + if (hRet == DDERR_INVALIDRECT ) wsprintf(szBuff3,"DDERR_INVALIDRECT "); + if (hRet == DDERR_INVALIDSTREAM ) wsprintf(szBuff3,"DDERR_INVALIDSTREAM "); + if (hRet == DDERR_INVALIDSURFACETYPE ) wsprintf(szBuff3,"DDERR_INVALIDSURFACETYPE "); + if (hRet == DDERR_LOCKEDSURFACES ) wsprintf(szBuff3,"DDERR_LOCKEDSURFACES "); + if (hRet == DDERR_MOREDATA ) wsprintf(szBuff3,"DDERR_MOREDATA "); + if (hRet == DDERR_NEWMODE ) wsprintf(szBuff3,"DDERR_NEWMODE "); + if (hRet == DDERR_NO3D ) wsprintf(szBuff3,"DDERR_NO3D "); + if (hRet == DDERR_NOALPHAHW ) wsprintf(szBuff3,"DDERR_NOALPHAHW "); + if (hRet == DDERR_NOBLTHW ) wsprintf(szBuff3,"DDERR_NOBLTHW "); + if (hRet == DDERR_NOCLIPLIST ) wsprintf(szBuff3,"DDERR_NOCLIPLIST "); + if (hRet == DDERR_NOCLIPPERATTACHED ) wsprintf(szBuff3,"DDERR_NOCLIPPERATTACHED "); + if (hRet == DDERR_NOCOLORCONVHW ) wsprintf(szBuff3,"DDERR_NOCOLORCONVHW "); + if (hRet == DDERR_NOCOLORKEY ) wsprintf(szBuff3,"DDERR_NOCOLORKEY "); + if (hRet == DDERR_NOCOLORKEYHW ) wsprintf(szBuff3,"DDERR_NOCOLORKEYHW "); + if (hRet == DDERR_NOCOOPERATIVELEVELSET ) wsprintf(szBuff3,"DDERR_NOCOOPERATIVELEVELSET "); + if (hRet == DDERR_NODC ) wsprintf(szBuff3,"DDERR_NODC "); + if (hRet == DDERR_NODDROPSHW ) wsprintf(szBuff3,"DDERR_NODDROPSHW "); + if (hRet == DDERR_NODIRECTDRAWHW ) wsprintf(szBuff3,"DDERR_NODIRECTDRAWHW "); + if (hRet == DDERR_NODIRECTDRAWSUPPORT ) wsprintf(szBuff3,"DDERR_NODIRECTDRAWSUPPORT "); + if (hRet == DDERR_NODRIVERSUPPORT ) wsprintf(szBuff3,"DDERR_NODRIVERSUPPORT "); + if (hRet == DDERR_NOEMULATION ) wsprintf(szBuff3,"DDERR_NOEMULATION "); + if (hRet == DDERR_NOEXCLUSIVEMODE ) wsprintf(szBuff3,"DDERR_NOEXCLUSIVEMODE "); + if (hRet == DDERR_NOFLIPHW ) wsprintf(szBuff3,"DDERR_NOFLIPHW "); + if (hRet == DDERR_NOFOCUSWINDOW ) wsprintf(szBuff3,"DDERR_NOFOCUSWINDOW "); + if (hRet == DDERR_NOGDI ) wsprintf(szBuff3,"DDERR_NOGDI "); + if (hRet == DDERR_NOHWND ) wsprintf(szBuff3,"DDERR_NOHWND "); + if (hRet == DDERR_NOMIPMAPHW ) wsprintf(szBuff3,"DDERR_NOMIPMAPHW "); + if (hRet == DDERR_NOMIRRORHW ) wsprintf(szBuff3,"DDERR_NOMIRRORHW "); + if (hRet == DDERR_NOMONITORINFORMATION ) wsprintf(szBuff3,"DDERR_NOMONITORINFORMATION "); + if (hRet == DDERR_NONONLOCALVIDMEM ) wsprintf(szBuff3,"DDERR_NONONLOCALVIDMEM "); + if (hRet == DDERR_NOOPTIMIZEHW ) wsprintf(szBuff3,"DDERR_NOOPTIMIZEHW "); + if (hRet == DDERR_NOOVERLAYDEST ) wsprintf(szBuff3,"DDERR_NOOVERLAYDEST "); + if (hRet == DDERR_NOOVERLAYHW ) wsprintf(szBuff3,"DDERR_NOOVERLAYHW "); + if (hRet == DDERR_NOPALETTEATTACHED ) wsprintf(szBuff3,"DDERR_NOPALETTEATTACHED "); + if (hRet == DDERR_NOPALETTEHW ) wsprintf(szBuff3,"DDERR_NOPALETTEHW "); + if (hRet == DDERR_NORASTEROPHW ) wsprintf(szBuff3,"DDERR_NORASTEROPHW "); + if (hRet == DDERR_NOROTATIONHW ) wsprintf(szBuff3,"DDERR_NOROTATIONHW "); + if (hRet == DDERR_NOSTEREOHARDWARE ) wsprintf(szBuff3,"DDERR_NOSTEREOHARDWARE "); + if (hRet == DDERR_NOSTRETCHHW ) wsprintf(szBuff3,"DDERR_NOSTRETCHHW "); + if (hRet == DDERR_NOSURFACELEFT ) wsprintf(szBuff3,"DDERR_NOSURFACELEFT "); + if (hRet == DDERR_NOT4BITCOLOR ) wsprintf(szBuff3,"DDERR_NOT4BITCOLOR "); + if (hRet == DDERR_NOT4BITCOLORINDEX ) wsprintf(szBuff3,"DDERR_NOT4BITCOLORINDEX "); + if (hRet == DDERR_NOT8BITCOLOR ) wsprintf(szBuff3,"DDERR_NOT8BITCOLOR "); + if (hRet == DDERR_NOTAOVERLAYSURFACE ) wsprintf(szBuff3,"DDERR_NOTAOVERLAYSURFACE "); + if (hRet == DDERR_NOTEXTUREHW ) wsprintf(szBuff3,"DDERR_NOTEXTUREHW "); + if (hRet == DDERR_NOTFLIPPABLE ) wsprintf(szBuff3,"DDERR_NOTFLIPPABLE "); + if (hRet == DDERR_NOTFOUND ) wsprintf(szBuff3,"DDERR_NOTFOUND "); + if (hRet == DDERR_NOTINITIALIZED ) wsprintf(szBuff3,"DDERR_NOTINITIALIZED "); + if (hRet == DDERR_NOTLOADED ) wsprintf(szBuff3,"DDERR_NOTLOADED "); + if (hRet == DDERR_NOTLOCKED ) wsprintf(szBuff3,"DDERR_NOTLOCKED "); + if (hRet == DDERR_NOTPAGELOCKED ) wsprintf(szBuff3,"DDERR_NOTPAGELOCKED "); + if (hRet == DDERR_NOTPALETTIZED ) wsprintf(szBuff3,"DDERR_NOTPALETTIZED "); + if (hRet == DDERR_NOVSYNCHW ) wsprintf(szBuff3,"DDERR_NOVSYNCHW "); + if (hRet == DDERR_NOZBUFFERHW ) wsprintf(szBuff3,"DDERR_NOZBUFFERHW "); + if (hRet == DDERR_NOZOVERLAYHW ) wsprintf(szBuff3,"DDERR_NOZOVERLAYHW "); + if (hRet == DDERR_OUTOFCAPS ) wsprintf(szBuff3,"DDERR_OUTOFCAPS "); + if (hRet == DDERR_OUTOFMEMORY ) wsprintf(szBuff3,"DDERR_OUTOFMEMORY "); + if (hRet == DDERR_OUTOFVIDEOMEMORY ) wsprintf(szBuff3,"DDERR_OUTOFVIDEOMEMORY "); + if (hRet == DDERR_OVERLAPPINGRECTS ) wsprintf(szBuff3,"DDERR_OVERLAPPINGRECTS "); + if (hRet == DDERR_OVERLAYCANTCLIP ) wsprintf(szBuff3,"DDERR_OVERLAYCANTCLIP "); + if (hRet == DDERR_OVERLAYCOLORKEYONLYONEACTIVE ) wsprintf(szBuff3,"DDERR_OVERLAYCOLORKEYONLYONEACTIVE "); + if (hRet == DDERR_OVERLAYNOTVISIBLE ) wsprintf(szBuff3,"DDERR_OVERLAYNOTVISIBLE "); + if (hRet == DDERR_PALETTEBUSY ) wsprintf(szBuff3,"DDERR_PALETTEBUSY "); + if (hRet == DDERR_PRIMARYSURFACEALREADYEXISTS ) wsprintf(szBuff3,"DDERR_PRIMARYSURFACEALREADYEXISTS "); + if (hRet == DDERR_REGIONTOOSMALL ) wsprintf(szBuff3,"DDERR_REGIONTOOSMALL "); + if (hRet == DDERR_SURFACEALREADYATTACHED ) wsprintf(szBuff3,"DDERR_SURFACEALREADYATTACHED "); + if (hRet == DDERR_SURFACEALREADYDEPENDENT ) wsprintf(szBuff3,"DDERR_SURFACEALREADYDEPENDENT "); + if (hRet == DDERR_SURFACEBUSY ) wsprintf(szBuff3,"DDERR_SURFACEBUSY "); + if (hRet == DDERR_SURFACEISOBSCURED ) wsprintf(szBuff3,"DDERR_SURFACEISOBSCURED "); + if (hRet == DDERR_SURFACELOST ) wsprintf(szBuff3,"DDERR_SURFACELOST "); + if (hRet == DDERR_SURFACENOTATTACHED ) wsprintf(szBuff3,"DDERR_SURFACENOTATTACHED "); + if (hRet == DDERR_TESTFINISHED ) wsprintf(szBuff3,"DDERR_TESTFINISHED "); + if (hRet == DDERR_TOOBIGHEIGHT ) wsprintf(szBuff3,"DDERR_TOOBIGHEIGHT "); + if (hRet == DDERR_TOOBIGSIZE ) wsprintf(szBuff3,"DDERR_TOOBIGSIZE "); + if (hRet == DDERR_TOOBIGWIDTH ) wsprintf(szBuff3,"DDERR_TOOBIGWIDTH "); + if (hRet == DDERR_UNSUPPORTED ) wsprintf(szBuff3,"DDERR_UNSUPPORTED "); + if (hRet == DDERR_UNSUPPORTEDFORMAT ) wsprintf(szBuff3,"DDERR_UNSUPPORTEDFORMAT "); + if (hRet == DDERR_UNSUPPORTEDMASK ) wsprintf(szBuff3,"DDERR_UNSUPPORTEDMASK "); + if (hRet == DDERR_UNSUPPORTEDMODE ) wsprintf(szBuff3,"DDERR_UNSUPPORTEDMODE "); + if (hRet == DDERR_VERTICALBLANKINPROGRESS ) wsprintf(szBuff3,"DDERR_VERTICALBLANKINPROGRESS "); + if (hRet == DDERR_VIDEONOTACTIVE ) wsprintf(szBuff3,"DDERR_VIDEONOTACTIVE "); + if (hRet == DDERR_WASSTILLDRAWING ) wsprintf(szBuff3,"DDERR_WASSTILLDRAWING "); + if (hRet == DDERR_WRONGMODE ) wsprintf(szBuff3,"DDERR_WRONGMODE "); + if (hRet == DDERR_XALIGN ) wsprintf(szBuff3,"DDERR_XALIGN "); + + wsprintf(szBuff2,"%s (%s)",szBuff,szBuff3); + + MessageBox(hWnd, szBuff2, "IanOut: A Post-Nuclear Ian-Playing Game", MB_OK); + PostMessage(hWnd, WM_CLOSE, 0, 0); + //DestroyWindow(hWnd); + va_end(vl); + return hRet; +} \ No newline at end of file diff --git a/IanOut/utils.h b/IanOut/utils.h new file mode 100644 index 0000000..57b563c --- /dev/null +++ b/IanOut/utils.h @@ -0,0 +1,44 @@ +#include "afx.h" + +#ifndef __utils_h +#define __utils_h + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +extern HRESULT InitFail(HWND hWnd, HRESULT hRet, LPCTSTR szError, ...); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +class TIniStr +{ +public: + TIniStr() + { + fname="";master="";slave="";buffer=""; + }; + virtual ~TIniStr() {}; + void Set(CString ifname, CString imaster, CString islave, CString ibuffer) + { + fname=ifname;master=imaster;slave=islave;buffer=ibuffer; + } + int FindIt(CString ifname, CString imaster, CString islave) + { + if ((ifname == fname) && (imaster == master) && (islave==slave)) return 0; else return 1; + } + CString Get() + { + return buffer; + } + +//private: + CString fname; + CString master; + CString slave; + CString buffer; +}; + +#endif // __utils_h \ No newline at end of file diff --git a/IanOut/version.txt b/IanOut/version.txt new file mode 100644 index 0000000..ddcd9b2 --- /dev/null +++ b/IanOut/version.txt @@ -0,0 +1,97 @@ +IanOut - A Post-Nuclear Ian-Playing Game + (gy.k: JánosKi - Egy Nukleáris háború utáni szerepjáték, melyben Jánossal kell játszani) + +-------------------------------------------------------------------------------------------------------------------- + +Jelenleg ismert hibák: +- Ha Ian (vagy bárki más) a pálya legtetejére, illetve legbaloldalra jut, akkor beragad, és tovább képtelen + mozogni +- Az emberek mozgása egy kicsit döcögős +- Nem érdemes játék közben visszamenni Windowsba, majd vissza, mert a játék már nem fog működni +- Rengeteg dolog még nem működik +- Osama Bin Laden ráunt a szexre + +IanOut v0.4a (2001. 11. 10-11) +- A version.txt (amit most olvasol) megszületése, és kitöltése +- Megváltozott intro +- Új (igényesebb) ikon +- 1 új kezdőképernyő (Kamarás Iván cigizik az úszó erődön (ha nem is azon, de legalább vízen)) +- A mozgás tökéletesítése +- Az NPC-k mozgásainak továbbfejlesztése +- A mozgó objektumok memóriakezelésének átírása (tizedannyi! memóriát fogyaszt) +- Gyorsabban betöltődik a program (az új memóriakezelés miatt) +- Néhány laikus számára láthatatlan, de a fejlődés szempontjából fontos fejlesztés +- Elkezdődött a IanEdit - A IanOut pályaszerkesztőjének a fejlesztése +- Tévedtem, megint fejleszteni kellett a betűk kezelését (mégse volt ő, ű betű) +- Most már papíron is megvan a forráskód. Hacsak nem történik tűzvész, ill. nem halok meg a project be fog fejeződni. +- Czehel már 16 éves + +IanOut v0.4 (2001. 11. 3-4) +- Egy rövidke kis (3 hónapos) szünet után megint újraindult a project +- Karaktergenerálás tökéletesre fejlesztve +- Az emberkkel már megint lehet rendesen lehet beszélgetni +- Új intro +- A betűk kezelését remélhetőleg végleg elkészítettem (most már van ő, ű betű) + +( - innentől nem vagyok biztos a helyes leírásban és dátumokban, ugyanis az emlékezetemre kell hagyatkoznom - ) + +IanOut v0.3c (második) (valamikor 2001. júliusában, vagy augusztusában) +- Winchesterhiba miatt vissza kellett térni a IanOut v0.3b-re +- A dumák kivételével u.a. mint az első 0.3c-s verzió, viszont + Az emberkkel már lehet Distract-olni (bár csak ilyen Guten Tag-szinten) +- Biztonsági másolat készítése CD-re winchesterhiba esetére +- Biztonsági másolat készítése lemezre winchesterhiba esetére. +- Biztonsági másolat készítése másik winchesterre winchesterhiba esetére. + +IanOut v0.3c (első) (valamikor 2001. júliusában) +- Karaktergenerálási képernyő +- Készítők listájának átírása +- Sok kis hiba kijavítása +- Szövegek és dumák elkészültek Magdikáig +- Lehet beszélgetni +- Már megint fejleszteni kellett a betűk kezelését + +IanOut v0.3a-b (valamikor 2001. május-június körül) +- Új főmenü +- Intro +- Gyorsabb rajzolóeljárás +- A betűk kezelésének továbbfejlesztése +- Kissebb hibajavítások +- Biztonsági másolat készítése CD-re + +IanOut v0.2 (valamikor 2001. május-június körül) +- Palettaanimációk +- A betű kezelésének teljes újraírása, több szín (piros és lila), valamint a számok rendes kezelése +- Falak, tárgyak, TageŠ-k stb. kezelése +- Készítők listája +- Kezdőképernyők (Please Wait, Loading, stb.) +- A file nevének átnevezése DDex4.exe-ből IanOut.exe-vé +- Új Ikon + +IanOut v0.15 (valamikor 2001.-ben május előtt) +- A hatszögletes pálya kezelése +- Mozgó objektumok (emberek, állatok, robtok, Ian stb.) kezelése +- A mozgás rendes beprogramozása +- Új betűszínek (fehér, zöld, kék, sárga) +- kissebb DDex4.exe +- Biztonsági másolat készítése CD-re + +IanOut v0.1 (valamikor 2001.-ben január és március között) +- Rendesen el vannak készítve az FRM betöltő, valamint kirajzoló eljárások +- Elkészültek az eredeti master.dat-ból hiányzó képek (főmenü, PipGirl, stb.) +- FallOut stílusú betűtípus (zöld) + +( - innentől biztos vagyok magamban - ) + +IanOut v0.0 (2001. január 4. (a téli szünet vége utáni második nap)) +- A ddex4 DirectDraw példaprogramból C++ nyelven elindult a FallOut egyetlen? teljes + átíratának az újrakészítése a IanOut. + +IanOut v0.0 (2001. január 4.) előtti események: +- Delphi 4.0, ban a DelphiX segítségével elindult a legeselegelső IanOut project, ami + egyrészt a DelphiX nehézkes kezelése, valamint egy winchesterhiba miatt leállt kb. + 2/3 évig, amikor is egy téliszünet utáni első napon Czehel megtalálta az eredeti + IanOut project kinyomtatott végigjátszását, miközben a Mortal Kombat billentyűzetkom- + binációját kereste. Ennek következtében indult újra a project. + +-------------------------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/IanOutEd/DDEX4.001 b/IanOutEd/DDEX4.001 new file mode 100644 index 0000000..0d2f41a --- /dev/null +++ b/IanOutEd/DDEX4.001 @@ -0,0 +1,262 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +!IF "$(CFG)" == "" +CFG=ddex4 - Win32 Debug +!MESSAGE No configuration specified. Defaulting to ddex4 - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "ddex4 - Win32 Release" && "$(CFG)" != "ddex4 - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "ddex4.mak" CFG="ddex4 - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ddex4 - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "ddex4 - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "ddex4 - Win32 Debug" +MTL=mktyplib.exe +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ddex4 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "$(OUTDIR)\ddex4.exe" + +CLEAN : + -@erase "$(INTDIR)\ddex4.obj" + -@erase "$(INTDIR)\ddex4.res" + -@erase "$(INTDIR)\ddutil.obj" + -@erase "$(OUTDIR)\ddex4.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D\ + "_WINDOWS" /Fp"$(INTDIR)/ddex4.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Release/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/ddex4.res" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/ddex4.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 dxguid.lib ddraw.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386 +LINK32_FLAGS=dxguid.lib ddraw.lib kernel32.lib user32.lib gdi32.lib\ + winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib\ + uuid.lib /nologo /subsystem:windows /incremental:no\ + /pdb:"$(OUTDIR)/ddex4.pdb" /machine:I386 /out:"$(OUTDIR)/ddex4.exe" +LINK32_OBJS= \ + "$(INTDIR)\ddex4.obj" \ + "$(INTDIR)\ddex4.res" \ + "$(INTDIR)\ddutil.obj" + +"$(OUTDIR)\ddex4.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "ddex4 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\Debug +INTDIR=.\Debug + +ALL : "$(OUTDIR)\ddex4.exe" + +CLEAN : + -@erase "$(INTDIR)\ddex4.obj" + -@erase "$(INTDIR)\ddex4.res" + -@erase "$(INTDIR)\ddutil.obj" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(OUTDIR)\ddex4.exe" + -@erase "$(OUTDIR)\ddex4.ilk" + -@erase "$(OUTDIR)\ddex4.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D\ + "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/ddex4.pch" /YX /Fo"$(INTDIR)/"\ + /Fd"$(INTDIR)/" /c +CPP_OBJS=.\Debug/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/ddex4.res" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/ddex4.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 +# ADD LINK32 dxguid.lib ddraw.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 +LINK32_FLAGS=dxguid.lib ddraw.lib kernel32.lib user32.lib gdi32.lib\ + winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib\ + uuid.lib /nologo /subsystem:windows /incremental:yes\ + /pdb:"$(OUTDIR)/ddex4.pdb" /debug /machine:I386 /out:"$(OUTDIR)/ddex4.exe" +LINK32_OBJS= \ + "$(INTDIR)\ddex4.obj" \ + "$(INTDIR)\ddex4.res" \ + "$(INTDIR)\ddutil.obj" + +"$(OUTDIR)\ddex4.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "ddex4 - Win32 Release" +# Name "ddex4 - Win32 Debug" + +!IF "$(CFG)" == "ddex4 - Win32 Release" + +!ELSEIF "$(CFG)" == "ddex4 - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\ddex4.cpp +DEP_CPP_DDEX4=\ + "..\..\include\ddutil.h"\ + ".\resource.h"\ + + +"$(INTDIR)\ddex4.obj" : $(SOURCE) $(DEP_CPP_DDEX4) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\ddex4.rc +DEP_RSC_DDEX4_=\ + ".\ALL.BMP"\ + ".\resource.h"\ + + +"$(INTDIR)\ddex4.res" : $(SOURCE) $(DEP_RSC_DDEX4_) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\ddutil.cpp +DEP_CPP_DDUTI=\ + "..\..\include\ddutil.h"\ + + +"$(INTDIR)\ddutil.obj" : $(SOURCE) $(DEP_CPP_DDUTI) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\ddutil.h + +!IF "$(CFG)" == "ddex4 - Win32 Release" + +!ELSEIF "$(CFG)" == "ddex4 - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\resource.h + +!IF "$(CFG)" == "ddex4 - Win32 Release" + +!ELSEIF "$(CFG)" == "ddex4 - Win32 Debug" + +!ENDIF + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/IanOutEd/DDEX4.DEF b/IanOutEd/DDEX4.DEF new file mode 100644 index 0000000..ac66347 --- /dev/null +++ b/IanOutEd/DDEX4.DEF @@ -0,0 +1,10 @@ +NAME ddex4.exe + +DESCRIPTION 'Direct Draw Example Program 4 (C) Microsoft 1995-1999' + +SECTIONS + .bss READ WRITE + .data READ WRITE + .idata READ WRITE + .rdata READ WRITE + .rsrc READ WRITE diff --git a/IanOutEd/DDEX4.DSW b/IanOutEd/DDEX4.DSW new file mode 100644 index 0000000..a16c47a --- /dev/null +++ b/IanOutEd/DDEX4.DSW @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "ddex4"=.\ddex4.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/IanOutEd/DDEX4.MAK b/IanOutEd/DDEX4.MAK new file mode 100644 index 0000000..0d2f41a --- /dev/null +++ b/IanOutEd/DDEX4.MAK @@ -0,0 +1,262 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +!IF "$(CFG)" == "" +CFG=ddex4 - Win32 Debug +!MESSAGE No configuration specified. Defaulting to ddex4 - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "ddex4 - Win32 Release" && "$(CFG)" != "ddex4 - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "ddex4.mak" CFG="ddex4 - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ddex4 - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "ddex4 - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "ddex4 - Win32 Debug" +MTL=mktyplib.exe +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ddex4 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "$(OUTDIR)\ddex4.exe" + +CLEAN : + -@erase "$(INTDIR)\ddex4.obj" + -@erase "$(INTDIR)\ddex4.res" + -@erase "$(INTDIR)\ddutil.obj" + -@erase "$(OUTDIR)\ddex4.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D\ + "_WINDOWS" /Fp"$(INTDIR)/ddex4.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Release/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/ddex4.res" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/ddex4.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 dxguid.lib ddraw.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386 +LINK32_FLAGS=dxguid.lib ddraw.lib kernel32.lib user32.lib gdi32.lib\ + winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib\ + uuid.lib /nologo /subsystem:windows /incremental:no\ + /pdb:"$(OUTDIR)/ddex4.pdb" /machine:I386 /out:"$(OUTDIR)/ddex4.exe" +LINK32_OBJS= \ + "$(INTDIR)\ddex4.obj" \ + "$(INTDIR)\ddex4.res" \ + "$(INTDIR)\ddutil.obj" + +"$(OUTDIR)\ddex4.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "ddex4 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\Debug +INTDIR=.\Debug + +ALL : "$(OUTDIR)\ddex4.exe" + +CLEAN : + -@erase "$(INTDIR)\ddex4.obj" + -@erase "$(INTDIR)\ddex4.res" + -@erase "$(INTDIR)\ddutil.obj" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(OUTDIR)\ddex4.exe" + -@erase "$(OUTDIR)\ddex4.ilk" + -@erase "$(OUTDIR)\ddex4.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D\ + "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/ddex4.pch" /YX /Fo"$(INTDIR)/"\ + /Fd"$(INTDIR)/" /c +CPP_OBJS=.\Debug/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/ddex4.res" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/ddex4.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 +# ADD LINK32 dxguid.lib ddraw.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 +LINK32_FLAGS=dxguid.lib ddraw.lib kernel32.lib user32.lib gdi32.lib\ + winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib\ + uuid.lib /nologo /subsystem:windows /incremental:yes\ + /pdb:"$(OUTDIR)/ddex4.pdb" /debug /machine:I386 /out:"$(OUTDIR)/ddex4.exe" +LINK32_OBJS= \ + "$(INTDIR)\ddex4.obj" \ + "$(INTDIR)\ddex4.res" \ + "$(INTDIR)\ddutil.obj" + +"$(OUTDIR)\ddex4.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "ddex4 - Win32 Release" +# Name "ddex4 - Win32 Debug" + +!IF "$(CFG)" == "ddex4 - Win32 Release" + +!ELSEIF "$(CFG)" == "ddex4 - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\ddex4.cpp +DEP_CPP_DDEX4=\ + "..\..\include\ddutil.h"\ + ".\resource.h"\ + + +"$(INTDIR)\ddex4.obj" : $(SOURCE) $(DEP_CPP_DDEX4) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\ddex4.rc +DEP_RSC_DDEX4_=\ + ".\ALL.BMP"\ + ".\resource.h"\ + + +"$(INTDIR)\ddex4.res" : $(SOURCE) $(DEP_RSC_DDEX4_) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\ddutil.cpp +DEP_CPP_DDUTI=\ + "..\..\include\ddutil.h"\ + + +"$(INTDIR)\ddutil.obj" : $(SOURCE) $(DEP_CPP_DDUTI) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\ddutil.h + +!IF "$(CFG)" == "ddex4 - Win32 Release" + +!ELSEIF "$(CFG)" == "ddex4 - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\resource.h + +!IF "$(CFG)" == "ddex4 - Win32 Release" + +!ELSEIF "$(CFG)" == "ddex4 - Win32 Debug" + +!ENDIF + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/IanOutEd/DDEX4.PLG b/IanOutEd/DDEX4.PLG new file mode 100644 index 0000000..896e9ee --- /dev/null +++ b/IanOutEd/DDEX4.PLG @@ -0,0 +1,37 @@ + + +
+

Build Log

+

+--------------------Configuration: ddex4 - Win32 Release-------------------- +

+

Command Lines

+Creating temporary file "C:\DOCUME~1\sztupy\LOCALS~1\Temp\RSP195.tmp" with contents +[ +/nologo /MD /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Fp".\Release/ddex4.pch" /YX /Fo".\Release/" /Fd".\Release/" /FD /c +"E:\IanOutEd\ddex4.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\sztupy\LOCALS~1\Temp\RSP195.tmp" +Creating temporary file "C:\DOCUME~1\sztupy\LOCALS~1\Temp\RSP196.tmp" with contents +[ +dxguid.lib ddraw.lib dinput.lib /nologo /subsystem:windows /incremental:no /pdb:".\Release/IanEd.pdb" /machine:I386 /out:".\IanEd.exe" +.\Release\ddex4.obj +.\Release\ddutil.obj +.\Release\ItemObj.obj +.\Release\utils.obj +.\Release\FRMGraph.obj +.\Release\ddex4.res +] +Creating command line "link.exe @C:\DOCUME~1\sztupy\LOCALS~1\Temp\RSP196.tmp" +

Output Window

+Compiling... +ddex4.cpp +Linking... + + + +

Results

+IanEd.exe - 0 error(s), 0 warning(s) +
+ + diff --git a/IanOutEd/DDUTIL.CPP b/IanOutEd/DDUTIL.CPP new file mode 100644 index 0000000..588e2fb --- /dev/null +++ b/IanOutEd/DDUTIL.CPP @@ -0,0 +1,395 @@ +//----------------------------------------------------------------------------- +// File: ddutil.cpp +// +// Desc: Routines for loading bitmap and palettes from resources +// +// +// Copyright (c) 1995-1999 Microsoft Corporation. All rights reserved. +//----------------------------------------------------------------------------- + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +//----------------------------------------------------------------------------- +// Include files +//----------------------------------------------------------------------------- +#include "ddutil.h" +#include +#include +#include +#include + +extern "C" +HRESULT BlitTo(LPDIRECTDRAWSURFACE7 Blit,int Sx1, int Sy1, int Sx2, int Sy2, int Dx, int Dy, DWORD flags, LPDIRECTDRAWSURFACE7 surf) +{ + DDBLTFX ddbltfx; + RECT rcRect; + HRESULT hRet; + int iw1; + int iw2; + int BltX; + int BltY; + + hRet = DD_OK; + ZeroMemory(&ddbltfx, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(ddbltfx); + ddbltfx.dwFillColor = 0; + + rcRect.left = Sx1; + rcRect.top = Sy1; + rcRect.right = Sx2; + rcRect.bottom = Sy2; + + iw1 = Sx2-Sx1; + iw2 = Sy2-Sy1; + + BltX = Dx; + BltY = Dy; + + if (!((Dx>640) || (Dy>480) || (Dx+iw1<0) || (Dy+iw2<0))) + { + if (Dx+iw1>640) {iw1 = iw1-(Dx+iw1-640);} + if (Dy+iw2>480) {iw2 = iw2-(Dy+iw2-480);} + + Sx2 = Sx1+iw1; + Sy2 = Sy1+iw2; + + if (Dx<0) { Sx1+=(-Dx);BltX=0;} + if (Dy<0) { Sy1+=(-Dy);BltY=0;} + + rcRect.left = Sx1; + rcRect.top = Sy1; + rcRect.right = Sx2; + rcRect.bottom = Sy2; + + + while (TRUE) + { + hRet = Blit->BltFast(BltX,BltY,surf,&rcRect,flags); + + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + // hRet = RestoreAll();if (hRet != DD_OK) + return hRet; + } + if (hRet != DDERR_WASSTILLDRAWING) + return hRet; + } + if (hRet != DD_OK) + return hRet; + } + + return hRet; +} + +extern "C" +void ClearSurface(LPDIRECTDRAWSURFACE7 Surf, int r, int g, int b) +{ + DDBLTFX ddbltfx; + + ZeroMemory(&ddbltfx, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(ddbltfx); + ddbltfx.dwFillColor = RGB(r,g,b); + Surf->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); +} + +//----------------------------------------------------------------------------- +// Name: DDLoadBitmap() +// Desc: Create a DirectDrawSurface from a bitmap resource. +//----------------------------------------------------------------------------- +extern "C" IDirectDrawSurface7 * +DDLoadBitmap(IDirectDraw7 * pdd, LPCSTR szBitmap, int dx, int dy, HRESULT *hRet, const long caps ) +{ + HBITMAP hbm; + BITMAP bm; + DDSURFACEDESC2 ddsd; + IDirectDrawSurface7 *pdds; + + // + // Try to load the bitmap as a resource, if that fails, try it as a file + // + *hRet = DDERR_NOTLOADED; + + hbm = (HBITMAP) LoadImage(GetModuleHandle(NULL), szBitmap, IMAGE_BITMAP, dx, + dy, LR_CREATEDIBSECTION); + if (hbm == NULL) + hbm = (HBITMAP) LoadImage(NULL, szBitmap, IMAGE_BITMAP, dx, dy, + LR_LOADFROMFILE | LR_CREATEDIBSECTION); + if (hbm == NULL) + return NULL; + // + // Get size of the bitmap + // + GetObject(hbm, sizeof(bm), &bm); + // + // Create a DirectDrawSurface for this bitmap + // + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + ddsd.ddsCaps.dwCaps = caps; + ddsd.dwWidth = bm.bmWidth; + ddsd.dwHeight = bm.bmHeight; + if (( *hRet = pdd->CreateSurface(&ddsd, &pdds, NULL) ) != DD_OK) + return NULL; + DDCopyBitmap(pdds, hbm, 0, 0, 0, 0); + DeleteObject(hbm); + return pdds; +} + + + + +//----------------------------------------------------------------------------- +// Name: DDReLoadBitmap() +// Desc: Load a bitmap from a file or resource into a directdraw surface. +// normaly used to re-load a surface after a restore. +//----------------------------------------------------------------------------- +HRESULT +DDReLoadBitmap(IDirectDrawSurface7 * pdds, LPCSTR szBitmap) +{ + HBITMAP hbm; + HRESULT hr; + + // + // Try to load the bitmap as a resource, if that fails, try it as a file + // + hbm = (HBITMAP) LoadImage(GetModuleHandle(NULL), szBitmap, IMAGE_BITMAP, 0, + 0, LR_CREATEDIBSECTION); + if (hbm == NULL) + hbm = (HBITMAP) LoadImage(NULL, szBitmap, IMAGE_BITMAP, 0, 0, + LR_LOADFROMFILE | LR_CREATEDIBSECTION); + if (hbm == NULL) + { + OutputDebugString("handle is null\n"); + return E_FAIL; + } + hr = DDCopyBitmap(pdds, hbm, 0, 0, 0, 0); + if (hr != DD_OK) + { + OutputDebugString("ddcopybitmap failed\n"); + } + DeleteObject(hbm); + return hr; +} + + + + +//----------------------------------------------------------------------------- +// Name: DDCopyBitmap() +// Desc: Draw a bitmap into a DirectDrawSurface +//----------------------------------------------------------------------------- +extern "C" HRESULT +DDCopyBitmap(IDirectDrawSurface7 * pdds, HBITMAP hbm, int x, int y, + int dx, int dy) +{ + HDC hdcImage; + HDC hdc; + BITMAP bm; + DDSURFACEDESC2 ddsd; + HRESULT hr; + + if (hbm == NULL || pdds == NULL) + return E_FAIL; + // + // Make sure this surface is restored. + // + pdds->Restore(); + // + // Select bitmap into a memoryDC so we can use it. + // + hdcImage = CreateCompatibleDC(NULL); + if (!hdcImage) + OutputDebugString("createcompatible dc failed\n"); + SelectObject(hdcImage, hbm); + // + // Get size of the bitmap + // + GetObject(hbm, sizeof(bm), &bm); + dx = dx == 0 ? bm.bmWidth : dx; // Use the passed size, unless zero + dy = dy == 0 ? bm.bmHeight : dy; + // + // Get size of surface. + // + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_HEIGHT | DDSD_WIDTH; + pdds->GetSurfaceDesc(&ddsd); + + if ((hr = pdds->GetDC(&hdc)) == DD_OK) + { + StretchBlt(hdc, 0, 0, ddsd.dwWidth, ddsd.dwHeight, hdcImage, x, y, + dx, dy, SRCCOPY); + pdds->ReleaseDC(hdc); + } + DeleteDC(hdcImage); + return hr; +} + + + + +//----------------------------------------------------------------------------- +// Name: DDLoadPalette() +// Desc: Create a DirectDraw palette object from a bitmap resource +// if the resource does not exist or NULL is passed create a +// default 332 palette. +//----------------------------------------------------------------------------- +extern "C" IDirectDrawPalette * +DDLoadPalette(IDirectDraw7 * pdd, LPCSTR szBitmap) +{ + IDirectDrawPalette *ddpal; + int i; + int n; + int fh; + HRSRC h; + LPBITMAPINFOHEADER lpbi; + PALETTEENTRY ape[256]; + RGBQUAD *prgb; + + // + // Build a 332 palette as the default. + // + for (i = 0; i < 256; i++) + { + ape[i].peRed = (BYTE) (((i >> 5) & 0x07) * 255 / 7); + ape[i].peGreen = (BYTE) (((i >> 2) & 0x07) * 255 / 7); + ape[i].peBlue = (BYTE) (((i >> 0) & 0x03) * 255 / 3); + ape[i].peFlags = (BYTE) 0; + } + // + // Get a pointer to the bitmap resource. + // + if (szBitmap && (h = FindResource(NULL, szBitmap, RT_BITMAP))) + { + lpbi = (LPBITMAPINFOHEADER) LockResource(LoadResource(NULL, h)); + if (!lpbi) + OutputDebugString("lock resource failed\n"); + prgb = (RGBQUAD *) ((BYTE *) lpbi + lpbi->biSize); + if (lpbi == NULL || lpbi->biSize < sizeof(BITMAPINFOHEADER)) + n = 0; + else if (lpbi->biBitCount > 8) + n = 0; + else if (lpbi->biClrUsed == 0) + n = 1 << lpbi->biBitCount; + else + n = lpbi->biClrUsed; + // + // A DIB color table has its colors stored BGR not RGB + // so flip them around. + // + for (i = 0; i < n; i++) + { + ape[i].peRed = prgb[i].rgbRed; + ape[i].peGreen = prgb[i].rgbGreen; + ape[i].peBlue = prgb[i].rgbBlue; + ape[i].peFlags = 0; + } + } + else if (szBitmap && (fh = _lopen(szBitmap, OF_READ)) != -1) + { + BITMAPFILEHEADER bf; + BITMAPINFOHEADER bi; + + _lread(fh, &bf, sizeof(bf)); + _lread(fh, &bi, sizeof(bi)); + _lread(fh, ape, sizeof(ape)); + _lclose(fh); + if (bi.biSize != sizeof(BITMAPINFOHEADER)) + n = 0; + else if (bi.biBitCount > 8) + n = 0; + else if (bi.biClrUsed == 0) + n = 1 << bi.biBitCount; + else + n = bi.biClrUsed; + // + // A DIB color table has its colors stored BGR not RGB + // so flip them around. + // + for (i = 0; i < n; i++) + { + BYTE r = ape[i].peRed; + + ape[i].peRed = ape[i].peBlue; + ape[i].peBlue = r; + } + } + pdd->CreatePalette(DDPCAPS_8BIT, ape, &ddpal, NULL); + return ddpal; +} + + + + +//----------------------------------------------------------------------------- +// Name: DDColorMatch() +// Desc: Convert a RGB color to a pysical color. +// We do this by leting GDI SetPixel() do the color matching +// then we lock the memory and see what it got mapped to. +//----------------------------------------------------------------------------- +extern "C" DWORD +DDColorMatch(IDirectDrawSurface7 * pdds, COLORREF rgb) +{ + COLORREF rgbT; + HDC hdc; + DWORD dw = CLR_INVALID; + DDSURFACEDESC2 ddsd; + HRESULT hres; + + // + // Use GDI SetPixel to color match for us + // + if (rgb != CLR_INVALID && pdds->GetDC(&hdc) == DD_OK) + { + rgbT = GetPixel(hdc, 0, 0); // Save current pixel value + SetPixel(hdc, 0, 0, rgb); // Set our value + pdds->ReleaseDC(hdc); + } + // + // Now lock the surface so we can read back the converted color + // + ddsd.dwSize = sizeof(ddsd); + while ((hres = pdds->Lock(NULL, &ddsd, 0, NULL)) == DDERR_WASSTILLDRAWING) + ; + if (hres == DD_OK) + { + dw = *(DWORD *) ddsd.lpSurface; // Get DWORD + if (ddsd.ddpfPixelFormat.dwRGBBitCount < 32) + dw &= (1 << ddsd.ddpfPixelFormat.dwRGBBitCount) - 1; // Mask it to bpp + pdds->Unlock(NULL); + } + // + // Now put the color that was there back. + // + if (rgb != CLR_INVALID && pdds->GetDC(&hdc) == DD_OK) + { + SetPixel(hdc, 0, 0, rgbT); + pdds->ReleaseDC(hdc); + } + return dw; +} + + + + +//----------------------------------------------------------------------------- +// Name: DDSetColorKey() +// Desc: Set a color key for a surface, given a RGB. +// If you pass CLR_INVALID as the color key, the pixel +// in the upper-left corner will be used. +//----------------------------------------------------------------------------- +extern "C" HRESULT +DDSetColorKey(IDirectDrawSurface7 * pdds, COLORREF rgb) +{ + DDCOLORKEY ddck; + + ddck.dwColorSpaceLowValue = DDColorMatch(pdds, rgb); + ddck.dwColorSpaceHighValue = ddck.dwColorSpaceLowValue; + return pdds->SetColorKey(DDCKEY_SRCBLT, &ddck); +} + + diff --git a/IanOutEd/DDUTIL.H b/IanOutEd/DDUTIL.H new file mode 100644 index 0000000..3676c1c --- /dev/null +++ b/IanOutEd/DDUTIL.H @@ -0,0 +1,30 @@ +/*========================================================================== + * + * Copyright (C) 1998-1999 Microsoft Corporation. All Rights Reserved. + * + * File: ddutil.cpp + * Content: Routines for loading bitmap and palettes from resources + * + ***************************************************************************/ +#ifndef __ddutil_h +#define __ddutil_h + +#include "ddraw.h" + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +extern IDirectDrawPalette *DDLoadPalette(IDirectDraw7 *pdd, LPCSTR szBitmap); +extern IDirectDrawSurface7 *DDLoadBitmap(IDirectDraw7 *pdd, LPCSTR szBitmap, int dx, int dy, HRESULT *hRet, const long caps); +extern HRESULT DDReLoadBitmap(IDirectDrawSurface7 *pdds, LPCSTR szBitmap); +extern HRESULT DDCopyBitmap(IDirectDrawSurface7 *pdds, HBITMAP hbm, int x, int y, int dx, int dy); +extern DWORD DDColorMatch(IDirectDrawSurface7 *pdds, COLORREF rgb); +extern HRESULT DDSetColorKey(IDirectDrawSurface7 *pdds, COLORREF rgb); +extern HRESULT BlitTo(LPDIRECTDRAWSURFACE7 Blit,int Sx1, int Sy1, int Sx2, int Sy2, int Dx, int Dy, DWORD flags, LPDIRECTDRAWSURFACE7 surf); +extern void ClearSurface(LPDIRECTDRAWSURFACE7 Surf, int r, int g, int b); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif \ No newline at end of file diff --git a/IanOutEd/Ddex4.cpp b/IanOutEd/Ddex4.cpp new file mode 100644 index 0000000..552957c --- /dev/null +++ b/IanOutEd/Ddex4.cpp @@ -0,0 +1,6 @@ +#include "ddex4_1.h" +#include "ddex4_2.h" +#include "ddex4_f.h" +#include "ddex4_u.h" +#include "ddex4_i.h" + diff --git a/IanOutEd/DirectX.ico b/IanOutEd/DirectX.ico new file mode 100644 index 0000000..e4588bf Binary files /dev/null and b/IanOutEd/DirectX.ico differ diff --git a/IanOutEd/FRMGr_1.h b/IanOutEd/FRMGr_1.h new file mode 100644 index 0000000..891faac --- /dev/null +++ b/IanOutEd/FRMGr_1.h @@ -0,0 +1,138 @@ +// --- TFRMAnim --- +// +// ---------------- + +int TFRMAnim::LoadFRM(int stream, LPVOID LoadIn, int x, int y, int p) +{ + LPSTR PointTo; + int i; + + PointTo = (LPSTR)LoadIn; + for (i=0; iInsert( new TFRM() ); + + FRMDat = (PFRM)(FRMList->FLast); + hRet = g_pDD->CreateSurface(&ddsd, &FRMDat->FRM, NULL); + if (hRet != DD_OK) return hRet; + + FRMDat->FRM->Lock(NULL, &ddsd, 0 , NULL); + LoadFRM(stream, ddsd.lpSurface, ddsd.dwWidth, ddsd.dwHeight, ddsd.lPitch); + FRMDat->FRM->Unlock(NULL); + + FRMDat->x = x; + FRMDat->y = y; + + FRMDat->bx = movetabl[i-1][0]; + FRMDat->by = movetabl[i-1][1]; + + + DDSetColorKey(FRMDat->FRM, RGB(0,0,0)); + + //FRMList->Insert( FRMDat ); + } + +/* Counter = (FRMList->FLast);*/ + Counter = FRMList->First(); + + _close(stream); + + return DD_OK; +} + + +void TFRMAnim::NextFrame() +{ + Counter = FRMList->RNext(Counter); +} + +PFRM TFRMAnim::GetCurFrame() +{ + PFRM Lista; + Lista = (PFRM)Counter; + return Lista; +} + +TFRMAnim::~TFRMAnim() +{ + if (FRMList) + { + PFRM Lista; + Lista = (PFRM)FRMList->First(); + while (Lista) + { + Lista->FRM->Release(); + Lista = (PFRM)FRMList->Next(Lista); + } + delete FRMList; + } + +} diff --git a/IanOutEd/FRMGr_2.h b/IanOutEd/FRMGr_2.h new file mode 100644 index 0000000..328f2b0 --- /dev/null +++ b/IanOutEd/FRMGr_2.h @@ -0,0 +1,154 @@ +// --- TFRMAnim6 --- +// +// ----------------- + +TFRMAnim6::~TFRMAnim6() +{ + int i; + for (i=0; i<6; i++) + { + if (FRMList6[i]) + { + PFRM Lista; + Lista = (PFRM)FRMList6[i]->First(); + while (Lista) + { + Lista->FRM->Release(); + Lista = (PFRM)FRMList6[i]->Next(Lista); + } + delete FRMList6[i]; + } + } +} + +TFRMAnim6::TFRMAnim6() +{ + int i; + for (i=0; i<6; i++) + { + FRMList6[i] = new TList(); + } +} + +HRESULT TFRMAnim6::Load(HWND hWnd, LPDIRECTDRAW7 g_pDD,char* filename) +{ + char buf[100]; + unsigned char framedat[12]; + unsigned char framecount[2]; + DDSURFACEDESC2 ddsd; + HRESULT hRet; + PFRM FRMDat; + int stream; + int stream2; + char filename2[100]; + signed short movetabl[100][2]; + int x, y; + int i,i2; + + wsprintf(filename2,"%s",filename); + i = lstrlen(filename2); + filename2[i-1] = 'p'; + filename2[i-2] = 's'; + filename2[i-3] = 'h'; + + if ((stream2 = _open( filename2,_O_BINARY)) == -1) + return InitFail(hWnd,DDERR_NOTLOADED,"File open error: %s",filename2); + + _read(stream2,movetabl,sizeof(movetabl)); + _close(stream2); + + if ((stream = _open( filename,_O_BINARY)) == -1) + return InitFail(hWnd,DDERR_NOTLOADED,"File open error: %s",filename); + + _read(stream,buf,9); + _read(stream,framecount,1); + _read(stream,buf,52); + framecounter = framecount[0]; + for (i2=0; i2<6; i2++) + for (i=1; i<=framecount[0]; i++) + { + _read(stream,framedat,12); + x=framedat[0]*256+framedat[1]; + y=framedat[2]*256+framedat[3]; + + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PITCH; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN /*| DDSCAPS_SYSTEMMEMORY */; + + ddsd.dwWidth = x; + ddsd.dwHeight = y; + ddsd.lPitch = x; + + FRMList6[i2]->Insert( new TFRM() ); + + FRMDat = (PFRM)(FRMList6[i2]->FLast); + hRet = g_pDD->CreateSurface(&ddsd, &FRMDat->FRM, NULL); + if (hRet != DD_OK) return hRet; + + FRMDat->FRM->Lock(NULL, &ddsd, 0 , NULL); + LoadFRM(stream, ddsd.lpSurface, ddsd.dwWidth, ddsd.dwHeight, ddsd.lPitch); + FRMDat->FRM->Unlock(NULL); + + FRMDat->x = x; + FRMDat->y = y; + + FRMDat->bx = movetabl[i2*framecount[0]+i-1][0]; + FRMDat->by = movetabl[i2*framecount[0]+i-1][1]; + + DDSetColorKey(FRMDat->FRM, RGB(0,0,0)); + + } + + for (i2=0; i2<6; i2++) Counter6[i2] = FRMList6[i2]->First(); + dir = 0; + + _close(stream); + + return DD_OK; +} + +void TFRMAnim6::FirstFrame() +{ + int i2; + for (i2=0; i2<6; i2++) { Counter6[i2] = FRMList6[i2]->First(); } +} + +void TFRMAnim6::NextFrame() +{ + Counter6[dir] = FRMList6[dir]->RNext(Counter6[dir]); +} + +PFRM TFRMAnim6::GetCurFrame() +{ + PFRM Lista; + Lista = (PFRM)Counter6[dir]; + return Lista; +} + +void TFRMAnim6::SetDir(int i_dir) +{ + dir = i_dir; +} + +/* - TFRMCommunicator - */ + +TFRMCommunicator::TFRMCommunicator(PFRMAnim6 FRMAssign) +{ + Animation = FRMAssign; + dir = 0; + FirstFrame(); +} + +void TFRMCommunicator::FirstFrame() +{ + int i2; + for (i2=0; i2<6; i2++) { Count6[i2] = Animation->FRMList6[i2]->First(); } +} + +PFRM TFRMCommunicator::GetCurFrame() +{ + PFRM Lista; + Lista = (PFRM)Count6[dir]; + return Lista; +} diff --git a/IanOutEd/FRMGr_3.h b/IanOutEd/FRMGr_3.h new file mode 100644 index 0000000..3cb250d --- /dev/null +++ b/IanOutEd/FRMGr_3.h @@ -0,0 +1,304 @@ +// --- TFRMSingle --- +// +// ------------------ + +HRESULT TFRMSingle::Load(HWND hWnd, LPDIRECTDRAW7 g_pDD, char* filename, int framenum) +{ + char buf[100]; + char buf2[50]; + unsigned char framedat[12]; + DDSURFACEDESC2 ddsd; + HRESULT hRet; + int stream; + int x, y; + int i; + LPVOID ize; + + wsprintf(buf2,"%s",filename); + wsprintf(fname,"%s",filename); + + if ((stream = _open( buf2,_O_BINARY)) == -1) + return InitFail(hWnd,DDERR_NOTLOADED,"File open error: %s",buf2); + + _read(stream,buf,62); + + for (i=1; i<=framenum; i++) + { + _read(stream,framedat,12); + x=framedat[0]*256+framedat[1]; + y=framedat[2]*256+framedat[3]; + if (i!=framenum) { + ize = malloc(x*y); + LoadFRM(stream,ize,x,y,x); + free(ize); + } + } + + //wsprintf( buf, "(%d, %d) %d %d %d %d", + // x,y,framedat[0],framedat[1],framedat[2],framedat[3]); + + //MessageBox(hWnd, buf, "Hiba", MB_OK); + + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PITCH; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN /*| DDSCAPS_SYSTEMMEMORY */; + + ddsd.dwWidth = x; + ddsd.dwHeight = y; + ddsd.lPitch = x; + + if (FRM) {FRM->FRM->Release();delete FRM;}; + + FRM = new TFRM(); + + hRet = g_pDD->CreateSurface(&ddsd, &FRM->FRM, NULL); + if (hRet != DD_OK) return hRet; + + FRM->FRM->Lock(NULL, &ddsd, 0 , NULL); + LoadFRM(stream, ddsd.lpSurface, ddsd.dwWidth, ddsd.dwHeight, ddsd.lPitch); + FRM->FRM->Unlock(NULL); + + FRM->x = x; + FRM->y = y; + + DDSetColorKey(FRM->FRM, RGB(0,0,0)); + + _close(stream); + + return DD_OK; +} + + +int TFRMSingle::LoadFRM(int stream, LPVOID LoadIn, int x, int y, int p) +{ + LPSTR PointTo; + int i; + + PointTo = (LPSTR)LoadIn; + for (i=0; iLoad(hWnd,g_pDD,buf,1); + if (hRet!=DD_OK) return InitFail(hWnd,hRet,"ERROR"); + + } + + fclose(stre); + return DD_OK; +} + +TIanMap::~TIanMap() +{ + int x; + for (x=0; x<10; x++) + { + if (Tiles[x]) + { + delete Tiles[x]; + } + } +} + + +// --- TIanWall --- +// +// ---------------- + +HRESULT TIanWall::LoadMap(HWND hWnd,char* filename) +{ + int x,y; + int stream; + + if ((stream = _open(filename,_O_BINARY)) == -1) + return InitFail(hWnd,DDERR_NOTLOADED,"LoadWall FAILED"); + + for (x=0; x<171; x++) + for (y=0; y<151; y++) + { + _read(stream,&Map[x][y],1); + } + _close(stream); + return DD_OK; +} + +HRESULT TIanWall::LoadWalls(HWND hWnd, LPDIRECTDRAW7 g_pDD) +{ + int x; + HRESULT hRet; + FILE* stre; + int numb = 0; + char buf[50]; + + hRet= DD_OK; + stre = fopen("master.dat\\proto\\walls.pro","r"); + if (stre == NULL) + return InitFail(hWnd,DDERR_NOTLOADED,"LoadMap FAILED"); + + wsprintf(buf,"d"); + fscanf(stre,"%i",&numb); + + for (x=0; x<50; x++) + { + if (xLoad(hWnd,g_pDD,buf,1); + if (hRet!=DD_OK) return InitFail(hWnd,hRet,"ERROR"); + + } + + fclose(stre); + return DD_OK; +} + +TIanWall::~TIanWall() +{ + int x; + for (x=0; x<50; x++) + { + if (Tiles[x]) + { + delete Tiles[x]; + } + } +} + +// --- TIanItems --- +// +// ----------------- + +HRESULT TIanItems::LoadMap(HWND hWnd,char* filename) +{ + int x,y; + int stream; + + if ((stream = _open(filename,_O_BINARY)) == -1) + return InitFail(hWnd,DDERR_NOTLOADED,"LoadItems FAILED"); + + for (x=0; x<171; x++) + for (y=0; y<151; y++) + { + _read(stream,&Map[x][y],1); + } + _close(stream); + return DD_OK; +} + +HRESULT TIanItems::LoadItems(HWND hWnd, LPDIRECTDRAW7 g_pDD) +{ + int x; + HRESULT hRet; + FILE* stre; + int numb = 0; + char buf[50]; + + hRet= DD_OK; + stre = fopen("master.dat\\proto\\items.pro","r"); + if (stre == NULL) + return InitFail(hWnd,DDERR_NOTLOADED,"LoadMap FAILED"); + + wsprintf(buf,"d"); + fscanf(stre,"%i",&numb); + + for (x=0; x<50; x++) + { + if (xLoad(hWnd,g_pDD,buf,1); + if (hRet!=DD_OK) return InitFail(hWnd,hRet,"ERROR"); + + } + + fclose(stre); + return DD_OK; +} + +TIanItems::~TIanItems() +{ + int x; + for (x=0; x<50; x++) + { + if (Tiles[x]) + { + delete Tiles[x]; + } + } +} diff --git a/IanOutEd/FRMGraph.cpp b/IanOutEd/FRMGraph.cpp new file mode 100644 index 0000000..2a8354f --- /dev/null +++ b/IanOutEd/FRMGraph.cpp @@ -0,0 +1,289 @@ +#include "FRMGraph.h" +#include "io.h" +#include +#include "ddutil.h" +#include "utils.h" +#include "math.h" + +#include "FRMGr_1.h" +#include "FRMGr_2.h" +#include "FRMGr_3.h" + +// --- TFRMPlayer --- +// +// ------------------ + +void TFRMPlayer::LoadPlayer(PlayerDefAnim PDefAni) +{ + if (Player.bIdle) + { + if (Idle) delete Idle; + Idle = new TFRMCommunicator(PDefAni.AIdle); + } + if (Player.bMove) + { + if (Moving) delete Moving; + Moving = new TFRMCommunicator(PDefAni.AMoving); + } +} + +void TFRMPlayer::GenerateTree(int tx, int ty, BlockType Block) +{ + int ix,iy,i,i2; + int ix2,iy2,tx2,ty2; + int Long[6][3]; + BOOL Mehet; + BOOL Ok; + + for (ix=0; ix<170; ix++) + for (iy=0; iy<150; iy++) + { + Table[ix][iy] = 111; + } + Table[x][y] = 1; + i = 1; + Mehet = TRUE; + while (Mehet) + { + for (ix=2; ix<163; ix++) + for (iy=1; iy<143; iy++) + { + if (Table[ix][iy] == i) + { + if ((Table[ix-1][iy-1] > i+1) && (Block[ix-1][iy-1]!=1)) Table[ix-1][iy-1] = i+1; + if ((Table[ix+1][iy-1] > i+1) && (Block[ix+1][iy-1]!=1)) Table[ix+1][iy-1] = i+1; + if ((Table[ix-1][iy+1] > i+1) && (Block[ix-1][iy+1]!=1)) Table[ix-1][iy+1] = i+1; + if ((Table[ix+1][iy+1] > i+1) && (Block[ix+1][iy+1]!=1)) Table[ix+1][iy+1] = i+1; + + if ((Table[ix-2][iy ] > i+1) && (Block[ix-1][iy ]!=1) && (Block[ix-2][iy ]!=1)) Table[ix-2][iy ] = i+1; + if ((Table[ix+2][iy ] > i+1) && (Block[ix+1][iy ]!=1) && (Block[ix+2][iy ]!=1)) Table[ix+2][iy ] = i+1; + } + } + i++; + if (i>100) Mehet=FALSE; + if (Table[tx][ty]!=111) Mehet=FALSE; + } + + if ((tx==x) && (ty==y)) {i=101;}; + + if (i<100) + { + PosIt[0][0]=i; + PosIt[0][1]=i; + PosIt[i][0]=tx; + PosIt[i][1]=ty; + + Mehet = TRUE; + while (Mehet) + { + i--; + for (i2=0; i2<6; i2++) + { + Long[i2][0] = -1; + Long[i2][1] = -1; + Long[i2][2] = -1; + } + i2=0; + if (i<1) {Mehet=FALSE;i=1;} + for (ix=2; ix<163; ix++) + for (iy=1; iy<143; iy++) + { + if (Table[ix][iy] == i) + { + Ok = FALSE; + if ((ix+2 == PosIt[i+1][0]) && + (iy == PosIt[i+1][1])) { Ok = TRUE; } + if ((ix-2 == PosIt[i+1][0]) && + (iy == PosIt[i+1][1])) { Ok = TRUE; } + if ((ix+1 == PosIt[i+1][0]) && + (iy+1 == PosIt[i+1][1])) { Ok = TRUE; } + if ((ix+1 == PosIt[i+1][0]) && + (iy-1 == PosIt[i+1][1])) { Ok = TRUE; } + if ((ix-1 == PosIt[i+1][0]) && + (iy+1 == PosIt[i+1][1])) { Ok = TRUE; } + if ((ix-1 == PosIt[i+1][0]) && + (iy-1 == PosIt[i+1][1])) { Ok = TRUE; } + + if (Ok) + { + Long[i2][0]=ix; + Long[i2][1]=iy; + ix2 = ix*14; + iy2 = iy*12; + tx2 = tx*14; + ty2 = ty*12; + Long[i2][2]=(int)sqrt(abs(ix2-tx2)*abs(ix2-tx2) + abs(iy2-ty2)*abs(iy2-ty2)); + i2++; + } + } + } + iy2=9999; + tx2=0; + for (ix2=0; ix21) + { + tx2 = PosIt[1][0]; + ty2 = PosIt[1][1]; + ix2 = PosIt[2][0]; + iy2 = PosIt[2][1]; + if ((tx2+1==ix2) && (ty2+1==iy2)) { dir =2; } + if ((tx2+1==ix2) && (ty2-1==iy2)) { dir =0; } + if ((tx2+2==ix2) && (ty2 ==iy2)) { dir =1; } + if ((tx2-2==ix2) && (ty2 ==iy2)) { dir =4; } + if ((tx2-1==ix2) && (ty2+1==iy2)) { dir =3; } + if ((tx2-1==ix2) && (ty2-1==iy2)) { dir =5; } + curth=1; + } else curth=0; + + ox = x; + oy = y; + if (i2>1) + { + PosIt[0][1]--; + x = PosIt[PosIt[0][0]+1-PosIt[0][1]][0]; + y = PosIt[PosIt[0][0]+1-PosIt[0][1]][1]; + } + + framenum=0; + fr2 = rand()%100; + fr3=0; + Moving->FirstFrame(); + Idle->FirstFrame(); + Labpos = FALSE; + +} + +void TFRMPlayer::Move(BlockType Block) +{ + int i; + if (PosIt[0][0] != -1) + { + if (PosIt[0][1] == 1) + { + PosIt[0][0] = -1; + PosIt[0][1] = -1; + curth = 0; + framenum =0; + fr2 = rand()%100; + fr3=0; + Idle->FirstFrame(); + } else + { + PosIt[0][1]--; + ox = x; + oy = y; + x = PosIt[PosIt[0][0]+1-PosIt[0][1]][0]; + y = PosIt[PosIt[0][0]+1-PosIt[0][1]][1]; + + if ((ox==x+1) && (oy==y+1)) { dir =5; } + if ((ox==x+1) && (oy==y-1)) { dir =3; } + if ((ox==x+2) && (oy==y )) { dir =4; } + if ((ox==x-2) && (oy==y )) { dir =1; } + if ((ox==x-1) && (oy==y+1)) { dir =0; } + if ((ox==x-1) && (oy==y-1)) { dir =2; } + Labpos = !Labpos; + Moving->SetDir(dir); + Moving->FirstFrame(); + if (Labpos == TRUE) + { + for (i=0; i<4; i++) + { + Moving->NextFrame(); + } + } + } + } else + { + curth = 0; + framenum =0; + fr2 = rand()%100; + fr3=0; + Idle->FirstFrame(); + } +} + +int TFRMPlayer::GetDir() +{ + int ox,oy,nx,ny; + ox = x; + oy = y; + nx = PosIt[PosIt[0][0]+1-PosIt[0][1]-1][0]; + ny = PosIt[PosIt[0][0]+1-PosIt[0][1]-1][1]; + if ((ox+1==nx) && (oy+1==ny)) { return 5; } + if ((ox+1==nx) && (oy-1==ny)) { return 3; } + if ((ox+2==nx) && (oy ==ny)) { return 4; } + if ((ox-2==nx) && (oy ==ny)) { return 1; } + if ((ox-1==nx) && (oy+1==ny)) { return 0; } + if ((ox-1==nx) && (oy-1==ny)) { return 2; } + return 0; +} + +void TFRMPlayer::Next(BlockType Block) +{ + int ix,iy; + if (curth == 1) + { + //dir = GetDir(); + framenum++; + Moving->NextFrame(); + if (framenum>Moving->Animation->framecounter/2-1) { framenum=0;Move(Block); } + } + if (curth == 0) + { + framenum++; + fr3++; + if ((framenum>fr2) && (fr3%2==0)) {Idle->NextFrame();} + if (framenum>fr2+Idle->Animation->framecounter*2) {framenum=0;Idle->FirstFrame();fr2 = rand()%100;} + if ((rand()%100==0) && (Player.bComputer)) + { + ix=rand()%3+1; + iy=rand()%3+1; + switch (rand()%6) + { + case 0:GenerateTree(x-ix,y-iy,Block);break; + case 1:GenerateTree(x-ix,y+iy,Block);break; + case 2:GenerateTree(x-ix*2,y,Block);break; + case 3:GenerateTree(x+ix*2,y,Block);break; + case 4:GenerateTree(x+ix,y-iy,Block);break; + case 5:GenerateTree(x+ix,y+iy,Block);break; + } + } + } +} + +void TFRMPlayer::Draw(LPDIRECTDRAWSURFACE7 g_pDDSBack, int TerX, int TerY) +{ + PFRM Lista; + switch (curth) + { + case 0: + Idle->SetDir(dir); + Lista = (PFRM)Idle->Count6[dir]; + BlitTo(g_pDDSBack,0,0,Lista->x,Lista->y,TerX+(x+226)*16+Lista->bx,TerY+(y)*12+Lista->by,DDBLTFAST_SRCCOLORKEY,Lista->FRM); + break; + case 1: + Moving->SetDir(dir); + Lista = (PFRM)Moving->Count6[dir]; + BlitTo(g_pDDSBack,0,0,Lista->x,Lista->y,TerX+(ox+226)*16+Lista->bx,TerY+(oy)*12+Lista->by,DDBLTFAST_SRCCOLORKEY,Lista->FRM); + break; + } +} \ No newline at end of file diff --git a/IanOutEd/FRMGraph.h b/IanOutEd/FRMGraph.h new file mode 100644 index 0000000..09ca3f2 --- /dev/null +++ b/IanOutEd/FRMGraph.h @@ -0,0 +1,213 @@ +#include "ItemObj.h" +#include +#include +#include + +#ifndef __FRMGRAPH_H +#define __FRMGRAPH_H + +class TFRM; +class TFRMAnim; +class TFRMAnim6; +class TFRMSingle; + +class TFRMCommunicator; +class TFRMPlayer; + +class TIanMap; +class TIanWall; +class TIanItems; + +typedef TFRM *PFRM; +typedef TFRMAnim *PFRMAnim; +typedef TFRMAnim6 *PFRMAnim6; +typedef TFRMSingle *PFRMSingle; + +typedef TFRMCommunicator *PFRMCommunicator; +typedef TFRMPlayer *PFRMPlayer; + +typedef TIanWall *PIanWall; +typedef TIanMap *PIanMap; +typedef TIanItems *PIanItems; + +typedef unsigned char MapInfo[100][100]; +typedef unsigned char WallInfo[171][151]; +typedef unsigned char BlockType[171][151]; + +typedef struct __PDF +{ + BOOL bIdle; + BOOL bMove; + BOOL bComputer; + char name[10]; + int maxtaunt; + char taunt[10][30]; +} PlayerDef; + + +typedef struct __PDFAnim +{ + PFRMAnim6 AIdle; + PFRMAnim6 AMoving; +} PlayerDefAnim; + +class TFRM : public TItem +{ +public: + TFRM(void) {}; + ~TFRM(void) {}; +//protected: + int x,y; + int bx,by; + LPDIRECTDRAWSURFACE7 FRM; + +// friend class TFRMAnim; +}; + +class TFRMAnim : public TItem +{ +public: + TFRMAnim() { FRMList = new TList(); }; + ~TFRMAnim(); + + virtual HRESULT Load(HWND hWnd, LPDIRECTDRAW7 g_pDD, char* filename); + + virtual void NextFrame(); + virtual PFRM GetCurFrame(); + + int framecounter; +protected: + virtual int LoadFRM(int stream, LPVOID LoadIn, int x, int y, int p); + PItem Counter; + +private: + PList FRMList; + +}; + +class TFRMAnim6 : public TFRMAnim +{ +public: + TFRMAnim6(); + ~TFRMAnim6(); + virtual HRESULT Load(HWND hWnd, LPDIRECTDRAW7 g_pDD, char* filename); + + virtual void FirstFrame(); + virtual void NextFrame(); + virtual PFRM GetCurFrame(); + virtual void SetDir(int i_dir); + + int dir; + PItem Counter6[6]; + PList FRMList6[6]; +}; + +class TFRMSingle : public TItem +{ +public: + PFRM FRM; + TFRMSingle() {FRM = NULL;}; + ~TFRMSingle() { if (FRM) {FRM->FRM->Release();delete FRM;}}; + + HRESULT Load(HWND hWnd, LPDIRECTDRAW7 g_pDD, char* filename, int framenum); + + char fname[80]; +protected: + int LoadFRM(int stream, LPVOID LoadIn, int x, int y, int p); +}; + +class TIanMap : public TItem +{ +public: + TIanMap() {}; + ~TIanMap(); + + HRESULT LoadMap(HWND hWnd,char* filename); + HRESULT LoadTiles(HWND hWnd, LPDIRECTDRAW7 g_pDD); + + MapInfo Map; + PFRMSingle Tiles[10]; +}; + +class TIanWall : public TItem +{ +public: + TIanWall() {}; + ~TIanWall(); + + HRESULT LoadMap(HWND hWnd,char* filename); + HRESULT LoadWalls(HWND hWnd, LPDIRECTDRAW7 g_pDD); + + WallInfo Map; + PFRMSingle Tiles[50]; +}; + +class TIanItems : public TItem +{ +public: + TIanItems() {}; + ~TIanItems(); + + HRESULT LoadMap(HWND hWnd,char* filename); + HRESULT LoadItems(HWND hWnd, LPDIRECTDRAW7 g_pDD); + + WallInfo Map; + PFRMSingle Tiles[50]; +}; + +class TFRMCommunicator : public TItem +{ +public: + TFRMCommunicator(PFRMAnim6 FRMAssign); + ~TFRMCommunicator() {}; + + virtual void FirstFrame(); + virtual void NextFrame() { Count6[dir] = Animation->FRMList6[dir]->RNext(Count6[dir]);}; + virtual PFRM GetCurFrame(); + virtual void SetDir(int i_dir) {dir = i_dir;}; + + int dir; + PItem Count6[6]; + + PFRMAnim6 Animation; +}; + +class TFRMPlayer : public TItem +{ +public: + TFRMPlayer(PlayerDef PDef) + { + curth = 0; + dir = 0; + framenum = 0; + Player = PDef; + fr2 = 0; + fr3 = 0; + }; + ~TFRMPlayer() { if (Idle) delete Idle; if (Moving) delete Moving;}; + + void LoadPlayer(PlayerDefAnim PDefAni); + + void Draw(LPDIRECTDRAWSURFACE7 g_pDDSBack,int TerX, int TerY); + void GenerateTree(int tx, int ty, BlockType Block); + void MoveTo(int t_x, int t_y) {x = t_x; y=t_y; }; + void Next(BlockType Block); + void Move(BlockType Block); + int GetDir(); + + int x,y; + int ox,oy; + int curth; + int framenum; + int fr2,fr3; + int dir; + BOOL Labpos; + PlayerDef Player; + + short Table[170][150]; + short PosIt[101][2]; + PFRMCommunicator Idle; /* 0 */ + PFRMCommunicator Moving; /* 1 */ +}; + +#endif // __FRMGRAPH_H \ No newline at end of file diff --git a/IanOutEd/FRMGraph_Source_0.4.doc b/IanOutEd/FRMGraph_Source_0.4.doc new file mode 100644 index 0000000..a7979f8 Binary files /dev/null and b/IanOutEd/FRMGraph_Source_0.4.doc differ diff --git a/IanOutEd/IanOut.ico b/IanOutEd/IanOut.ico new file mode 100644 index 0000000..e4588bf Binary files /dev/null and b/IanOutEd/IanOut.ico differ diff --git a/IanOutEd/ItemObj.cpp b/IanOutEd/ItemObj.cpp new file mode 100644 index 0000000..2cf7769 --- /dev/null +++ b/IanOutEd/ItemObj.cpp @@ -0,0 +1,112 @@ +#include "stdio.h" +#include "ItemObj.h" + +////////////////////////////////////////////////////////////////// +// +// TItem + +PItem TItem::Prev() +{ + PItem Item; + Item = this; + while ( Item->FNext != this ) + Item = Item->FNext; + return Item; +} + +////////////////////////////////////////////////////////////////// +// +// TList + +TList::TList() +{ + FLast = NULL; +} + +Boolean TList::Exists(PItem Item) +{ + PItem Cur; + + if ( Empty() ) + return False; + + Cur = FLast->FNext; + while (Cur != Item && Cur!= FLast ) + Cur = Cur->FNext; + + return Cur == Item ? True : False; +} + +void TList::Insert(PItem Item) +{ + if (!Item ) + return; + + if ( Empty() ) + Item->FNext = Item; + else + { + Item->FNext = FLast->FNext; + FLast->FNext = Item; + } + FLast = Item; +} + +Boolean TList::Disconnect(PItem Item) +{ + PItem Cur; + if ( Empty() ) return False; + + Cur = FLast; + while (Cur->FNext != Item && Cur->FNext != FLast ) + Cur = Cur -> FNext; + + if ( Cur->FNext == Item) + { + Cur ->FNext = Item->FNext; + if (FLast == Item) + if ( Cur == Item) + FLast = NULL; + else + FLast = Cur; + return True; + } + return False; +} + +void TList::Delete(PItem Item) +{ + if ( Disconnect(Item) ) delete Item; +} + +void TList::DeleteAll() +{ + while (!Empty()) Delete(First()); +} + +void TList::Each(ItemProcedure DoToItem) +{ + PItem Item; + + Item = First(); + while ( Item ) + { + DoToItem(Item); + Item = Next(Item); + } +} + +PItem TList::GetItem() +{ + Current = First(); + + while ( Current && !Found() ) + Current = Next(Current); + + return Current; +} + +TList::~TList() +{ + DeleteAll(); +} \ No newline at end of file diff --git a/IanOutEd/ItemObj.h b/IanOutEd/ItemObj.h new file mode 100644 index 0000000..2875011 --- /dev/null +++ b/IanOutEd/ItemObj.h @@ -0,0 +1,76 @@ +#include "stdio.h" + +#ifndef __ULIST_H +#define __ULIST_H + +#define Boolean int +#define True 1 +#define False 0 + +class TItem; +class TList; + +typedef TItem *PItem; +typedef TList *PList; + +typedef void (*ItemProcedure)(PItem Item); + +////////////////////////////////////////////////////////////////// +// +// TItem + +class TItem +{ +public: + TItem() {}; + virtual ~TItem() {}; + + PItem Next() { return FNext; }; + PItem Prev(); + +private: + PItem FNext; + + friend class TList; + friend class TFRMList; + friend class TFRMChr; +}; + +////////////////////////////////////////////////////////////////// +// +// TList + +class TList : public TItem +{ +public: + TList(); + ~TList(); + Boolean Empty() { return FLast == NULL ? True : False; }; + PItem First() { return Empty () == True ? NULL : FLast->FNext; }; + PItem Last() { return FLast; }; + PItem Next(PItem Item) { return Item == FLast ? NULL : Item->FNext; }; + PItem RNext(PItem Item) { return Item->FNext; } ; + PItem Prev(PItem Item) { return Item == First() ? NULL : Item->Prev(); }; + PItem RPrev(PItem Item) { return Item->Prev(); } ; + + Boolean Exists(PItem Item); + Boolean Disconnect(PItem Item); + void Delete(PItem Item); + void DeleteAll(); + void Each(ItemProcedure DoToItem); + PItem GetItem(); + + virtual void Insert(PItem Item); + virtual Boolean Found() { return True; }; + +public: + PItem Current; + +//private: + PItem FLast; + + friend class TFRMChr; +}; + +#endif //__ULIST_H + diff --git a/IanOutEd/RESOURCE.H b/IanOutEd/RESOURCE.H new file mode 100644 index 0000000..27e2a4d --- /dev/null +++ b/IanOutEd/RESOURCE.H @@ -0,0 +1,3 @@ +#define IDI_MAIN_ICON 101 +#define IDR_MENU 102 +#define IDM_EXIT 40001 diff --git a/IanOutEd/d.rc b/IanOutEd/d.rc new file mode 100644 index 0000000..5f6e29a --- /dev/null +++ b/IanOutEd/d.rc @@ -0,0 +1,46 @@ +#include "resource.h" + +ALL BITMAP MOVEABLE PURE "ALL.BMP" + +IDR_MENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", IDM_EXIT + END +END + +IDI_MAIN_ICON ICON DISCARDABLE "DirectX.ico" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,1,0,1 + PRODUCTVERSION 0,1,0,1 + FILEFLAGSMASK 0x3fL + FILEFLAGS 0x0L + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040e04b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Kék eper neoszürrealista társulat\0" + VALUE "FileDescription", "IanEd\0" + VALUE "FileVersion", "0,1,0,1\0" + VALUE "InternalName", "IanEd\0" + VALUE "LegalCopyright", "Copyright Š 2000-2002\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "IanEd.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "IanEd - IanOut Level Editor\0" + VALUE "ProductVersion", "0,1,0,1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x40e, 1200 + END +END \ No newline at end of file diff --git a/IanOutEd/ddex4.dsp b/IanOutEd/ddex4.dsp new file mode 100644 index 0000000..0d3b5cb --- /dev/null +++ b/IanOutEd/ddex4.dsp @@ -0,0 +1,212 @@ +# Microsoft Developer Studio Project File - Name="ddex4" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=ddex4 - Win32 Release +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "ddex4.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "ddex4.mak" CFG="ddex4 - Win32 Release" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ddex4 - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "ddex4 - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ddex4 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir ".\Release" +# PROP BASE Intermediate_Dir ".\Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 2 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir ".\Release" +# PROP Intermediate_Dir ".\Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 dxguid.lib ddraw.lib dinput.lib /nologo /subsystem:windows /machine:I386 /out:".\IanEd.exe" +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "ddex4 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir ".\Debug" +# PROP BASE Intermediate_Dir ".\Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 2 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir ".\Debug" +# PROP Intermediate_Dir ".\Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /YX /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 +# ADD LINK32 dxguid.lib ddraw.lib /nologo /subsystem:windows /debug /machine:I386 + +!ENDIF + +# Begin Target + +# Name "ddex4 - Win32 Release" +# Name "ddex4 - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90" +# Begin Source File + +SOURCE=.\ddex4.cpp +# End Source File +# Begin Source File + +SOURCE=.\ddex4.rc +# End Source File +# Begin Source File + +SOURCE=.\ddutil.cpp +# End Source File +# Begin Source File + +SOURCE=.\ItemObj.cpp +# End Source File +# Begin Source File + +SOURCE=.\utils.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" +# Begin Group "FRMGraph headers" + +# PROP Default_Filter "h" +# Begin Source File + +SOURCE=.\FRMGr_1.h +# End Source File +# Begin Source File + +SOURCE=.\FRMGr_2.h +# End Source File +# Begin Source File + +SOURCE=.\FRMGr_3.h +# End Source File +# End Group +# Begin Group "Ddex headers" + +# PROP Default_Filter "h" +# Begin Source File + +SOURCE=.\ddex4_1.h +# End Source File +# Begin Source File + +SOURCE=.\ddex4_2.h +# End Source File +# Begin Source File + +SOURCE=.\ddex4_f.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\ddutil.h +# End Source File +# Begin Source File + +SOURCE=.\ItemObj.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\utils.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\ALL.BMP +# End Source File +# Begin Source File + +SOURCE=.\directx.ico +# End Source File +# End Group +# Begin Group "Recently" + +# PROP Default_Filter "c;cpp;h" +# Begin Source File + +SOURCE=.\ddex4_i.h +# End Source File +# Begin Source File + +SOURCE=.\ddex4_u.h +# End Source File +# Begin Source File + +SOURCE=.\ddex4_u2.h +# End Source File +# Begin Source File + +SOURCE=.\ddex4_u3.h +# End Source File +# Begin Source File + +SOURCE=.\FRMGraph.cpp +# End Source File +# Begin Source File + +SOURCE=.\FRMGraph.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\temp.txt +# End Source File +# End Target +# End Project diff --git a/IanOutEd/ddex4.rc b/IanOutEd/ddex4.rc new file mode 100644 index 0000000..5f6e29a --- /dev/null +++ b/IanOutEd/ddex4.rc @@ -0,0 +1,46 @@ +#include "resource.h" + +ALL BITMAP MOVEABLE PURE "ALL.BMP" + +IDR_MENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", IDM_EXIT + END +END + +IDI_MAIN_ICON ICON DISCARDABLE "DirectX.ico" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,1,0,1 + PRODUCTVERSION 0,1,0,1 + FILEFLAGSMASK 0x3fL + FILEFLAGS 0x0L + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040e04b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Kék eper neoszürrealista társulat\0" + VALUE "FileDescription", "IanEd\0" + VALUE "FileVersion", "0,1,0,1\0" + VALUE "InternalName", "IanEd\0" + VALUE "LegalCopyright", "Copyright Š 2000-2002\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "IanEd.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "IanEd - IanOut Level Editor\0" + VALUE "ProductVersion", "0,1,0,1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x40e, 1200 + END +END \ No newline at end of file diff --git a/IanOutEd/ddex4_1.h b/IanOutEd/ddex4_1.h new file mode 100644 index 0000000..eef0cf2 --- /dev/null +++ b/IanOutEd/ddex4_1.h @@ -0,0 +1,122 @@ + + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +//----------------------------------------------------------------------------- +// Include files +//----------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include "itemobj.h" +#include "resource.h" +#include "ddutil.h" +#include "FRMGraph.h" +#include "utils.h" +#include + +//----------------------------------------------------------------------------- +// Local definitions +//----------------------------------------------------------------------------- +#define NAME "IanEd" +#define TITLE "IanOut Editor" + +#define VERSIONNUM "0.1" + +//----------------------------------------------------------------------------- +// Local data +//----------------------------------------------------------------------------- +const int FontMap[] = { +// * *_* * * *!* *"* *#* *$* *%* *&* *'* *(* *)* *** *+* *,* *-* *.* */* *0* *1* *2* *3* *4* *5* *6* *7* *8* *9* *:* *;* *<* *=* *>* *?* *@* *A* *B* *C* *D* *E* *F* *G* *H* *I* *J* *K* *L* *M* *N* *O* *P* *Q* *R* *S* *T* *U* *V* *W* *X* *Y* *Z* *[* *\* *]* *^* *_* *`* *a* *b* *c* *d* *e* *f* *g* *h* *i* *j* *k* *l* *m* *n* *o* *p* *q* *r* *s* *t* *u* *v* *w* *x* *y* *z* *{* *|* *}* *~* *o* + 0, 6, 10, 17, 26, 34, 44, 53, 58, 64, 70, 77, 84, 88, 96,100,110,118,124,132,140,148,156,164,172,180,188,192,196,205,213,222,230,239,249,258,266,275,283,291,300,309,313,322,331,339,348,357,366,375,384,393,402,410,419,429,438,448,458,467,473,483,489,498,507,512,520,528,535,543,551,558,566,574,578,585,593,597,606,614,622,630,638,645,653,661,669,677,686,694,702,710,716,720,726,735,742 +}; + +const int WallMap[][2] = { {0,-120},{0,-120},{0,-120},{0,-120},{-22,-120},{0,0},{0,0},{0,-120},{0,-120},{0,-120},{0,-120},{0,-120},{0,-120},{0,-98},{0,-120}, +/*b*/ {0,0},{0,-108},{0,-100},{0,-108},{0,-100},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,-108},{0,-100},{0,-108},{0,-117},{0,-76 },{0,-84 },{0,-76 },{0,-84 }, +/*b*/ {0,-76 },{0,-84 },{0,-76 },{0,-84 },{0,-84 },{0,-84 },{0,-84 },{0,-84 },{0,-80} +}; + +const int ItemMap[][2] = { {3,-13},{-30,-95},{-11,-60},{2,-38},{-36,-70},{-11,-63},{0,-95},{-4,-28},{-13,-68},{-18,-88},{-22,-71},{9,-119},{6,-119},{6,-79} +}; + +const int Calculate[8] = {6,3,0,5,2,7,4,1}; + + +DWORD dwFrameCount; +DWORD dwFrameTime; +DWORD dwFrames; +DWORD dwFramesLast; + +// Name of our bitmap resource. +static char szBitmap[] = "ALL"; + +//----------------------------------------------------------------------------- +// Global data +//----------------------------------------------------------------------------- + + +LPDIRECTDRAW7 g_pDD = NULL; // DirectDraw object +LPDIRECTDRAWSURFACE7 g_pDDSPrimary = NULL; // DirectDraw primary surface +LPDIRECTDRAWSURFACE7 g_pDDSBack = NULL; // DirectDraw back surface +LPDIRECTDRAWSURFACE7 g_pDDSOne = NULL; // Offscreen surface 1 + +LPDIRECTDRAWPALETTE g_pDDPal = NULL; // The primary surface palette +LPVOID lpSurface = NULL; +BOOL g_bActive = FALSE; // Is application active? + +DIMOUSESTATE dims; // DirectInput mouse state structure +DIMOUSESTATE olddims; // DirectInput mouse state structure +IDirectInput* g_pDI = NULL; +IDirectInputDevice* g_pMouse = NULL; + +int MousX = 320; +int MousY = 240; + +int TerX = 0; +int TerY = 0; + +PFRMSingle FullScreen = NULL; +PFRMSingle Mouse = NULL; +PFRMSingle MenuUp = NULL; +PFRMSingle MenuDown = NULL; +PFRMSingle Select = NULL; +PFRMSingle Select2 = NULL; +PFRMSingle MouseScr[8][2]; +PFRMSingle Buttons[2]; + +PIanMap MapInf; +PIanWall WallInf; +PIanItems ItemInf; + +PALETTEENTRY pe[256]; +PALETTEENTRY pe2[256]; + +double gamma = 1.5; + +int gameSpeed = 40; + +HWND hWnd; + +int GamePos = 0; + +int wallpos[6][2]; +int current; +BlockType BlockDat; + +TIniStr *LINIStr[75]; + +BOOL dot_plane = FALSE; +BOOL wall_plane = FALSE; +BOOL item_plane = FALSE; +BOOL block_plane = FALSE; + +BOOL show_wall = TRUE; +BOOL show_item = TRUE; + +int putmode = 1; +int Selected = -1; \ No newline at end of file diff --git a/IanOutEd/ddex4_2.h b/IanOutEd/ddex4_2.h new file mode 100644 index 0000000..44478ab --- /dev/null +++ b/IanOutEd/ddex4_2.h @@ -0,0 +1,194 @@ +//----------------------------------------------------------------------------- +// Name: ReleaseAllObjects() +// Desc: Finished with all objects we use; release them +//----------------------------------------------------------------------------- + +HRESULT +InitFail(HWND hWnd, HRESULT hRet, LPCTSTR szError,...); + +HRESULT InitDirectInput( HWND hDlg,HINSTANCE g_hInst ) +{ + HRESULT hr; + + hr = DirectInputCreate( g_hInst, DIRECTINPUT_VERSION, &g_pDI, NULL ); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"DirectInputCreate Failed"); + hr = g_pDI->CreateDevice( GUID_SysMouse, &g_pMouse, NULL ); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"CreateDevice (mouse) failed"); + hr = g_pMouse->SetDataFormat( &c_dfDIMouse ); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"SetDataFormat (mouse) failed"); + hr = g_pMouse->SetCooperativeLevel( hDlg, + DISCL_EXCLUSIVE | DISCL_FOREGROUND); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"SetCooperativeLevel (mouse) failed"); + + return S_OK; +} + +BOOL MouseIn(int x1,int y1,int x2,int y2) +{ + return ((MousX>=x1) && (MousX<=x2) && (MousY>=y1) && (MousY<=y2)); +} + +BOOL Pressed(int i) +{ + if ((i>=0) && (i<=2)) + return ((dims.rgbButtons[i] & 0x80) && !(olddims.rgbButtons[i] & 0x80)); else + return ((olddims.rgbButtons[i-3] & 0x80) && !(dims.rgbButtons[i-3] & 0x80)); +} + +BOOL MInPr(int x1,int y1, int x2, int y2,int i) +{ + return (MouseIn(x1,y1,x2,y2) && (Pressed(i))); +} + +//----------------------------------------------------------------------------- +// Function: SetAcquire +// +// Description: +// Acquire or unacquire the mouse, depending on if the app is active +// Input device must be acquired before the GetDeviceState is called +// +//----------------------------------------------------------------------------- +HRESULT SetAcquire( ) +{ + + if (NULL == g_pMouse) + return S_FALSE; + + if (g_bActive) + { + g_pMouse->Acquire(); + } + else + { + g_pMouse->Unacquire(); + } + + return S_OK; +} + + + + +//----------------------------------------------------------------------------- +// Function: UpdateInputState +// +// Description: +// Get the input device's state and display it. +// +//----------------------------------------------------------------------------- +HRESULT UpdateInputState( ) +{ + + if (NULL != g_pMouse) + { + HRESULT hr; + + hr = DIERR_INPUTLOST; + + while ( DIERR_INPUTLOST == hr ) + { + + hr = g_pMouse->GetDeviceState( sizeof(DIMOUSESTATE), &dims ); + + if ( hr == DIERR_INPUTLOST ) + { + hr = g_pMouse->Acquire(); + if ( FAILED(hr) ) + return hr; + } + } + + if ( FAILED(hr) ) + return hr; + + } + + return S_OK; +} + + + + +//----------------------------------------------------------------------------- +// Function: FreeDirectInput +// +// Description: +// Initialize the DirectInput variables. +// +//----------------------------------------------------------------------------- +HRESULT FreeDirectInput() +{ + if (NULL != g_pMouse) + { + + g_pMouse->Release(); + g_pMouse = NULL; + } + + if (NULL != g_pDI) + { + g_pDI->Release(); + g_pDI = NULL; + } + + return S_OK; +} + + +static void +ReleaseAllObjects(void) +{ + int i; + if (g_pDD != NULL) + { + if (g_pDDSPrimary != NULL) + { + g_pDDSPrimary->Release(); + g_pDDSPrimary = NULL; + } + if (g_pDDSOne != NULL) + { + g_pDDSOne->Release(); + g_pDDSOne = NULL; + } + if (g_pDDPal != NULL) + { + g_pDDPal->Release(); + g_pDDPal = NULL; + } + + if (Mouse) delete Mouse; + if (FullScreen) delete FullScreen; + if (MenuUp) delete MenuUp; + if (Select) delete Select; + if (Select2) delete Select2; + if (MenuDown) delete MenuDown; + + if (MapInf) delete MapInf; + if (WallInf) delete WallInf; + if (ItemInf) delete ItemInf; + for (i=0; i<8; i++) + { + if (MouseScr[i][0]) delete MouseScr[i][0]; + if (MouseScr[i][1]) delete MouseScr[i][1]; + } + for (i=0; i<2; i++) + { + if (Buttons[i]) delete Buttons[i]; + } + + g_pDD->Release(); + g_pDD = NULL; + } + for (i=0; i<75; i++) + { + LINIStr[i]->~TIniStr(); + LINIStr[i] = NULL; + } + + FreeDirectInput(); +} diff --git a/IanOutEd/ddex4_f.h b/IanOutEd/ddex4_f.h new file mode 100644 index 0000000..6bf1fc1 --- /dev/null +++ b/IanOutEd/ddex4_f.h @@ -0,0 +1,957 @@ +void SetPaletteBl(int Frame) +{ + int i; + int Blue; + int Green; + int Red; + if (Frame>255) Frame=255; + if (Frame<0) Frame=0; + for ( i = 0; i<=255; i++) + { + Blue = Frame; + Green = Frame; + Red = Frame; + + if (Blue>(int)(pe[i].peBlue*gamma)) Blue = (int)(pe[i].peBlue*gamma); + if (Red>(int)(pe[i].peRed*gamma)) Red = (int)(pe[i].peRed*gamma); + if (Green>(int)(pe[i].peGreen*gamma)) Green = (int)(pe[i].peGreen*gamma); + + if (Blue>255) Blue=255; + if (Red>255) Red=255; + if (Green>255) Green=255; + if (Blue<0) Blue=0; + if (Red<0) Red=0; + if (Green<0) Green=0; + + pe2[i].peBlue = Blue; + pe2[i].peRed = Red; + pe2[i].peGreen = Green; + + } + if (g_pDDPal->SetEntries(0, 0, 256, pe2) != DD_OK) + return; +} + +HRESULT RestoreAll(); + +void FadeOut() +{ + int i; + HRESULT hRet; + + //g_pDDSPrimary->Blt(NULL,g_pDDSBack,NULL,0,NULL); + g_pDDSBack->Blt(NULL,g_pDDSPrimary,NULL,0,NULL); + + for (i=255; i>0; i-=4) + { + SetPaletteBl(i); + while (TRUE) + { + hRet = g_pDDSPrimary->Flip(NULL, 0); + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + hRet = RestoreAll(); + if (hRet != DD_OK) + break; + } + if (hRet != DDERR_WASSTILLDRAWING) + break; + } + + } + +} + +void FadeIn() +{ + int i; + HRESULT hRet; + + //g_pDDSPrimary->Blt(NULL,g_pDDSBack,NULL,0,NULL); + g_pDDSBack->Blt(NULL,g_pDDSPrimary,NULL,0,NULL); + + for (i=0; i<255; i+=4) + { + SetPaletteBl(i); + while (TRUE) + { + hRet = g_pDDSPrimary->Flip(NULL, 0); + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + hRet = RestoreAll(); + if (hRet != DD_OK) + break; + } + if (hRet != DDERR_WASSTILLDRAWING) + break; + } + + } + +} + + +void SetPaletteNo() +{ + g_pDDPal->SetEntries(0, 0, 256, pe); +} + + +void SetPaletteWh(int Frame) +{ + int i; + int Blue; + int Green; + int Red; + if (Frame>255) Frame=255; + if (Frame<0) Frame=0; + for ( i = 0; i<=255; i++) + { + Blue = 255-Frame; + Green = 255-Frame; + Red = 255-Frame; + + if (Blue<(int)(pe[i].peBlue*gamma)) Blue = (int)(pe[i].peBlue*gamma); + if (Red<(int)(pe[i].peRed*gamma)) Red = (int)(pe[i].peRed*gamma); + if (Green<(int)(pe[i].peGreen*gamma)) Green = (int)(pe[i].peGreen*gamma); + + if (Blue>255) Blue=255; + if (Red>255) Red=255; + if (Green>255) Green=255; + if (Blue<0) Blue=0; + if (Red<0) Red=0; + if (Green<0) Green=0; + + pe2[i].peBlue = Blue; + pe2[i].peRed = Red; + pe2[i].peGreen = Green; + } + + if (g_pDDPal->SetEntries(0, 0, 256, pe2) != DD_OK) + return; +} + +void FadeOutWh() +{ + int i; + HRESULT hRet; + + //g_pDDSPrimary->Blt(NULL,g_pDDSBack,NULL,0,NULL); + g_pDDSBack->Blt(NULL,g_pDDSPrimary,NULL,0,NULL); + + for (i=255; i>0; i-=4) + { + SetPaletteWh(i); + while (TRUE) + { + hRet = g_pDDSPrimary->Flip(NULL, 0); + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + hRet = RestoreAll(); + if (hRet != DD_OK) + break; + } + if (hRet != DDERR_WASSTILLDRAWING) + break; + } + + } + +} + +HRESULT +RestoreAll(void) +{ + HRESULT hRet; + + hRet = g_pDDSPrimary->Restore(); + if (hRet == DD_OK) + { + hRet = g_pDDSOne->Restore(); + if (hRet == DD_OK) + { + DDReLoadBitmap(g_pDDSOne, szBitmap); + } + } + return hRet; +} + + +void DrawChar( + int x, + int y, + int co, + char c) +{ + RECT rcRect; + + rcRect.left = FontMap[(c-32)]+1; + rcRect.top = (co*24)+1; + rcRect.right = FontMap[(c-31)]+1; + rcRect.bottom = (co*24)+12; + + if (rcRect.left>467) + { + rcRect.left-=468; + rcRect.right-=468; + rcRect.top+=12; + rcRect.bottom+=12; + } + + BlitTo(g_pDDSBack,rcRect.left,rcRect.top,rcRect.right,rcRect.bottom,x,y,DDBLTFAST_SRCCOLORKEY ,g_pDDSOne); +} + + +void IanOutText(int x, int y, int co, CString str) +{ + int i; + int jelenx = x; + int sor = y+3; + int length = str.GetLength(); + int maxjelenx = 0; + int maxsor = 0; + HRESULT hRet; + HDC hdc; + + if (co==11) + { + + hRet = g_pDDSBack->GetDC(&hdc); + if (!FAILED(hRet)) + { + + SetBkMode(hdc,TRANSPARENT); + SetTextColor(hdc,RGB(0,0,0)); + TextOut(hdc, x,y,str,length); + g_pDDSBack->ReleaseDC(hdc); + } + } + + for (i=0 ; i=' ') && (str[i]<='~'+1))) + + { + DrawChar(jelenx,sor,co,str[i]); + jelenx += FontMap[str[i]-31]-FontMap[str[i]-32]; + } else + if (str[i]=='\n') + { + sor += 12; + jelenx=x; + } else + if (str[i]=='á') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'a'); + jelenx += FontMap['a'-31]-FontMap['a'-32]; + } else + if (str[i]=='é') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'e'); + jelenx += FontMap['e'-31]-FontMap['e'-32]; + } else + if (str[i]=='í') + { + DrawChar(jelenx-1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'i'); + jelenx += FontMap['i'-31]-FontMap['i'-32]; + }else + if (str[i]=='ó') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'o'); + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if (str[i]=='ú') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'u'); + jelenx += FontMap['u'-31]-FontMap['u'-32]; + }else + if ((str[i]=='ö') || (str[i]=='ő')) + { + DrawChar(jelenx-1,sor-1,co,'"'); + DrawChar(jelenx,sor,co,'o'); + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if ((str[i]=='ü') || (str[i]=='ű')) + { + DrawChar(jelenx-1,sor-1,co,'"'); + DrawChar(jelenx,sor,co,'u'); + jelenx += FontMap['u'-31]-FontMap['u'-32]; + } else + if (str[i]=='Á') + { + DrawChar(jelenx+5,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'A'); + jelenx += FontMap['A'-31]-FontMap['A'-32]; + } else + if (str[i]=='É') + { + DrawChar(jelenx+2,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'E'); + jelenx += FontMap['E'-31]-FontMap['E'-32]; + } else + if (str[i]=='Í') + { + DrawChar(jelenx,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'I'); + jelenx += FontMap['I'-31]-FontMap['I'-32]; + }else + if (str[i]=='Ó') + { + DrawChar(jelenx+2,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'O'); + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if (str[i]=='Ú') + { + DrawChar(jelenx+2,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'U'); + jelenx += FontMap['U'-31]-FontMap['U'-32]; + }else + if ((str[i]=='Ö') || (str[i]=='Ő')) + { + DrawChar(jelenx,sor-3,co,'"'); + DrawChar(jelenx,sor,co,'O'); + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if ((str[i]=='Ü') || (str[i]=='Ű')) + { + DrawChar(jelenx,sor-3,co,'"'); + DrawChar(jelenx,sor,co,'U'); + jelenx += FontMap['U'-31]-FontMap['U'-32]; + } + if (jelenx>maxjelenx) maxjelenx=jelenx; + if (sor+13>maxsor) maxsor=sor+13; + } + +} + +void IanOutTextC(int x, int y, int co, CString str) +{ + int i; + int jelenx = 0; + int sor = y+3; + int length = str.GetLength(); + int kihossz = 0; + int maxjelenx = 0; + int maxsor = 0; + + for (i=0 ; i=' ') && (str[i]<='~'+1))) + + { + jelenx += FontMap[str[i]-31]-FontMap[str[i]-32]; + } else + if (str[i]=='á') + { + jelenx += FontMap['a'-31]-FontMap['a'-32]; + } else + if (str[i]=='é') + { + jelenx += FontMap['e'-31]-FontMap['e'-32]; + } else + if (str[i]=='í') + { + jelenx += FontMap['i'-31]-FontMap['i'-32]; + }else + if (str[i]=='ó') + { + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if (str[i]=='ú') + { + jelenx += FontMap['u'-31]-FontMap['u'-32]; + }else + if (str[i]=='ö') + { + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if (str[i]=='ü') + { + jelenx += FontMap['u'-31]-FontMap['u'-32]; + } else + if (str[i]=='Á') + { + jelenx += FontMap['A'-31]-FontMap['A'-32]; + } else + if (str[i]=='É') + { + jelenx += FontMap['E'-31]-FontMap['E'-32]; + } else + if (str[i]=='Í') + { + jelenx += FontMap['I'-31]-FontMap['I'-32]; + }else + if (str[i]=='Ó') + { + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if (str[i]=='Ú') + { + jelenx += FontMap['U'-31]-FontMap['U'-32]; + }else + if (str[i]=='Ö') + { + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if (str[i]=='Ü') + { + jelenx += FontMap['U'-31]-FontMap['U'-32]; + } + } + + kihossz = jelenx; + jelenx = x-kihossz/2; + for (i=0 ; i=' ') && (str[i]<='~'+1))) + + { + DrawChar(jelenx,sor,co,str[i]); + jelenx += FontMap[str[i]-31]-FontMap[str[i]-32]; + } else + if (str[i]=='á') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'a'); + jelenx += FontMap['a'-31]-FontMap['a'-32]; + } else + if (str[i]=='é') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'e'); + jelenx += FontMap['e'-31]-FontMap['e'-32]; + } else + if (str[i]=='í') + { + DrawChar(jelenx-1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'i'); + jelenx += FontMap['i'-31]-FontMap['i'-32]; + }else + if (str[i]=='ó') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'o'); + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if (str[i]=='ú') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'u'); + jelenx += FontMap['u'-31]-FontMap['u'-32]; + }else + if (str[i]=='ö') + { + DrawChar(jelenx-1,sor-1,co,'"'); + DrawChar(jelenx,sor,co,'o'); + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if (str[i]=='ü') + { + DrawChar(jelenx-1,sor-1,co,'"'); + DrawChar(jelenx,sor,co,'u'); + jelenx += FontMap['u'-31]-FontMap['u'-32]; + } else + if (str[i]=='Á') + { + DrawChar(jelenx+5,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'A'); + jelenx += FontMap['A'-31]-FontMap['A'-32]; + } else + if (str[i]=='É') + { + DrawChar(jelenx+2,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'E'); + jelenx += FontMap['E'-31]-FontMap['E'-32]; + } else + if (str[i]=='Í') + { + DrawChar(jelenx,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'I'); + jelenx += FontMap['I'-31]-FontMap['I'-32]; + }else + if (str[i]=='Ó') + { + DrawChar(jelenx+2,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'O'); + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if (str[i]=='Ú') + { + DrawChar(jelenx+2,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'U'); + jelenx += FontMap['U'-31]-FontMap['U'-32]; + }else + if (str[i]=='Ö') + { + DrawChar(jelenx,sor-3,co,'"'); + DrawChar(jelenx,sor,co,'O'); + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if (str[i]=='Ü') + { + DrawChar(jelenx,sor-3,co,'"'); + DrawChar(jelenx,sor,co,'U'); + jelenx += FontMap['U'-31]-FontMap['U'-32]; + } + if (jelenx>maxjelenx) maxjelenx=jelenx; + if (sor+13>maxsor) maxsor=sor+13; + } +} + + +void DisplayFrameRate(void) +{ + DWORD time2; + char buff[256]; + + dwFrameCount++; + time2 = GetTickCount() - dwFrameTime; + if( time2 > 1000 ) + { + dwFrames = (dwFrameCount*1000)/time2; + dwFrameTime = GetTickCount(); + dwFrameCount = 0; + } + if( dwFrames == 0 ) + { + return; + } + + if (dwFrames != dwFramesLast) + { + dwFramesLast = dwFrames; + } + + if( dwFrames > 99 ) + { + dwFrames = 99; + } + buff[0] = (char)((dwFrames / 10) + '0'); + buff[1] = (char)((dwFrames % 10) + '0'); + buff[2] = ' '; + buff[3] = 'F'; + buff[4] = 'P'; + buff[5] = 'S'; + buff[6] = '\0'; + IanOutText(0,0,3,buff); +} + +void IanOutTextR(int x, int y, int co, CString str) +{ + int i; + int jelenx = 0; + int sor = y+3; + int length = str.GetLength(); + int kihossz = 0; + int maxjelenx = 0; + int maxsor = 0; + + for (i=0 ; i=' ') && (str[i]<='~'+1))) + + { + jelenx += FontMap[str[i]-31]-FontMap[str[i]-32]; + } else + if (str[i]=='á') + { + jelenx += FontMap['a'-31]-FontMap['a'-32]; + } else + if (str[i]=='é') + { + jelenx += FontMap['e'-31]-FontMap['e'-32]; + } else + if (str[i]=='í') + { + jelenx += FontMap['i'-31]-FontMap['i'-32]; + }else + if (str[i]=='ó') + { + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if (str[i]=='ú') + { + jelenx += FontMap['u'-31]-FontMap['u'-32]; + }else + if (str[i]=='ö') + { + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if (str[i]=='ü') + { + jelenx += FontMap['u'-31]-FontMap['u'-32]; + } else + if (str[i]=='Á') + { + jelenx += FontMap['A'-31]-FontMap['A'-32]; + } else + if (str[i]=='É') + { + jelenx += FontMap['E'-31]-FontMap['E'-32]; + } else + if (str[i]=='Í') + { + jelenx += FontMap['I'-31]-FontMap['I'-32]; + }else + if (str[i]=='Ó') + { + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if (str[i]=='Ú') + { + jelenx += FontMap['U'-31]-FontMap['U'-32]; + }else + if (str[i]=='Ö') + { + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if (str[i]=='Ü') + { + jelenx += FontMap['U'-31]-FontMap['U'-32]; + } + } + + kihossz = jelenx; + jelenx = x-kihossz; + for (i=0 ; i=' ') && (str[i]<='~'+1))) + + { + DrawChar(jelenx,sor,co,str[i]); + jelenx += FontMap[str[i]-31]-FontMap[str[i]-32]; + } else + if (str[i]=='á') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'a'); + jelenx += FontMap['a'-31]-FontMap['a'-32]; + } else + if (str[i]=='é') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'e'); + jelenx += FontMap['e'-31]-FontMap['e'-32]; + } else + if (str[i]=='í') + { + DrawChar(jelenx-1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'i'); + jelenx += FontMap['i'-31]-FontMap['i'-32]; + }else + if (str[i]=='ó') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'o'); + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if (str[i]=='ú') + { + DrawChar(jelenx+1,sor-1,co,'\''); + DrawChar(jelenx,sor,co,'u'); + jelenx += FontMap['u'-31]-FontMap['u'-32]; + }else + if (str[i]=='ö') + { + DrawChar(jelenx-1,sor-1,co,'"'); + DrawChar(jelenx,sor,co,'o'); + jelenx += FontMap['o'-31]-FontMap['o'-32]; + }else + if (str[i]=='ü') + { + DrawChar(jelenx-1,sor-1,co,'"'); + DrawChar(jelenx,sor,co,'u'); + jelenx += FontMap['u'-31]-FontMap['u'-32]; + } else + if (str[i]=='Á') + { + DrawChar(jelenx+5,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'A'); + jelenx += FontMap['A'-31]-FontMap['A'-32]; + } else + if (str[i]=='É') + { + DrawChar(jelenx+2,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'E'); + jelenx += FontMap['E'-31]-FontMap['E'-32]; + } else + if (str[i]=='Í') + { + DrawChar(jelenx,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'I'); + jelenx += FontMap['I'-31]-FontMap['I'-32]; + }else + if (str[i]=='Ó') + { + DrawChar(jelenx+2,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'O'); + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if (str[i]=='Ú') + { + DrawChar(jelenx+2,sor-3,co,'\''); + DrawChar(jelenx,sor,co,'U'); + jelenx += FontMap['U'-31]-FontMap['U'-32]; + }else + if (str[i]=='Ö') + { + DrawChar(jelenx,sor-3,co,'"'); + DrawChar(jelenx,sor,co,'O'); + jelenx += FontMap['O'-31]-FontMap['O'-32]; + }else + if (str[i]=='Ü') + { + DrawChar(jelenx,sor-3,co,'"'); + DrawChar(jelenx,sor,co,'U'); + jelenx += FontMap['U'-31]-FontMap['U'-32]; + } + if (jelenx>maxjelenx) maxjelenx=jelenx; + if (sor+13>maxsor) maxsor=sor+13; + } +} + + + +void IanOutNum1(int x, int y, int c,CString str) +{ + int i; + int length = str.GetLength(); + int be; + + for (i=0; i='0') && (str[i]<='9'+2)) + { + be = (str[i]-'0')*14; + if (c==7) be+=168; + BlitTo(g_pDDSBack,be,144,be+14,168,x+i*14,y,0,g_pDDSOne); + } + } +} + +void IanOutNum2(int x, int y, int c,CString str) +{ + int i; + int length = str.GetLength(); + int be; + + for (i=0; i='0') && (str[i]<='9'+2)) + { + be = (str[i]-'0')*9; + if (c==9) be+=120; + if (c==10) be+=240; + BlitTo(g_pDDSBack,be,169,be+9,186,x+i*9,y,0,g_pDDSOne); + } + if ((str[i]=='-')) + { + be = 12*9; + if (c==9) be+=120; + if (c==10) be+=240; + BlitTo(g_pDDSBack,be,169,be+9,186,x+i*9,y,0,g_pDDSOne); + } + } +} + +void DisplayNum(int x, int y, int c,short i, short count) +{ + char buff[256]; + int i2,i3; + i2=0; + for (i3=1; i3<=count;i3++) + { + i2=i2*10; + i2=i2+1; + } + i2=9*i2; + + buff[0]=' '; + if( i > i2 ) + { + i = i2; + } + if (i<-i2) + { + i = -i2; + } + if (i<0) { buff[0] = '-'; i =-i;}; + + switch(count) + { + case 1: + buff[1]=(char)i+'0'; + break; + case 2: + buff[1] = (char)((i / 10) + '0'); + buff[2] = (char)((i % 10) + '0'); + break; + case 3: + buff[1] = (char)((i / 100) + '0');i-=i/100*100; + buff[2] = (char)((i / 10) + '0'); + buff[3] = (char)((i % 10) + '0'); + break; + case 4: + buff[1] = (char)((i / 1000) + '0');i-=i/1000*1000; + buff[2] = (char)((i / 100) + '0');i-=i/100*100; + buff[3] = (char)((i / 10) + '0'); + buff[4] = (char)((i % 10) + '0'); + break; + case 5: + buff[1] = (char)((i / 10000) + '0');i-=i/10000*10000; + buff[2] = (char)((i / 1000) + '0');i-=i/1000*1000; + buff[3] = (char)((i / 100) + '0');i-=i/100*100; + buff[4] = (char)((i / 10) + '0'); + buff[5] = (char)((i % 10) + '0'); + break; + } + buff[count+1] = '\0'; + if ((c>=0) && (c<=5)) IanOutText(x,y,c,buff); + if ((c>=6) && (c<=7)) IanOutNum1(x,y,c,buff); + if ((c>=8) && (c<=10)) IanOutNum2(x,y,c,buff); +} + +void WriteFromProf(int x,int y,int c,int i3,CString fnam,CString master,CString slave) +{ + int i,i2; + char buf[80]; + i2=-1; + for (i=0; i<75; i++) + { + if (LINIStr[i]->FindIt(fnam,master,slave) == 0) i2=i; + } + if (i2!=-1) + { + wsprintf(buf,"%s",LINIStr[i2]->Get()); + if (i3==1) IanOutText(x,y,c,buf); + if (i3==2) IanOutTextC(x,y,c,buf); + if (i3==3) IanOutTextR(x,y,c,buf); + } else + { + GetPrivateProfileString(master,slave,"",buf,80,fnam); + for (i=1; i<75; i++) + { + LINIStr[i-1]->Set(LINIStr[i]->fname,LINIStr[i]->master,LINIStr[i]->slave,LINIStr[i]->buffer); + } + LINIStr[74]->Set(fnam,master,slave,buf); + if (i3==1) IanOutText(x,y,c,buf); + if (i3==2) IanOutTextC(x,y,c,buf); + if (i3==3) IanOutTextR(x,y,c,buf); + } +} + +CString GetFromProf(CString fnam,CString master,CString slave) +{ + int i,i2; + char buf[80]; + i2=-1; + for (i=0; i<75; i++) + { + if (LINIStr[i]->FindIt(fnam,master,slave) == 0) i2=i; + } + if (i2!=-1) + { + wsprintf(buf,"%s",LINIStr[i2]->Get()); + return buf; + } else + { + GetPrivateProfileString(master,slave,"",buf,80,fnam); + for (i=1; i<75; i++) + { + LINIStr[i-1]->Set(LINIStr[i]->fname,LINIStr[i]->master,LINIStr[i]->slave,LINIStr[i]->buffer); + } + LINIStr[74]->Set(fnam,master,slave,buf); + return buf; + } +} \ No newline at end of file diff --git a/IanOutEd/ddex4_i.h b/IanOutEd/ddex4_i.h new file mode 100644 index 0000000..c50643e --- /dev/null +++ b/IanOutEd/ddex4_i.h @@ -0,0 +1,362 @@ + +//----------------------------------------------------------------------------- +// Name: WindowProc() +// Desc: The Main Window Procedure +//----------------------------------------------------------------------------- + +long FAR PASCAL +WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_ACTIVATE: + // Pause if minimized + g_bActive = !((BOOL)HIWORD(wParam)); + return 0L; + + case WM_DESTROY: + // Clean up and close the app + ReleaseAllObjects(); + PostQuitMessage(0); + return 0L; + + + case WM_KEYDOWN: + // Handle any non-accelerated key commands + switch (wParam) + { + case VK_PAUSE: + PostMessage(hWnd, WM_CLOSE, 0, 0); + return 0L; + case VK_ADD: + if (gamma>=1) gamma+=0.1; + else gamma+=0.05; + if (gamma>4) gamma = 4; + SetPaletteBl(255); + break; + case VK_SUBTRACT: + if (gamma>=1) gamma-=0.1; + else gamma-=0.05; + if (gamma<0.2) gamma = 0.2; + SetPaletteBl(255); + break; + case VK_MULTIPLY: + gameSpeed-=5; + if (gameSpeed<0) gameSpeed=0; + break; + case VK_DIVIDE: + gameSpeed+=5; + if (gameSpeed>100) gameSpeed=100; + break; + case 'D': dot_plane = !dot_plane;break; + case 'W': wall_plane = !wall_plane;break; + case 'I': item_plane = !item_plane;break; + case 'B': block_plane = !block_plane;break; + case '2': show_wall = !show_wall;break; + case '1': show_item = !show_item;break; + case VK_SPACE: (putmode<4) ? putmode++ : putmode=1; break; + case 'Z': Selected--;break; + case 'X': Selected++;break; + } + break; + + case WM_SETCURSOR: + // Turn off the cursor since this is a full-screen app + SetCursor(NULL); + return TRUE; + } + + return DefWindowProc(hWnd, message, wParam, lParam); +} + + +void CreateIanPalette() +{ + int i; + FILE *stream; + + + if( (stream = fopen( "master.dat\\pal.pal", "rb" )) != NULL ) + { + for (i=0; i < 256; i++) + { + fread(&pe[i].peRed, 1, 1, stream); + fread(&pe[i].peGreen, 1, 1, stream); + fread(&pe[i].peBlue, 1, 1, stream); + } + + fclose( stream ); + } +} + +IDirectDrawPalette * LoadSplashScreen(LPDIRECTDRAWSURFACE7 g_pDDSB) +{ + IDirectDrawPalette *ddpal; + PALETTEENTRY ape[256]; + DDSURFACEDESC2 ddsd; + HRESULT hRet; + + int x; + int r,g,b; + int stream; + char buf[80]; + + + wsprintf(buf,"master.dat\\pal.pal"); + stream = _open(buf,_O_BINARY); + +// for (x=0; x<10; x++) _read(stream,&y,1); + for (x=0; x<256; x++) + { + _read(stream,&r,1); + _read(stream,&g,1); + _read(stream,&b,1); + ape[x].peRed = 0; + ape[x].peGreen = 0; + ape[x].peBlue = 0; + pe[x].peRed = r*4; + pe[x].peGreen = g*4; + pe[x].peBlue = b*4; + } + ape[0].peRed=0;ape[0].peGreen=0;ape[0].peBlue=0; + ape[1].peRed=255;ape[1].peGreen=255;ape[1].peBlue=255; + + pe[0].peRed=0;pe[0].peGreen=0;pe[0].peBlue=0; + pe[1].peRed=255;pe[1].peGreen=255;pe[1].peBlue=255; + + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + + hRet = g_pDD->CreatePalette(DDPCAPS_8BIT | DDPCAPS_ALLOW256 , ape, &ddpal, NULL); + if (hRet != DD_OK) InitFail(hWnd,hRet,"Baj2"); + hRet = g_pDDSPrimary->SetPalette(ddpal); + if (hRet != DD_OK) InitFail(hWnd,hRet,"Baj3"); + + ddpal->SetEntries(0,0,256,ape); + + return ddpal; +} + + + +static HRESULT +InitApp(HINSTANCE hInstance, int nCmdShow) +{ + WNDCLASS wc; + DDSURFACEDESC2 ddsd; + DDSCAPS2 ddscaps; + HRESULT hRet; + char buf[100]; + int i; + + srand( (unsigned)time( NULL ) ); + + // Set up and register window class + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = WindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MAIN_ICON)); + wc.hCursor = LoadCursor(NULL, IDC_WAIT); + wc.hbrBackground = (HBRUSH )GetStockObject(BLACK_BRUSH); + wc.lpszMenuName = NAME; + wc.lpszClassName = NAME; + RegisterClass(&wc); + + // Create a window + hWnd = CreateWindowEx(WS_EX_TOPMOST, + NAME, + TITLE, + WS_POPUP, + 0, + 0, + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), + NULL, + NULL, + hInstance, + NULL); + if (!hWnd) + return FALSE; + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + SetFocus(hWnd); + + InitDirectInput(hWnd, hInstance); + SetAcquire(); + + + /////////////////////////////////////////////////////////////////////////// + // Create the main DirectDraw object + /////////////////////////////////////////////////////////////////////////// + hRet = DirectDrawCreateEx(NULL, (VOID**)&g_pDD, IID_IDirectDraw7, NULL); + if (hRet != DD_OK) + return InitFail(hWnd, hRet, "DirectDrawCreateEx FAILED"); + + + // Get exclusive mode + hRet = g_pDD->SetCooperativeLevel(hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + if (hRet != DD_OK) + return InitFail(hWnd, hRet, "SetCooperativeLevel FAILED"); + + // Set the video mode to 640x480x8 + hRet = g_pDD->SetDisplayMode(640, 480, 8, 0, 0); + if (hRet != DD_OK) + return InitFail(hWnd, hRet, "SetDisplayMode FAILED"); + + // Create the primary surface with 1 back buffer + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | + DDSCAPS_FLIP | + DDSCAPS_COMPLEX; + ddsd.dwBackBufferCount = 1; + hRet = g_pDD->CreateSurface(&ddsd, &g_pDDSPrimary, NULL); + if (hRet != DD_OK) + return InitFail(hWnd, hRet, "CreateSurface FAILED"); + + // Get a pointer to the back buffer + ZeroMemory(&ddscaps, sizeof(ddscaps)); + ddscaps.dwCaps = DDSCAPS_BACKBUFFER; + hRet = g_pDDSPrimary->GetAttachedSurface(&ddscaps, &g_pDDSBack); + if (hRet != DD_OK) + return InitFail(hWnd, hRet, "GetAttachedSurface FAILED"); + + g_pDDPal=LoadSplashScreen(g_pDDSBack); + + MapInf = new TIanMap(); + + MapInf->LoadMap(hWnd,"master.dat\\maps\\shady.map"); + MapInf->LoadTiles(hWnd,g_pDD); + + WallInf = new TIanWall(); + if (WallInf == NULL) return InitFail(hWnd,hRet,"Baj"); + + WallInf->LoadMap(hWnd,"master.dat\\maps\\shady.wal"); + WallInf->LoadWalls(hWnd,g_pDD); + + ItemInf = new TIanItems(); + if (ItemInf == NULL) return InitFail(hWnd,hRet,"Baj"); + + ItemInf->LoadMap(hWnd,"master.dat\\maps\\shady.ite"); + ItemInf->LoadItems(hWnd,g_pDD); + + + hRet = LoadFRMSingle(&Mouse, hWnd, "master.dat\\art\\interface\\stdarrow.frm",1); + if (hRet!=DD_OK) return hRet; + + hRet = LoadFRMSingle(&FullScreen, hWnd, "master.dat\\art\\interface\\mainmenu.frm",1); + if (hRet!=DD_OK) return hRet; + + hRet = LoadFRMSingle(&MenuUp, hWnd, "master.dat\\art\\interface\\menuup.frm",1); + if (hRet!=DD_OK) return hRet; + + hRet = LoadFRMSingle(&MenuDown, hWnd, "master.dat\\art\\interface\\menudown.frm",1); + if (hRet!=DD_OK) return hRet; + + hRet = LoadFRMSingle(&Select, hWnd, "master.dat\\art\\interface\\msef000.frm",1); + if (hRet!=DD_OK) return hRet; + hRet = LoadFRMSingle(&Select2, hWnd, "master.dat\\art\\interface\\msef001.frm",1); + if (hRet!=DD_OK) return hRet; + + hRet = LoadFRMSingle(&Buttons[0], hWnd, "master.dat\\art\\interface\\tgskloff.frm",1); + if (hRet!=DD_OK) return hRet; + hRet = LoadFRMSingle(&Buttons[1], hWnd, "master.dat\\art\\interface\\tgsklon.frm",1); + if (hRet!=DD_OK) return hRet; + + for (i=0; i<8; i++) + { + wsprintf(buf,"master.dat\\art\\interface\\scr%i.frm",i+1); + hRet = LoadFRMSingle(&MouseScr[i][0], hWnd, buf,1); + if (hRet!=DD_OK) return hRet; + wsprintf(buf,"master.dat\\art\\interface\\scr%ix.frm",i+1); + hRet = LoadFRMSingle(&MouseScr[i][1], hWnd, buf,1); + if (hRet!=DD_OK) return hRet; + } + + for (i=0 ; i<256; i++) + { + pe2[i].peBlue = 0; + pe2[i].peRed = 0; + pe2[i].peGreen = 0; + } + + int x,y; + int stream; + + if ((stream = _open("master.dat\\maps\\shady.blk",_O_BINARY)) == -1) + return InitFail(hWnd,DDERR_NOTLOADED,"LoadBlock FAILED"); + + for (x=0; x<171; x++) + for (y=0; y<151; y++) + { + _read(stream,&BlockDat[x][y],1); + } + _close(stream); + + for (i=0; i<75; i++) LINIStr[i] = new TIniStr(); + + ClearSurface(g_pDDSBack,0,0,0); ClearSurface(g_pDDSPrimary,0,0,0); + //InitFail(hWnd,DD_OK,"OK"); + CreateIanPalette(); + + + SetPaletteBl(255); + g_pDDSOne = DDLoadBitmap(g_pDD, szBitmap, 0, 0, &hRet, DDSCAPS_OFFSCREENPLAIN); + + if (g_pDDSOne == NULL) + return InitFail(hWnd, hRet, "DDLoadBitmap FAILED"); + DDSetColorKey(g_pDDSOne, CLR_INVALID); + + return DD_OK; +} + + + + +//----------------------------------------------------------------------------- +// Name: WinMain() +// Desc: Initialization, message loop +//----------------------------------------------------------------------------- +int PASCAL +WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + if (InitApp(hInstance, nCmdShow) != DD_OK) + return FALSE; + + while (TRUE) + { + if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) + { + if (!GetMessage(&msg, NULL, 0, 0)) + return msg.wParam; + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else if (g_bActive) + { + switch (GamePos) + { + case 0: + MainMenu(); + break; + case 1: + UpdateFrame(); + break; + } + } + else + { + // Make sure we go to sleep if we have nothing else to do + WaitMessage(); + } + } +} + diff --git a/IanOutEd/ddex4_u.h b/IanOutEd/ddex4_u.h new file mode 100644 index 0000000..76b793d --- /dev/null +++ b/IanOutEd/ddex4_u.h @@ -0,0 +1,256 @@ +#include "ddex4_u3.h" + +//----------------------------------------------------------------------------- +// Name: UpdateFrame() +// Desc: Decide what needs to be blitted next, wait for flip to complete, +// then flip the buffers. +//----------------------------------------------------------------------------- + +void +UpdateFrame(void) +{ + int x,y; + HRESULT hRet; + static int Frame = 0; + static DWORD ThisTick; + static DWORD LastTick = 0; + static int mousetyp = 0; + int i,ix,iy; + BOOL kintvan; + BOOL oldal[4]; + BlockType BlDat; + DDBLTFX ddbltfx; + RECT rcRect; + + for (x=0; x<170; x++) + for (y=0; y<150; y++) + { + BlDat[x][y] = BlockDat[x][y]; + } + + if ((mousetyp>0) && (mousetyp<9)) mousetyp=0; + ThisTick = GetTickCount(); + + if ((ThisTick - LastTick) > (DWORD)gameSpeed) + { + LastTick = ThisTick; + } + +// ------------------------------------------------------------------- + olddims=dims; // + UpdateInputState(); // + if ((dims.lX == olddims.lX) && (dims.lY == olddims.lY)) Frame++; else Frame=0; + //if ((dims.rgbButtons[1] & 0x80) && !(olddims.rgbButtons[1] & 0x80)) + // if (mousetyp==0) { mousetyp=9; } else { mousetyp=0; } + // + MousX += dims.lX; // + MousY += dims.lY; // + // + if ((MousX>=640) && (MousY<=0)) {mousetyp = 2;} else // + if ((MousX>=640) && (MousY>=480)) {mousetyp = 4;} else // + if ((MousX<=0) && (MousY<=0)) {mousetyp = 8;} else // + if ((MousX<=0) && (MousY>=480)) {mousetyp = 6;} else // + if (MousX>=640) {mousetyp = 3;} else // + if (MousX<=0) {mousetyp = 7;} else // + if (MousY>=480) {mousetyp = 5;} else // + if (MousY<=0) {mousetyp = 1;} // + // + kintvan=FALSE; // + oldal[0]=FALSE;oldal[2]=FALSE; // + oldal[1]=FALSE;oldal[3]=FALSE; // + // + if (MousX>=640) { MousX=640; TerX-=15; } // + if (MousX<=0) { MousX=0; TerX+=15; } // + if (MousY>=480) { MousY=480; TerY-=15; } // + if (MousY<=0) { MousY=0; TerY+=15; } // + // + if (TerY>0) {TerY=0;oldal[0]=TRUE;kintvan=TRUE;} // + if (TerY<-1210) {TerY=-1210;oldal[1]=TRUE;kintvan=TRUE;} // + // + if (TerX>-3640) {TerX=-3640;oldal[2]=TRUE;kintvan=TRUE;} // + if (TerX<-5240) {TerX=-5240;oldal[3]=TRUE;kintvan=TRUE;} // + if ((mousetyp == 2) && (oldal[0] != oldal[3])) kintvan=FALSE; // + if ((mousetyp == 4) && (oldal[1] != oldal[3])) kintvan=FALSE; // + if ((mousetyp == 6) && (oldal[2] != oldal[1])) kintvan=FALSE; // + if ((mousetyp == 8) && (oldal[2] != oldal[0])) kintvan=FALSE; // + // +// ------------------------------------------------------------------- + + //if (((-TerY+MousY)%24)<12) + { + y = (-TerY+MousY)/12; + x = (-TerX+MousX)/16-226; + //if (x%2==1) x--; + } //else + /*{ + y = (-TerY+MousY)/12; + x = (-TerX+MousX)/16-1-226; + if (x%2==0) x++; + }*/ + + DrawTerep(mousetyp,x,y); + + ZeroMemory(&ddbltfx, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(ddbltfx); + ddbltfx.dwFillColor = 0; + + rcRect.top=460; + rcRect.left=0; + rcRect.bottom=480; + rcRect.right=640; + g_pDDSBack->Blt(&rcRect, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); + + rcRect.top=0; + rcRect.left=0; + rcRect.bottom=15; + rcRect.right=640; + g_pDDSBack->Blt(&rcRect, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); + + switch (putmode) + { + case 1:IanOutText(0,460,1,"WALL");break; + case 2:IanOutText(0,460,1,"ITEM");break; + case 3:IanOutText(0,460,1,"BLCK");break; + case 4:IanOutText(0,460,1,"TILE");break; + } + + IanOutTextR(640,460,dot_plane ? 0 : 1,"DOT"); + IanOutTextR(610,460,wall_plane ? 0 : 1,"WALL"); + IanOutTextR(570,460,item_plane ? 0 : 1,"ITEM"); + IanOutTextR(540,460,block_plane ? 0 : 1,"BLCK"); + + IanOutText(490,460,1,"+"); + IanOutText(450,460,1,"-"); + DisplayNum(460,460,1,Selected,2); + + DisplayNum(610,0,show_wall ? 0 : 1,WallInf->Map[x][y]-1,2); + IanOutText(570,0,show_wall ? 0 : 1,"WALL"); + + DisplayNum(540,0,show_item ? 0 : 1,ItemInf->Map[x][y]-1,2); + IanOutText(510,0,show_item ? 0 : 1,"ITEM"); + + if (MInPr(570,0,640,15,0)) show_wall=!show_wall; + if (MInPr(510,0,569,15,0)) show_item=!show_item; + + + if (MInPr(490,460,499,480,0)) Selected++; + if (MInPr(450,460,460,480,0)) Selected--; + + if (MInPr(0,460,40,480,0)) + { + (putmode<4) ? putmode++ : putmode=1; + } + + + if (MInPr(611,460,640,480,0)) dot_plane=!dot_plane; + if (MInPr(571,460,610,480,0)) wall_plane=!wall_plane; + if (MInPr(541,460,570,480,0)) item_plane=!item_plane; + if (MInPr(500,460,540,480,0)) block_plane=!block_plane; + + if (MouseIn(0,15,640,460)) + { + if (mousetyp==0) BlitTo(g_pDDSBack,0,0,32,16,TerX+(x+226)*16,TerY+(y)*12,DDBLTFAST_SRCCOLORKEY,Select2->FRM->FRM); + //if (mousetyp==9) BlitTo(g_pDDSBack,0,0,Mouse2->FRM->x,Mouse2->FRM->y,MousX,MousY,DDBLTFAST_SRCCOLORKEY,Mouse2->FRM->FRM); + } else + { + + if ((putmode==1) && (Selected>=0) && (Selected<50)) + BlitTo(g_pDDSBack,0,0,WallInf->Tiles[Selected]->FRM->x,WallInf->Tiles[Selected]->FRM->y,320-WallInf->Tiles[Selected]->FRM->x/2,240-WallInf->Tiles[Selected]->FRM->y/2,0,WallInf->Tiles[Selected]->FRM->FRM); + + + if ((putmode==2) && (Selected>=0) && (Selected<14)) + BlitTo(g_pDDSBack,0,0,ItemInf->Tiles[Selected]->FRM->x,ItemInf->Tiles[Selected]->FRM->y,320-ItemInf->Tiles[Selected]->FRM->x/2,240-ItemInf->Tiles[Selected]->FRM->y/2,0,ItemInf->Tiles[Selected]->FRM->FRM); + + + if ((putmode==4) && (Selected>=0) && (Selected<6)) + BlitTo(g_pDDSBack,0,0,80,35,280,223,0,MapInf->Tiles[Selected]->FRM->FRM); + + if ((mousetyp<1) || (mousetyp>8)) BlitTo(g_pDDSBack,0,0,Mouse->FRM->x, Mouse->FRM->y,MousX,MousY,DDBLTFAST_SRCCOLORKEY,Mouse->FRM->FRM); + } + + if (MouseIn(0,0,640,460)) + { + if (Pressed(0)) + { + if (putmode==1) WallInf->Map[x][y] = Selected+1; + if (putmode==2) ItemInf->Map[x][y] = Selected+1; + if (putmode==3) BlockDat[x][y] = 1; + if (putmode==4) + { + if ((Selected>=0) && (Selected<6)) + for (ix=0; ix<100; ix++) { + for (iy=0; iy<100; iy++) { + if (((ix*48+iy*32+TerX) == (TerX+(x+226)*16)) && + ((iy*24-ix*12+TerY) == (TerY+y*12))) + { + MapInf->Map[iy][ix] = (unsigned char)Selected; + } + } + } + } + } + + if (Pressed(2)) + { + if (putmode==1) Selected = WallInf->Map[x][y] - 1; + if (putmode==2) Selected = ItemInf->Map[x][y] - 1; + } + + if ((dims.rgbButtons[1] & 0x80)) + { + if (putmode==1) WallInf->Map[x][y] = 0; + if (putmode==2) ItemInf->Map[x][y] = 0; + if (putmode==3) BlockDat[x][y] = 0; + } + } + + if ((mousetyp>0) && (mousetyp<9)) + { + if (kintvan) i=1; else i=0; + x = MouseScr[mousetyp-1][i]->FRM->x; + y = MouseScr[mousetyp-1][i]->FRM->y; + if ((mousetyp==1) || (mousetyp>6)) + BlitTo(g_pDDSBack,0,0,x,y,MousX,MousY,DDBLTFAST_SRCCOLORKEY, + MouseScr[mousetyp-1][i]->FRM->FRM); + if (mousetyp==2) + BlitTo(g_pDDSBack,0,0,x,y,MousX-x,MousY,DDBLTFAST_SRCCOLORKEY, + MouseScr[mousetyp-1][i]->FRM->FRM); + if (mousetyp==3) + BlitTo(g_pDDSBack,0,0,x,y,MousX-x,MousY,DDBLTFAST_SRCCOLORKEY, + MouseScr[mousetyp-1][i]->FRM->FRM); + if (mousetyp==4) + BlitTo(g_pDDSBack,0,0,x,y,MousX-x,MousY-y,DDBLTFAST_SRCCOLORKEY, + MouseScr[mousetyp-1][i]->FRM->FRM); + if (mousetyp==5) + BlitTo(g_pDDSBack,0,0,x,y,MousX,MousY-y,DDBLTFAST_SRCCOLORKEY, + MouseScr[mousetyp-1][i]->FRM->FRM); + if (mousetyp==6) + BlitTo(g_pDDSBack,0,0,x,y,MousX,MousY-y,DDBLTFAST_SRCCOLORKEY, + MouseScr[mousetyp-1][i]->FRM->FRM); + + } + + DisplayNum(70,0,1,x,3); + DisplayNum(100,0,1,y,3); + DisplayNum(130,0,1,gameSpeed,2); + DisplayFrameRate(); + + // Flip the surfaces + while (TRUE) + { + hRet = g_pDDSPrimary->Flip(NULL, 0); + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + hRet = RestoreAll(); + if (hRet != DD_OK) + break; + } + if (hRet != DDERR_WASSTILLDRAWING) + break; + } + +} + +#include "ddex4_u2.h" \ No newline at end of file diff --git a/IanOutEd/ddex4_u2.h b/IanOutEd/ddex4_u2.h new file mode 100644 index 0000000..a2e8d5d --- /dev/null +++ b/IanOutEd/ddex4_u2.h @@ -0,0 +1,122 @@ +void +MainMenu(void) +{ + HRESULT hRet; + //DDBLTFX ddbltfx; + + static int Frame = -25; + static DWORD ThisTick; + static DWORD LastTick = 0; + //int i; + + if ((lstrcmpi(FullScreen->fname,"master.dat\\art\\interface\\mainmenu.frm"))) + { + LoadFRMSingle(&FullScreen,hWnd,"master.dat\\art\\interface\\mainmenu.frm",1); + + } + + ThisTick = GetTickCount(); + + if ((ThisTick - LastTick) > 0) + { + LastTick = ThisTick; + + Frame+=3; + + } + + olddims = dims; + UpdateInputState(); + + MousX += dims.lX; + MousY += dims.lY; + + if (MousX>=640) { MousX=640;} + if (MousX<=0) { MousX=0; } + if (MousY>=480) { MousY=480;} + if (MousY<=0) { MousY=0; } + + BlitTo(g_pDDSBack,0,0,640,480,0,0,0,FullScreen->FRM->FRM); + + if ((dims.rgbButtons[0] & 0x80) && MouseIn(30,20,56,46)) + { + BlitTo(g_pDDSBack,0,0,MenuDown->FRM->x,MenuDown->FRM->y,30,20,DDBLTFAST_SRCCOLORKEY,MenuDown->FRM->FRM); + } else + { + BlitTo(g_pDDSBack,0,0,MenuUp->FRM->x,MenuUp->FRM->y,30,20,DDBLTFAST_SRCCOLORKEY,MenuUp->FRM->FRM); + } + IanOutTextC(123,25,2,"Terep megadása"); + if ((dims.rgbButtons[0] & 0x80) && MouseIn(30,61,56,93)) + { + BlitTo(g_pDDSBack,0,0,MenuDown->FRM->x,MenuDown->FRM->y,30,61,DDBLTFAST_SRCCOLORKEY,MenuDown->FRM->FRM); + } else + { + BlitTo(g_pDDSBack,0,0,MenuUp->FRM->x,MenuUp->FRM->y,30,61,DDBLTFAST_SRCCOLORKEY,MenuUp->FRM->FRM); + } + IanOutTextC(123,66,2,"Szerkesztés"); + if ((dims.rgbButtons[0] & 0x80) && MouseIn(30,102,56,134)) + { + BlitTo(g_pDDSBack,0,0,MenuDown->FRM->x,MenuDown->FRM->y,30,102,DDBLTFAST_SRCCOLORKEY,MenuDown->FRM->FRM); + } else + { + BlitTo(g_pDDSBack,0,0,MenuUp->FRM->x,MenuUp->FRM->y,30,102,DDBLTFAST_SRCCOLORKEY,MenuUp->FRM->FRM); + } + IanOutTextC(123,107,2,"X"); + if ((dims.rgbButtons[0] & 0x80) && MouseIn(30,143,56,175)) + { + BlitTo(g_pDDSBack,0,0,MenuDown->FRM->x,MenuDown->FRM->y,30,143,DDBLTFAST_SRCCOLORKEY,MenuDown->FRM->FRM); + } else + { + BlitTo(g_pDDSBack,0,0,MenuUp->FRM->x,MenuUp->FRM->y,30,143,DDBLTFAST_SRCCOLORKEY,MenuUp->FRM->FRM); + } + IanOutTextC(123,148,2,"X"); + if ((dims.rgbButtons[0] & 0x80) && MouseIn(30,184,56,210)) + { + BlitTo(g_pDDSBack,0,0,MenuDown->FRM->x,MenuDown->FRM->y,30,184,DDBLTFAST_SRCCOLORKEY,MenuDown->FRM->FRM); + } else + { + BlitTo(g_pDDSBack,0,0,MenuUp->FRM->x,MenuUp->FRM->y,30,184,DDBLTFAST_SRCCOLORKEY,MenuUp->FRM->FRM); + } + IanOutTextC(123,189,2,"X"); + + if ((dims.rgbButtons[0] & 0x80) && MouseIn(30,225,56,250)) + { + BlitTo(g_pDDSBack,0,0,MenuDown->FRM->x,MenuDown->FRM->y,30,225,DDBLTFAST_SRCCOLORKEY,MenuDown->FRM->FRM); + } else + { + BlitTo(g_pDDSBack,0,0,MenuUp->FRM->x,MenuUp->FRM->y,30,225,DDBLTFAST_SRCCOLORKEY,MenuUp->FRM->FRM); + } + IanOutTextC(123,230,2,"Kilépés"); + + DisplayFrameRate(); + + IanOutText(0,465,1,"IanEd - IanOut Level Editor v"VERSIONNUM); + IanOutText(455,465,4,"Copyright (c) Sztupy corp."); + + if (Frame<256) SetPaletteBl(Frame); + + if ((olddims.rgbButtons[0] & 0x80) && !(dims.rgbButtons[0] & 0x80) && MouseIn(30,61,56,93)) + { GamePos=1; Frame=-25;FadeOut(); ClearSurface(g_pDDSBack,0,0,0); ClearSurface(g_pDDSPrimary,0,0,0);SetPaletteBl(255);return;} + if ((olddims.rgbButtons[0] & 0x80) && !(dims.rgbButtons[0] & 0x80) && MouseIn(30,225,56,250)) + { FadeOut(); ClearSurface(g_pDDSBack,0,0,0); ClearSurface(g_pDDSPrimary,0,0,0); PostMessage(hWnd, WM_CLOSE, 0, 0); return;} + + + BlitTo(g_pDDSBack,0,0,Mouse->FRM->x, Mouse->FRM->y,MousX,MousY,DDBLTFAST_SRCCOLORKEY,Mouse->FRM->FRM); + + // Flip the surfaces + while (TRUE) + { + hRet = g_pDDSPrimary->Flip(NULL, 0); + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + hRet = RestoreAll(); + if (hRet != DD_OK) + break; + } + if (hRet != DDERR_WASSTILLDRAWING) + break; + } + +} diff --git a/IanOutEd/ddex4_u3.h b/IanOutEd/ddex4_u3.h new file mode 100644 index 0000000..a88e84a --- /dev/null +++ b/IanOutEd/ddex4_u3.h @@ -0,0 +1,97 @@ +HRESULT LoadFRMSingle(PFRMSingle *LoadIn, HWND hWnd, char* filename, int i) +{ + HRESULT hRet; + + *LoadIn = new TFRMSingle(); + if ((hRet = (*LoadIn)->Load(hWnd, g_pDD, filename, i)) != DD_OK) + return InitFail(hWnd,hRet,"%s FAILED",filename); else return DD_OK; +} + +void DrawTerep(int mousetyp,int x,int y) +{ + int i2,iy,ix,i;//,ix2,iy2; + DDBLTFX ddbltfx; + + ZeroMemory(&ddbltfx, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(ddbltfx); + ddbltfx.dwFillColor = RGB(21,21,21); + g_pDDSBack->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); + + for (ix=0; ix<100; ix++) { + for (iy=0; iy<100; iy++) { + BlitTo(g_pDDSBack,0,0,80,35,ix*48+iy*32+TerX+9,iy*24-ix*12+TerY-5,DDBLTFAST_SRCCOLORKEY,MapInf->Tiles[(unsigned char)MapInf->Map[iy][ix]]->FRM->FRM); + //DrawChar(ix*48+iy*32+TerX+9,iy*24-ix*12+TerY-5,0,'X'); + //DisplayNum(ix*48+iy*32+TerX+9,iy*24-ix*12+TerY-5,1,ix,2); + //DisplayNum(ix*48+iy*32+TerX+9+10,iy*24-ix*12+TerY-5+10,1,iy,2); + } + } + + for (i2=0; i2<145; i2++) + for (ix=0; ix<165; ix++) + { + iy = i2; + if ((x==ix) && (y==iy)) + if ((MousY<460) && (MousY>15) && (mousetyp==0)) + { + BlitTo(g_pDDSBack,0,0,32,16,TerX+(x+226)*16,TerY+(y)*12,DDBLTFAST_SRCCOLORKEY,Select->FRM->FRM); + } + i = WallInf->Map[ix][iy]; + if ((i > 0) && (i<50) && (show_wall)) + { + i--; + BlitTo(g_pDDSBack,0,0,WallInf->Tiles[i]->FRM->x,WallInf->Tiles[i]->FRM->y,TerX+(ix+226)*16+WallMap[i][0],TerY+(iy)*12+WallMap[i][1],DDBLTFAST_SRCCOLORKEY,WallInf->Tiles[i]->FRM->FRM); + + } + i = ItemInf->Map[ix][iy]; + if ((i > 0) && (i<50) && (show_item)) + { + i--; + BlitTo(g_pDDSBack,0,0,ItemInf->Tiles[i]->FRM->x,ItemInf->Tiles[i]->FRM->y,TerX+(ix+226)*16+ItemMap[i][0],TerY+(iy)*12+ItemMap[i][1],DDBLTFAST_SRCCOLORKEY,ItemInf->Tiles[i]->FRM->FRM); + + } + + } + + if (putmode==1) + { + if ((MousY<460) && (MousY>15) && (Selected>=0) && (Selected<50)) + BlitTo(g_pDDSBack,0,0,WallInf->Tiles[Selected]->FRM->x,WallInf->Tiles[Selected]->FRM->y,TerX+(x+226)*16+WallMap[Selected][0],TerY+(y)*12+WallMap[Selected][1],DDBLTFAST_SRCCOLORKEY,WallInf->Tiles[Selected]->FRM->FRM); + } + + if (putmode==2) + { + if ((MousY<460) && (MousY>15) && (Selected>=0) && (Selected<14)) + BlitTo(g_pDDSBack,0,0,ItemInf->Tiles[Selected]->FRM->x,ItemInf->Tiles[Selected]->FRM->y,TerX+(x+226)*16+ItemMap[Selected][0],TerY+(y)*12+ItemMap[Selected][1],DDBLTFAST_SRCCOLORKEY,ItemInf->Tiles[Selected]->FRM->FRM); + } + + if (putmode==4) + { + if ((MousY<460) && (MousY>15) && (Selected>=0) && (Selected<6)) + BlitTo(g_pDDSBack,0,0,80,35,TerX+(x+226)*16+9,TerY+(y)*12-5,DDBLTFAST_SRCCOLORKEY,MapInf->Tiles[Selected]->FRM->FRM); + } + + + if (block_plane) + for (iy=0; iy<145; iy++) + for (ix=0; ix<165; ix++) + if (BlockDat[ix][iy] != 0) DrawChar(TerX+(ix+226)*16+11,TerY+(iy)*12+2,0,'X'); + + if (dot_plane) + for (iy=0; iy<145; iy++) + for (ix=0; ix<165; ix++) + { + if(iy%2==ix%2) DrawChar(TerX+(ix+226)*16+14,TerY+(iy)*12,4,(ix%8==Calculate[iy%8]) ? ((putmode==4) ? ('~'+1) : '.') : '.'); + //if(ix%8==Calculate[iy%8]) DrawChar(TerX+(ix+226)*16-2,TerY+(iy)*12,5,'.'); + } + + if (wall_plane) + for (iy=0; iy<145; iy++) + for (ix=0; ix<165; ix++) + if (WallInf->Map[ix][iy] != 0) DrawChar(TerX+(ix+226)*16+14,TerY+(iy)*12,3,'.'); + + if (item_plane) + for (iy=0; iy<145; iy++) + for (ix=0; ix<165; ix++) + if (ItemInf->Map[ix][iy] != 0) DrawChar(TerX+(ix+226)*16+14,TerY+(iy)*12,1,'.'); + +} \ No newline at end of file diff --git a/IanOutEd/font.h b/IanOutEd/font.h new file mode 100644 index 0000000..f2136af --- /dev/null +++ b/IanOutEd/font.h @@ -0,0 +1,18 @@ +#ifndef __font_h +#define __font_h + +#include "ddraw.h" +#include "afx.h" + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +extern void DisplayNum(int x, int y, int c,unsigned char i,LPDIRECTDRAWSURFACE7 g_pDDSText, LPDIRECTDRAWSURFACE7 g_pDDSOne, LPDIRECTDRAWSURFACE7 g_pDDSBack); +extern void DisplayFrameRate(LPDIRECTDRAWSURFACE7 g_pDDSText, LPDIRECTDRAWSURFACE7 g_pDDSOne, LPDIRECTDRAWSURFACE7 g_pDDSBack ); +extern void IanOutText(int x, int y, int co, CString str, LPDIRECTDRAWSURFACE7 g_pDDSText, LPDIRECTDRAWSURFACE7 g_pDDSOne, LPDIRECTDRAWSURFACE7 g_pDDSBack); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif \ No newline at end of file diff --git a/IanOutEd/resrc1.h b/IanOutEd/resrc1.h new file mode 100644 index 0000000..913a942 --- /dev/null +++ b/IanOutEd/resrc1.h @@ -0,0 +1,15 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by ddex4.rc +// + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/IanOutEd/temp.txt b/IanOutEd/temp.txt new file mode 100644 index 0000000..1da5e9b --- /dev/null +++ b/IanOutEd/temp.txt @@ -0,0 +1,497 @@ +//----------------------------------------------------------------------------- +// Name: InitApp() +// Desc: Do work required for every instance of the application: +// Create the window, initialize data +//----------------------------------------------------------------------------- + +int GetFRMData(char dat) +{ + FILE *stream; + char buf[74]; + DWORD i; + DWORD ki; + + + if( (stream = fopen( "test.frm", "r" )) != NULL ) + { + if (dat=='W') { + fread(&buf, 62, 1, stream); + } + else + { + fread(&buf, 64, 1, stream); + } + // ki = 0; + i = fgetc( stream); + ki=i*256; + i = fgetc( stream); + ki+=i; + fclose( stream ); + } + + return i; +} + +int LoadFRM(HWND hWnd, LPVOID LoadInto, int x, int y, int pitch) +{ + char buf[100]; + LPSTR PointTo; + int i; + int stream; + + PointTo = (LPSTR)LoadInto; + if( (stream = _open( "test.frm",_O_BINARY)) != -1 ) + { + _read(stream, &buf, 74); + + for (i=0; iBltFast(x, y, g_pDDSOne, + &rcRect, DDBLTFAST_SRCCOLORKEY); + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + hRet = RestoreAll(); + if (hRet != DD_OK) + return; + } + if (hRet != DDERR_WASSTILLDRAWING) + return; + } + + +void IanOutText(int x, int y, int co, CString str) +{ + int i; + int jelenx = 0; + int sor = 0; + int length = str.GetLength(); + for (i=0 ; iCreateDevice( GUID_SysMouse, &g_pMouse, NULL ); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"CreateDevice (mouse) failed"); + + /*hr = g_pDI->CreateDevice( GUID_SysKeyboard, &g_pKeyb, NULL ); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"CreateDevice (keyboard) failed");;*/ + + // Set the data format to "mouse format" - a predefined data format + // + // A data format specifies which controls on a device we + // are interested in, and how they should be reported. + // + // This tells DirectInput that we will be passing a + // DIMOUSESTATE structure to IDirectInputDevice::GetDeviceState. + hr = g_pMouse->SetDataFormat( &c_dfDIMouse ); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"SetDataFormat (mouse) failed"); + + /*hr = g_pKeyb->SetDataFormat( &c_dfDIKeyboard ); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"SetDataFormat (keyb) failed");;*/ + + // Set the cooperativity level to let DirectInput know how + // this device should interact with the system and with other + // DirectInput applications. + hr = g_pMouse->SetCooperativeLevel( hDlg, + DISCL_EXCLUSIVE | DISCL_FOREGROUND); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"SetCooperativeLevel (mouse) failed"); + + /*hr = g_pKeyb->SetCooperativeLevel( hDlg, + DISCL_EXCLUSIVE | DISCL_FOREGROUND); + if ( FAILED(hr) ) + return InitFail(hDlg,hr,"SetCooperativeLevel (keyb) failed");*/ + + return S_OK; +} + + + + +//----------------------------------------------------------------------------- +// Function: SetAcquire +// +// Description: +// Acquire or unacquire the mouse, depending on if the app is active +// Input device must be acquired before the GetDeviceState is called +// +//----------------------------------------------------------------------------- +HRESULT SetAcquire( ) +{ + + // nothing to do if g_pMouse is NULL + if (NULL == g_pMouse) + return S_FALSE; + + if (g_bActive) + { + // acquire the input device + g_pMouse->Acquire(); + //g_pKeyb->Acquire(); + } + else + { + + // unacquire the input device + g_pMouse->Unacquire(); + //g_pKeyb->Unacquire(); + } + + return S_OK; +} + + + + +//----------------------------------------------------------------------------- +// Function: UpdateInputState +// +// Description: +// Get the input device's state and display it. +// +//----------------------------------------------------------------------------- +HRESULT UpdateInputState( ) +{ + + if (NULL != g_pMouse) + { + HRESULT hr; + + hr = DIERR_INPUTLOST; + + // if input is lost then acquire and keep trying + while ( DIERR_INPUTLOST == hr ) + { + // get the input's device state, and put the state in dims + hr = g_pMouse->GetDeviceState( sizeof(DIMOUSESTATE), &dims ); + + if ( hr == DIERR_INPUTLOST ) + { + // DirectInput is telling us that the input stream has + // been interrupted. We aren't tracking any state + // between polls, so we don't have any special reset + // that needs to be done. We just re-acquire and + // try again. + hr = g_pMouse->Acquire(); + if ( FAILED(hr) ) + return hr; + } + } + + if ( FAILED(hr) ) + return hr; + + + /*int i; + + for (i=0; i<255; i++) + { + olddim[i] = keybdim[i]; + } + hr = g_pKeyb->GetDeviceState(sizeof(keybdim),(LPVOID)&keybdim); + if FAILED(hr) + { + return hr; + } */ + + + // The dims structure now has the state of the mouse, so + // display mouse coordinates (x, y, z) and buttons. + /*wsprintf( szNewText, "(%d, %d, %d) %c %c %c %c", + dims.lX, dims.lY, dims.lZ, + (dims.rgbButtons[0] & 0x80) ? '0' : ' ', + (dims.rgbButtons[1] & 0x80) ? '1' : ' ', + (dims.rgbButtons[2] & 0x80) ? '2' : ' ', + (dims.rgbButtons[3] & 0x80) ? '3' : ' '); +*/ + // if anything changed then repaint - avoid flicker + + } + + return S_OK; +} + + + + +//----------------------------------------------------------------------------- +// Function: FreeDirectInput +// +// Description: +// Initialize the DirectInput variables. +// +//----------------------------------------------------------------------------- +HRESULT FreeDirectInput() +{ + // Unacquire and release any DirectInputDevice objects. + if (NULL != g_pMouse) + { + // Unacquire the device one last time just in case + // the app tried to exit while the device is still acquired. + g_pMouse->Unacquire(); + + g_pMouse->Release(); + g_pMouse = NULL; + } + + /*if (NULL != g_pKeyb) + { + g_pKeyb->Unacquire(); + + g_pKeyb->Release(); + g_pKeyb = NULL; + }*/ + // Release any DirectInput objects. + if (NULL != g_pDI) + { + g_pDI->Release(); + g_pDI = NULL; + } + + return S_OK; +} + +pe2[i].peBlue = Frame; + pe2[i].peGreen = Frame; + pe2[i].peRed = Frame; + if (pe2[i].peBlue>(int)(pe[i].peBlue*gamma)) pe2[i].peBlue = (int)(pe[i].peBlue*gamma); + if (pe2[i].peRed>(int)(pe[i].peRed*gamma)) pe2[i].peRed = (int)(pe[i].peRed*gamma); + if (pe2[i].peGreen>(int)(pe[i].peGreen*gamma)) pe2[i].peGreen = (int)(pe[i].peGreen*gamma); + if (pe2[i].peBlue>255) pe2[i].peBlue=255; + if (pe2[i].peRed>255) pe2[i].peRed=255; + if (pe2[i].peGreen>255) pe2[i].peGreen=255; + + + +//DisplayNum(0,70,2,-TerX+MousX,4); + //DisplayNum(70,70,2,-TerY+MousY,4); + + for (x=0; x<160; x++) { + for (y=0; y<150; y++) { + if ((y%2==x%2) && (Ian->Table[x][y] != 111)) + DisplayNum(TerX+(x+226)*14, TerY+y*12, 2, Ian->Table[x][y],2); + + } + } + + + if (i<100) + { + PosIt[0][0]=1; + PosIt[0][1]=i; + PosIt[1][0]=tx; + PosIt[1][1]=ty; + + Mehet = TRUE; + while (Mehet) + { + i--; + if (i<1) {Mehet=FALSE;i=1;} + for (ix=2; ix<170; ix++) + for (iy=1; iy<150; iy++) + { + if (Table[ix][iy] == i) + { + if ((ix+2 == PosIt[i-1][0]) && + (iy == PosIt[i-1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix-2 == PosIt[i-1][0]) && + (iy == PosIt[i-1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix+1 == PosIt[i-1][0]) && + (iy+1 == PosIt[i-1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix+1 == PosIt[i-1][0]) && + (iy-1 == PosIt[i-1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix-1 == PosIt[i-1][0]) && + (iy+1 == PosIt[i-1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix-1 == PosIt[i-1][0]) && + (iy-1 == PosIt[i-1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + } + } + } + + } else + { + PosIt[0][0]=-1; + PosIt[0][1]=-1; + } + + + + i--; + if (i<1) {Mehet=FALSE;i=1;} + for (ix=2; ix<163; ix++) + for (iy=1; iy<143; iy++) + { + if (Table[ix][iy] == i) + { + if ((ix+2 == PosIt[i+1][0]) && + (iy == PosIt[i+1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix-2 == PosIt[i+1][0]) && + (iy == PosIt[i+1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix+1 == PosIt[i+1][0]) && + (iy+1 == PosIt[i+1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix+1 == PosIt[i+1][0]) && + (iy-1 == PosIt[i+1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix-1 == PosIt[i+1][0]) && + (iy+1 == PosIt[i+1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + if ((ix-1 == PosIt[i+1][0]) && + (iy-1 == PosIt[i+1][1])) {PosIt[i][0]=ix;PosIt[i][1]=iy;} + } + } + + +extern "C" +HRESULT BlitTo(LPDIRECTDRAWSURFACE7 Blit,int Sx1, int Sy1, int Sx2, int Sy2, int Dx, int Dy, DWORD flags, LPDIRECTDRAWSURFACE7 surf) +{ + DDBLTFX ddbltfx; + RECT rcRect; + RECT rcDest; + HRESULT hRet; + int iw1; + int iw2; + + hRet = DD_OK; + ZeroMemory(&ddbltfx, sizeof(ddbltfx)); + ddbltfx.dwSize = sizeof(ddbltfx); + ddbltfx.dwFillColor = 0; + + rcRect.left = Sx1; + rcRect.top = Sy1; + rcRect.right = Sx2; + rcRect.bottom = Sy2; + + iw1 = Sx2-Sx1; + iw2 = Sy2-Sy1; + + if (!((Dx>640) || (Dy>480) || (Dx+iw1<0) || (Dy+iw2<0))) { + + rcDest.left = Dx; + rcDest.top = Dy; + rcDest.right = Dx+iw1; + rcDest.bottom = Dy+iw2; + + while (TRUE) + { + hRet = Blit->Blt(&rcDest, surf, &rcRect, flags, &ddbltfx); + + if (hRet == DD_OK) + break; + if (hRet == DDERR_SURFACELOST) + { + /* hRet = RestoreAll(); + if (hRet != DD_OK)*/ + return hRet; + } + if (hRet != DDERR_WASSTILLDRAWING) + return hRet; + } + if (hRet != DD_OK) + return hRet; + } + return hRet; +} diff --git a/IanOutEd/utils.cpp b/IanOutEd/utils.cpp new file mode 100644 index 0000000..320d8df --- /dev/null +++ b/IanOutEd/utils.cpp @@ -0,0 +1,141 @@ +#include "ddraw.h" +#include +#include + +extern "C" HRESULT +InitFail(HWND hWnd, HRESULT hRet, LPCTSTR szError,...) +{ + char szBuff[128]; + char szBuff2[128]; + char szBuff3[50]; + va_list vl; + + va_start(vl, szError); + vsprintf(szBuff, szError, vl); + if (hRet == DD_OK) wsprintf(szBuff3,"DDERR_UNKNOWN"); + if (hRet == DDERR_ALREADYINITIALIZED ) wsprintf(szBuff3,"DDERR_ALREADYINITIALIZED "); + if (hRet == DDERR_BLTFASTCANTCLIP ) wsprintf(szBuff3,"DDERR_BLTFASTCANTCLIP "); + if (hRet == DDERR_CANNOTATTACHSURFACE ) wsprintf(szBuff3,"DDERR_CANNOTATTACHSURFACE "); + if (hRet == DDERR_CANNOTDETACHSURFACE ) wsprintf(szBuff3,"DDERR_CANNOTDETACHSURFACE "); + if (hRet == DDERR_CANTCREATEDC ) wsprintf(szBuff3,"DDERR_CANTCREATEDC "); + if (hRet == DDERR_CANTDUPLICATE ) wsprintf(szBuff3,"DDERR_CANTDUPLICATE "); + if (hRet == DDERR_CANTLOCKSURFACE ) wsprintf(szBuff3,"DDERR_CANTLOCKSURFACE "); + if (hRet == DDERR_CANTPAGELOCK ) wsprintf(szBuff3,"DDERR_CANTPAGELOCK "); + if (hRet == DDERR_CANTPAGEUNLOCK ) wsprintf(szBuff3,"DDERR_CANTPAGEUNLOCK "); + if (hRet == DDERR_CLIPPERISUSINGHWND ) wsprintf(szBuff3,"DDERR_CLIPPERISUSINGHWND "); + if (hRet == DDERR_COLORKEYNOTSET ) wsprintf(szBuff3,"DDERR_COLORKEYNOTSET "); + if (hRet == DDERR_CURRENTLYNOTAVAIL ) wsprintf(szBuff3,"DDERR_CURRENTLYNOTAVAIL "); + if (hRet == DDERR_DDSCAPSCOMPLEXREQUIRED ) wsprintf(szBuff3,"DDERR_DDSCAPSCOMPLEXREQUIRED "); + if (hRet == DDERR_DCALREADYCREATED ) wsprintf(szBuff3,"DDERR_DCALREADYCREATED "); + if (hRet == DDERR_DEVICEDOESNTOWNSURFACE ) wsprintf(szBuff3,"DDERR_DEVICEDOESNTOWNSURFACE "); + if (hRet == DDERR_DIRECTDRAWALREADYCREATED ) wsprintf(szBuff3,"DDERR_DIRECTDRAWALREADYCREATED "); + if (hRet == DDERR_EXCEPTION ) wsprintf(szBuff3,"DDERR_EXCEPTION "); + if (hRet == DDERR_EXCLUSIVEMODEALREADYSET ) wsprintf(szBuff3,"DDERR_EXCLUSIVEMODEALREADYSET "); + if (hRet == DDERR_EXPIRED ) wsprintf(szBuff3,"DDERR_EXPIRED "); + if (hRet == DDERR_GENERIC ) wsprintf(szBuff3,"DDERR_GENERIC "); + if (hRet == DDERR_HEIGHTALIGN ) wsprintf(szBuff3,"DDERR_HEIGHTALIGN "); + if (hRet == DDERR_HWNDALREADYSET ) wsprintf(szBuff3,"DDERR_HWNDALREADYSET "); + if (hRet == DDERR_HWNDSUBCLASSED ) wsprintf(szBuff3,"DDERR_HWNDSUBCLASSED "); + if (hRet == DDERR_IMPLICITLYCREATED ) wsprintf(szBuff3,"DDERR_IMPLICITLYCREATED "); + if (hRet == DDERR_INCOMPATIBLEPRIMARY ) wsprintf(szBuff3,"DDERR_INCOMPATIBLEPRIMARY "); + if (hRet == DDERR_INVALIDCAPS ) wsprintf(szBuff3,"DDERR_INVALIDCAPS "); + if (hRet == DDERR_INVALIDCLIPLIST ) wsprintf(szBuff3,"DDERR_INVALIDCLIPLIST "); + if (hRet == DDERR_INVALIDDIRECTDRAWGUID ) wsprintf(szBuff3,"DDERR_INVALIDDIRECTDRAWGUID "); + if (hRet == DDERR_INVALIDMODE ) wsprintf(szBuff3,"DDERR_INVALIDMODE "); + if (hRet == DDERR_INVALIDOBJECT ) wsprintf(szBuff3,"DDERR_INVALIDOBJECT "); + if (hRet == DDERR_INVALIDPARAMS ) wsprintf(szBuff3,"DDERR_INVALIDPARAMS "); + if (hRet == DDERR_INVALIDPIXELFORMAT ) wsprintf(szBuff3,"DDERR_INVALIDPIXELFORMAT "); + if (hRet == DDERR_INVALIDPOSITION ) wsprintf(szBuff3,"DDERR_INVALIDPOSITION "); + if (hRet == DDERR_INVALIDRECT ) wsprintf(szBuff3,"DDERR_INVALIDRECT "); + if (hRet == DDERR_INVALIDSTREAM ) wsprintf(szBuff3,"DDERR_INVALIDSTREAM "); + if (hRet == DDERR_INVALIDSURFACETYPE ) wsprintf(szBuff3,"DDERR_INVALIDSURFACETYPE "); + if (hRet == DDERR_LOCKEDSURFACES ) wsprintf(szBuff3,"DDERR_LOCKEDSURFACES "); + if (hRet == DDERR_MOREDATA ) wsprintf(szBuff3,"DDERR_MOREDATA "); + if (hRet == DDERR_NEWMODE ) wsprintf(szBuff3,"DDERR_NEWMODE "); + if (hRet == DDERR_NO3D ) wsprintf(szBuff3,"DDERR_NO3D "); + if (hRet == DDERR_NOALPHAHW ) wsprintf(szBuff3,"DDERR_NOALPHAHW "); + if (hRet == DDERR_NOBLTHW ) wsprintf(szBuff3,"DDERR_NOBLTHW "); + if (hRet == DDERR_NOCLIPLIST ) wsprintf(szBuff3,"DDERR_NOCLIPLIST "); + if (hRet == DDERR_NOCLIPPERATTACHED ) wsprintf(szBuff3,"DDERR_NOCLIPPERATTACHED "); + if (hRet == DDERR_NOCOLORCONVHW ) wsprintf(szBuff3,"DDERR_NOCOLORCONVHW "); + if (hRet == DDERR_NOCOLORKEY ) wsprintf(szBuff3,"DDERR_NOCOLORKEY "); + if (hRet == DDERR_NOCOLORKEYHW ) wsprintf(szBuff3,"DDERR_NOCOLORKEYHW "); + if (hRet == DDERR_NOCOOPERATIVELEVELSET ) wsprintf(szBuff3,"DDERR_NOCOOPERATIVELEVELSET "); + if (hRet == DDERR_NODC ) wsprintf(szBuff3,"DDERR_NODC "); + if (hRet == DDERR_NODDROPSHW ) wsprintf(szBuff3,"DDERR_NODDROPSHW "); + if (hRet == DDERR_NODIRECTDRAWHW ) wsprintf(szBuff3,"DDERR_NODIRECTDRAWHW "); + if (hRet == DDERR_NODIRECTDRAWSUPPORT ) wsprintf(szBuff3,"DDERR_NODIRECTDRAWSUPPORT "); + if (hRet == DDERR_NODRIVERSUPPORT ) wsprintf(szBuff3,"DDERR_NODRIVERSUPPORT "); + if (hRet == DDERR_NOEMULATION ) wsprintf(szBuff3,"DDERR_NOEMULATION "); + if (hRet == DDERR_NOEXCLUSIVEMODE ) wsprintf(szBuff3,"DDERR_NOEXCLUSIVEMODE "); + if (hRet == DDERR_NOFLIPHW ) wsprintf(szBuff3,"DDERR_NOFLIPHW "); + if (hRet == DDERR_NOFOCUSWINDOW ) wsprintf(szBuff3,"DDERR_NOFOCUSWINDOW "); + if (hRet == DDERR_NOGDI ) wsprintf(szBuff3,"DDERR_NOGDI "); + if (hRet == DDERR_NOHWND ) wsprintf(szBuff3,"DDERR_NOHWND "); + if (hRet == DDERR_NOMIPMAPHW ) wsprintf(szBuff3,"DDERR_NOMIPMAPHW "); + if (hRet == DDERR_NOMIRRORHW ) wsprintf(szBuff3,"DDERR_NOMIRRORHW "); + if (hRet == DDERR_NOMONITORINFORMATION ) wsprintf(szBuff3,"DDERR_NOMONITORINFORMATION "); + if (hRet == DDERR_NONONLOCALVIDMEM ) wsprintf(szBuff3,"DDERR_NONONLOCALVIDMEM "); + if (hRet == DDERR_NOOPTIMIZEHW ) wsprintf(szBuff3,"DDERR_NOOPTIMIZEHW "); + if (hRet == DDERR_NOOVERLAYDEST ) wsprintf(szBuff3,"DDERR_NOOVERLAYDEST "); + if (hRet == DDERR_NOOVERLAYHW ) wsprintf(szBuff3,"DDERR_NOOVERLAYHW "); + if (hRet == DDERR_NOPALETTEATTACHED ) wsprintf(szBuff3,"DDERR_NOPALETTEATTACHED "); + if (hRet == DDERR_NOPALETTEHW ) wsprintf(szBuff3,"DDERR_NOPALETTEHW "); + if (hRet == DDERR_NORASTEROPHW ) wsprintf(szBuff3,"DDERR_NORASTEROPHW "); + if (hRet == DDERR_NOROTATIONHW ) wsprintf(szBuff3,"DDERR_NOROTATIONHW "); + if (hRet == DDERR_NOSTEREOHARDWARE ) wsprintf(szBuff3,"DDERR_NOSTEREOHARDWARE "); + if (hRet == DDERR_NOSTRETCHHW ) wsprintf(szBuff3,"DDERR_NOSTRETCHHW "); + if (hRet == DDERR_NOSURFACELEFT ) wsprintf(szBuff3,"DDERR_NOSURFACELEFT "); + if (hRet == DDERR_NOT4BITCOLOR ) wsprintf(szBuff3,"DDERR_NOT4BITCOLOR "); + if (hRet == DDERR_NOT4BITCOLORINDEX ) wsprintf(szBuff3,"DDERR_NOT4BITCOLORINDEX "); + if (hRet == DDERR_NOT8BITCOLOR ) wsprintf(szBuff3,"DDERR_NOT8BITCOLOR "); + if (hRet == DDERR_NOTAOVERLAYSURFACE ) wsprintf(szBuff3,"DDERR_NOTAOVERLAYSURFACE "); + if (hRet == DDERR_NOTEXTUREHW ) wsprintf(szBuff3,"DDERR_NOTEXTUREHW "); + if (hRet == DDERR_NOTFLIPPABLE ) wsprintf(szBuff3,"DDERR_NOTFLIPPABLE "); + if (hRet == DDERR_NOTFOUND ) wsprintf(szBuff3,"DDERR_NOTFOUND "); + if (hRet == DDERR_NOTINITIALIZED ) wsprintf(szBuff3,"DDERR_NOTINITIALIZED "); + if (hRet == DDERR_NOTLOADED ) wsprintf(szBuff3,"DDERR_NOTLOADED "); + if (hRet == DDERR_NOTLOCKED ) wsprintf(szBuff3,"DDERR_NOTLOCKED "); + if (hRet == DDERR_NOTPAGELOCKED ) wsprintf(szBuff3,"DDERR_NOTPAGELOCKED "); + if (hRet == DDERR_NOTPALETTIZED ) wsprintf(szBuff3,"DDERR_NOTPALETTIZED "); + if (hRet == DDERR_NOVSYNCHW ) wsprintf(szBuff3,"DDERR_NOVSYNCHW "); + if (hRet == DDERR_NOZBUFFERHW ) wsprintf(szBuff3,"DDERR_NOZBUFFERHW "); + if (hRet == DDERR_NOZOVERLAYHW ) wsprintf(szBuff3,"DDERR_NOZOVERLAYHW "); + if (hRet == DDERR_OUTOFCAPS ) wsprintf(szBuff3,"DDERR_OUTOFCAPS "); + if (hRet == DDERR_OUTOFMEMORY ) wsprintf(szBuff3,"DDERR_OUTOFMEMORY "); + if (hRet == DDERR_OUTOFVIDEOMEMORY ) wsprintf(szBuff3,"DDERR_OUTOFVIDEOMEMORY "); + if (hRet == DDERR_OVERLAPPINGRECTS ) wsprintf(szBuff3,"DDERR_OVERLAPPINGRECTS "); + if (hRet == DDERR_OVERLAYCANTCLIP ) wsprintf(szBuff3,"DDERR_OVERLAYCANTCLIP "); + if (hRet == DDERR_OVERLAYCOLORKEYONLYONEACTIVE ) wsprintf(szBuff3,"DDERR_OVERLAYCOLORKEYONLYONEACTIVE "); + if (hRet == DDERR_OVERLAYNOTVISIBLE ) wsprintf(szBuff3,"DDERR_OVERLAYNOTVISIBLE "); + if (hRet == DDERR_PALETTEBUSY ) wsprintf(szBuff3,"DDERR_PALETTEBUSY "); + if (hRet == DDERR_PRIMARYSURFACEALREADYEXISTS ) wsprintf(szBuff3,"DDERR_PRIMARYSURFACEALREADYEXISTS "); + if (hRet == DDERR_REGIONTOOSMALL ) wsprintf(szBuff3,"DDERR_REGIONTOOSMALL "); + if (hRet == DDERR_SURFACEALREADYATTACHED ) wsprintf(szBuff3,"DDERR_SURFACEALREADYATTACHED "); + if (hRet == DDERR_SURFACEALREADYDEPENDENT ) wsprintf(szBuff3,"DDERR_SURFACEALREADYDEPENDENT "); + if (hRet == DDERR_SURFACEBUSY ) wsprintf(szBuff3,"DDERR_SURFACEBUSY "); + if (hRet == DDERR_SURFACEISOBSCURED ) wsprintf(szBuff3,"DDERR_SURFACEISOBSCURED "); + if (hRet == DDERR_SURFACELOST ) wsprintf(szBuff3,"DDERR_SURFACELOST "); + if (hRet == DDERR_SURFACENOTATTACHED ) wsprintf(szBuff3,"DDERR_SURFACENOTATTACHED "); + if (hRet == DDERR_TESTFINISHED ) wsprintf(szBuff3,"DDERR_TESTFINISHED "); + if (hRet == DDERR_TOOBIGHEIGHT ) wsprintf(szBuff3,"DDERR_TOOBIGHEIGHT "); + if (hRet == DDERR_TOOBIGSIZE ) wsprintf(szBuff3,"DDERR_TOOBIGSIZE "); + if (hRet == DDERR_TOOBIGWIDTH ) wsprintf(szBuff3,"DDERR_TOOBIGWIDTH "); + if (hRet == DDERR_UNSUPPORTED ) wsprintf(szBuff3,"DDERR_UNSUPPORTED "); + if (hRet == DDERR_UNSUPPORTEDFORMAT ) wsprintf(szBuff3,"DDERR_UNSUPPORTEDFORMAT "); + if (hRet == DDERR_UNSUPPORTEDMASK ) wsprintf(szBuff3,"DDERR_UNSUPPORTEDMASK "); + if (hRet == DDERR_UNSUPPORTEDMODE ) wsprintf(szBuff3,"DDERR_UNSUPPORTEDMODE "); + if (hRet == DDERR_VERTICALBLANKINPROGRESS ) wsprintf(szBuff3,"DDERR_VERTICALBLANKINPROGRESS "); + if (hRet == DDERR_VIDEONOTACTIVE ) wsprintf(szBuff3,"DDERR_VIDEONOTACTIVE "); + if (hRet == DDERR_WASSTILLDRAWING ) wsprintf(szBuff3,"DDERR_WASSTILLDRAWING "); + if (hRet == DDERR_WRONGMODE ) wsprintf(szBuff3,"DDERR_WRONGMODE "); + if (hRet == DDERR_XALIGN ) wsprintf(szBuff3,"DDERR_XALIGN "); + + wsprintf(szBuff2,"%s (%s)",szBuff,szBuff3); + + MessageBox(hWnd, szBuff2, "IanOut: A Post-Nuclear Ian-Playing Game", MB_OK); + PostMessage(hWnd, WM_CLOSE, 0, 0); + //DestroyWindow(hWnd); + va_end(vl); + return hRet; +} \ No newline at end of file diff --git a/IanOutEd/utils.h b/IanOutEd/utils.h new file mode 100644 index 0000000..57b563c --- /dev/null +++ b/IanOutEd/utils.h @@ -0,0 +1,44 @@ +#include "afx.h" + +#ifndef __utils_h +#define __utils_h + +#ifdef __cplusplus +extern "C" { /* Assume C declarations for C++ */ +#endif /* __cplusplus */ + +extern HRESULT InitFail(HWND hWnd, HRESULT hRet, LPCTSTR szError, ...); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +class TIniStr +{ +public: + TIniStr() + { + fname="";master="";slave="";buffer=""; + }; + virtual ~TIniStr() {}; + void Set(CString ifname, CString imaster, CString islave, CString ibuffer) + { + fname=ifname;master=imaster;slave=islave;buffer=ibuffer; + } + int FindIt(CString ifname, CString imaster, CString islave) + { + if ((ifname == fname) && (imaster == master) && (islave==slave)) return 0; else return 1; + } + CString Get() + { + return buffer; + } + +//private: + CString fname; + CString master; + CString slave; + CString buffer; +}; + +#endif // __utils_h \ No newline at end of file diff --git a/IanOutEd/version.txt b/IanOutEd/version.txt new file mode 100644 index 0000000..be3fe87 --- /dev/null +++ b/IanOutEd/version.txt @@ -0,0 +1,15 @@ +IanEd - IanOut Level Editor + (gy.k: JánosSzerk - JánosKi Pályaszerkesztő) + +-------------------------------------------------------------------------------------------------------------------- + +IanEd v0.1 (2001. 11. 11-25) +- Elkészült az új fömenüképernyő +- Már lehet objektumokat elhelyezni a pályán, de betölteni ill. menteni még nem + +IanEd v0.0 (2001. 11. 11) +- A IanOut v0.4a megjelenésével szükségessé vált egy egyszerűbben kezelhető pályaszerkesztő, + a további fejlesztéshez. Úgyhogy elkezdődött a pályaszerkesztő megírása... +- Elkészült a IanEd első változata a IanOut v4.0a-ból (ez lényegében ugyanaz, csak le van butítva) + +--------------------------------------------------------------------------------------------------------------------