void new_enemy(enum etype t, unsigned int health, int x, int y){ int i; enemy *e; person *p; for (i = 0; i < MAX_ENEMIES && enemies[i]; i++); if (i >= MAX_ENEMIES) return; enemies[i] = calloc(sizeof(*enemies[i]), 1); e = enemies[i]; p = (person*)e; p->x = x; p->y = y; p->health = health; p->heading = LEFT; e->type = t; switch(t){ case GOON: init_goon(e); break; case CHINESE: init_chinese(e); break; case BOSS: case FINAL: default: break; } e->action = stand_enemy; stand_enemy(e); }
BOOL gigaso_init(){ if(4 == sizeof(void *)){ my_assert(24 == sizeof(FileEntry), 0); }else{ my_assert(40 == sizeof(FileEntry), 0); } breakpad_init(); //request_dump(); init_chinese(); setlocale(LC_ALL, ""); load_online_db(MAC_DRIVE_INDEX); //TODO: 根据mount情况得到onlinedb,然后load。 printf("scan passed %d ms.\n",time_passed(scan)); StartMonitorThread(MAC_DRIVE_INDEX); return 1; }