_Bool enemyldresrc(void){ untihit = resrcacq(sfx, "sfx/hit.wav", 0); if(!untihit) return 0; untiinfo.hit = untihit; untiimg = resrcacq(imgs, "img/unti.png", 0); if(!untiimg) return 0; thuimg = resrcacq(imgs, "img/thu.png", 0); if(!thuimg) return 0; thuinfo.hit = untihit; splatimg = resrcacq(imgs, "img/splat.png", 0); if(!splatimg) return 0; splatinfo.hit = untihit; nousimg = resrcacq(imgs, "img/nous.png", 0); if(!nousimg) return 0; nousinfo.hit = untihit; grenduimg = resrcacq(imgs, "img/grendu.png", 0); if(!grenduimg) return 0; grenduinfo.hit = untihit; daimg = resrcacq(imgs, "img/da.png", 0); if(!daimg) return 0; dainfo.hit = untihit; rnginit(&rng, 666); //TODO: use the game seed return 1; }
static void rng(Rng *r) { clock_t seed = time(0) ^ getpid() ^ getpid() << 16; if (seedstr) seed = strtol(seedstr, NULL, 10); rnginit(r, seed); }
static int rng(Rng *r, int argc, char *argv[]) { int args = 0; clock_t seed = 0; if (argv[1][0] == '-' && argv[1][1] == 's') { seed = strtol(argv[2], NULL, 10); args = 2; } else { seed = time(0); pr("enmgen seed = %lu", (unsigned long) seed); } rnginit(r, seed); return args; }
_Bool enemyldresrc(unsigned seed) { untihit = resrcacq(sfx, "sfx/hit.wav", 0); if(!untihit) return 0; untiinfo.hit = untihit; untiimg = resrcacq(imgs, "img/unti.png", 0); if(!untiimg) return 0; thuimg = resrcacq(imgs, "img/thu.png", 0); if(!thuimg) return 0; thuinfo.hit = untihit; splatimg = resrcacq(imgs, "img/splat.png", 0); if(!splatimg) return 0; splatinfo.hit = untihit; nousimg = resrcacq(imgs, "img/nous.png", 0); if(!nousimg) return 0; nousinfo.hit = untihit; grenduimg = resrcacq(imgs, "img/grendu.png", 0); if(!grenduimg) return 0; grenduinfo.hit = untihit; daimg = resrcacq(imgs, "img/da.png", 0); if(!daimg) return 0; dainfo.hit = untihit; tihgtimg = resrcacq(imgs, "img/tihgt.png", 0); if(!tihgtimg) return 0; tihgtinfo.hit = untihit; heartimg = resrcacq(imgs, "img/placeholder.png", 0); if(!heartimg) return 0; heartinfo.hit = untihit; rnginit(&rng, seed); return 1; }