Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PlatformSDL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ PlatformSDL::PlatformSDL() :
animTilesSurface = IMG_Load("animtiles.png");
#ifdef PLATFORM_SPRITE_SUPPORT
spritesSurface = IMG_Load("spritesalpha.png");
SDL_SetColorKey(spritesSurface, SDL_TRUE, 16);
SDL_SetColorKey(spritesSurface, SDL_TRUE, SDL_MapRGB(spritesSurface->format, 255, 0, 255));
#endif
#endif
#ifdef PLATFORM_CURSOR_SUPPORT
Expand Down
Binary file added WindowsProject/Resource.rc
Binary file not shown.
10 changes: 9 additions & 1 deletion WindowsProject/WindowsProject.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ CP ../SDL_src/VC/SDL2_image/lib/x64/SDL2_image.dll ../x64/Debug/</Command>
<AdditionalIncludeDirectories>..\SDL_src\VC\SDL2_image\include;..\SDL_src\VC\SDL2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>SDL2.lib;SDL2main.lib;SDL2_image.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\SDL_src\VC\SDL2\lib\x64;..\SDL_src\VC\SDL2_image\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
Expand Down Expand Up @@ -161,6 +161,7 @@ CP ../SDL_src/VC/SDL2_image/lib/x64/SDL2_image.dll ../x64/Debug/</Command>
<ClInclude Include="..\PlatformSDL.h" />
<ClInclude Include="..\PT2.3A_replay_cia.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
Expand All @@ -169,6 +170,13 @@ CP ../SDL_src/VC/SDL2_image/lib/x64/SDL2_image.dll ../x64/Debug/</Command>
<ClCompile Include="..\PlatformSDL.cpp" />
<ClCompile Include="..\PT2.3A_replay_cia.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Resource.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="..\icon.ico" />
<Image Include="..\icon.png" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Expand Down
25 changes: 25 additions & 0 deletions WindowsProject/WindowsProject.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="..\petrobots.cpp" />
<ClCompile Include="..\Platform.cpp" />
<ClCompile Include="..\PlatformSDL.cpp" />
<ClCompile Include="..\PT2.3A_replay_cia.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\petrobots.h" />
<ClInclude Include="..\Platform.h" />
<ClInclude Include="..\PlatformSDL.h" />
<ClInclude Include="..\PT2.3A_replay_cia.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Resource.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="..\icon.png" />
<Image Include="..\icon.ico" />
</ItemGroup>
</Project>
16 changes: 16 additions & 0 deletions WindowsProject/resource.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Resource.rc
//
#define IDI_ICON1 102

// 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 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
Binary file added icon.ico
Binary file not shown.
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions petrobots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,18 @@ uint8_t CLOCK_ACTIVE = 0;
uint8_t INACTIVE_SECONDS = 0;
#endif

Uint32 next_time;
Uint32 time_left(void)
{
Uint32 now;

now = SDL_GetTicks();
if (next_time <= now)
return 0;
else
return next_time - now;
}

// This routine spaces out the timers so that not everything
// is running out once. It also starts the game_clock.
void SET_INITIAL_TIMERS()
Expand Down Expand Up @@ -694,6 +706,8 @@ void MAIN_GAME_LOOP()
break;
}
}
SDL_Delay(time_left()); // limit FPS on computers and mobile devices. Causes issues on game consoles and web.
next_time += TICK_INTERVAL;
}
}

Expand Down
2 changes: 2 additions & 0 deletions petrobots.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#define MAP_WINDOW_WIDTH (PLATFORM_MAP_WINDOW_TILES_WIDTH * 24)
#define MAP_WINDOW_HEIGHT (PLATFORM_MAP_WINDOW_TILES_HEIGHT * 24)

#define TICK_INTERVAL 120

// MAP FILES CONSIST OF EVERYTHING FROM THIS POINT ON
extern uint8_t MAP_DATA[8960];
#define UNIT_TYPE MAP_DATA // Unit type 0=none (64 bytes)
Expand Down