Skip to content

Instantly share code, notes, and snippets.

@ryonagana
Created December 30, 2025 01:00
Show Gist options
  • Select an option

  • Save ryonagana/d1d6297f0056f027891b943b9df7b532 to your computer and use it in GitHub Desktop.

Select an option

Save ryonagana/d1d6297f0056f027891b943b9df7b532 to your computer and use it in GitHub Desktop.
Deluxe Pacman Patch For Linux
--- a/a5_screenshot.c
+++ b/a5_screenshot.c
@@ -7,7 +7,7 @@
{
time_t rawtime;
struct tm *timeinfo;
- char filename[80], timestr[80];
+ char filename[80], timestr[25];
bool saved;
ALLEGRO_STATE state;
@@ -18,8 +18,8 @@
time(&rawtime);
timeinfo = localtime(&rawtime);
- strftime(timestr, 80, "%Y%m%d_%H%M%S", timeinfo);
- snprintf(filename, 80, "%s_%s.png", gamename, timestr);
+ strftime(timestr, sizeof(timestr), "%Y%m%d_%H%M%S", timeinfo);
+ snprintf(filename, sizeof(filename), "%s_%s.png", gamename, timestr);
saved = al_save_bitmap(filename, al_get_target_bitmap());
--- a/dp2_collision.c
+++ b/dp2_collision.c
@@ -1,5 +1,7 @@
#include "dp2_collision.h"
+#define abs fabs
+
// Circular collision detection
bool dp2_collision(PACMAN *p, GHOST *g, bool h)
{
--- a/dp2_hiscore.c
+++ b/dp2_hiscore.c
@@ -99,7 +99,7 @@
al_ustr_assign_cstr(hiscore[dif][i].name, "empty");
hiscore[dif][i].score = 0;
hiscore[dif][i].level = 0;
- snprintf(hiscore[dif][i].time, TIME_LEN, timestr);
+ snprintf(hiscore[dif][i].time, TIME_LEN, "%s",timestr);
}
}
--- a/dp2_main.c
+++ b/dp2_main.c
@@ -621,7 +621,7 @@
al_set_new_bitmap_flags(ALLEGRO_MAG_LINEAR); // | ALLEGRO_NO_PRESERVE_TEXTURE);
//al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA);
- al_set_new_display_option(ALLEGRO_SINGLE_BUFFER, 1, ALLEGRO_REQUIRE);
+ //al_set_new_display_option(ALLEGRO_SINGLE_BUFFER, 1, ALLEGRO_REQUIRE);
// Allegro picks the desktop resolution automatically with ALLEGRO_FULLSCREEN_WINDOW flag set.
setting.screen = al_create_display(WIDTH, HEIGHT);
@@ -1020,7 +1020,7 @@
/* Initialize:
* Initializes allegro + add-ons,
*/
-void initialize(void)
+static void initialize(void)
{
char s[TEXT_BUFFER] = "";
@@ -1080,6 +1080,7 @@
/// ****** Initialize PHYSFS *******
PHYSFS_init(NULL);
+
if(!PHYSFS_mount("Deluxe Pacman 2.pak", "/", 1)) {
a5_error(AT, setting.screen, "PHSYFS_init() failed.");
exit(1);
@@ -1104,7 +1105,7 @@
init_display(false); // false = this isn't a reset
#ifdef DEBUG
- if(size_check != PAKSIZE) printf("Pakfile size has changed, new size is %I64d.\n", size_check);
+ if(size_check != PAKSIZE) printf("Pakfile size has changed, new size is %ld.\n", size_check);
#endif // DEBUG
/// ****** Create redraw_timer *******
@@ -1459,7 +1460,7 @@
al_draw_textf(font, al_map_rgba_f(0, 0, 0, .5),
WIDTH / 2 + 10, HEIGHT / 2 - textHeight + shadow, ALLEGRO_ALIGN_CENTRE,
- text_message);
+ "%s", text_message);
al_draw_textf(font, al_map_rgba_f(0, 0, 0, .5),
WIDTH / 2 + 10, HEIGHT / 2 + shadow, ALLEGRO_ALIGN_CENTRE,
"(click / press key)");
@@ -1472,7 +1473,7 @@
al_draw_textf(font, al_map_rgb_f(0, 1, 0),
WIDTH / 2, HEIGHT / 2 - textHeight, ALLEGRO_ALIGN_CENTRE,
- text_message);
+ "%s", text_message);
al_draw_textf(font, al_map_rgb_f(.5, 5, 5),
WIDTH / 2, HEIGHT / 2, ALLEGRO_ALIGN_CENTRE,
"(click / press key)");
@@ -1983,7 +1984,7 @@
credits();
break;
case WEBSITE: // WEBSITE
- system(DP2_WEBSITE);
+ //system(DP2_WEBSITE);
break;
case QUIT: // QUIT
menu_done = true;
@@ -2101,7 +2102,7 @@
credits();
break;
case WEBSITE: // WEBSITE
- system(DP2_WEBSITE);
+ //system(DP2_WEBSITE);
break;
case QUIT: // QUIT
menu_done = true;
@@ -2235,7 +2236,7 @@
credits();
break;
case WEBSITE: // WEBSITE
- system(DP2_WEBSITE);
+ //system(DP2_WEBSITE);
break;
case QUIT: // QUIT
menu_done = true;
@@ -4896,8 +4897,8 @@
// do ghost movement etc here
if(ghost[i].x % TILE_SIZE == 0 && ghost[i].y % TILE_SIZE == 0
- && ghost[i].map.x >= 0 && ghost[i].map.x < MAPX
- && ghost[i].map.y >= 0 && ghost[i].map.y < MAPY) {
+ && ghost[i].map.x > 0 && ghost[i].map.x < MAPX
+ && ghost[i].map.y > 0 && ghost[i].map.y < MAPY) {
int sd = setting.difficulty;
if(hack_detected) sd = 2;
--- a/dp2_map.c
+++ b/dp2_map.c
@@ -140,14 +140,14 @@
// There are MAPX tiles horizontally (or for x) and MAPY vertically (or for y)
// make certain we fall within those bounds
// and adjust to the closest valid value if we fall outside of it.
- if(dest->x < 0) dest->x = 0;
- else if(dest->x >= MAPX) dest->x = MAPX - 1;
- if(dest->y < 0) dest->y = 0;
- else if(dest->y >= MAPY) dest->y = MAPY - 1;
+ if((int)dest->x <= 0) dest->x = 0;
+ else if((int)dest->x >= MAPX) dest->x = MAPX - 1;
+ if((int)dest->y <= 0) dest->y = 0;
+ else if((int)dest->y >= MAPY) dest->y = MAPY - 1;
- if(g_start.x < 0) g_start.x = 0;
+ if(g_start.x <= 0) g_start.x = 0;
else if(g_start.x >= MAPX) g_start.x = MAPX - 1;
- if(g_start.y < 0) g_start.y = 0;
+ if(g_start.y <= 0) g_start.y = 0;
else if(g_start.y >= MAPY) g_start.y = MAPY - 1;
--- a/dp2_message.c
+++ b/dp2_message.c
@@ -23,5 +23,5 @@
al_draw_filled_rounded_rectangle(x0 + 10, y0 + 10, x1 + 10, y1 + 10, 15, 15, al_map_rgba_f(0, 0, 0, .25));
al_draw_filled_rounded_rectangle(x0, y0, x1, y1, 15, 15, al_map_rgba_f(0, 0, 0, .6));
al_draw_rounded_rectangle(x0, y0, x1, y1, 15, 15, colour, 2);
- al_draw_textf(font, colour, WIDTH / 2, HEIGHT / 2 - text_h / 2, ALLEGRO_ALIGN_CENTRE, buffer);
+ al_draw_textf(font, colour, WIDTH / 2, HEIGHT / 2 - text_h / 2, ALLEGRO_ALIGN_CENTRE, "%s",buffer);
}
--- a/p2_edit.c
+++ b/p2_edit.c
@@ -62,7 +62,7 @@
// convert to lower case
char lcname[4096] = "";
- for(int i = 0; i < strlen(filename); i++) lcname[i] = tolower(filename[i]);
+ for(int i = 0; i < (int)strlen(filename); i++) lcname[i] = tolower(filename[i]);
ALLEGRO_FILE *file = NULL;
@@ -193,7 +193,7 @@
// convert to lower case
char lcname[4096] = "";
- for(int i = 0; i < strlen(filename); i++) lcname[i] = tolower(filename[i]);
+ for(int i = 0; i < (int)strlen(filename); i++) lcname[i] = tolower(filename[i]);
ALLEGRO_FILE *file = NULL;
--- a/dp2_ghost.h
+++ b/dp2_ghost.h
@@ -1,5 +1,5 @@
#pragma once
-#include <allegro5\allegro.h>
+#include <allegro5/allegro.h>
#include "dp2_map.h"
typedef struct GHOST {
--- a/vec2d_stack.h
+++ b/vec2d_stack.h
@@ -22,4 +22,4 @@
bool stack_is_empty(STACK_TYPE *stack_ptr); // Returns true if the stack is empty; used by stack_pop()
bool stack_is_full(STACK_TYPE *stack_ptr); // Returns true if the stack is full; used by stack_push()
bool stack_shrink(STACK_TYPE *stack_ptr); // Removes unused memory from the stack, shrinking it to fit
-unsigned int stack_size(STACK_TYPE *stack_ptr); // Returns the size of the stack, good for loops
+size_t stack_size(STACK_TYPE *stack_ptr); // Returns the size of the stack, good for loops
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment