コード例 #1
0
ファイル: otiles.cpp プロジェクト: Techokami/cannonball
// Clear various areas related to TILE RAM and init default values for start of level
// Source: 0xD848
void OTiles::clear_tile_info()
{
    // 1. Clear portion of RAM containing tilemap info (60F00 - 60F1F)
    fg_h_scroll = 
    bg_h_scroll = 
    fg_v_scroll = 
    bg_v_scroll =   // +4 words
    fg_psel = 
    bg_psel = 
    tilemap_v_scr = 
    tilemap_h_scr = // +5 words
    fg_v_tiles = 
    bg_v_tiles = 
    tilemap_v_off = // +3 words
    fg_addr = 
    bg_addr = 0;    // +4 words

    // 2. Clear portion of TEXT RAM containing tilemap info (110E80 - 110FFF)
    uint32_t dst_addr = HW_FG_PSEL;
    for (uint8_t i = 0; i <= 0x5F; i++)
        video.write_text32(&dst_addr, 0);

    // 3. Clear all of TILE RAM 100000 - 10FFFF
    video.clear_tile_ram();

    // 4. Setup new values
    fg_psel = roms.rom0.read16(TILES_PAGE_FG1);
    bg_psel = roms.rom0.read16(TILES_PAGE_BG1);
    video.write_text16(HW_FG_PSEL, fg_psel);    // Also write values to hardware
    video.write_text16(HW_BG_PSEL, bg_psel);

    init_tilemap(oroad.stage_lookup_off); // Initialize Default Tilemap
}
コード例 #2
0
void init_world_area(World_Area* area, Memory_Arena* arena)
{
	init_simulator(&area->sim, World_Area_Entity_Capacity, arena);
	init_tilemap(&area->map, 
			World_Area_Tilemap_Width,
			World_Area_Tilemap_Height,
			arena);

	area->entities = Arena_Push_Array(arena, Entity, World_Area_Entity_Capacity);
	area->entities_count = 0;
	area->entities_capacity = World_Area_Entity_Capacity;
	area->next_entity_id = 0;
	area->entities_dirty = false;

}
コード例 #3
0
ファイル: tilemap.c プロジェクト: chasonr/unnethack-i18n
int main(void)
{
    register int i;
    char filename[30];
    FILE *ofp;

    init_tilemap();

    /*
     * create the source file, "tile.c"
     */
    Sprintf(filename, SOURCE_TEMPLATE, TILE_FILE);
    if (!(ofp = fopen(filename, "w"))) {
        perror(filename);
        exit(EXIT_FAILURE);
    }
    fprintf(ofp,"/* This file is automatically generated.  Do not edit. */\n");
    fprintf(ofp,"\n#include \"hack.h\"\n\n");
    fprintf(ofp,"short glyph2tile[MAX_GLYPH] = {\n");

    for (i = 0; i < MAX_GLYPH; i++) {
        fprintf(ofp,"%2d,%c", tilemap[i], (i % 12) ? ' ' : '\n');
    }
    fprintf(ofp,"%s};\n", (i % 12) ? "\n" : "");

    process_substitutions(ofp);

    fprintf(ofp,"\n#define MAXMONTILE %d\n", lastmontile);
    fprintf(ofp,"#define MAXOBJTILE %d\n", lastobjtile);
    fprintf(ofp,"#define MAXOTHTILE %d\n", lastothtile);

    fprintf(ofp,"\n/*tile.c*/\n");

    fclose(ofp);
    exit(EXIT_SUCCESS);
    /*NOTREACHED*/
    return 0;
}
コード例 #4
0
ファイル: otiles.cpp プロジェクト: Techokami/cannonball
// Note this is called in attract mode, when we need to loop back to Stage 1, from the final stage.
// Source: 0xD982
void OTiles::loop_to_stage1()
{
    opalette.pal_manip_ctrl = 1;    // Enable palette fade routines to transition between levels
    init_tilemap();                 // Initalize Default Tilemap (Stage 1)
    opalette.setup_sky_change();    // Setup data in RAM necessary for sky palette fade.
}