int main(void) { while (1) { refresh_inputs(); if (isSchedulable_done()) { done(); } else if (isSchedulable_write_value()) { int ports = 0; if (!FIFO_HAS_ROOM(decoder_parser_blkexp_OUT)(&fifo_o_decoder_parser_blkexp_OUT, 1)) { ports |= 0x01; } if (ports != 0) { continue; } write_value(); } else if (isSchedulable_write_zero()) { int ports = 0; if (!FIFO_HAS_ROOM(decoder_parser_blkexp_OUT)(&fifo_o_decoder_parser_blkexp_OUT, 1)) { ports |= 0x01; } if (ports != 0) { continue; } write_zero(); } else if ((decoder_parser_blkexp_RUN_tokens >= 1) && (decoder_parser_blkexp_VALUE_tokens >= 1) && (decoder_parser_blkexp_LAST_tokens >= 1) && isSchedulable_read_immediate()) { int ports = 0; if (!FIFO_HAS_ROOM(decoder_parser_blkexp_OUT)(&fifo_o_decoder_parser_blkexp_OUT, 1)) { ports |= 0x01; } if (ports != 0) { continue; } read_immediate(); } else if ((decoder_parser_blkexp_RUN_tokens >= 1) && (decoder_parser_blkexp_VALUE_tokens >= 1) && (decoder_parser_blkexp_LAST_tokens >= 1) && isSchedulable_read_save()) { int ports = 0; if (!FIFO_HAS_ROOM(decoder_parser_blkexp_OUT)(&fifo_o_decoder_parser_blkexp_OUT, 1)) { ports |= 0x01; } if (ports != 0) { continue; } read_save(); } else { continue; } } }
void load_game() { #ifdef UNIX sprintf(temp, "%s/.oki", getenv("HOME")); mkdir(temp, 0); sprintf(temp, "%s/.oki/%s_save", getenv("HOME"), maplist[mapset]); save = fopen(temp, "a+b"); #endif #ifdef WIN32 sprintf(temp, "maps/%s/save", maplist[mapset]); save = fopen(temp, "a+b"); #endif progress = read_save(0); coins = read_save(0); lifes = read_save(2); oki->speed = read_save(3); oki->jump.power = read_save(5); oki->strength = read_save(0); oki->run = read_save(0); oki->jump.time = read_save(5); oki->HP = read_save(0); oki->shoot = read_save(0); fclose(save); }
ERR_VALUE read_set_save(FILE *Stream, const ONE_READ *ReadSet, const size_t Count) { const uint32_t count32 = (uint32_t)Count; ERR_VALUE ret = ERR_INTERNAL_ERROR; ret = utils_fwrite(&count32, sizeof(count32), 1, Stream); if (ret == ERR_SUCCESS) { for (uint32_t i = 0; i < count32; ++i) { ret = read_save(Stream, ReadSet + i); if (ret != ERR_SUCCESS) break; } } return ret; }