void player_status() { unsigned int level, r; const char *rank; level = player.xp >> 4; r = level >> 2; if(r > 7) r = 7; rank = get_rank(player.role, r); stat_printf("%s the %s\nFloor:%u HP:%u(%u) Lvl:%u St:%u Dx:%u Co:%u In:%u Wi:%u Ch:%u T:%u", player.name, rank, player.level->floor, player.stats.hp, player.stats.hpmax, level, player.stats.st, player.stats.dx, player.stats.co, player.stats.in, player.stats.wi, player.stats.ch, player.turn); }
int pbsdboot(TCHAR *wkernel_name, int argc, char *argv[], struct bootinfo* bi) { int i; caddr_t start, end; caddr_t argbuf, p; struct bootinfo *bibuf; int fd = -1; stat_printf(TEXT("open %s..."), wkernel_name); if (CheckCancel(0) || (fd = open((char*)wkernel_name, O_RDONLY)) < 0) { msg_printf(MSG_ERROR, whoami, TEXT("open failed.\n")); stat_printf(TEXT("open %s...failed"), wkernel_name); goto cancel; } stat_printf(TEXT("read information from %s..."), wkernel_name); if (CheckCancel(0) || getinfo(fd, &start, &end) < 0) { stat_printf(TEXT("read information failed"), wkernel_name); goto cancel; } stat_printf(TEXT("create memory map...")); if (CheckCancel(0) || vmem_init(start, end) < 0) { stat_printf(TEXT("create memory map...failed")); goto cancel; } //vmem_dump_map(); stat_printf(TEXT("prepare boot information...")); if ((argbuf = vmem_alloc()) == NULL || (bibuf = (struct bootinfo*)vmem_alloc()) == NULL) { msg_printf(MSG_ERROR, whoami, TEXT("can't allocate argument page\n")); stat_printf(TEXT("prepare boot information...failed")); goto cancel; } memcpy(bibuf, bi, sizeof(struct bootinfo)); for (p = &argbuf[sizeof(char*) * argc], i = 0; i < argc; i++) { int arglen = strlen(argv[i]) + 1; ((char**)argbuf)[i] = p; memcpy(p, argv[i], arglen); p += arglen; } stat_printf(TEXT("loading...")); if (CheckCancel(0) || loadfile(fd, &start) < 0) { stat_printf(TEXT("loading...failed")); goto cancel; } /* last chance to cancel */ if (CheckCancel(-1)) { goto cancel; } stat_printf(TEXT("execute kernel...")); vmem_exec(start, argc, (char**)argbuf, bibuf); stat_printf(TEXT("execute kernel...failed")); cancel: if (0 <= fd) { close(fd); } vmem_free(); return (-1); }