Browse Source

Replace #define types with HolyC native types

master
Alec Murphy 2 years ago
parent
commit
418bd88a80
  1. 90
      Actor.HC
  2. 4
      Actor_Collision.HC
  3. 70
      Actor_WorkType.HC
  4. 16
      Backdrop.HC
  5. 6
      Cartoon.HC
  6. 8
      Define.HC
  7. 62
      Dialog.HC
  8. 22
      Effects.HC
  9. 6
      File.HC
  10. 12
      Font.HC
  11. 12
      Fullscreen_Image.HC
  12. 14
      Game.HC
  13. 16
      Input.HC
  14. 2
      Main.HC
  15. 44
      Map.HC
  16. 30
      Platforms.HC
  17. 72
      Player.HC
  18. 8
      Status.HC
  19. 52
      Tile.HC
  20. 56
      Video.HC
  21. 24
      Vol.HC

90
Actor.HC

@ -1,5 +1,5 @@
extern U0 video_draw_tile_flipped(Tile *tile, uint16 x, uint16 y);
extern U0 video_draw_tile_mode3(Tile *tile, uint16 x, uint16 y);
extern U0 video_draw_tile_flipped(Tile *tile, U16 x, U16 y);
extern U0 video_draw_tile_mode3(Tile *tile, U16 x, U16 y);
extern I64 finished_game_flag_maybe;
extern I64 finished_level_flag_maybe;
extern U8 get_episode_number();
@ -18,11 +18,11 @@ class ActorData
I64 can_fall_down_flag;
I64 has_moved_left_flag;
I64 has_moved_right_flag;
uint16 data_1;
uint16 data_2;
uint16 data_3;
uint16 data_4;
uint16 data_5;
U16 data_1;
U16 data_2;
U16 data_3;
U16 data_4;
U16 data_5;
I64 is_deactivated_flag_maybe;
I64 falling_counter;
I64 count_down_timer;
@ -33,41 +33,41 @@ class ActorData
ActorData actors[MAX_ACTORS];
I64 total_num_actors = 0;
uint16 word_2E17E = 0;
uint16 word_2E22A = 0;
uint16 word_2E236 = 0;
uint16 word_2E228 = 0;
uint16 word_2E220 = 0;
uint16 word_2E238 = 0;
uint16 word_2E21E = 0;
uint16 word_2E24C = 0;
uint16 word_2E23C = 0;
uint16 word_2E232 = 0;
uint16 word_2E234 = 0;
uint16 word_2E246 = 0;
U16 word_2E17E = 0;
U16 word_2E22A = 0;
U16 word_2E236 = 0;
U16 word_2E228 = 0;
U16 word_2E220 = 0;
U16 word_2E238 = 0;
U16 word_2E21E = 0;
U16 word_2E24C = 0;
U16 word_2E23C = 0;
U16 word_2E232 = 0;
U16 word_2E234 = 0;
U16 word_2E246 = 0;
uint8 byte_32EB8 = 0;
U8 byte_32EB8 = 0;
uint16 word_32EC2 = 0; //range 0 - 35
U16 word_32EC2 = 0; //range 0 - 35
uint8 energy_beam_enabled_flag = 0;
U8 energy_beam_enabled_flag = 0;
uint16 word_2E1E4 = 0; //seems to be related to number of actors in play.
U16 word_2E1E4 = 0; //seems to be related to number of actors in play.
uint16 word_2E1E2 = 0;
U16 word_2E1E2 = 0;
uint16 num_moving_platforms = 0;
U16 num_moving_platforms = 0;
uint16 brightness_effect_enabled_flag = 0;
uint16 obj_switch_151_flag = 0;
U16 brightness_effect_enabled_flag = 0;
U16 obj_switch_151_flag = 0;
uint8 move_platform_flag = 0;
uint16 actor_tile_display_func_index = 0;
U8 move_platform_flag = 0;
U16 actor_tile_display_func_index = 0;
Tile *actor_tiles;
Sprite *actor_sprites;
uint16 word_28D9C[36] = {
U16 word_28D9C[36] = {
31, 12, 17, 233,
99, 8, 64, 12,
199, 49, 5, 6,
@ -79,7 +79,7 @@ uint16 word_28D9C[36] = {
79, 46, 1, 98
};
ActorData *get_actor(uint16 actor_num) {
ActorData *get_actor(U16 actor_num) {
//assert(actor_num < MAX_ACTORS);
return &actors[actor_num];
}
@ -90,10 +90,10 @@ TileInfo *actor_get_tile_info(I64 actorInfoIndex, I64 frame_num) {
I64 sprite_blocking_check(I64 blocking_dir, I64 actorInfoIndex, I64 frame_num, I64 x_pos, I64 y_pos)
{
uint16 sprite_height = actor_sprites[actorInfoIndex].frames[frame_num].height;
uint16 sprite_width = actor_sprites[actorInfoIndex].frames[frame_num].width;
U16 sprite_height = actor_sprites[actorInfoIndex].frames[frame_num].height;
U16 sprite_width = actor_sprites[actorInfoIndex].frames[frame_num].width;
I64 i;
uint16 tile_attr;
U16 tile_attr;
switch (blocking_dir)
{
@ -176,8 +176,8 @@ I64 sprite_blocking_check(I64 blocking_dir, I64 actorInfoIndex, I64 frame_num, I
U0 actor_load_tiles()
{
uint16 num_tile_info_records;
uint16 num_tiles;
U16 num_tile_info_records;
U16 num_tiles;
actor_tiles = load_tiles("ACTORS.MNI", TRANSPARENT, &num_tiles);
"Loaded %d actor tiles.\n", num_tiles;
@ -187,8 +187,8 @@ U0 actor_load_tiles()
I64 is_sprite_on_screen(I64 actorInfoIndex, I64 frame_num, I64 x_pos, I64 y_pos)
{
uint16 sprite_height = actor_sprites[actorInfoIndex].frames[frame_num].height;
uint16 sprite_width = actor_sprites[actorInfoIndex].frames[frame_num].width;
U16 sprite_height = actor_sprites[actorInfoIndex].frames[frame_num].height;
U16 sprite_width = actor_sprites[actorInfoIndex].frames[frame_num].width;
if(((mapwindow_x_offset > x_pos || mapwindow_x_offset + 0x26 <= x_pos) && (mapwindow_x_offset < x_pos || x_pos + sprite_width <= mapwindow_x_offset)) ||
((mapwindow_y_offset + 0x12 <= y_pos - sprite_height + 1 || mapwindow_y_offset + 0x12 > y_pos) && (y_pos < mapwindow_y_offset || mapwindow_y_offset + 0x12 <= y_pos)))
@ -207,9 +207,9 @@ U0 display_actor_sprite_flipped(TileInfo *info, I64 x_pos, I64 y_pos)
{
for (x = 0; x < info->width; x++)
{
uint16 screen_x = (x_pos - mapwindow_x_offset + x + 1) * 8;
uint16 screen_y = (y_pos - info->height + 1 - mapwindow_y_offset + (info->height-y-1) + 1) * 8;
uint16 tile_attr = tileattr_mni_data[map_get_tile_cell(x_pos+x,y_pos - info->height + 1 + (info->height-y-1))/8];
U16 screen_x = (x_pos - mapwindow_x_offset + x + 1) * 8;
U16 screen_y = (y_pos - info->height + 1 - mapwindow_y_offset + (info->height-y-1) + 1) * 8;
U16 tile_attr = tileattr_mni_data[map_get_tile_cell(x_pos+x,y_pos - info->height + 1 + (info->height-y-1))/8];
if(screen_x >= 8 && screen_x <= 304 && //FIXME need a better way of making sure we draw in the borders.
screen_y >= 8 && screen_y < 152 &&
!(tile_attr & TILE_ATTR_IN_FRONT))
@ -246,9 +246,9 @@ U0 display_actor_sprite_maybe(I64 actorInfoIndex, I64 frame_num, I64 x_pos, I64
{
for(x=0;x < info->width; x++)
{
uint16 screen_x = (x_pos - mapwindow_x_offset + x + 1) * 8;
uint16 screen_y = (y_pos - info->height + 1 - mapwindow_y_offset + y + 1) * 8;
uint16 tile_attr = tileattr_mni_data[map_get_tile_cell(x_pos+x,y_pos - info->height + y + 1)/8];
U16 screen_x = (x_pos - mapwindow_x_offset + x + 1) * 8;
U16 screen_y = (y_pos - info->height + 1 - mapwindow_y_offset + y + 1) * 8;
U16 tile_attr = tileattr_mni_data[map_get_tile_cell(x_pos+x,y_pos - info->height + y + 1)/8];
if(tile_display_func_index == 6) //FIXME
{
screen_x = (x_pos + x + 1) * 8;
@ -281,7 +281,7 @@ U0 display_actor_sprite_maybe(I64 actorInfoIndex, I64 frame_num, I64 x_pos, I64
}
//TODO work out what this should be called.
uint16 sub_1106F()
U16 sub_1106F()
{
word_32EC2++;
if(word_32EC2 > 0x23)

4
Actor_Collision.HC

@ -40,8 +40,8 @@ I64 actor_update_impl(ActorData *actor, I64 actorInfoIndex, I64 frame_num, I64 x
I64 ax;
uint16 sprite_height = actor_get_tile_info(actorInfoIndex, frame_num)->height;
uint16 sprite_width = actor_get_tile_info(actorInfoIndex, frame_num)->width;
U16 sprite_height = actor_get_tile_info(actorInfoIndex, frame_num)->height;
U16 sprite_width = actor_get_tile_info(actorInfoIndex, frame_num)->width;
word_2E1E8 = 0;
if (actorInfoIndex != 0x66)

70
Actor_WorkType.HC

@ -1,20 +1,20 @@
extern U0 actor_add_new(I64 image_index, I64 x_pos, I64 y_pos);
extern I64 game_play_mode;
extern U0 map_write_tile_cell(uint16 map_tile_cell, I64 x, I64 y);
extern U0 map_write_row_of_tiles(uint16 map_tile_cell, uint16 length_in_tiles, I64 x, I64 y);
extern U0 map_write_tile_cell(U16 map_tile_cell, I64 x, I64 y);
extern U0 map_write_row_of_tiles(U16 map_tile_cell, U16 length_in_tiles, I64 x, I64 y);
extern U8 byte_2E21C;
extern U0 ingame_hint_dialogs(uint16 hint_number);
extern U0 end_game_dialog(uint16 dialog_number);
extern U0 ingame_hint_dialogs(U16 hint_number);
extern U0 end_game_dialog(U16 dialog_number);
extern U0 push_player_around(I64 push_direction, I64 push_anim_duration, I64 push_duration, I64 player_frame_num,
uint8 dont_push_while_jumping_flag, I64 check_for_blocking_flag);
extern U0 write_tile_row_to_tilemap(uint16 map_tile_cell,
uint16 map_tile_cell2,
uint16 map_tile_cell3,
uint16 map_tile_cell4,
U8 dont_push_while_jumping_flag, I64 check_for_blocking_flag);
extern U0 write_tile_row_to_tilemap(U16 map_tile_cell,
U16 map_tile_cell2,
U16 map_tile_cell3,
U16 map_tile_cell4,
I64 x,
I64 y);
sint16 purple_boss_y_offset_tbl[14] = {2, 2, 1, 0, -1, -2, -2, -2, -2, -1, 0, 1, 2, 2};
I16 purple_boss_y_offset_tbl[14] = {2, 2, 1, 0, -1, -2, -2, -2, -2, -1, 0, 1, 2, 2};
U0 actor_wt_133_boss_purple_15411(ActorData *actor)
{
actor_tile_display_func_index = 1;
@ -337,7 +337,7 @@ U0 actor_wt_159_unknown(ActorData *actor)
return;
}
uint8 acid_frame_num_tbl[7] = {0, 1, 2, 3, 2, 1, 0};
U8 acid_frame_num_tbl[7] = {0, 1, 2, 3, 2, 1, 0};
U0 actor_wt_acid(ActorData *actor)
{
if(actor->data_5 != 0)
@ -387,8 +387,8 @@ U0 actor_wt_acid(ActorData *actor)
return;
}
uint8 alien_eating_space_plant_f_num_tbl[4] = {5, 6, 7, 8};
uint8 alien_eating_space_plant_f_num_2_tbl[16] = {
U8 alien_eating_space_plant_f_num_tbl[4] = {5, 6, 7, 8};
U8 alien_eating_space_plant_f_num_2_tbl[16] = {
1, 1, 1, 1, 1, 1, 1, 2,
3, 4, 1, 1, 1, 1, 1, 1
};
@ -451,7 +451,7 @@ U0 actor_wt_angry_moon(ActorData *actor)
return;
}
sint8 red_jumper_tbl[40] = {
I8 red_jumper_tbl[40] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1,
0, 1, -2, 2, -2, 2, -2, 2,
@ -502,7 +502,7 @@ U0 actor_wt_big_red_jumper(ActorData *actor)
// node 00015546-0001561d #insn=6 use={} def={} in={} out={} pred={ 153F7} CONDJUMP target=0001566d follow=0001561f
//loc_15546:
//si = * ((actor->data_2 << 1) + word_28356);
sint8 si = red_jumper_tbl[actor->data_2];
I8 si = red_jumper_tbl[actor->data_2];
if(si == -1)
{
if(sprite_blocking_check(0, 0x65, 0, actor->x, actor->y - 1) != 0)
@ -660,7 +660,7 @@ U0 actor_wt_big_red_jumper(ActorData *actor)
/* pop */
}
uint8 big_red_plant_frame_num_tbl[5] ={0, 2, 1, 0, 1};
U8 big_red_plant_frame_num_tbl[5] ={0, 2, 1, 0, 1};
U0 actor_wt_big_red_plant(ActorData *actor)
{
if(actor->has_moved_right_flag > 0 && actor->has_moved_right_flag < 7)
@ -836,18 +836,18 @@ U0 actor_wt_big_yellow_spike(ActorData *actor)
return;
}
uint8 blue_ball_frame_num_tbl[27] = {
U8 blue_ball_frame_num_tbl[27] = {
2, 2, 2, 0, 3, 3, 3, 0, 0, 2, 2, 0, 0, 1, 1, 0, 1, 3, 3, 3, 0, 1, 1, 0, 1, 1, 1
};
uint8 blue_ball_moving_left_frame_num_tbl[4] = {7, 6, 5, 4};
uint8 blue_ball_moving_right_frame_num_tbl[4] = {4, 5, 6, 7};
U8 blue_ball_moving_left_frame_num_tbl[4] = {7, 6, 5, 4};
U8 blue_ball_moving_right_frame_num_tbl[4] = {4, 5, 6, 7};
U0 check_actor_move_left_or_right(ActorData *actor, I64 direction_of_movement)
{
uint16 sprite_width = actor_get_tile_info(actor->actorInfoIndex, actor->frame_num)->width;
U16 sprite_width = actor_get_tile_info(actor->actorInfoIndex, actor->frame_num)->width;
I64 block_status;
uint8 tile_attr;
U8 tile_attr;
if(direction_of_movement == LEFT)
{
@ -1103,7 +1103,7 @@ U0 actor_wt_blue_ball(ActorData *actor)
return;
}
sint8 bird_swoop_y_offset_tbl[15] = {
I8 bird_swoop_y_offset_tbl[15] = {
2, 2, 2, 1, 1, 1, 0, 0, 0, -1, -1, -1, -2, -2, -2
};
@ -1578,7 +1578,7 @@ U0 actor_wt_bonus_item(ActorData *actor)
}
}
uint8 clam_trap_frame_num_tbl[27] = {
U8 clam_trap_frame_num_tbl[27] = {
0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 0
};
@ -2166,7 +2166,7 @@ U0 actor_wt_green_plant(ActorData *actor)
}
}
sint8 cabbage_ball_y_tbl[4] = {-1, -1, 0, 0};
I8 cabbage_ball_y_tbl[4] = {-1, -1, 0, 0};
U0 actor_wt_green_pruny_cabbage_ball(ActorData *actor)
{
@ -2346,7 +2346,7 @@ U0 actor_wt_green_roamer_worm(ActorData *actor)
actor->frame_num = actor->data_3 + actor->data_4;
}
uint8 byte_28EFE[6] = { 0, 4, 5, 6, 5, 4};
U8 byte_28EFE[6] = { 0, 4, 5, 6, 5, 4};
U0 actor_wt_hint_dialog(ActorData *actor)
{
@ -2384,7 +2384,7 @@ U0 actor_wt_hint_dialog(ActorData *actor)
return;
}
uint8 flame_frame_num_tbl[17] = {
U8 flame_frame_num_tbl[17] = {
0, 1, 0, 1, 0, 1, 0, 1, 2, 3, 2, 3, 2, 3, 1, 0, 0
};
U0 actor_wt_horizontal_flame(ActorData *actor)
@ -2455,7 +2455,7 @@ U0 actor_wt_invisible_exit_marker_right(ActorData *actor)
return;
}
uint8 jaws_and_tongue_frame_num_tbl[4] = {2, 3, 4, 3};
U8 jaws_and_tongue_frame_num_tbl[4] = {2, 3, 4, 3};
U0 actor_wt_jaws_and_tongue(ActorData *actor)
{
if(actor->data_1 == 0)
@ -2499,7 +2499,7 @@ U0 actor_wt_jaws_and_tongue(ActorData *actor)
display_actor_sprite_maybe(actor->actorInfoIndex, 0, actor->x, actor->y - 1 - actor->data_5, 0);
return;
}
sint16 bullet_head_y_tbl[16] = {-2, -2, -2, -2, -1, -1, -1, 0, 0, 1, 1, 1, 2, 2, 2, 2};
I16 bullet_head_y_tbl[16] = {-2, -2, -2, -2, -1, -1, -1, 0, 0, 1, 1, 1, 2, 2, 2, 2};
U0 actor_wt_jumping_bullet_head(ActorData *actor)
{
if(actor->data_2 != 0)
@ -2967,8 +2967,8 @@ U0 actor_wt_red_blue_plant(ActorData *actor)
return;
}
uint8 word_28EE6[6] = { 8, 9, 10, 10, 9, 8};
uint8 word_28EF2[6] = { 10, 9, 8, 8, 9, 10};
U8 word_28EE6[6] = { 8, 9, 10, 10, 9, 8};
U8 word_28EF2[6] = { 10, 9, 8, 8, 9, 10};
U0 actor_wt_red_chomper_alien(ActorData *actor)
{
@ -3135,7 +3135,7 @@ U0 actor_wt_retracting_spikes(ActorData *actor)
U0 actor_wt_robot_with_blue_arc(ActorData *actor)
{
static uint16 spark_frame_num = 0;
static U16 spark_frame_num = 0;
I64 si;
actor_tile_display_func_index = 1;
@ -4071,7 +4071,7 @@ U0 actor_wt_stone_head(ActorData *actor)
return;
}
uint8 suction_cup_enemy_check_if_blocked(ActorData *actor, uint8 blocking_check)
U8 suction_cup_enemy_check_if_blocked(ActorData *actor, U8 blocking_check)
{
if ((sub_1106F() & 1) == 0)
{
@ -4109,7 +4109,7 @@ uint8 suction_cup_enemy_check_if_blocked(ActorData *actor, uint8 blocking_check)
U0 actor_wt_suction_cup_alien_enemy(ActorData *actor)
{
I64 blocking_check;
uint8 tile_attr;
U8 tile_attr;
actor->data_4 = Cond(actor->data_4, -1, 0) + 1;
if (actor->data_1 == 0)
{
@ -4712,7 +4712,7 @@ U0 actor_wt_two_tons(ActorData *actor)
return;
}
sint8 score_effect_x_tbl[10] = {
I8 score_effect_x_tbl[10] = {
-2, -1, 0, 1, 2, 2, 1, 0, -1, -2
};
U0 actor_wt_floating_score_effect(ActorData *actor)
@ -4766,7 +4766,7 @@ U0 actor_wt_speech_bubble(ActorData *actor)
return;
}
uint8 unk_232_frame_num_tbl[4] = {0, 1, 2, 1};
U8 unk_232_frame_num_tbl[4] = {0, 1, 2, 1};
U0 actor_wt_unknown_232(ActorData *actor)
{
byte_32EB8 = 1;

16
Backdrop.HC

@ -1,12 +1,12 @@
extern U0 video_draw_tile_with_clip_rect(Tile *tile, uint16 x, uint16 y, uint16 clip_x, uint16 clip_y, uint16 clip_w, uint16 clip_h);
extern U0 video_draw_tile_with_clip_rect(Tile *tile, U16 x, U16 y, U16 clip_x, U16 clip_y, U16 clip_w, U16 clip_h);
#define BACKGROUND_WIDTH 40
#define BACKGROUND_HEIGHT 18
//Data
uint16 backdrop_index = 0xff;
uint8 background_x_scroll_flag = 0;
uint8 background_y_scroll_flag = 0;
U16 backdrop_index = 0xff;
U8 background_x_scroll_flag = 0;
U8 background_y_scroll_flag = 0;
U8 backdrop_filename_tbl[26][13] = {
"BDBLANK.MNI",
@ -41,15 +41,15 @@ Tile *bg_tiles;
U0 load_backdrop_image(U8 *filename)
{
uint16 num_tiles;
U16 num_tiles;
bg_tiles = load_tiles(filename, SOLID, &num_tiles);
"Loading %d background tiles.\n", num_tiles;
}
Bool set_backdrop(uint16 new_backdrop_index)
Bool set_backdrop(U16 new_backdrop_index)
{
uint8 cur_background_x_scroll_flag = 0;
uint8 cur_background_y_scroll_flag = 0;
U8 cur_background_x_scroll_flag = 0;
U8 cur_background_y_scroll_flag = 0;
if (new_backdrop_index != backdrop_index ||
cur_background_x_scroll_flag != background_x_scroll_flag ||

6
Cartoon.HC

@ -3,8 +3,8 @@ Sprite *sprites;
U0 load_cartoon_images()
{
uint16 num_tile_info_records;
uint16 num_tiles;
U16 num_tile_info_records;
U16 num_tiles;
cartoon_tiles = load_tiles("CARTOON.MNI", TRANSPARENT, &num_tiles);
"Loading %d cartoon tiles.\n", num_tiles;
@ -12,7 +12,7 @@ U0 load_cartoon_images()
"Loading %d, cartoon tile info records.\n", num_tile_info_records;
}
U0 display_cartoon_sequence(uint16 frame_num, uint16 x_pos, uint16 y_pos)
U0 display_cartoon_sequence(U16 frame_num, U16 x_pos, U16 y_pos)
{
TileInfo *info = &sprites[0].frames[frame_num];
Tile *tile = &cartoon_tiles[info->tile_num];

8
Define.HC

@ -1,11 +1,3 @@
#define uint8 U8
#define uint16 U16
#define uint32 U32
#define sint8 I8
#define sint16 I16
#define sint32 I32
// BlockingType
#define NOT_BLOCKED 0
#define BLOCKED 1

62
Dialog.HC

@ -1,13 +1,13 @@
extern U0 video_update();
extern Tile *map_get_bg_tile(uint16 tile_num);
extern Tile *map_get_bg_tile(U16 tile_num);
extern U8 get_episode_number();
extern U0 set_initial_game_state();
extern U0 display_fullscreen_image(uint8 image_number);
extern U0 display_fullscreen_image(U8 image_number);
extern U0 fade_to_black_speed_3();
extern U0 video_fill_screen_with_black();
extern U0 fade_in_from_black_with_delay_3();
extern U0 fade_to_white(uint16 wait_time);
extern U0 fade_in_from_black(uint16 wait_time);
extern U0 fade_to_white(U16 wait_time);
extern U0 fade_in_from_black(U16 wait_time);
#define SDLK_UP 1
@ -22,17 +22,17 @@ extern U0 fade_in_from_black(uint16 wait_time);
class MenuItem {
uint16 x_pos;
uint16 y_pos;
U16 x_pos;
U16 y_pos;
U8 *text;
I64 action_key;
};
//Data
uint8 show_one_moment_screen_flag = 0;
uint8 byte_28BE3 = 0;
uint8 byte_2E21C = 0;
U8 show_one_moment_screen_flag = 0;
U8 byte_28BE3 = 0;
U8 byte_2E21C = 0;
I64 cur_selected_item = 0;
//HintDialogInput
@ -83,11 +83,11 @@ U16 dialog_text_extract_num(U8 *text)
return Str2I64(&buf) & 0xFFFF;
}
U0 display_dialog_text_with_color(uint16 x_pos, uint16 y_pos, U8 *text, uint8 text_color)
U0 display_dialog_text_with_color(U16 x_pos, U16 y_pos, U8 *text, U8 text_color)
{
I64 input = NO_INPUT;
uint16 typewriter_keys_count = 0;
uint16 typewriter_delay_counter = 0;
U16 typewriter_keys_count = 0;
U16 typewriter_delay_counter = 0;
I64 len = StrLen(text);
I64 x=0;
I64 i;
@ -138,7 +138,7 @@ U0 display_dialog_text_with_color(uint16 x_pos, uint16 y_pos, U8 *text, uint8 te
}
if(c >= 0xfb && c < 0xff)
{
uint16 frame_num = dialog_text_extract_num(&text[i+1]);
U16 frame_num = dialog_text_extract_num(&text[i+1]);
switch(c)
{
case 0xfb : display_cartoon_sequence(frame_num, x_pos + x, y_pos); break;
@ -159,12 +159,12 @@ display_dialog_text_with_color_cont:
video_update();
}
U0 display_dialog_text(uint16 x_pos, uint16 y_pos, U8 *text)
U0 display_dialog_text(U16 x_pos, U16 y_pos, U8 *text)
{
display_dialog_text_with_color(x_pos, y_pos, text, FONT_WHITE);
}
uint16 draw_dialog_frame(uint16 x_pos, uint16 y_pos, uint16 height, uint16 width, U8 *top_text, U8 *bottom_text, uint8 display_text)
U16 draw_dialog_frame(U16 x_pos, U16 y_pos, U16 height, U16 width, U8 *top_text, U8 *bottom_text, U8 display_text)
{
video_draw_tile(map_get_bg_tile(1991), x_pos * TILE_WIDTH, y_pos * TILE_HEIGHT);
video_draw_tile(map_get_bg_tile(1992), (x_pos + width-1) * TILE_WIDTH, y_pos * TILE_HEIGHT);
@ -200,7 +200,7 @@ uint16 draw_dialog_frame(uint16 x_pos, uint16 y_pos, uint16 height, uint16 width
return x_pos + 1;
}
uint16 create_text_dialog_box(uint16 y_offset, uint16 height, uint16 width, U8 *top_message, U8 *bottom_message)
U16 create_text_dialog_box(U16 y_offset, U16 height, U16 width, U8 *top_message, U8 *bottom_message)
{
I64 dialog_x = 0x14 - (width / 2);
I64 var_4 = (height / 2) + y_offset;
@ -224,7 +224,7 @@ uint16 create_text_dialog_box(uint16 y_offset, uint16 height, uint16 width, U8 *
return draw_dialog_frame(dialog_x, y_offset, height, width, top_message, bottom_message, 1);
}
U0 display_clear_tile_to_gray(uint16 x, uint16 y)
U0 display_clear_tile_to_gray(U16 x, U16 y)
{
video_draw_tile(map_get_bg_tile(1999), x * TILE_WIDTH, y * TILE_HEIGHT);
}
@ -235,7 +235,7 @@ I64 wait_for_input_with_repeat(I64 spinner_x, I64 spinner_y, Bool allow_key_repe
reset_player_control_inputs();
flush_input();
uint16 spinner_idx = 0;
U16 spinner_idx = 0;
I64 keycode = poll_for_key_press(allow_key_repeat);
while(keycode == SDLK_UNKNOWN && !Bt(kbd.down_bitmap, SC_ESC))
{
@ -277,10 +277,10 @@ MenuItem main_menu_items[14] = {
};
U0 ingame_hint_dialogs(uint16 hint_number) {
U0 ingame_hint_dialogs(U16 hint_number) {
cosmo_wait(0x1e);
flush_input();
uint16 x;
U16 x;
if(hint_number != 0 && hint_number < 15)
{
x = create_text_dialog_box(2, 9, 0x1c, "COSMIC HINT!", "Press any key to exit.");
@ -394,7 +394,7 @@ U0 ingame_hint_dialogs(uint16 hint_number) {
}
/*
uint16 x = create_text_dialog_box(4, 13, 0x1a, "A game by", "Copyright (c) 1992");
U16 x = create_text_dialog_box(4, 13, 0x1a, "A game by", "Copyright (c) 1992");
display_dialog_text(x, 7, " Todd J Replogle");
display_dialog_text(x + 11, 9, "and");
display_dialog_text(x, 11, "\xfd""027 Stephen A Hornback""\xfd""004");
@ -405,7 +405,7 @@ U0 ingame_hint_dialogs(uint16 hint_number) {
*/
U0 end_game_dialog(uint16 dialog_number) {
U0 end_game_dialog(U16 dialog_number) {
if(get_episode_number() != 1)
{
return;
@ -420,7 +420,7 @@ U0 end_game_dialog(uint16 dialog_number) {
}
if(dialog_number == 0xa4 || dialog_number == 0xa5)
{
uint16 x = create_text_dialog_box(2, 8, 0x1c, "", "Press any key to exit.");
U16 x = create_text_dialog_box(2, 8, 0x1c, "", "Press any key to exit.");
if(dialog_number == 0xa4)
{
display_dialog_text(x, 4, "\xfc003 What's happening? Is\n Cosmo falling to his\n Doom?");
@ -494,7 +494,7 @@ I64 display_menu_items_in_dialog(I64 x_offset,
I64 quit_game_dialog()
{
uint16 x = create_text_dialog_box(11, 4, 0x12, "Are you sure you", "want to quit? ");
U16 x = create_text_dialog_box(11, 4, 0x12, "Are you sure you", "want to quit? ");
I64 key = wait_for_input(x + 14, 13);
//if (key == SDLK_y || is_return_key(key))
if (Bt(kbd.down_bitmap, Char2ScanCode('y')) || Bt(kbd.down_bitmap, SC_ENTER))
@ -513,11 +513,11 @@ U0 main_menu_dialog()
}
U8 level_numbers_tbl[18] ={ 1, 2, 0, 0, 3, 4, 0, 0, 5, 6, 0, 0, 7, 8, 0, 0, 9, 10 };
U0 now_entering_level_n_dialog(uint16 level_number)
U0 now_entering_level_n_dialog(U16 level_number)
{
if(game_play_mode == 0)
{
uint16 x = create_text_dialog_box(7, 3, 0x18, " Now entering level ", "");
U16 x = create_text_dialog_box(7, 3, 0x18, " Now entering level ", "");
cosmo_wait(0x14);
//play_sfx(0x40);
if(level_numbers_tbl[level_number] != 10)
@ -551,7 +551,7 @@ I64 main_menu() {
return QUIT_GAME;
}
}
uint16 restore_status = 0;
U16 restore_status = 0;
for(return_to_title=0;!return_to_title;)
{
main_menu_dialog();
@ -712,7 +712,7 @@ U0 no_bombs_dialog() {
if(game_play_mode == PLAY_GAME)
{
//play_sfx(0x1e);
uint16 x = create_text_dialog_box(2, 4, 0x1c, "", "");
U16 x = create_text_dialog_box(2, 4, 0x1c, "", "");
x++;
display_dialog_text(x, 3, "You haven't found any");
display_dialog_text(x, 4, "bombs to use yet! ");
@ -741,7 +741,7 @@ U0 monster_attack_hint_dialog()
if(game_play_mode == PLAY_GAME)
{
//play_sfx(0x1e);
uint16 si = create_text_dialog_box(2, 5, 0x16, "REMINDER: Jump on", "defend yourself. ");
U16 si = create_text_dialog_box(2, 5, 0x16, "REMINDER: Jump on", "defend yourself. ");
display_dialog_text(si, 4, " top of creatures to");
cosmo_wait(0x3c);
wait_for_input(si + 0x13, 5);
@ -820,7 +820,7 @@ U0 display_score_from_level()
if((star_counter & 7) == 1)
{
uint8 score_text_idx = (star_counter/6);
U8 score_text_idx = (star_counter/6);
if(score_text_idx > 12)
{
score_text_idx = 12;
@ -840,7 +840,7 @@ U0 display_end_of_level_score_dialog(U8 *header_text, U8 *footer_text)
{
fade_to_black_speed_3();
video_fill_screen_with_black();
uint16 x = create_text_dialog_box(6, 4, 0x1e, header_text, footer_text);
U16 x = create_text_dialog_box(6, 4, 0x1e, header_text, footer_text);
fade_in_from_black_with_delay_3();
wait_for_input(x + 0x1b, 8);
display_score_from_level();

22
Effects.HC

@ -5,8 +5,8 @@ extern U16 word_2E1E2;
extern TileInfo *actor_get_tile_info(I64 actorInfoIndex, I64 frame_num);
extern I64 sprite_blocking_check(I64 blocking_dir, I64 actorInfoIndex, I64 frame_num, I64 x_pos, I64 y_pos);
extern I64 is_sprite_on_screen(I64 actorInfoIndex, I64 frame_num, I64 x_pos, I64 y_pos);
extern uint16 brightness_effect_enabled_flag;
extern U0 video_draw_highlight_effect(uint16 x, uint16 y, uint8 type);
extern U16 brightness_effect_enabled_flag;
extern U0 video_draw_highlight_effect(U16 x, U16 y, U8 type);
#define MAX_EFFECT_SPRITES 10
#define MAX_EXPLODE_EFFECT_SPRITES 16
@ -49,11 +49,11 @@ class Brightness
I64 y;
};
uint16 num_brightness_objs = 0;
U16 num_brightness_objs = 0;
Brightness brightness_tbl[MAX_BRIGHTNESS_OBJS + 1];
effect_sprite static_effect_sprites[MAX_EFFECT_SPRITES];
uint16 effect_frame_num_tbl[MAX_EFFECT_SPRITES];
U16 effect_frame_num_tbl[MAX_EFFECT_SPRITES];
explode_effect_sprite explode_effect_sprites[MAX_EXPLODE_EFFECT_SPRITES];
@ -91,7 +91,7 @@ U0 effect_clear_sprites()
U0 explode_effect_add_sprite(I64 actorInfoIndex, I64 frame_num, I64 x_pos, I64 y_pos)
{
uint8 explode_direction = 0;
U8 explode_direction = 0;
I64 i;
explode_direction++;
@ -246,12 +246,12 @@ I64 blow_up_actor_with_bomb(I64 actorInfoIndex, I64 frame_num, I64 x_pos, I64 y_
Bool struct6_collision_check_maybe(I64 actorInfoIndex1, I64 actor_frame_num1, I64 actor1_x, I64 actor1_y, I64 actorInfoIndex2, I64 actor_frame_num2, I64 actor2_x, I64 actor2_y)
{
TileInfo *actor1_info = actor_get_tile_info(actorInfoIndex1, actor_frame_num1);
uint16 sprite1_width = actor1_info->width;
uint16 si = actor1_info->height;
U16 sprite1_width = actor1_info->width;
U16 si = actor1_info->height;
TileInfo *actor2_info = actor_get_tile_info(actorInfoIndex2, actor_frame_num2);
uint16 sprite2_width = actor2_info->width;
uint16 di = actor2_info->height;
U16 sprite2_width = actor2_info->width;
U16 di = actor2_info->height;
if(actor1_x > map_width_in_tiles && actor1_x <= -1)
{
@ -313,7 +313,7 @@ U0 struct6_add_sprite(I64 x_pos, I64 y_pos)
}
}
U0 add_brightness_obj(uint8 type, I64 x_pos, I64 y_pos)
U0 add_brightness_obj(U8 type, I64 x_pos, I64 y_pos)
{
if (num_brightness_objs != MAX_BRIGHTNESS_OBJS)
{
@ -544,7 +544,7 @@ U0 update_brightness_objs()
{
video_draw_highlight_effect((brightness->x - mapwindow_x_offset + 1) * TILE_WIDTH, (brightness->y - mapwindow_y_offset + 1) * TILE_HEIGHT, brightness->type);
uint16 tile_attr = tileattr_mni_data[map_get_tile_cell(brightness->x,brightness->y + 1)/8];
U16 tile_attr = tileattr_mni_data[map_get_tile_cell(brightness->x,brightness->y + 1)/8];
for(j = 1; !(tile_attr & TILE_ATTR_BLOCK_DOWN);)
{
if(brightness->x >= mapwindow_x_offset && brightness->x < mapwindow_x_offset + MAP_WINDOW_WIDTH &&

6
File.HC

@ -74,7 +74,7 @@ Bool file_open(U8 *filename, U8 *mode, File *file) {
return FALSE;
}
Bool file_open_at_offset(U8 *filename, U8 *mode, File *file, uint32 offset, uint32 size)
Bool file_open_at_offset(U8 *filename, U8 *mode, File *file, U32 offset, U32 size)
{
if (!file_open(filename, mode, file))
{
@ -97,7 +97,7 @@ Bool file_open_at_offset(U8 *filename, U8 *mode, File *file, uint32 offset, uint
return TRUE;
}
U0 file_seek(File *file, uint32 new_position) {
U0 file_seek(File *file, U32 new_position) {
if(file->data && new_position <= file->size)
{
file->pos = new_position;
@ -106,7 +106,7 @@ U0 file_seek(File *file, uint32 new_position) {
return;
}
U32 file_read_to_buffer(File *file, U8 *buf, uint32 num_bytes) {
U32 file_read_to_buffer(File *file, U8 *buf, U32 num_bytes) {
if(file->pos + num_bytes > file->size)
num_bytes = file->size - file->pos;

12
Font.HC

@ -1,4 +1,4 @@
extern U0 video_draw_font_tile(Tile *tile, uint16 x, uint16 y, uint8 font_color);
extern U0 video_draw_font_tile(Tile *tile, U16 x, U16 y, U8 font_color);
#define FONT_WHITE 0xf
@ -6,14 +6,14 @@ Tile *font_tiles;
U0 font_load_tiles()
{
uint16 num_tiles;
U16 num_tiles;
font_tiles = load_tiles("FONTS.MNI", FONT, &num_tiles);
"Loading %d font tiles.\n", num_tiles;
}
U0 display_number(I64 x_pos, I64 y_pos, uint32 number)
U0 display_number(I64 x_pos, I64 y_pos, U32 number)
{
uint8 font_color = FONT_WHITE;
U8 font_color = FONT_WHITE;
I64 i;
U8 buf[32];
StrPrint(buf, "%d", number);
@ -23,7 +23,7 @@ U0 display_number(I64 x_pos, I64 y_pos, uint32 number)
}
}
U0 display_char(I64 x_pos, I64 y_pos, U8 c, uint8 font_color)
U0 display_char(I64 x_pos, I64 y_pos, U8 c, U8 font_color)
{
if(c == 0x18 || c == 0x19 || c == 0x1b || c == 0x1c) //FIXME hack to get arrow key font to render.
{
@ -41,7 +41,7 @@ U0 display_char(I64 x_pos, I64 y_pos, U8 c, uint8 font_color)
}
}
U0 display_text_with_color(I64 x_pos, I64 y_pos, U8 *text, uint8 color)
U0 display_text_with_color(I64 x_pos, I64 y_pos, U8 *text, U8 color)
{
I64 len = StrLen(text);
I64 i;

12
Fullscreen_Image.HC

@ -1,4 +1,4 @@
extern U0 video_draw_fullscreen_image(uint8 *pixels);
extern U0 video_draw_fullscreen_image(U8 *pixels);
U8 filename_ep1_tbl[6][13] = {
"PRETITLE.MNI",
@ -27,7 +27,7 @@ U8 filename_ep3_tbl[6][13] = {
#define NUM_PIXELS (320 * 200)
U8 *get_filename(uint8 image_number)
U8 *get_filename(U8 image_number)
{
switch(get_episode_number())
{
@ -41,7 +41,7 @@ U8 *get_filename(uint8 image_number)
U8 *load_image(U8 *filename)
{
uint8 *pixels = MAlloc(320*200);
U8 *pixels = MAlloc(320*200);
I64 c, i, j;
File image;
@ -52,7 +52,7 @@ U8 *load_image(U8 *filename)
for(c=0;c<4;c++) {
for (i = 0; i < NUM_PIXELS / 8; i++) {
uint8 data = file_read1(&image);
U8 data = file_read1(&image);
for (j = 0; j < 8; j++) {
if(c==0)
{
@ -70,7 +70,7 @@ U8 *load_image(U8 *filename)
return pixels;
}
U0 display_fullscreen_image(uint8 image_number)
U0 display_fullscreen_image(U8 image_number)
{
//assert(image_number < 6);
@ -81,7 +81,7 @@ U0 display_fullscreen_image(uint8 image_number)
fade_to_black_speed_3();
uint8 *image = load_image(get_filename(image_number));
U8 *image = load_image(get_filename(image_number));
video_draw_fullscreen_image(image);
Free(image);

14
Game.HC

@ -1,7 +1,7 @@
extern I64 palette_index;
extern I64 palette_2E1EE;
extern U0 update_palette_anim();
extern U0 fade_to_black(uint16 wait_time);
extern U0 fade_to_black(U16 wait_time);
I64 last_wait = cnts.jiffies;
@ -9,15 +9,15 @@ I64 last_wait = cnts.jiffies;
//Data
I64 game_play_mode = PLAY_GAME;
uint32 score;
uint32 num_stars_collected;
U32 score;
U32 num_stars_collected;
I64 cheats_used_flag = 0;
I64 knows_about_powerups_flag;
I64 finished_game_flag_maybe = 0;
I64 finished_level_flag_maybe;
I64 cheat_mode_flag = 0;
uint8 episode_number = 1;
U8 episode_number = 1;
Bool quick_start_mode = FALSE;
U8 get_episode_number()
@ -156,9 +156,9 @@ Bool open_file(U8 *filename, File *file)
return vol_file_open(get_game_stn_filename(), filename, file);
}
U8 *load_file(U8 *filename, U8 *buf, uint32 buf_size)
U8 *load_file(U8 *filename, U8 *buf, U32 buf_size)
{
uint32 bytes_read;
U32 bytes_read;
if(vol_file_load(get_game_vol_filename(), filename, buf, buf_size, &bytes_read))
{
return buf;
@ -169,7 +169,7 @@ U8 *load_file(U8 *filename, U8 *buf, uint32 buf_size)
U0 select_next_level()
{
uint32 tmp_num_stars_collected = num_stars_collected;
U32 tmp_num_stars_collected = num_stars_collected;
if (game_play_mode == PLAY_GAME)
{
switch (current_level)

16
Input.HC

@ -14,18 +14,18 @@
#define SDLK_UNKNOWN 0
uint8 bomb_key_pressed = 0;
uint8 jump_key_pressed = 0;
uint8 up_key_pressed = 0;
uint8 down_key_pressed = 0;
uint8 left_key_pressed = 0;
uint8 right_key_pressed = 0;
U8 bomb_key_pressed = 0;
U8 jump_key_pressed = 0;
U8 up_key_pressed = 0;
U8 down_key_pressed = 0;
U8 left_key_pressed = 0;
U8 right_key_pressed = 0;
//This is needed because the game manipulates up_key_pressed as part of the hover board logic. This is the actual
//key pressed state.
uint8 input_up_key_pressed = 0;
U8 input_up_key_pressed = 0;
uint8 byte_2E17C; //modifies the left, right and jump key presses
U8 byte_2E17C; //modifies the left, right and jump key presses
U0 cosmo_wait(I64 delay)
{

2
Main.HC

@ -24,7 +24,7 @@ I64 main(...)
video_fill_screen_with_black();
//a_game_by_dialog();
uint16 x = create_text_dialog_box(4, 13, 0x1a, "A game by", "Copyright (c) 1992");
U16 x = create_text_dialog_box(4, 13, 0x1a, "A game by", "Copyright (c) 1992");
display_dialog_text(x, 7, " Todd J Replogle");
display_dialog_text(x + 11, 9, "and");
display_dialog_text(x, 11, " Stephen A Hornback");

44
Map.HC

@ -1,10 +1,10 @@
extern U0 video_draw_tile(Tile *tile, uint16 x, uint16 y);
extern U0 video_draw_tile(Tile *tile, U16 x, U16 y);
extern U8 palette_anim_type;
extern U0 reset_game_state();
#define MAX_MAP_TILES 32768
//Data
uint16 current_level;
U16 current_level;
I64 map_width_in_tiles = 0;
I64 map_stride_bit_shift_amt;
@ -12,14 +12,14 @@ I64 mapwindow_x_offset = 0;
I64 mapwindow_y_offset = 0;
I64 map_max_y_offset = 0;
uint8 rain_flag = 0;
U8 rain_flag = 0;
uint16 map_data[MAX_MAP_TILES];
U16 map_data[MAX_MAP_TILES];
Tile *map_bg_tiles;
Tile *map_fg_tiles;
uint16 map_get_tile_cell(I64 x, I64 y) {
U16 map_get_tile_cell(I64 x, I64 y) {
if (x + y * map_width_in_tiles >= MAX_MAP_TILES)
{
return 0;
@ -141,19 +141,19 @@ U8 *get_level_filename(I64 level_number)
U0 map_load_tiles()
{
uint16 num_tiles;
U16 num_tiles;
map_bg_tiles = load_tiles("TILES.MNI", SOLID, &num_tiles);
"Loading %d map bg tiles.\n", num_tiles;
map_fg_tiles = load_tiles("MASKTILE.MNI", TRANSPARENT, &num_tiles);
"Loading %d map fg tiles.\n", num_tiles;
}
U0 map_write_tile_cell(uint16 map_tile_cell, I64 x, I64 y)
U0 map_write_tile_cell(U16 map_tile_cell, I64 x, I64 y)
{
map_data[x + y * map_width_in_tiles] = map_tile_cell;
}
U0 map_write_row_of_tiles(uint16 map_tile_cell, uint16 length_in_tiles, I64 x, I64 y) {
U0 map_write_row_of_tiles(U16 map_tile_cell, U16 length_in_tiles, I64 x, I64 y) {
//assert(x + length_in_tiles < map_width_in_tiles);
I64 i;
for(i = 0; i < length_in_tiles; i++)
@ -162,10 +162,10 @@ U0 map_write_row_of_tiles(uint16 map_tile_cell, uint16 length_in_tiles, I64 x, I
}
}
U0 write_tile_row_to_tilemap(uint16 map_tile_cell,
uint16 map_tile_cell2,
uint16 map_tile_cell3,
uint16 map_tile_cell4,
U0 write_tile_row_to_tilemap(U16 map_tile_cell,
U16 map_tile_cell2,
U16 map_tile_cell3,
U16 map_tile_cell4,
I64 x,
I64 y)
{
@ -175,7 +175,7 @@ U0 write_tile_row_to_tilemap(uint16 map_tile_cell,
map_write_tile_cell(map_tile_cell4, x + 3, y);
}
Tile *map_get_bg_tile(uint16 tile_num) {
Tile *map_get_bg_tile(U16 tile_num) {
return &map_bg_tiles[tile_num];
}
@ -184,14 +184,14 @@ U0 map_display() {
mapwindow_y_offset = map_max_y_offset;
I64 x, y;
uint16 tile;
U16 tile;
backdrop_display();
for(y=0; y < MAP_WINDOW_HEIGHT; y++)
{
for(x=0; x < MAP_WINDOW_WIDTH; x++)
{
uint16 map_cell = map_data[(x+mapwindow_x_offset) + (y+mapwindow_y_offset) * map_width_in_tiles];
U16 map_cell = map_data[(x+mapwindow_x_offset) + (y+mapwindow_y_offset) * map_width_in_tiles];
if(map_cell < 16000)
{
tile = map_cell/8;
@ -238,7 +238,7 @@ U0 load_level_data(I64 level_number)
}
uint16 actor_data_size_in_words = file_read2(&map_file);
U16 actor_data_size_in_words = file_read2(&map_file);
total_num_actors = 0;
num_moving_platforms = 0;
@ -249,9 +249,9 @@ U0 load_level_data(I64 level_number)
for(i=0;i< actor_data_size_in_words/3;i++)
{
uint16 actor_type = file_read2(&map_file);
uint16 x = file_read2(&map_file);
uint16 y = file_read2(&map_file);
U16 actor_type = file_read2(&map_file);
U16 x = file_read2(&map_file);
U16 y = file_read2(&map_file);
if(total_num_actors < MAX_ACTORS)
{
load_actor(total_num_actors, actor_type, x, y);
@ -293,18 +293,18 @@ U0 load_level(I64 level_number)
return;
}
uint16 level_flags = file_read2(&map_file);
U16 level_flags = file_read2(&map_file);
file_close(&map_file);
//stop_music();
rain_flag = (level_flags & 0x20);
uint16 backdrop_index = (level_flags & 0x1f);
U16 backdrop_index = (level_flags & 0x1f);
background_x_scroll_flag = (level_flags & 0x40);
background_y_scroll_flag = (level_flags & 0x80);
palette_anim_type = (level_flags >> 8 & 7);
uint16 music_index = ((level_flags >> 11) & 0x1f);
U16 music_index = ((level_flags >> 11) & 0x1f);
"Level %d: rain=%d, backdrop_index=%d, bg_x_scroll=%d, bg_y_scroll=%d, pal_anim_type=%d, music_index=%d\n", current_level, rain_flag, backdrop_index, background_x_scroll_flag, background_y_scroll_flag, palette_anim_type, music_index;
reset_game_state();

30
Platforms.HC

@ -1,27 +1,27 @@
extern U0 map_write_tile_cell(uint16 map_tile_cell, I64 x, I64 y);
extern U0 map_write_tile_cell(U16 map_tile_cell, I64 x, I64 y);
extern U0 display_actor_sprite_maybe(I64 actorInfoIndex, I64 frame_num, I64 x_pos, I64 y_pos, I64 tile_display_func_index);
extern U16 num_moving_platforms;
extern U8 move_platform_flag;
class MovingPlatform
{
uint16 x;
uint16 y;
uint16 map_tiles[5];
U16 x;
U16 y;
U16 map_tiles[5];
};
class MudFountain
{
uint16 x;
uint16 y;
uint16 direction;
uint16 length_counter;
uint16 current_height;
uint16 max_height;
uint16 pause_counter;
U16 x;
U16 y;
U16 direction;
U16 length_counter;
U16 current_height;
U16 max_height;
U16 pause_counter;
};
uint16 num_mud_fountains = 0;
U16 num_mud_fountains = 0;
MovingPlatform moving_platform_tbl[10];
MudFountain mud_fountain_tbl[10];
@ -86,8 +86,8 @@ U0 update_mud_fountains()
U0 display_mud_fountains()
{
uint16 frame_counter = 0;
uint16 frame_num = 0;
U16 frame_counter = 0;
U16 frame_num = 0;
I64 i, j;
frame_counter++;
if ((frame_counter & 1) != 0)
@ -121,7 +121,7 @@ U0 update_moving_platforms() {
map_write_tile_cell(platform->map_tiles[si - 2], platform->x + si - 4, platform->y);
}
uint16 map_tile_num = (map_get_tile_cell(platform->x, platform->y) / 8);
U16 map_tile_num = (map_get_tile_cell(platform->x, platform->y) / 8);
if (player_death_counter == 0) {
if (platform->y - 1 == player_y_pos && move_platform_flag != 0) {
player_move_on_platform(platform->x - 2, platform->x + 2, map_tile_num, map_tile_num);

72
Player.HC

@ -2,20 +2,20 @@ extern TileInfo *actor_get_tile_info(I64 actorInfoIndex, I64 frame_num);
extern I64 map_width_in_tiles;
extern U8 byte_32EB8;
extern U0 actor_add_new(I64 image_index, I64 x_pos, I64 y_pos);
extern uint16 map_get_tile_cell(I64 x, I64 y);
extern U16 map_get_tile_cell(I64 x, I64 y);
extern I64 map_max_y_offset;
extern I64 mapwindow_x_offset;
extern I64 mapwindow_y_offset;
extern U0 video_draw_tile_white(Tile *tile, uint16 x, uint16 y);
extern U0 video_draw_tile_white(Tile *tile, U16 x, U16 y);
extern U0 no_bombs_dialog();
extern I64 map_stride_bit_shift_amt;
extern U0 effect_add_sprite(I64 actorInfoIndex, I64 frame_num, I64 x_pos, I64 y_pos, I64 arg_8, I64 counter);
extern U0 display_actor_sprite_maybe(I64 actorInfoIndex, I64 frame_num, I64 x_pos, I64 y_pos, I64 tile_display_func_index);
extern U0 load_level(I64 level_number);
extern uint16 current_level;
extern U16 current_level;
sint16 player_x_offset_tbl[9] = { 0, 0, 1, 1, 1, 0, -1, -1, -1 };
sint16 player_y_offset_tbl[9] = { 0, -1, -1, 0, 1, 1, 1, 0, -1 };
I16 player_x_offset_tbl[9] = { 0, 0, 1, 1, 1, 0, -1, -1, -1 };
I16 player_y_offset_tbl[9] = { 0, -1, -1, 0, 1, 1, 1, 0, -1 };
I64 player_is_grabbing_wall_flag = 0;
I64 player_death_counter = 0;
@ -39,29 +39,29 @@ I64 is_standing_slipry_slope_right_flg = 0;
I64 num_health_bars = 0;
uint16 num_bombs = 0;
uint16 has_had_bomb_flag = 0;
U16 num_bombs = 0;
U16 has_had_bomb_flag = 0;
I64 teleporter_state_maybe = 0;
I64 player_is_teleporting_flag = 0;
I64 teleporter_counter = 0;
uint8 player_in_pneumatic_tube_flag = 0;
U8 player_in_pneumatic_tube_flag = 0;
I64 player_invincibility_counter = 0;
I64 player_fall_off_map_bottom_counter = 0;
I64 num_hits_since_touching_ground = 0;
uint16 player_push_direction = 0;
uint16 player_push_anim_duration_maybe = 0;
uint16 player_push_anim_counter = 0;
uint16 player_push_duration = 0;
uint16 player_push_frame_num = 0;
uint8 player_dont_push_while_jumping_flag = 0;
uint16 player_push_check_blocking_flag = 0;
U16 player_push_direction = 0;
U16 player_push_anim_duration_maybe = 0;
U16 player_push_anim_counter = 0;
U16 player_push_duration = 0;
U16 player_push_frame_num = 0;
U8 player_dont_push_while_jumping_flag = 0;
U16 player_push_check_blocking_flag = 0;
uint8 word_28BEA;
U8 word_28BEA;
I64 word_28F7E;
I64 word_28F94;
I64 word_2E180;
@ -76,8 +76,8 @@ I64 word_32EB2;
U8 byte_2E182;
U8 byte_2E2E4;
uint8 god_mode_flag = 0;
uint8 show_monster_attack_hint = 0;
U8 god_mode_flag = 0;
U8 show_monster_attack_hint = 0;
Tile *player_tiles;
Sprite *player_sprites;
@ -89,7 +89,7 @@ U0 sub_11062()
return;
}
U0 player_add_to_score(uint32 amount_to_add_low)
U0 player_add_to_score(U32 amount_to_add_low)
{
add_to_score_update_on_display(amount_to_add_low, 9, 0x16);
}
@ -188,8 +188,8 @@ I64 player_check_collision_with_actor(I64 actorInfoIndex, I64 frame_num, I64 x_p
if(player_death_counter == 0)
{
TileInfo *tileInfo = actor_get_tile_info(actorInfoIndex, frame_num);
uint16 di = tileInfo->height;
uint16 si = tileInfo->width;
U16 di = tileInfo->height;
U16 si = tileInfo->width;
if(x_pos > map_width_in_tiles && x_pos <= -1 && actorInfoIndex == 0x1a)
{
@ -238,7 +238,7 @@ U0 player_decrease_health()
}
U0 push_player_around(I64 push_direction, I64 push_anim_duration, I64 push_duration, I64 player_frame_num,
uint8 dont_push_while_jumping_flag, I64 check_for_blocking_flag)
U8 dont_push_while_jumping_flag, I64 check_for_blocking_flag)
{
player_push_direction = push_direction;
player_push_anim_duration_maybe = push_anim_duration;
@ -259,7 +259,7 @@ I64 player_check_movement(I64 direction, I64 x_pos, I64 y_pos)
{
is_standing_slipry_slope_left_flg = 0;
is_standing_slipry_slope_right_flg = 0;
uint8 tile_attr;
U8 tile_attr;
I64 i;
switch (direction)
{
@ -440,8 +440,8 @@ U0 player_move_on_platform(I64 platform_x_left, I64 platform_x_right, I64 x_offs
U0 player_load_tiles()
{
uint16 num_tile_info_records;
uint16 num_tiles;
U16 num_tile_info_records;
U16 num_tiles;
player_tiles = load_tiles("PLAYERS.MNI", TRANSPARENT, &num_tiles);
"Loading %d player tiles.\n", num_tiles;
@ -449,7 +449,7 @@ U0 player_load_tiles()
"Loading %d, player tile info records.\n", num_tile_info_records;
}
U0 display_player_sprite_mode_6(uint8 frame_num, I64 x_pos, I64 y_pos)
U0 display_player_sprite_mode_6(U8 frame_num, I64 x_pos, I64 y_pos)
{
TileInfo *info = &player_sprites[0].frames[frame_num];
Tile *tile = &player_tiles[info->tile_num];
@ -465,7 +465,7 @@ U0 display_player_sprite_mode_6(uint8 frame_num, I64 x_pos, I64 y_pos)
}
}
U0 display_player_sprite(uint8 frame_num, I64 x_pos, I64 y_pos, I64 tile_display_func_index)
U0 display_player_sprite(U8 frame_num, I64 x_pos, I64 y_pos, I64 tile_display_func_index)
{
if(tile_display_func_index == 6)
{
@ -486,8 +486,8 @@ U0 display_player_sprite(uint8 frame_num, I64 x_pos, I64 y_pos, I64 tile_display
{
for(x=0;x < info->width; x++)
{
uint16 screen_x = (x_pos - mapwindow_x_offset + x + 1) * 8;
uint16 screen_y = (y_pos - info->height + 1 - mapwindow_y_offset + y + 1) * 8;
U16 screen_x = (x_pos - mapwindow_x_offset + x + 1) * 8;
U16 screen_y = (y_pos - info->height + 1 - mapwindow_y_offset + y + 1) * 8;
if(screen_x >= 8 && screen_x <= 304 && //FIXME need a better way of making sure we draw in the borders.
screen_y >= 8 && screen_y < 152 &&
@ -523,7 +523,7 @@ U0 player_reset_push_variables()
return;
}
sint16 word_28F80[10] = {-2, -1, -1, -1, -1, -1, -1, 0, 0, 0};
I16 word_28F80[10] = {-2, -1, -1, -1, -1, -1, -1, 0, 0, 0};
U0 push_player()
{
@ -592,7 +592,7 @@ U0 handle_player_input_maybe()
I64 bottom_bomb_check_flag;
I64 di;
I64 blockingCheck;
uint8 tile_attr;
U8 tile_attr;
I64 si = 0;
player_is_grabbing_wall_flag = 0;
@ -1218,7 +1218,7 @@ U0 handle_player_input_maybe()
{
if(left_key_pressed == right_key_pressed)
{
uint8 rvalue = (cosmo_rand() % 0x32);
U8 rvalue = (cosmo_rand() % 0x32);
player_sprite_dir_frame_offset = 4;
if(left_key_pressed == 0 && right_key_pressed == 0 && byte_2E2E4 == 0)
@ -1501,13 +1501,13 @@ I64 player_bounce_in_the_air(I64 bounce_height)
U0 player_hoverboard_update()
{
uint16 drop_bomb_state = 0;
U16 drop_bomb_state = 0;
sub_11062();
word_2E1E8 = 0;
player_bounce_height_counter = 0;
byte_2E2E4 = 0;
uint8 tr1, tr2;
U8 tr1, tr2;
if (player_death_counter != 0)
{
return;
@ -1708,7 +1708,7 @@ U0 player_hoverboard_update()
}
return;
}
uint8 player_walk_frame_tbl_maybe[9] = {
U8 player_walk_frame_tbl_maybe[9] = {
0x13, 0x14, 0x15,
0x14, 0x13, 0x14,
0x15, 0x14, 0x13
@ -1744,7 +1744,7 @@ U0 player_update_walk_anim()
I64 player_update_sprite()
{
uint8 byte_28FAC = 0;
U8 byte_28FAC = 0;
if (map_max_y_offset + 0x15 < player_y_pos && player_death_counter == 0)
{

8
Status.HC

@ -1,13 +1,13 @@
#define MAP_WINDOW_WIDTH 38
#define MAP_WINDOW_HEIGHT 18
extern uint32 score;
extern U32 score;
extern U8 num_health_bars;
I64 health = 0;
extern U32 num_stars_collected;
extern U16 num_bombs;
extern CDC *game_surface;
extern U0 video_draw_tile(Tile *tile, uint16 x, uint16 y);
extern U0 video_draw_tile(Tile *tile, U16 x, U16 y);
#define STATUS_BAR_HEIGHT 6
#define STATUS_BAR_WIDTH 38
@ -15,7 +15,7 @@ extern U0 video_draw_tile(Tile *tile, uint16 x, uint16 y);
Tile *status_tiles;
U0 status_load_tiles() {
uint16 num_tiles;
U16 num_tiles;
status_tiles = load_tiles("STATUS.MNI", SOLID, &num_tiles);
"Loading %d status tiles.\n", num_tiles;
}
@ -32,7 +32,7 @@ U0 status_display()
}
}
U0 add_to_score_update_on_display(uint32 amount_to_add_low, I64 x_pos, I64 y_pos)
U0 add_to_score_update_on_display(U32 amount_to_add_low, I64 x_pos, I64 y_pos)
{
score += amount_to_add_low;
display_number(x_pos, y_pos, score);

52
Tile.HC

@ -1,4 +1,4 @@
extern U8 *load_file(U8 *filename, U8 *buf, uint32 buf_size);
extern U8 *load_file(U8 *filename, U8 *buf, U32 buf_size);
extern Bool open_file(U8 *filename, File *file);
// Tiletype
@ -18,17 +18,17 @@ extern Bool open_file(U8 *filename, File *file);
class Tile {
I64 type;
uint8 pixels[64];
U8 pixels[64];
};
class TileInfo {
uint16 height;
uint16 width;
uint16 tile_num;
U16 height;
U16 width;
U16 tile_num;
};
class Sprite {
uint16 num_frames;
U16 num_frames;
TileInfo *frames;
};
@ -46,22 +46,22 @@ class Sprite {
#define TRANSPARENT_COLOR 255
uint8 tileattr_mni_data[7000];
U8 tileattr_mni_data[7000];
U0 tile_attr_load()
{
load_file("TILEATTR.MNI", &tileattr_mni_data, 7000);
}
uint8 get_tile_size(I64 type)
U8 get_tile_size(I64 type)
{
return Cond(type == SOLID, 32, 40);
}
uint16 get_number_of_tiles(File *file, I64 type)
U16 get_number_of_tiles(File *file, I64 type)
{
uint8 tile_size = get_tile_size(type);
U8 tile_size = get_tile_size(type);
uint16 num_tiles = 0;
uint32 filesize = file->size;
U16 num_tiles = 0;
U32 filesize = file->size;
while(filesize > 0xffff)
{
num_tiles += 0xffff / tile_size;
@ -76,9 +76,9 @@ uint16 get_number_of_tiles(File *file, I64 type)
return num_tiles;
}
uint8 getPixelAtColumnPosition(uint8 *rowPtr, uint8 column, I64 tileType)
U8 getPixelAtColumnPosition(U8 *rowPtr, U8 column, I64 tileType)
{
uint8 color = 0;
U8 color = 0;
if (tileType == TRANSPARENT) {
if (*rowPtr & (1 << (7 - column))) {
@ -104,10 +104,10 @@ uint8 getPixelAtColumnPosition(uint8 *rowPtr, uint8 column, I64 tileType)
return color;
}
U0 load_tile(uint8 *planarData, I64 type, Tile *tile)
U0 load_tile(U8 *planarData, I64 type, Tile *tile)
{
tile->type = type;
uint8 *pixelPtr = tile->pixels;
U8 *pixelPtr = tile->pixels;
U8 x,y;
for(y=0;y<TILE_HEIGHT;y++) {
for(x=0;x<TILE_WIDTH;x++) {