Skip to content
Clément Gallet edited this page Jun 25, 2014 · 1 revision
char sprite_infos1[0x6][0x44]; // $8259
char sprite_infos2[0x6][0x44]; // $83F1
char sprite_infos3[0x6][0x44]; // $8589
char sprite_infos4[0x6][0x44]; // $8721
char* mold_pointers; // $C2C4A4
char* grid_infos; // $C2B9E7

char mold_number; // $2000

char grid_i = 0;

zeroing(sprite_infos1);
zeroing(sprite_infos2);
zeroing(sprite_infos3);
zeroing(sprite_infos4);

char mold_offset = 0xC * mold_number // $26
mold_pointer = *(short)(mold_pointers + mold_offset);

for (char enemy = 0; enemy < 0x6; enemy++) { // 6 - $16
  char hor_offset = *(char)(mold_pointer); // $18
  mold_pointer++;
  char vert_offset = *(char)(mold_pointer); // $19
  mold_pointer++;

  while (*(char)(mold_pointer) >= 0) {
    char grid_pos = *(char)(mold_pointer)
    sprite_infos1[enemy][grid_i++] = *(grid_infos + 4*grid_pos) - hor_offset;
    sprite_infos1[enemy][grid_i++] = *(grid_infos + 4*grid_pos + 1) - vert_offset;
    sprite_infos1[enemy][grid_i++] = *(grid_infos + 4*grid_pos + 2);
    sprite_infos1[enemy][grid_i++] = *(grid_infos + 4*grid_pos + 3);
    mold_pointer++;
  }
  sprite_infos1[enemy][grid_i++] = *(char)(mold_pointer);
}

copyto(sprite_infos1,sprite_infos2);
copyto(sprite_infos1,sprite_infos3);
copyto(sprite_infos1,sprite_infos4);

char *enemy_width // $812F

char t = 0; // $14
for (char sprite_off = 0; sprite_off < 0x198; sprite_off += 4){
  char s = 0x11; // $12
  char width = *(enemy_width+2*t) * 8; // $10
  t++;
  loc_sprite = *(sprite_infos1 + sprite_off);
  if ( loc_sprite != 0xFF ) {
    loc_sprite = (loc_sprite ^ 0xFF) - 0x20 + width;
  }
  *(sprite_infos2 + sprite_off) = loc_sprite;
  *(sprite_infos4 + sprite_off) = loc_sprite;
}

/* The rest does not matter. Mainly, it's the same with heigth instead of width and copy to sprite_infos3 and sprite_infos4 */
Clone this wiki locally