Skip to content

Commit

Permalink
Bugfixes: Lemmings in minimap; highperf-font
Browse files Browse the repository at this point in the history
  • Loading branch information
esoteric-programmer committed Oct 2, 2016
1 parent 9dfb4ab commit af91259
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 69 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 0.2.3
- Added error screens
- Bugfixes

Version 0.2.2
- Support demo versions:
- Original Lemmings Demo
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@ because they are protected by copyright law.

For game control, see CONTROL.txt.

Sound is not supported yet.
The source code is not released yet, because it needs to be cleaned before.
Sorry for these limitations.
Sound is not supported yet. Sorry for this limitation.
6 changes: 3 additions & 3 deletions include/gamespecific.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
#define PATH_DATA_HOLIDAY94 "holi94"

struct GameSpecific {
const char ABBA_order;
const unsigned char num_of_difficulties;
const unsigned char num_of_level_per_difficulty;
const u8 ABBA_order;
const u8 num_of_difficulties;
const u8 num_of_level_per_difficulty;
const char* path;
const char* level_dat_prefix;
const char* const* difficulties;
Expand Down
90 changes: 45 additions & 45 deletions src/data/highperf_font.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const u8 highperf_font_dot[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xF9, 0xF3, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xF4, 0xF9, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xF2, 0xF9, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

Expand All @@ -34,26 +34,26 @@ const u8 highperf_font_comma[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF9, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00, 0x00, 0x00
0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00, 0x00, 0x00
};

const u8 highperf_font_questionmark[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xF4, 0xF9, 0xF9, 0xF3, 0xF3, 0x00, 0x00,
0x00, 0xF4, 0xF4, 0xF4, 0xF4, 0xF9, 0xF3, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00,
0x00, 0x00, 0xF4, 0xF9, 0xF9, 0xF9, 0x00, 0x00,
0x00, 0xF4, 0xF9, 0xF4, 0xF4, 0xF9, 0x00, 0x00,
0x00, 0xF4, 0xF3, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xF4, 0xF9, 0xF3, 0xF9, 0xF9, 0xF3, 0x00,
0x00, 0x00, 0xF4, 0xF4, 0xF4, 0xF4, 0xF4, 0x00,
0x00, 0xF2, 0xF9, 0xF9, 0xF3, 0xF3, 0x00, 0x00,
0x00, 0xF2, 0xF2, 0xF2, 0xF2, 0xF9, 0xF3, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00,
0x00, 0x00, 0xF2, 0xF9, 0xF9, 0xF9, 0x00, 0x00,
0x00, 0xF2, 0xF9, 0xF2, 0xF2, 0xF9, 0x00, 0x00,
0x00, 0xF2, 0xF3, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xF2, 0xF9, 0xF3, 0xF9, 0xF9, 0xF3, 0x00,
0x00, 0x00, 0xF2, 0xF2, 0xF2, 0xF2, 0xF2, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF9, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

Expand All @@ -63,16 +63,16 @@ const u8 highperf_font_exclamationmark[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF3, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF2, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF2, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF2, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF9, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

Expand All @@ -84,14 +84,14 @@ const u8 highperf_font_colon[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF9, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF9, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

Expand All @@ -101,16 +101,16 @@ const u8 highperf_font_bracket_l[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xF9, 0xF3, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF4, 0xF4, 0xF9, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF4, 0xF3, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF4, 0xF3, 0xF9, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF4, 0xF9, 0xF9, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xF4, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF2, 0xF2, 0xF9, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF2, 0xF3, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF2, 0xF3, 0xF9, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF2, 0xF9, 0xF9, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xF2, 0xF2, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

Expand All @@ -120,16 +120,16 @@ const u8 highperf_font_bracket_r[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF9, 0xF3, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF4, 0xF9, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF3, 0xF4, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF9, 0xF9, 0xF4, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF4, 0xF4, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF2, 0xF9, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF2, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF2, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF3, 0xF2, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF9, 0xF9, 0xF2, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF2, 0xF2, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

Expand All @@ -139,8 +139,8 @@ const u8 highperf_font_apostrophe[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF9, 0xF3, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF4, 0xF9, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF2, 0xF9, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand All @@ -158,8 +158,8 @@ const u8 highperf_font_quote[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF9, 0xF3, 0x00, 0xF9, 0xF3, 0x00,
0x00, 0x00, 0xF4, 0xF9, 0x00, 0xF4, 0xF9, 0x00,
0x00, 0xF4, 0xF9, 0x00, 0xF4, 0xF9, 0x00, 0x00,
0x00, 0x00, 0xF2, 0xF9, 0x00, 0xF2, 0xF9, 0x00,
0x00, 0xF2, 0xF9, 0x00, 0xF2, 0xF9, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down
36 changes: 18 additions & 18 deletions src/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "lemming.h"
#include "particles.h"

void draw_lemmings_minimap(struct Lemming[MAX_NUM_OF_LEMMINGS], u32 palette[16], struct RGB_Image* image);
void draw_lemmings_minimap(struct Lemming[MAX_NUM_OF_LEMMINGS], struct MainInGameData* data, struct RGB_Image* image);

void draw_single_lemming(struct Lemming* lem, struct Image* lemmings_anim[337], struct Image* masks[23], u32 palette[16], struct RGB_Image* image, u16 x_offset);

Expand Down Expand Up @@ -182,15 +182,15 @@ int draw_level(struct RGB_Image* image, struct Level* level) {
if (!image || !level) {
return 0;
}

if (level->info.x_pos + image->width > 1584) {
if (image->width >= 1584) {
level->info.x_pos = 0;
}else{
level->info.x_pos = 1584 - image->width;
}
}

for (y=0;y<160 && y<image->height;y++) {
for (x=0;x<image->width;x++) {
s16 level_x = x + (s16)level->info.x_pos;
Expand All @@ -204,7 +204,7 @@ int draw_level(struct RGB_Image* image, struct Level* level) {
}
}
}


// draw objects into level graphic
for (i=0;i<32;i++) {
Expand All @@ -215,7 +215,7 @@ int draw_level(struct RGB_Image* image, struct Level* level) {
struct Object* o = level->o[level->obj[i].type];
if (!o) {
continue;
}
}

// copy image
s16 x,y;
Expand Down Expand Up @@ -501,7 +501,7 @@ int draw_toolbar(struct RGB_Image* image, struct MainInGameData* data,
if (!image || !data || !level || !state) {
return 0;
}

s16 x,y,i;
data->high_perf_palette[7] = level->palette.vga[8];
for (y=0;y<40 && y+160<image->height;y++) {
Expand All @@ -514,9 +514,9 @@ int draw_toolbar(struct RGB_Image* image, struct MainInGameData* data,
}
}
}

draw_highperf_text(image, data, 160, text);

// DRAW SKILLZ
u8 nums[10];
nums[0] = level->info.rate;
Expand Down Expand Up @@ -550,7 +550,7 @@ int draw_toolbar(struct RGB_Image* image, struct MainInGameData* data,
}
}
}

// draw active_skill
if (state->selected_skill >= 8) {
state->selected_skill = 0;
Expand All @@ -572,7 +572,7 @@ int draw_toolbar(struct RGB_Image* image, struct MainInGameData* data,
}
}
}

// draw mini-map
for (y=16;y<160;y+=8) {
for (x=0;x<1584;x+=16) {
Expand All @@ -590,11 +590,11 @@ int draw_toolbar(struct RGB_Image* image, struct MainInGameData* data,
image->data[minimap_x+minimap_y*image->width] = data->high_perf_palette[solid] | 0xFF000000;
}
}

// draw lemmings
draw_lemmings_minimap(lemmings,data->high_perf_palette,image);
draw_lemmings_minimap(lemmings,data,image);


// draw current view into minimap
s16 view_rect_width = 103 - (1584-image->width) / 16;
if (view_rect_width < 3) {
Expand All @@ -620,11 +620,11 @@ int draw_toolbar(struct RGB_Image* image, struct MainInGameData* data,

}
}

return 1; // all fine
}

void draw_lemmings_minimap(struct Lemming lemmings[MAX_NUM_OF_LEMMINGS], u32 palette[16], struct RGB_Image* image) {
void draw_lemmings_minimap(struct Lemming lemmings[MAX_NUM_OF_LEMMINGS], struct MainInGameData* data, struct RGB_Image* image) {
int i;
if (!lemmings || !image) {
return; // error
Expand All @@ -636,10 +636,10 @@ void draw_lemmings_minimap(struct Lemming lemmings[MAX_NUM_OF_LEMMINGS], u32 pal
if (lemmings[i].y >= 160 || lemmings[i].x >= 1664) { // or: 1584?
continue;
}

s16 minimap_x = 209 + (lemmings[i].x>=0?lemmings[i].x:0)/16;
s16 minimap_y = 177 + (lemmings[i].y>=16?lemmings[i].y:16)/8;
image->data[minimap_x+minimap_y*image->width] = palette[2]; // TODO: green?
image->data[minimap_x+minimap_y*image->width] = data->high_perf_palette[2] | 0xFF000000; // green
}
}

Expand Down

0 comments on commit af91259

Please sign in to comment.