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
33 changes: 33 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
add_subdirectory(src)

FILE(
GLOB_RECURSE
data_dos_file
data/*
)

add_custom_target(Data_DOS
SOURCES
${data_dos_file}
)

FILE(
GLOB_RECURSE
doc_file
doc/*
)

add_custom_target(Doc
SOURCES
${doc_file}
)

add_custom_target(Root_Data
SOURCES
COPYING
ReadMe.amigaos4
README.md
SDLPoP.ini
mods/mods.txt
replays/replays.txt
)
4 changes: 4 additions & 0 deletions SDLPoP.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@


[General]
; Language selection (EN, FR, DE)
; Texts not translated default to english
language = EN

; Show the in-game menu when you pause the game by pressing Escape.
; If this is disabled, you can still bring up the menu using Backspace.
enable_pause_menu = true
Expand Down
Binary file added data/TITLE/res42_DE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/TITLE/res42_FR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/TITLE/res43_DE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/TITLE/res43_FR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/TITLE/res44_DE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/TITLE/res44_FR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/TITLE/res52_DE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/TITLE/res52_FR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/TITLE/res53_DE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/TITLE/res53_FR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/font/res1132.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/font/res1133.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/font/res1134.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/font/res1135.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ if (WIN32)
link_directories(${SDL2}/${SDL2_ARCH}/lib)
endif()

if (UNIX)
add_definitions(-D_GNU_SOURCE=1)
endif()

set(SOURCE_FILES
main.c
common.h
Expand All @@ -59,6 +63,12 @@ set(SOURCE_FILES
data.h
proto.h
types.h
Localization/legacy_ingame_texts.h
Localization/language.h
Localization/non_ascii_code.h
Localization/legacy_ingame_texts.c
Localization/language.c
Localization/non_ascii_code.c
seg000.c
seg001.c
seg002.c
Expand Down
63 changes: 63 additions & 0 deletions src/Localization/language.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
SDLPoP, a port/conversion of the DOS game Prince of Persia.
Copyright (C) 2013-2023 Dávid Nagy

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.

The authors of this program may be contacted at https://forum.princed.org
*/

#include <string.h>
#include <stdio.h>

#include "../proto.h"
#include "language.h"

enum localization set_language_param(const char *value) {
if (strcmp(value, "EN") == 0) return EN;
else if (strcmp(value, "FR") == 0) return FR;
else if (strcmp(value, "DE") == 0) return DE;
else return EN;
}

void select_language_img(enum localization loc,
char* image_filename, size_t image_filename_size,
const char* filename_no_ext, int resource_id, const char* extension) {
char lang_append[10];

switch (loc) {
case EN:
strncpy(lang_append, "", sizeof(lang_append)); break;
case FR:
strncpy(lang_append, "_FR", sizeof(lang_append)); break;
case DE:
strncpy(lang_append, "_DE", sizeof(lang_append)); break;
default:
strncpy(lang_append, "", sizeof(lang_append)); break;
}

// First check if there is a file specific to the selected language
snprintf_check(image_filename,image_filename_size,"data/%s/res%d%s.%s",filename_no_ext, resource_id, lang_append, extension);

// try to open the file to check if it exists
FILE* fp = fopen(locate_file(image_filename), "rb");
if (fp != NULL) {
fclose(fp);
}
else {
// Specific file does not exist - fallback to regular file
snprintf_check(image_filename,image_filename_size,"data/%s/res%d.%s",filename_no_ext, resource_id, extension);
}
return;
}
36 changes: 36 additions & 0 deletions src/Localization/language.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
SDLPoP, a port/conversion of the DOS game Prince of Persia.
Copyright (C) 2013-2023 Dávid Nagy

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.

The authors of this program may be contacted at https://forum.princed.org
*/

#ifndef LANGUAGE_H
#define LANGUAGE_H

enum localization {
EN = 0,
FR,
DE
};

enum localization set_language_param(const char *value);

void select_language_img(enum localization loc,
char* image_filename, size_t image_filename_size,
const char* filename_no_ext, int resource_id, const char* extension);

#endif
195 changes: 195 additions & 0 deletions src/Localization/legacy_ingame_texts.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
/*
SDLPoP, a port/conversion of the DOS game Prince of Persia.
Copyright (C) 2013-2023 Dávid Nagy

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.

The authors of this program may be contacted at https://forum.princed.org
*/

#include <stdio.h>

#include "legacy_ingame_texts.h"

// Note : bottom text box cannot display more than 28 chars

void str_one_second_left(enum localization loc, char* string, size_t string_size) {
switch (loc) {
case FR:
strncpy(string, "DERNIERE SECONDE", string_size); break;
case DE:
strncpy(string, "1 SEKUNDE UEBRIG", string_size); break;
case EN:
default:
strncpy(string, "1 SECOND LEFT", string_size); break;
}
}

void str_seconds_left(enum localization loc, char* string, size_t string_size, word rem_sec) {
switch (loc) {
case FR:
snprintf(string, string_size, "ENCORE %d SECONDES", rem_sec); break;
case DE:
snprintf(string, string_size, "%d SEKUNDEN UEBRIG", rem_sec); break;
case EN:
default:
snprintf(string, string_size, "%d SECONDS LEFT", rem_sec); break;
}
}

void str_minutes_left(enum localization loc, char* string, size_t string_size, word rem_min) {
switch (loc) {
case FR:
snprintf(string, string_size, "ENCORE %d MINUTES", rem_min); break;
case DE:
snprintf(string, string_size, "%d MINUTEN UEBRIG", rem_min); break;
case EN:
default:
snprintf(string, string_size, "%d MINUTES LEFT", rem_min); break;
}
}

void str_time_expired(enum localization loc, char* string, size_t string_size) {
switch (loc) {
case FR:
strncpy(string, "TEMPS ECOULE!", string_size); break;
case DE:
strncpy(string, "DIE ZEIT IST ABGELAUFEN!", string_size); break;
case EN:
default:
strncpy(string, "TIME HAS EXPIRED!", string_size); break;
}
}

void str_level(enum localization loc, char* string, size_t string_size, byte disp_level) {
switch (loc) {
case FR:
snprintf(string, string_size, "NIVEAU %d", disp_level); break;
case DE:
snprintf(string, string_size, "LEVEL %d", disp_level); break;
case EN:
default:
snprintf(string, string_size, "LEVEL %d", disp_level); break;
}
}

void str_pressbutton(enum localization loc, char* string, size_t string_size) {
switch (loc) {
case FR:
strncpy(string, "PRESSEZ LE BOUTON", string_size); break;
case DE:
strncpy(string, "KNOPFDRUCK ZUM WEITERSPIELEN", string_size); break;
case EN:
default:
strncpy(string, "Press Button to Continue", string_size); break;
}
}

void str_pause(enum localization loc, char* string, size_t string_size) {
switch (loc) {
case FR:
strncpy(string, "PAUSE", string_size); break;
case DE:
strncpy(string, "PAUSE", string_size); break;
case EN:
default:
strncpy(string, "GAME PAUSED", string_size); break;
}
}

void str_save(enum localization loc, char* string, size_t string_size) {
switch (loc) {
case FR:
strncpy(string, "PARTIE SAUVEE", string_size); break;
case DE:
strncpy(string, "SPIEL WURDE GESPEICHERT", string_size); break;
case EN:
default:
strncpy(string, "GAME SAVED", string_size); break;
}
}

void str_unable_save(enum localization loc, char* string, size_t string_size) {
switch (loc) {
case FR:
strncpy(string, "SAUVEGARDE IMPOSSIBLE", string_size); break;
case DE:
strncpy(string, "SPIEL NICHT GESPEICHERT", string_size); break;
case EN:
default:
strncpy(string, "UNABLE TO SAVE GAME", string_size); break;
}
}

void str_copy_protection_bottom(enum localization loc, char* string, size_t string_size,
word copy_word, word copy_line, word copy_page) {
switch (loc) {
case FR:
snprintf(string, string_size, "PAGE %d LIGNE %d MOT %d", copy_page, copy_line, copy_word); break;
case DE:
snprintf(string, string_size, "SEITE %d ZEILE %d WORT %d", copy_page, copy_line, copy_word); break;
case EN:
default:
snprintf(string, string_size, "WORD %d LINE %d PAGE %d", copy_word, copy_line, copy_page);
}
}

void str_copy_protection_dialog(enum localization loc, char* string, size_t string_size,
word copy_word, word copy_line, word copy_page) {
switch (loc) {
case FR:
snprintf(string, string_size,
"Buvez la potion correspondant à la première "
"lettre du Mot %d Ligne %d de la Page %d du Manuel.",
copy_word, copy_line, copy_page);
break;
case DE:
snprintf(string, string_size,
"Trinken Sie die magische Flasche mit dem Anfangsbuchstaben von\n"
"Wort %d in Zeile %d auf Seite %d.",
copy_word, copy_line, copy_page);
break;
case EN:
default:
snprintf(string, string_size,
"Drink potion matching the first letter of Word %d on Line %d\n"
"of Page %d of the manual.",
copy_word, copy_line, copy_page);
}
}

void str_dialog(enum localization loc, char* string, size_t string_size, const char* text) {
switch (loc) {
case FR:
snprintf(string, string_size, "%s\n\nPressez une touche pour continuer.", text);
break;
case DE:
snprintf(string, string_size, "%s\n\nDrücken Sie eine Taste.", text); break;
case EN:
default:
snprintf(string, string_size, "%s\n\nPress any key to continue.", text);
}
}

void str_loading(enum localization loc, char* string, size_t string_size) {
switch (loc) {
case FR:
strncpy(string, "Chargement. . .", string_size); break;
case DE:
strncpy(string, "Bitte Warten. . .", string_size); break;
case EN:
default:
strncpy(string, "Loading. . . .", string_size); break;
}
}
Loading