Пример #1
0
struct map_t *map_preset_arena(void)
{
        struct map_t *arena;
        struct map_t *cave;
        double **armap;
        int i;
        int j;

        armap = empty_simplex_matrix(FULLSCREEN);
       
        for (i=0; i<LINES; i++) {
        for (j=0; j<COLS; j++) {
                if (i >= ARENA_H/2 && i <= LINES-ARENA_H/2
                &&  j >= ARENA_W/2 && j <= COLS-ARENA_W/2)
                        armap[i][j] = BEACH_F;
                else if (i > ISLAND_H_LO && i < ISLAND_H_HI 
                &&       j > ISLAND_W_LO-2 && j < ISLAND_W_HI)
                {
                        if (i > ISLAND_H_LO+ISLAND_FAT+5
                        &&  i < ISLAND_H_HI-ISLAND_FAT
                        &&  j < ISLAND_W_LO+ISLAND_FAT+1) {
                                if (j > ISLAND_W_LO+ISLAND_FAT-2)
                                        armap[i][j] = BEACH_F;
                                else
                                        armap[i][j] = -0.05;
                        } else {
                                armap[i][j] = TERRA_F;
                        }
                }
                else
                        armap[i][j] = -0.05;
        }
        }
       
        arena = new_map(FULLSCREEN);
        map_gen(arena, armap, MAP_NOSMOOTH);

        /* Make a cave entrance */
        cave = new_dungeon();
        put_door(CAVE_DOOR, arena, cave, 
                 1, 1, ARENA_H/2-1, COLS/2,
                 1, 1, LINES/2-10, COLS/2);

        cave_connect_door(cave);
        map_render(arena);
        map_render(cave);

        return arena;
}
Пример #2
0
struct map_t *map_preset_sand(void)
{
        struct map_t *sandmap;
        double **sand;
        int i;
        int j;

        sand = empty_simplex_matrix(LINES, COLS);

        for (i=0; i<LINES; i++) {
        for (j=0; j<COLS; j++) {
                sand[i][j] = BEACH_F;
        }
        }

        sandmap = new_map(FULLSCREEN);
        map_gen(sandmap, sandmap->pmap, MAP_NOSMOOTH);

        /*sandmap->asset[1] = new_asset(0);*/
        /*sandmap->asset[1]->put(sandmap, 1, ((LINES/2)-(LINES/3)), ((COLS/2)-2));*/

        map_render(sandmap);

        return sandmap;
}
Пример #3
0
void map_editor_render(state_stack* stack) {
	state_desc *top = (state_desc*) table_ind(stack, stack->m_len-1);
	map_editor *mapEditor = (map_editor*) top->m_pData;

	map_render();

	rect tempSrc = _tile_rect(mapEditor->m_iActiveTile);
	rect tempDst = {1180, 32, 64, 64};
	image_draw(g_map.m_imageTiles, &tempSrc, &tempDst);
	font_print(g_font, 10, 10, "%s", g_map.m_cName);
	
	struct { int mode; const char *name; } modeNames[] = {
		{MAPEDITOR_NONE,	"How the f**k are you even here?"},
		{MAPEDITOR_EDIT,	"Edit Mode"},
		{MAPEDITOR_NAME,	"Rename Map"},
		{MAPEDITOR_SAVE,	"Saving Map"},
		{MAPEDITOR_LOAD,	"Loading Map"},
		{MAPEDITOR_TILE,	"Tile Select"},
		{MAPEDITOR_SHEET,	"Sheet Select"},
		{MAPEDITOR_WALK,	"Walk Edit"},
	};
	
	struct { int mode; const char *name; } walkModeNames[] = {
		{WALK_NONE, "NONE"},
		{WALK_WALK, "WALK"},
		{WALK_RUN, "RUN"},
		{WALK_SWIM, "SWIM"},
		{WALK_CLIMB, "CLIMB"},
		{WALK_FLY, "FLY"},
	};
	
	bool found = false;
	for (int i = 0; i < SIZE(modeNames); i++) {
		if (modeNames[i].mode == mapEditor->m_iMapEditorState) {
			font_print(g_font, 10, 690, modeNames[i].name);
			found = true;
		}
	}
	
	if (!found) {
		font_print(g_font, 10, 690, "How the f**k are you even here?");
		return;
	}
	
	if (mapEditor->m_iMapEditorState != MAPEDITOR_WALK) { return; }
	
	for (int i = 0; i < SIZE(walkModeNames); i++) {
		if (walkModeNames[i].mode == mapEditor->m_cMapWalk) {
			font_print(g_font, 1180, 32, walkModeNames[i].name);
			return;
		}
	}
	
	font_print(g_font, 1180, 32, "BROKEN");
	return;
}
Пример #4
0
static void do_render(world_t w, float lerp, light_t l)
{
	renderer_t r = w->render;
	vec3_t cpos;

	chopper_get_pos(w->apache, lerp, cpos);

	glPushMatrix();
	renderer_translate(r, w->cpos[0], w->cpos[1], w->cpos[2]);
	renderer_translate(r, -cpos[0], -cpos[1], -cpos[2]);
	map_render(w->map, r, l);
	chopper_render_missiles(w->apache, r, lerp, l);
	glPopMatrix();

	glPushMatrix();
	renderer_translate(r, w->cpos[0], w->cpos[1], w->cpos[2]);
	chopper_render(w->apache, r, lerp, l);
	glPopMatrix();
}
Пример #5
0
/*@ Map.render(layer, [scroll_x, scroll_y])
 *# Renders the specified layer of the map (background, center or foreground).
 *# The center layer is where all the action in the game occurs and sprites and so on moves around.
 *# The background is drawn behind the center layer for objects in the background. It needs to be drawn first,
 *# so that the center and foreground layers are drawn over it.
 *# The foreground layer is drawn last and contains objects in the foreground. 
 */
static int render_map(lua_State *L) {	
	int layer = luaL_checknumber(L,1) - 1;
	
	int sx = 0, sy = 0;
	struct lustate_data *sd = get_state_data(L);
	
	if(!sd->map) {
		luaL_error(L, "Attempt to render non-existent Map");
	} 
	if(layer < 0 || layer >= 3) {
		luaL_error(L, "Attempt to render non-existent Map layer %d", layer);
	}
	if(!sd->bmp) {
		luaL_error(L, "Attempt to render Map outside of a screen update");	
	}
	
	if(lua_gettop(L) > 2) {
		sx = luaL_checknumber(L,2);
		sy = luaL_checknumber(L,3);
	}
	
	map_render(sd->map, sd->bmp, layer, sx, sy);
	return 0;
}
Пример #6
0
void game_render() {
	map_render();
	player_render();
	if(gamestate_current()==GAMESTATE_GAME)
		particle_emitter_loop();
}
Пример #7
0
void game_render() {
  map_render();
  char_render();
}