1
0
mirror of https://github.com/jummy0/sb2-decomp synced 2025-03-14 20:23:30 +01:00

Event.cpp Work

This commit is contained in:
HMVocaloid 2024-05-31 13:40:11 -04:00
parent 3388639bae
commit df44d886f2
12 changed files with 9262 additions and 6 deletions

View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Speedy Eggbert 2 Source", "Speedy Eggbert 2 Source.vcxproj", "{07F25327-C838-4ACD-ADBA-BE17F75007EF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{07F25327-C838-4ACD-ADBA-BE17F75007EF}.Debug|x64.ActiveCfg = Debug|x64
{07F25327-C838-4ACD-ADBA-BE17F75007EF}.Debug|x64.Build.0 = Debug|x64
{07F25327-C838-4ACD-ADBA-BE17F75007EF}.Debug|x86.ActiveCfg = Debug|Win32
{07F25327-C838-4ACD-ADBA-BE17F75007EF}.Debug|x86.Build.0 = Debug|Win32
{07F25327-C838-4ACD-ADBA-BE17F75007EF}.Release|x64.ActiveCfg = Release|x64
{07F25327-C838-4ACD-ADBA-BE17F75007EF}.Release|x64.Build.0 = Release|x64
{07F25327-C838-4ACD-ADBA-BE17F75007EF}.Release|x86.ActiveCfg = Release|Win32
{07F25327-C838-4ACD-ADBA-BE17F75007EF}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {13496F7E-739E-4004-A5EA-AAF0B184B7C6}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,181 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{07f25327-c838-4acd-adba-be17f75007ef}</ProjectGuid>
<RootNamespace>SpeedyEggbert2Source</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\SE2 Source Code\button.h" />
<ClInclude Include="..\..\SE2 Source Code\ddraw.h" />
<ClInclude Include="..\..\SE2 Source Code\ddutil.h" />
<ClInclude Include="..\..\SE2 Source Code\decor.h" />
<ClInclude Include="..\..\SE2 Source Code\def.h" />
<ClInclude Include="..\..\SE2 Source Code\dplay.h" />
<ClInclude Include="..\..\SE2 Source Code\dsound.h" />
<ClInclude Include="..\..\SE2 Source Code\event.h" />
<ClInclude Include="..\..\SE2 Source Code\fifo.h" />
<ClInclude Include="..\..\SE2 Source Code\jauge.h" />
<ClInclude Include="..\..\SE2 Source Code\menu.h" />
<ClInclude Include="..\..\SE2 Source Code\misc.h" />
<ClInclude Include="..\..\SE2 Source Code\movie.h" />
<ClInclude Include="..\..\SE2 Source Code\network.h" />
<ClInclude Include="..\..\SE2 Source Code\pixmap.h" />
<ClInclude Include="..\..\SE2 Source Code\sound.h" />
<ClInclude Include="..\..\SE2 Source Code\text.h" />
<ClInclude Include="..\..\SE2 Source Code\wave.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="Speedy Eggbert 2 Source.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\SE2 Source Code\blupi.cpp" />
<ClCompile Include="..\..\SE2 Source Code\button.cpp" />
<ClCompile Include="..\..\SE2 Source Code\ddutil.cpp" />
<ClCompile Include="..\..\SE2 Source Code\decblupi.cpp" />
<ClCompile Include="..\..\SE2 Source Code\decor.cpp" />
<ClCompile Include="..\..\SE2 Source Code\event.cpp" />
<ClCompile Include="..\..\SE2 Source Code\jauge.cpp" />
<ClCompile Include="..\..\SE2 Source Code\menu.cpp" />
<ClCompile Include="..\..\SE2 Source Code\misc.cpp" />
<ClCompile Include="..\..\SE2 Source Code\movie.cpp" />
<ClCompile Include="..\..\SE2 Source Code\network.cpp" />
<ClCompile Include="..\..\SE2 Source Code\pixmap.cpp" />
<ClCompile Include="..\..\SE2 Source Code\sound.cpp" />
<ClCompile Include="..\..\SE2 Source Code\text.cpp" />
<ClCompile Include="..\..\SE2 Source Code\wave.cpp" />
<ClCompile Include="Speedy Eggbert 2 Source.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Speedy Eggbert 2 Source.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="small.ico" />
<Image Include="Speedy Eggbert 2 Source.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Speedy Eggbert 2 Source.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SE2 Source Code\sound.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SE2 Source Code\text.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SE2 Source Code\wave.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SE2 Source Code\button.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SE2 Source Code\ddraw.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SE2 Source Code\ddutil.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SE2 Source Code\decor.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SE2 Source Code\def.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SE2 Source Code\dplay.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SE2 Source Code\dsound.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SE2 Source Code\event.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SE2 Source Code\fifo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SE2 Source Code\jauge.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SE2 Source Code\menu.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SE2 Source Code\misc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SE2 Source Code\movie.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SE2 Source Code\network.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\SE2 Source Code\pixmap.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Speedy Eggbert 2 Source.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\SE2 Source Code\jauge.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\SE2 Source Code\menu.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\SE2 Source Code\misc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\SE2 Source Code\movie.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\SE2 Source Code\network.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\SE2 Source Code\pixmap.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\SE2 Source Code\sound.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\SE2 Source Code\text.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\SE2 Source Code\wave.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\SE2 Source Code\blupi.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\SE2 Source Code\button.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\SE2 Source Code\ddutil.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\SE2 Source Code\decblupi.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\SE2 Source Code\decor.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\SE2 Source Code\event.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Speedy Eggbert 2 Source.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="small.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="Speedy Eggbert 2 Source.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>

5856
ddraw.h Normal file

File diff suppressed because it is too large Load Diff

143
decor.cpp
View File

@ -15,6 +15,7 @@
#include "misc.h"
#include "fifo.h"
#include "DECMOVE.h"
#include "event.h"
////////////////////////////////////////////////////////////////////////////////
@ -58,6 +59,40 @@ CDecor::~CDecor()
UndoClose();
}
/*
int CDecor::SetBlupiChannel()
{
if ( m_bMulti = 0 ||
m_blupiChannel == ch_blupi00 ||
m_team > 0);{
return m_team + 10;
}
return m_blupiChannel;
}
int CDecor::GetBlupiChannel()
int m_blupiChannel -> CHBLUPI000;
{
if ( m_bMulti != 0 ||
m_team > 0);{
return m_team + 10;
}
return CHBLUPI000;
}
*/
/*
int CDecor::GetPersonalBombIcon()
{
if ( m_bMulti != 0){
return m_team + icon_button_personalbombyellow;
}
return icon_button_personalbombyellow;
}
*/
void CDecor::SetTime(int time)
{
m_time = time;
@ -71,4 +106,110 @@ int CDecor::GetTime()
int CDecor::GetTargetLevel(int mission)
{
m_targetMission = mission;
}
}
int CDecor::GetRegion()
{
return m_region;
}
int CDecor::SetRegion(int region)
{
m_region = region;
}
int CDecor::GetMusic()
{
return m_music;
}
int CDecor::SetMusic(int music)
{
m_music = music
}
void CDecor::GetDims(POINT *ptr)
{
ptr.x = m_worldDims.x;
ptr.y = m_worldDims.y;
return;
}
void CDecor::SetDims(POINT dims)
{
m_worldDims.x = dims.x;
m_worldDims.y = dims.y;
}
int CDecor::GetLives()
{
return m_lives;
}
void CDecor::SetLives(int lives)
{
m_lives = lives;
}
BOOL CDecor::GetInvincible()
{
return m_bInvincible;
}
void CDecor::SetInvincible(BOOL invincible)
{
m_bInvincible = invincible;
}
BOOL CDecor::GetShowSecret()
{
return m_bShowSecret;
}
void CDecor::SetShowSecret(BOOL secret)
{
m_bShowSecret = secret;
}
void CDecor::SetAccessBuild(BOOL build)
{
m_bAccessBuild = build;
}
BOOL CDecor::GetNetPacked()
{
return m_bNetPacked;
}
void CDecor::SetNetPacked(BOOL net)
{
m_bNetPacked = net;
}
BOOL CDecor::GetNetMovePredict()
{
return m_bNetMovePredict;
}
void CDecor::SetNetMovePredict(BOOL netmove)
{
m_bNetMovePredict = netmove;
}
BOOL CDecor::GetNetDebug()
{
return m_bNetDebug;
}
void CDecor::SetMulti(int multi)
{
m_bMulti = multi;
}
void CDecor::SetTeam(int team)
{
m_team = team;
}

View File

@ -436,6 +436,10 @@ public:
void UndoCopy();
void UndoBack();
BOOL IsUndo();
BOOL GetShowSecret();
BOOL GetNetPacked();
BOOL GetNetMovePredict();
UINT GetPhase();
protected:

2385
dsound.h Normal file

File diff suppressed because it is too large Load Diff

315
event.cpp
View File

@ -15,7 +15,6 @@
#include "menu.h"
#include "jauge.h"
#include "event.h"
#include "action.h"
#include "text.h"
#include "misc.h"
#include "network.h"
@ -1654,7 +1653,7 @@ void CEvent::RestoreGame()
}
/*
void AddCheatCode(char *pDst, char *pSrc)
{
int i, j;
@ -1669,7 +1668,7 @@ void AddCheatCode(char *pDst, char *pSrc)
}
pDst[j] = 0;
}
*/
void CEvent::DrawTextCenter(int res, int x, int y, int font)
{
@ -1699,6 +1698,14 @@ BOOL CEvent::DrawButtons()
m_bChangeCheat = FALSE;
text[0] = 0;
if (m_bAccessBuild != 0)
{
AddCheatCode(text, cheat_code[0]);
}
if (m_posHelpButton.y != 0)
{
AddCheatCode(text, cheat_code[1]);
}
if ( m_pDecor->GetInvincible() )
{
AddCheatCode(text, cheat_code[3]);
@ -1711,9 +1718,43 @@ BOOL CEvent::DrawButtons()
{
AddCheatCode(text, cheat_code[19]);
}
if (m_pDecor->GetNetMovePredict())
{
AddCheatCode(text, cheat_code[21]);
}
}
}
int CEvent::MousePosToSprite(POINT pos)
{
int sprite;
sprite = SPRITE_POINTER;
if (m_phase == WM_PHASE_PLAY ||
m_phase == WM_PHASE_PLAYTEST ||
m_phase == WM_PHASE_BUILD ||
m_phase == WM_PHASE_BYE ||
MouseOnButton(pos.x, pos.y) = 0)
{
sprite = SPRITE_POINTER;
}
if (m_bWaitMouse)
{
sprite = SPRITE_WAIT;
}
if (m_bHideMouse)
{
sprite = SPRITE_EMPTY;
}
if (m_bFillMouse)
{
sprite = SPRITE_FILL;
}
return sprite;
}
void CEvent::MouseSprite(POINT pos)
{
m_mouseSprite = MousePosToSprite(pos);
@ -1776,7 +1817,27 @@ BOOL CEvent::MouseOnButton(POINT pos)
return FALSE;
}
int CEvent::SearchPhase(UINT phase)
{
int i = 0;
while (table[i].phase != 0)
{
if (table[i].phase == phase) return i;
i++;
}
return -1;
}
int CEvent::GetWorld()
{
if (m_bPrivate) return m_bPrivate;
if (m_bMulti) return m_multi;
else return m_mission;
}
int CEvent::GetPhysicalWorld()
{
if ( m_bPrivate ) return m_bPrivate;
if ( m_bMulti ) return m_multi+200;
@ -1810,6 +1871,90 @@ void CEvent::TryInsert()
}
}
void CEvent::MovieToStart()
{
if (m_movieToStart[0] != 0)
{
HideMouse(TRUE);
if (StartMovie(m_movieToStart))
{
m_phase = m_phaseAfterMovie;
}
else
{
ChangePhase(m_phaseAfterMovie);
}
m_movieToStart[0] = 0;
}
}
void CEvent::TryPhase()
{
m_tryPhase = 1;
ShowCursor(1);
}
void CEvent::UnTryPhase()
{
m_tryPhase = 0;
ShowCursor(1);
}
int CEvent::GetTryPhase()
{
return m_tryPhase;
}
BOOL CEvent::StartMovie(char* pFilename)
{
RECT rect;
char filename[MAX_PATH];
if (!m_pMovie->GetEnable()) return FALSE;
if (!m_bMovie) return FALSE;
if (!m_pMovie->IsExist(pFilename)) return FALSE;
rect.left = 1;
rect.top = 1;
rect.right = LXIMAGE - 2;
rect.bottom = LYIMAGE - 2;
m_pSound->StopMusic();
m_pPixmap->SavePalette();
strcpy(filename, pFilename);
strcpy(filename + strlen(filename) - 4, ".blp");
m_pSound->Cache(SOUND_MOVIE, filename);
if (m_pMovie->Play(m_hWnd, rect, pFilename)) return FALSE;
m_bRunMovie = TRUE;
m_pSound->Play(SOUND_MOVIE, 0, 0);
return TRUE;
}
void CEvent::StopMovie()
{
m_pMovie->Stop(m_hWnd);
m_pPixmap->RestorePalette();
m_pPixmap->MouseInvalidate();
m_pSound->Flush(SOUND_MOVIE);
ChangePhase(m_phase);
m_bRunMovie = FALSE;
}
BOOL CEvent::IsMovie()
{
return m_bRunMovie;
}
void CEvent::SetLives(int lives)
{
m_lives = lives;
}
void CEvent::SetSpeed(int speed)
{
int max;
@ -1875,4 +2020,168 @@ void CEvent::DemoRecStop()
m_bDemoRec = FALSE;
m_demoTime = 0;
}
BOOL CEvent::DemoPlayStart()
{
char filename[MAX_PATH];
FILE* file = NULL;
DemoHeader header;
int nb, world, time, total;
m_pDemoBuffer = (DemoEvent*)malloc(MAXDEMO * sizeof(DemoEvent));
if (m_pDemoBuffer == NULL) return FALSE;
memset(m_pDemoBuffer, 0, MAXDEMO * sizeof(DemoEvent));
sprintf(filename, "data\\demo%.3d.blp", m_demoNumber);
AddCDPath(filename); // ajoute l'acc<63>s au CD-Rom
file = fopen(filename, "rb");
if (file == NULL)
{
DemoPlayStop();
return FALSE;
}
nb = fread(&header, sizeof(DemoHeader), 1, file);
if (nb < 1)
{
DemoPlayStop();
return FALSE;
}
m_bSchool = header.bSchool;
m_bPrivate = header.bPrivate;
m_pDecor->SetSkill(header.skill);
m_demoEnd = fread(m_pDemoBuffer, sizeof(DemoEvent), MAXDEMO, file);
fclose(file);
m_demoTime = 0;
m_demoIndex = 0;
m_bDemoPlay = TRUE;
m_bDemoRec = FALSE;
if (!m_pDecor->Read(header.world, FALSE, world, time, total))
{
DemoPlayStop();
return FALSE;
}
ChangePhase(WM_PHASE_PLAY);
InitRandom();
m_pDecor->SetTime(0);
m_speed = 1;
return TRUE;
}
void CEvent::DemoPlayStop()
{
if (m_pDemoBuffer != NULL)
{
free(m_pDemoBuffer);
m_pDemoBuffer = NULL;
}
m_bDemoPlay = FALSE;
m_bDemoRec = FALSE;
m_demoTime = 0;
m_input = 0;
m_pDecor->TreatEvent;
m_private = 1;
ChangePhase(WM_PHASE_INIT);
}
void CEvent::DemoStep()
{
int time;
UINT message;
WPARAM wParam;
LPARAM lParam;
POINT pos;
if (m_phase == WM_PHASE_INIT)
{
if (m_demoTime > DEF_TIME_DEMO) // ~30 secondes <20>coul<75>es ?
{
m_demoNumber = 0;
DemoPlayStart(); // d<>marre une d<>mo automatique
}
}
if (m_bDemoPlay && // d<>mo en lecture ?
m_pDemoBuffer != NULL)
{
while (TRUE)
{
time = m_pDemoBuffer[m_demoIndex].time;
if (time > m_demoTime) break;
message = m_pDemoBuffer[m_demoIndex].message;
wParam = m_pDemoBuffer[m_demoIndex].wParam;
lParam = m_pDemoBuffer[m_demoIndex].lParam;
m_demoIndex++;
if (message == WM_MOUSEMOVE &&
m_mouseType == MOUSETYPEWIN)
{
pos = ConvLongToPos(lParam);
ClientToScreen(m_hWnd, &pos);
SetCursorPos(pos.x, pos.y);
}
TreatEventBase(message, wParam, lParam);
if (m_demoIndex >= m_demoEnd)
{
m_demoNumber++; // d<>mo suivante
if (!DemoPlayStart()) // d<>marre la d<>mo suivante
{
m_demoNumber = 0; // premi<6D>re d<>mo
DemoPlayStart(); // d<>marre la d<>mo
}
return;
}
}
}
m_demoTime++;
}
void CEvent::DemoRecEvent(UINT message, UINT input, WPARAM wParam, LPARAM lParam)
{
if (m_demoIndex > 0 &&
m_pDemoBuffer[m_demoIndex - 1].time == m_demoTime &&
m_pDemoBuffer[m_demoIndex - 1].input == m_input)
m_demoIndex++;
if (m_demoIndex >= MAXDEMO)
{
DemoRecStop();
}
}
POINT CEvent::GetLastMousePos()
{
return m_oldMousePos;
}
BOOL CEvent::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam)
{
if (m_bDemoPlay) // d<>mo en lecture ?
{
if (message == WM_KEYDOWN || // l'utilisateur clique ?
message == WM_KEYUP ||
// message == WM_LBUTTONDOWN ||
// message == WM_RBUTTONDOWN ||
message == WM_LBUTTONUP ||
message == WM_RBUTTONUP)
{
DemoPlayStop();
return TRUE;
}
if (message == WM_MOUSEMOVE) // l'utilisateur bouge ?
{
return TRUE;
}
}
return TreatEventBase(message, wParam, lParam);
}

View File

@ -129,12 +129,18 @@ protected:
BOOL ReadLibelle(int world, BOOL bSchool, BOOL bHelp);
BOOL WriteInfo();
BOOL ReadInfo();
BOOL IsMulti();
BOOL IsPrivate();
void TryPhase();
void UnTryPhase();
int GetTryPhase();
void SetLives(int lives);
void DemoRecStart();
void DemoRecStop();
BOOL DemoPlayStart();
void DemoPlayStop();
void DemoRecEvent(UINT message, WPARAM wParam, LPARAM lParam);
void DemoRecEvent(UINT message, UINT input, WPARAM wParam, LPARAM lParam);
protected:
int m_speed;
@ -216,6 +222,7 @@ protected:
int m_demoIndex;
int m_demoEnd;
int m_demoNumber;
int m_tryPhase;
BOOL m_bCtrlDown;
POINT m_debugPos;
int m_introTime;

View File

@ -16,7 +16,9 @@ public:
void Redraw();
void SetLevel(int level);
int GetLevel();
void SetType(int type);
int GetType();
BOOL GetHide();
void SetHide(BOOL bHide);

193
misc.cpp
View File

@ -154,4 +154,195 @@ void AddCDPath(char *pFilename)
#endif
strcpy(pFilename, temp);
}
}
void AddUserPath(char *pFilename)
{
char temp[MAX_PATH];
char* pText;
int pos;
char last;
SECURITY_ATTRIBUTES att;
if ( g_CDPath[0] != 0 ) return;
strcpy(temp, "c:\\Speedy_Blupi\\");
att.nLength = sizeof(SECURITY_ATTRIBUTES);
att.lpSecurityDescriptor = NULL;
att.bInheritHandle = FALSE;
CreateDirectory(temp, &att);
pText = strstr(pFilename, "\\");
if ( pText != NULL )
{
pos = strlen(temp)+(pText-pFilename)+1;
strcat(temp, pFilename);
last = temp[pos];
temp[pos] = 0;
CreateDirectory(temp, &att);
temp[pos] = last;
}
else
{
strcat(temp, pFilename);
}
strcpy(pFilename, temp);
}
void TraceErrorDD(HRESULT hErr, char *sFile, int nLine)
{
char dderr[256];
char err[1024];
switch (hErr)
{
case DD_OK : sprintf(dderr, "DD_OK"); break;
case DDERR_ALREADYINITIALIZED : sprintf(dderr, "DDERR_ALREADYINITIALIZED"); break;
case DDERR_CANNOTATTACHSURFACE : sprintf(dderr, "DDERR_CANNOTATTACHSURFACE"); break;
case DDERR_CANNOTDETACHSURFACE : sprintf(dderr, "DDERR_CANNOTDETACHSURFACE"); break;
case DDERR_CURRENTLYNOTAVAIL : sprintf(dderr, "DDERR_CURRENTLYNOTAVAIL"); break;
case DDERR_EXCEPTION : sprintf(dderr, "DDERR_EXCEPTION"); break;
case DDERR_GENERIC : sprintf(dderr, "DDERR_GENERIC"); break;
case DDERR_HEIGHTALIGN : sprintf(dderr, "DDERR_HEIGHTALIGN"); break;
case DDERR_INCOMPATIBLEPRIMARY : sprintf(dderr, "DDERR_INCOMPATIBLEPRIMARY"); break;
case DDERR_INVALIDCAPS : sprintf(dderr, "DDERR_INVALIDCAPS"); break;
case DDERR_INVALIDCLIPLIST : sprintf(dderr, "DDERR_INVALIDCLIPLIST"); break;
case DDERR_INVALIDMODE : sprintf(dderr, "DDERR_INVALIDMODE"); break;
case DDERR_INVALIDOBJECT : sprintf(dderr, "DDERR_INVALIDOBJECT"); break;
case DDERR_INVALIDPARAMS : sprintf(dderr, "DDERR_INVALIDPARAMS"); break;
case DDERR_INVALIDPIXELFORMAT : sprintf(dderr, "DDERR_INVALIDPIXELFORMAT"); break;
case DDERR_INVALIDRECT : sprintf(dderr, "DDERR_INVALIDRECT"); break;
case DDERR_LOCKEDSURFACES : sprintf(dderr, "DDERR_LOCKEDSURFACES"); break;
case DDERR_NO3D : sprintf(dderr, "DDERR_NO3D"); break;
case DDERR_NOALPHAHW : sprintf(dderr, "DDERR_NOALPHAHW"); break;
case DDERR_NOCLIPLIST : sprintf(dderr, "DDERR_NOCLIPLIST"); break;
case DDERR_NOCOLORCONVHW : sprintf(dderr, "DDERR_NOCOLORCONVHW"); break;
case DDERR_NOCOOPERATIVELEVELSET : sprintf(dderr, "DDERR_NOCOOPERATIVELEVELSET"); break;
case DDERR_NOCOLORKEY : sprintf(dderr, "DDERR_NOCOLORKEY"); break;
case DDERR_NOCOLORKEYHW : sprintf(dderr, "DDERR_NOCOLORKEYHW"); break;
case DDERR_NODIRECTDRAWSUPPORT : sprintf(dderr, "DDERR_NODIRECTDRAWSUPPORT"); break;
case DDERR_NOEXCLUSIVEMODE : sprintf(dderr, "DDERR_NOEXCLUSIVEMODE"); break;
case DDERR_NOFLIPHW : sprintf(dderr, "DDERR_NOFLIPHW"); break;
case DDERR_NOGDI : sprintf(dderr, "DDERR_NOGDI"); break;
case DDERR_NOMIRRORHW : sprintf(dderr, "DDERR_NOMIRRORHW"); break;
case DDERR_NOTFOUND : sprintf(dderr, "DDERR_NOTFOUND"); break;
case DDERR_NOOVERLAYHW : sprintf(dderr, "DDERR_NOOVERLAYHW"); break;
case DDERR_NORASTEROPHW : sprintf(dderr, "DDERR_NORASTEROPHW"); break;
case DDERR_NOROTATIONHW : sprintf(dderr, "DDERR_NOROTATIONHW"); break;
case DDERR_NOSTRETCHHW : sprintf(dderr, "DDERR_NOSTRETCHHW"); break;
case DDERR_NOT4BITCOLOR : sprintf(dderr, "DDERR_NOT4BITCOLOR"); break;
case DDERR_NOT4BITCOLORINDEX : sprintf(dderr, "DDERR_NOT4BITCOLORINDEX"); break;
case DDERR_NOT8BITCOLOR : sprintf(dderr, "DDERR_NOT8BITCOLOR"); break;
case DDERR_NOTEXTUREHW : sprintf(dderr, "DDERR_NOTEXTUREHW"); break;
case DDERR_NOVSYNCHW : sprintf(dderr, "DDERR_NOVSYNCHW"); break;
case DDERR_NOZBUFFERHW : sprintf(dderr, "DDERR_NOZBUFFERHW"); break;
case DDERR_NOZOVERLAYHW : sprintf(dderr, "DDERR_NOZOVERLAYHW"); break;
case DDERR_OUTOFCAPS : sprintf(dderr, "DDERR_OUTOFCAPS"); break;
case DDERR_OUTOFMEMORY : sprintf(dderr, "DDERR_OUTOFMEMORY"); break;
case DDERR_OUTOFVIDEOMEMORY : sprintf(dderr, "DDERR_OUTOFVIDEOMEMORY"); break;
case DDERR_OVERLAYCANTCLIP : sprintf(dderr, "DDERR_OVERLAYCANTCLIP"); break;
case DDERR_OVERLAYCOLORKEYONLYONEACTIVE : sprintf(dderr, "DDERR_OVERLAYCOLORKEYONLYONEACTIVE"); break;
case DDERR_PALETTEBUSY : sprintf(dderr, "DDERR_PALETTEBUSY"); break;
case DDERR_COLORKEYNOTSET : sprintf(dderr, "DDERR_COLORKEYNOTSET"); break;
case DDERR_SURFACEALREADYATTACHED : sprintf(dderr, "DDERR_SURFACEALREADYATTACHED"); break;
case DDERR_SURFACEALREADYDEPENDENT : sprintf(dderr, "DDERR_SURFACEALREADYDEPENDENT"); break;
case DDERR_SURFACEBUSY : sprintf(dderr, "DDERR_SURFACEBUSY"); break;
case DDERR_CANTLOCKSURFACE : sprintf(dderr, "DDERR_CANTLOCKSURFACE"); break;
case DDERR_SURFACEISOBSCURED : sprintf(dderr, "DDERR_SURFACEISOBSCURED"); break;
case DDERR_SURFACELOST : sprintf(dderr, "DDERR_SURFACELOST"); break;
case DDERR_SURFACENOTATTACHED : sprintf(dderr, "DDERR_SURFACENOTATTACHED"); break;
case DDERR_TOOBIGHEIGHT : sprintf(dderr, "DDERR_TOOBIGHEIGHT"); break;
case DDERR_TOOBIGSIZE : sprintf(dderr, "DDERR_TOOBIGSIZE"); break;
case DDERR_TOOBIGWIDTH : sprintf(dderr, "DDERR_TOOBIGWIDTH"); break;
case DDERR_UNSUPPORTED : sprintf(dderr, "DDERR_UNSUPPORTED"); break;
case DDERR_UNSUPPORTEDFORMAT : sprintf(dderr, "DDERR_UNSUPPORTEDFORMAT"); break;
case DDERR_UNSUPPORTEDMASK : sprintf(dderr, "DDERR_UNSUPPORTEDMASK"); break;
case DDERR_VERTICALBLANKINPROGRESS : sprintf(dderr, "DDERR_VERTICALBLANKINPROGRESS"); break;
case DDERR_WASSTILLDRAWING : sprintf(dderr, "DDERR_WASSTILLDRAWING"); break;
case DDERR_XALIGN : sprintf(dderr, "DDERR_XALIGN"); break;
case DDERR_INVALIDDIRECTDRAWGUID : sprintf(dderr, "DDERR_INVALIDDIRECTDRAWGUID"); break;
case DDERR_DIRECTDRAWALREADYCREATED : sprintf(dderr, "DDERR_DIRECTDRAWALREADYCREATED"); break;
case DDERR_NODIRECTDRAWHW : sprintf(dderr, "DDERR_NODIRECTDRAWHW"); break;
case DDERR_PRIMARYSURFACEALREADYEXISTS : sprintf(dderr, "DDERR_PRIMARYSURFACEALREADYEXISTS"); break;
case DDERR_NOEMULATION : sprintf(dderr, "DDERR_NOEMULATION"); break;
case DDERR_REGIONTOOSMALL : sprintf(dderr, "DDERR_REGIONTOOSMALL"); break;
case DDERR_CLIPPERISUSINGHWND : sprintf(dderr, "DDERR_CLIPPERISUSINGHWND"); break;
case DDERR_NOCLIPPERATTACHED : sprintf(dderr, "DDERR_NOCLIPPERATTACHED"); break;
case DDERR_NOHWND : sprintf(dderr, "DDERR_NOHWND"); break;
case DDERR_HWNDSUBCLASSED : sprintf(dderr, "DDERR_HWNDSUBCLASSED"); break;
case DDERR_HWNDALREADYSET : sprintf(dderr, "DDERR_HWNDALREADYSET"); break;
case DDERR_NOPALETTEATTACHED : sprintf(dderr, "DDERR_NOPALETTEATTACHED"); break;
case DDERR_NOPALETTEHW : sprintf(dderr, "DDERR_NOPALETTEHW"); break;
case DDERR_BLTFASTCANTCLIP : sprintf(dderr, "DDERR_BLTFASTCANTCLIP"); break;
case DDERR_NOBLTHW : sprintf(dderr, "DDERR_NOBLTHW"); break;
case DDERR_NODDROPSHW : sprintf(dderr, "DDERR_NODDROPSHW"); break;
case DDERR_OVERLAYNOTVISIBLE : sprintf(dderr, "DDERR_OVERLAYNOTVISIBLE"); break;
case DDERR_NOOVERLAYDEST : sprintf(dderr, "DDERR_NOOVERLAYDEST"); break;
case DDERR_INVALIDPOSITION : sprintf(dderr, "DDERR_INVALIDPOSITION"); break;
case DDERR_NOTAOVERLAYSURFACE : sprintf(dderr, "DDERR_NOTAOVERLAYSURFACE"); break;
case DDERR_EXCLUSIVEMODEALREADYSET : sprintf(dderr, "DDERR_EXCLUSIVEMODEALREADYSET"); break;
case DDERR_NOTFLIPPABLE : sprintf(dderr, "DDERR_NOTFLIPPABLE"); break;
case DDERR_CANTDUPLICATE : sprintf(dderr, "DDERR_CANTDUPLICATE"); break;
case DDERR_NOTLOCKED : sprintf(dderr, "DDERR_NOTLOCKED"); break;
case DDERR_CANTCREATEDC : sprintf(dderr, "DDERR_CANTCREATEDC"); break;
case DDERR_NODC : sprintf(dderr, "DDERR_NODC"); break;
case DDERR_WRONGMODE : sprintf(dderr, "DDERR_WRONGMODE"); break;
case DDERR_IMPLICITLYCREATED : sprintf(dderr, "DDERR_IMPLICITLYCREATED"); break;
case DDERR_NOTPALETTIZED : sprintf(dderr, "DDERR_NOTPALETTIZED"); break;
case DDERR_UNSUPPORTEDMODE : sprintf(dderr, "DDERR_UNSUPPORTEDMODE"); break;
case DDERR_NOMIPMAPHW : sprintf(dderr, "DDERR_NOMIPMAPHW"); break;
case DDERR_INVALIDSURFACETYPE : sprintf(dderr, "DDERR_INVALIDSURFACETYPE"); break;
case DDERR_DCALREADYCREATED : sprintf(dderr, "DDERR_DCALREADYCREATED"); break;
case DDERR_CANTPAGELOCK : sprintf(dderr, "DDERR_CANTPAGELOCK"); break;
case DDERR_CANTPAGEUNLOCK : sprintf(dderr, "DDERR_CANTPAGEUNLOCK"); break;
case DDERR_NOTPAGELOCKED : sprintf(dderr, "DDERR_NOTPAGELOCKED"); break;
case DDERR_NOTINITIALIZED : sprintf(dderr, "DDERR_NOTINITIALIZED"); break;
default : sprintf(dderr, "Unknown Error"); break;
}
sprintf(err, "DirectDraw Error %s in file %s at line %d\n", dderr, sFile, nLine);
OutputDebug(err);
}
//----------------------------------------------------------------------
//
// Function : TraceErrorDS()
//
// Purpose : Traces an error (DirectSound)
//
//----------------------------------------------------------------------
void TraceErrorDS(HRESULT hErr, char *sFile, int nLine)
{
char dserr[256];
char err[1024];
switch (hErr)
{
case DS_OK : sprintf(dserr, "DD_OK"); break;
case DSERR_ALLOCATED : sprintf(dserr, "DSERR_ALLOCATED"); break;
case DSERR_CONTROLUNAVAIL : sprintf(dserr, "DSERR_CONTROLUNAVAIL"); break;
case DSERR_INVALIDPARAM : sprintf(dserr, "DSERR_INVALIDPARAM"); break;
case DSERR_INVALIDCALL : sprintf(dserr, "DSERR_INVALIDCALL"); break;
case DSERR_GENERIC : sprintf(dserr, "DSERR_GENERIC"); break;
case DSERR_PRIOLEVELNEEDED : sprintf(dserr, "DSERR_PRIOLEVELNEEDED"); break;
case DSERR_OUTOFMEMORY : sprintf(dserr, "DSERR_OUTOFMEMORY"); break;
case DSERR_BADFORMAT : sprintf(dserr, "DSERR_BADFORMAT"); break;
case DSERR_UNSUPPORTED : sprintf(dserr, "DSERR_UNSUPPORTED"); break;
case DSERR_NODRIVER : sprintf(dserr, "DSERR_NODRIVER"); break;
case DSERR_ALREADYINITIALIZED : sprintf(dserr, "DSERR_ALREADYINITIALIZED"); break;
case DSERR_NOAGGREGATION : sprintf(dserr, "DSERR_NOAGGREGATION"); break;
case DSERR_BUFFERLOST : sprintf(dserr, "DSERR_BUFFERLOST"); break;
case DSERR_OTHERAPPHASPRIO : sprintf(dserr, "DSERR_OTHERAPPHASPRIO"); break;
case DSERR_UNINITIALIZED : sprintf(dserr, "DSERR_UNINITIALIZED"); break;
default : sprintf(dserr, "Unknown Error"); break;
}
sprintf(err, "DirectSound Error %s in file %s at line %d\n", dserr, sFile, nLine);
OutputDebug(err);
}

View File

@ -53,6 +53,7 @@ protected:
HWND m_hWnd;
BOOL m_bEnable;
BOOL m_bState;
BOOL m_bCDAudio;
LPDIRECTSOUND m_lpDS;
LPDIRECTSOUNDBUFFER m_lpDSB[MAXSOUND];
short m_channelBlupi[MAXBLUPI];