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
57 changes: 57 additions & 0 deletions .runtime-test-data/config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

---------------
-- Should the game panic if there's a missing asset?
-- It is not advised to disable it.
-- Some levels may be unplayable anyway.
-- The best way is to find all the missing assets and rezip the episode!
*panic_when_missing_assets: true



-- To use legacy saving system with "slots"
*use_save_slots: true



-- To be able to complete the game as a killed player.
-- It was a legacy bug and was removed in 1.5.0
-- But some players requested it to be reimplemented.
-- And so many players requested it that it's enabled by default now.
*dead_level_finish: true



-- Player name
-- Used to save the game progress if "save slots" are disabled.
*player: pekka



-- Hardcore mode
-- While enabled, you only have 1 HP and cannot respawn at checkpoints
-- Only for masochists and no-hit challenges
-- Some episodes may be unbeatable
*hardcore_mode: false



-- To determine how the links menu should look like
-- Available options are: main_menu, bottom, none
*links_menu: main_menu



-- Audio Buffer Size
-- low value = low audio latency; high value = less cpu usage
-- Default is 1024
-- Prefer a power of 2: 512 1024 2048 4096 default
*audio_buffer_size: default



-- Silent suicide
-- If set to "true" the player has no destruction effect
-- after committing suicide by pressing delete key
-- Some players requested it for "psychological reasons".
-- disabled by default
*silent_suicide: false
64 changes: 64 additions & 0 deletions .runtime-test-data/log.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[DEBUG] PK2 - Pekka Kana 2 started!
[DEBUG] PK2 - Game version: Pekka Kana 2 Greta Engine v0.340 (zip)
[DEBUG] PK2 - Assets path - .\res
[DEBUG] PK2 - Data path - .\.runtime-test-data
[DEBUG] Piste - We compiled against SDL version 2.32.10 ...
[DEBUG] Piste - But we are linking against SDL version 2.32.10.
[DEBUG] PDraw - Initializing buffers
[DEBUG] PRender - Initializing graphics
[INFO] PRender - Video driver: windows
[INFO] PInput - No Controller found
[INFO] PInput - No haptic found
[DEBUG] PSound - buffer size: 1024
[DEBUG] PSound - Desired 44100hz 0x8010
[DEBUG] PSound - Audio driver: wasapi
[DEBUG] PSound - Got 44100hz 0x8010
[DEBUG] PK2 - Loading language from .\res\language\english.txt
[DEBUG] PDraw - Created font from .\res\language\fonts\ScandicSmall.txt - id 0
[DEBUG] PDraw - Created font from .\res\language\fonts\ScandicBig1.txt - id 1
[DEBUG] PDraw - Created font from .\res\language\fonts\ScandicBig2.txt - id 2
[DEBUG] PDraw - Created font from .\res\language\fonts\ScandicBig3.txt - id 3
[INFO] PInput - No Controller found
[INFO] PInput - No haptic found
[DEBUG] Piste - FPS set to 60
[DEBUG] PK2 - Testing episode 'rooster island 1' level 'level001.map'
[DEBUG] PK2 - Loading .\res\episodes\rooster island 1\level001.map, version 1.3
[INFO] PK2lua - No Lua scripting in this level
[DEBUG] PSound - Loaded .\res\music\song01.xm
[INFO] PK2 - Saving quick-save...
[DEBUG] PK2 - Quick-save saved!
[DEBUG] PK2 - Loading .\res\episodes\rooster island 1\level001.map, version 1.3
[INFO] PK2 - Loading quick-save...
[DEBUG] PK2 - Loading .\.runtime-test-data\quicksave\level.map, version 1.5
[DEBUG] PK2 - Quick-save loaded!
[DEBUG] PSound - Loaded .\res\music\song01.xm
[DEBUG] PK2 - Loading .\res\episodes\rooster island 1\level001.map, version 1.3
[INFO] PK2 - Loading quick-save...
[DEBUG] PK2 - Loading .\.runtime-test-data\quicksave\level.map, version 1.5
[DEBUG] PK2 - Quick-save loaded!
[DEBUG] PSound - Loaded .\res\music\song01.xm
[INFO] PK2 - Saving quick-save...
[DEBUG] PK2 - Quick-save saved!
[DEBUG] PK2 - Loading .\res\episodes\rooster island 1\level001.map, version 1.3
[INFO] PK2 - Loading quick-save...
[DEBUG] PK2 - Loading .\.runtime-test-data\quicksave\level.map, version 1.5
[DEBUG] PK2 - Quick-save loaded!
[DEBUG] PSound - Loaded .\res\music\song01.xm
[DEBUG] PK2 - Loading .\res\episodes\rooster island 1\level001.map, version 1.3
[INFO] PK2 - Loading quick-save...
[DEBUG] PK2 - Loading .\.runtime-test-data\quicksave\level.map, version 1.5
[DEBUG] PK2 - Quick-save loaded!
[DEBUG] PSound - Loaded .\res\music\song01.xm
[DEBUG] PK2 - Loading .\res\episodes\rooster island 1\level001.map, version 1.3
[INFO] PK2 - Loading quick-save...
[DEBUG] PK2 - Loading .\.runtime-test-data\quicksave\level.map, version 1.5
[DEBUG] PK2 - Quick-save loaded!
[DEBUG] PSound - Loaded .\res\music\song01.xm
[DEBUG] PK2 - Loading .\res\episodes\rooster island 1\level001.map, version 1.3
[INFO] PK2 - Loading quick-save...
[DEBUG] PK2 - Loading .\.runtime-test-data\quicksave\level.map, version 1.5
[DEBUG] PK2 - Quick-save loaded!
[DEBUG] PSound - Loaded .\res\music\song01.xm
[DEBUG] PSdl - Terminated
[DEBUG] PK2 - Terminated
[DEBUG] PLog - Terminated
Binary file added .runtime-test-data/quicksave/game.dat
Binary file not shown.
Binary file added .runtime-test-data/quicksave/level.map
Binary file not shown.
82 changes: 82 additions & 0 deletions .runtime-test-data/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"double_speed": false,
"filtering": 1,
"fps": 1,
"fullscreen": true,
"gui": true,
"joystick": {
"attack1": {
"code": 0,
"type": 2
},
"attack2": {
"code": 1,
"type": 2
},
"down": {
"code": 12,
"type": 2
},
"left": {
"code": 13,
"type": 2
},
"open_gift": {
"code": 9,
"type": 2
},
"right": {
"code": 14,
"type": 2
},
"up": {
"code": 11,
"type": 2
},
"walk_slow": {
"code": 3,
"type": 2
}
},
"keyboard": {
"attack1": {
"code": 224,
"type": 1
},
"attack2": {
"code": 225,
"type": 1
},
"down": {
"code": 81,
"type": 1
},
"left": {
"code": 80,
"type": 1
},
"open_gift": {
"code": 44,
"type": 1
},
"right": {
"code": 79,
"type": 1
},
"up": {
"code": 82,
"type": 1
},
"walk_slow": {
"code": 226,
"type": 1
}
},
"language": "english.txt",
"music_max_volume": 35,
"sfx_max_volume": 85,
"touchscreen": false,
"transparent_text": false,
"use_joystick": false,
"use_vibration": false
}
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ Pekka Kana 2 is installed or run. This is expected behavior.

## Advanced options

### Quick save

While playing a level, press **F5** to save the exact current game state and
**F9** to load the latest quick save. Quick saves are kept separate from level
checkpoints, so using them does not change normal checkpoint respawns or score
penalties.

### Commandline arguments

The game can be started with the "--dev" argument to enable the
Expand Down Expand Up @@ -259,4 +266,4 @@ https://sites.google.com/view/pekka-kana-fanpage/pekka-kana-2/useful-lists
https://libzip.org/

- **sol2**
https://github.com/ThePhD/sol2
https://github.com/ThePhD/sol2
2 changes: 1 addition & 1 deletion src/engine/PFilesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,4 +581,4 @@ std::string GetScreenshotName(){
return res.string();
}

}
}
9 changes: 5 additions & 4 deletions src/engine/PRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ bool is_vsync() {

void init(int width, int height, const char* name, const char* icon) {

Uint32 window_flags = SDL_WINDOW_SHOWN;
Uint32 window_flags = SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI;

PLog::Write(PLog::DEBUG, "PRender", "Initializing graphics");

Expand Down Expand Up @@ -263,11 +263,12 @@ void init(int width, int height, const char* name, const char* icon) {

void terminate() {

SDL_DestroyWindow(window);

delete renderer;
renderer = nullptr;

SDL_DestroyWindow(window);
window = nullptr;

}

void update(void* _buffer8) {
Expand All @@ -276,4 +277,4 @@ void update(void* _buffer8) {

}

}
}
23 changes: 19 additions & 4 deletions src/engine/Piste.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static void wait_frame() {

}

static void logic() {
static void update_input() {

SDL_Event event;

Expand All @@ -66,7 +66,8 @@ static void logic() {
}
else if(event.type == SDL_WINDOWEVENT){

if(event.window.event == SDL_WINDOWEVENT_RESIZED){
if(event.window.event == SDL_WINDOWEVENT_RESIZED ||
event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED){
PRender::adjust_screen();
}
else if(event.window.event == SDL_WINDOWEVENT_RESTORED){
Expand All @@ -81,6 +82,10 @@ static void logic() {
PInput::InputSystem::instance().updateMouse();
PInput::InputSystem::instance().updateTouch();

}

static void finish_frame() {

// Pass PDraw informations do PRender
if (draw) {
//PGui::update();
Expand Down Expand Up @@ -160,13 +165,23 @@ void loop(std::function<void()> GameLogic) {

static int frame_counter = 0;
static u32 last_time = 0;
bool first_frame = true;

running = true;

while(running) {


// ScreensHandler creates its first active screen in GameLogic. Delay input
// dispatch until that has happened so early events cannot hit a null screen.
if (!first_frame) {
update_input();
if (!running)
break;
}

GameLogic();
logic();
finish_frame();
first_frame = false;

frame_counter++;
if (frame_counter >= UPDATE_FPS) {
Expand Down
Loading