Exemplo n.º 1
0
AS3_Val render( void* self, AS3_Val args )
{
	Viewport * viewport;

	int time;
	
	double mouseX, mouseY;//, hit = 0;

	//Vector3D test;

	AS3_ArrayValue( args, "PtrType, IntType, DoubleType, DoubleType", &viewport, &time, & mouseX, & mouseY );

	//viewport->mouseX = (int)mouseX;
	//viewport->mouseY = (int)mouseY;

	//AS3_Trace( AS3_Int(viewport->mouseX) );
	//AS3_Trace( AS3_Int(viewport->mouseY) );

	viewport->numFrames ++;

	viewport_updateBeforeRender( viewport );

	viewport_project( viewport, time );

	//hit = viewport_mouseOn( viewport, (float)mouseX, (float)mouseY );
	
	viewport_render( viewport );

	viewport_mouseOn( viewport, (int)mouseX, (int)mouseY );

	viewport_updateAfterRender( viewport );

	return 0;//AS3_Int( hit );
}
Exemplo n.º 2
0
/**
 *
 *  rct2: 0x66CCAE
 * This function immediately jumps to 0x00685BE1 this is the second function
 * decompiled.
 */
void window_main_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
    viewport_render(dpi, w->viewport, dpi->x, dpi->y, dpi->x + dpi->width, dpi->y + dpi->height);
}
Exemplo n.º 3
0
static std::vector<paint_session> extract_paint_session(const std::string parkFileName)
{
    core_init();
    gOpenRCT2Headless = true;
    auto context = OpenRCT2::CreateContext();
    std::vector<paint_session> sessions;
    log_info("Starting...");
    if (context->Initialise())
    {
        drawing_engine_init();
        if (!context->LoadParkFromFile(parkFileName))
        {
            log_error("Failed to load park!");
            return {};
        }

        gIntroState = INTRO_STATE_NONE;
        gScreenFlags = SCREEN_FLAGS_PLAYING;

        int32_t mapSize = gMapSize;
        int32_t resolutionWidth = (mapSize * 32 * 2);
        int32_t resolutionHeight = (mapSize * 32 * 1);

        resolutionWidth += 8;
        resolutionHeight += 128;

        rct_viewport viewport;
        viewport.x = 0;
        viewport.y = 0;
        viewport.width = resolutionWidth;
        viewport.height = resolutionHeight;
        viewport.view_width = viewport.width;
        viewport.view_height = viewport.height;
        viewport.var_11 = 0;
        viewport.flags = 0;

        int32_t customX = (gMapSize / 2) * 32 + 16;
        int32_t customY = (gMapSize / 2) * 32 + 16;

        int32_t x = 0, y = 0;
        int32_t z = tile_element_height(customX, customY) & 0xFFFF;
        x = customY - customX;
        y = ((customX + customY) / 2) - z;

        viewport.view_x = x - ((viewport.view_width) / 2);
        viewport.view_y = y - ((viewport.view_height) / 2);
        viewport.zoom = 0;
        gCurrentRotation = 0;

        // Ensure sprites appear regardless of rotation
        reset_all_sprite_quadrant_placements();

        rct_drawpixelinfo dpi;
        dpi.x = 0;
        dpi.y = 0;
        dpi.width = resolutionWidth;
        dpi.height = resolutionHeight;
        dpi.pitch = 0;
        dpi.bits = (uint8_t*)malloc(dpi.width * dpi.height);

        log_info("Obtaining sprite data...");
        viewport_render(&dpi, &viewport, 0, 0, viewport.width, viewport.height, &sessions);

        free(dpi.bits);
        drawing_engine_dispose();
    }
    log_info("Got %u paint sessions.", std::size(sessions));
    return sessions;
}