int FULLSCREEN_SetMode(int width, int height, int bpp)
{
   SCREENMODEBLOCK smb;
   _kernel_swi_regs regs;

   smb.flags = 1;
   smb.x_pixels = width;
   smb.y_pixels = height;
   smb.mode_vars[0] = -1;

   switch(bpp)
   {
	case 8:
		smb.pixel_depth = 3;
		
		smb.mode_vars[0] = 0; smb.mode_vars[1] = 128; 
		smb.mode_vars[2] = 3; smb.mode_vars[3] = 255; 
		smb.mode_vars[4] = -1; 
		break;

	case 15:
	case 16:
		smb.pixel_depth = 4;
		break;

	case 32:
		smb.pixel_depth = 5;
		break;

	default:
		SDL_SetError("Pixel depth not supported");
		return 0;
		break;
   }
   
   smb.frame_rate = -1;

   regs.r[0] = 0;
   regs.r[1] = (int)&smb;

   if (_kernel_swi(OS_ScreenMode, &regs, &regs) != 0)
   {
	   SDL_SetError("Couldn't set requested mode");
	   return 0;
   }

    
    _kernel_oswrch(23);_kernel_oswrch(1);_kernel_oswrch(0);
    _kernel_oswrch(0);_kernel_oswrch(0);_kernel_oswrch(0);
    _kernel_oswrch(0);_kernel_oswrch(0);_kernel_oswrch(0);
    _kernel_oswrch(0);_kernel_oswrch(0);

   return 1;
}
int FULLSCREEN_SetMode(int width, int height, int bpp)
{
   SCREENMODEBLOCK smb;
   _kernel_swi_regs regs;

   smb.flags = 1;
   smb.x_pixels = width;
   smb.y_pixels = height;
   smb.mode_vars[0] = -1;

   switch(bpp)
   {
	case 8:
		smb.pixel_depth = 3;
		/* Note: Need to set ModeFlags to 128 and NColour variables to 255 get full 8 bit palette */
		smb.mode_vars[0] = 0; smb.mode_vars[1] = 128; /* Mode flags */
		smb.mode_vars[2] = 3; smb.mode_vars[3] = 255; /* NColour (number of colours -1) */
		smb.mode_vars[4] = -1; /* End of list */
		break;

	case 15:
	case 16:
		smb.pixel_depth = 4;
		break;

	case 32:
		smb.pixel_depth = 5;
		break;

	default:
		SDL_SetError("Pixel depth not supported");
		return 0;
		break;
   }
   
   smb.frame_rate = -1;

   regs.r[0] = 0;
   regs.r[1] = (int)&smb;

   if (_kernel_swi(OS_ScreenMode, &regs, &regs) != 0)
   {
	   SDL_SetError("Couldn't set requested mode");
	   return 0;
   }

    /* Turn cursor off*/
    _kernel_oswrch(23);_kernel_oswrch(1);_kernel_oswrch(0);
    _kernel_oswrch(0);_kernel_oswrch(0);_kernel_oswrch(0);
    _kernel_oswrch(0);_kernel_oswrch(0);_kernel_oswrch(0);
    _kernel_oswrch(0);_kernel_oswrch(0);

   return 1;
}
static void FULLSCREEN_UpdateRectsOS(_THIS, int numrects, SDL_Rect *rects)
{
   _kernel_swi_regs regs;
   _kernel_oserror *err;
   int j;
   int y;

   regs.r[0] = 28 + 512;
   regs.r[1] = (unsigned int)this->hidden->alloc_bank;
   regs.r[2] = (unsigned int)this->hidden->alloc_bank+16;
   regs.r[5] = 0;

   for (j = 0; j < numrects; j++)
   {
      y = this->screen->h - rects->y; 
      _kernel_oswrch(24); 
      _kernel_oswrch((rects->x << this->hidden->xeig) & 0xFF); 
      _kernel_oswrch(((rects->x << this->hidden->xeig) >> 8) & 0xFF);
      _kernel_oswrch(((y - rects->h) << this->hidden->yeig) & 0xFF); 
      _kernel_oswrch((((y - rects->h) << this->hidden->yeig)>> 8) & 0xFF);
      _kernel_oswrch(((rects->x + rects->w - 1) << this->hidden->xeig) & 0xFF); 
      _kernel_oswrch((((rects->x + rects->w - 1)<< this->hidden->xeig) >> 8) & 0xFF);
      _kernel_oswrch(((y-1) << this->hidden->yeig) & 0xFF); 
      _kernel_oswrch((((y-1) << this->hidden->yeig) >> 8) & 0xFF);

      regs.r[3] = 0;
      regs.r[4] = 0;

      if ((err = _kernel_swi(OS_SpriteOp, &regs, &regs)) != 0)
      {
         printf("OS_SpriteOp failed \n%s\n",err->errmess);
      }

      rects++;

      
      _kernel_oswrch(24); 
      _kernel_oswrch(0); 
      _kernel_oswrch(0);
      _kernel_oswrch(0); 
      _kernel_oswrch(0);
      _kernel_oswrch(((this->screen->w-1) << this->hidden->xeig) & 0xFF); 
      _kernel_oswrch((((this->screen->w-1) << this->hidden->xeig) >> 8) & 0xFF);
      _kernel_oswrch(((this->screen->h-1) << this->hidden->yeig) & 0xFF); 
      _kernel_oswrch((((this->screen->h-1) << this->hidden->yeig) >> 8) & 0xFF);
   }
}
示例#4
0
//-----------------------------------------------------------------------------
//
// R_DrawPlanes
// At the end of each frame.
//
void R_DrawPlanes(void)
{
    int i;
    visplane_t *pl;

#ifdef RANGECHECK
    if (ds_p > &drawsegs[MAXDRAWSEGS])
        I_Error ("R_DrawPlanes: drawsegs overflow (%i)",
                 ds_p - drawsegs);

    if (lastvisplane > &visplanes[MAXVISPLANES])
        I_Error ("R_DrawPlanes: visplane overflow (%i)",
                 lastvisplane - visplanes);

    if (lastopening > &openings[MAXOPENINGS])
        I_Error ("R_DrawPlanes: opening overflow (%i)",
                 lastopening - openings);
#endif

    if (showrplanestats)
    {
#ifdef __riscos
        extern void _kernel_oswrch (int);
        _kernel_oswrch (31);
        _kernel_oswrch (0);
        _kernel_oswrch (0);
#endif
        printf ("Drawsegs = %u/%u, Visplanes = %u/%u, Openings = %u/%u\n",
                ds_p - drawsegs, MAXDRAWSEGS,
                lastvisplane - visplanes, MAXVISPLANES,
                lastopening - openings, MAXOPENINGS);
    }

    for (pl = visplanes ; pl < lastvisplane ; pl++)
    {
        if (pl->minx <= pl->maxx)
        {
            int picnum = pl->picnum;

            // sky flat
            if (picnum == skyflatnum || (picnum & PL_SKYFLAT))
            {
                int	 x;
                int	 texture;
                int	 offset;
                angle_t  an, flip;
                rpatch_t *tex_patch;

                // killough 10/98: allow skies to come from sidedefs.
                // Allows scrolling and/or animated skies, as well as
                // arbitrary multiple skies per level without having
                // to use info lumps.
                an = viewangle;

                if (picnum & PL_SKYFLAT)
                {
                    // Sky Linedef
                    const line_t *l = &lines[picnum & ~PL_SKYFLAT];

                    // Sky transferred from first sidedef
                    const side_t *s = *l->sidenum + sides;

                    // Texture comes from upper texture of reference sidedef
                    texture = texturetranslation[s->toptexture];

                    // Horizontal offset is turned into an angle offset,
                    // to allow sky rotation as well as careful positioning.
                    // However, the offset is scaled very small, so that it
                    // allows a long-period of sky rotation.
                    an += s->textureoffset;

                    // Vertical offset allows careful sky positioning.
                    dc_texturemid = s->rowoffset - 28 * FRACUNIT;

                    // We sometimes flip the picture horizontally.
                    //
                    // DOOM always flipped the picture, so we make it optional,
                    // to make it easier to use the new feature, while to still
                    // allow old sky textures to be used.
                    flip = l->special==272 ? 0u : ~0u;
                }
                else	// Normal DOOM sky, only one allowed per level
                {
                    dc_texturemid = skytexturemid;	// Default y-offset
                    texture = skytexture;			// Default texture
                    flip = 0;				// DOOM flips it
                }

                // Sky is always drawn full bright,
                //  i.e. colormaps[0] is used.
                // Because of this hack, sky is not affected
                //  by INVUL inverse mapping.
                dc_colormap = (fixedcolormap ? fixedcolormap : colormaps);

                dc_ylim = textureheight[texture];
                dc_iscale = skyiscale;
                tex_patch = R_CacheTextureCompositePatchNum (texture);
                offset = skycolumnoffset >> FRACBITS;

                for (x = pl->minx; x <= pl->maxx; x++)
                {
                    dc_yl = pl->top[x+1];
                    dc_yh = pl->bottom[x+1];

                    if (dc_yl <= dc_yh)
                    {
                        dc_x = x;
                        dc_source = R_GetTextureColumn(tex_patch, (((an + xtoviewangle[x]) ^ flip)
                                                       >> ANGLETOSKYSHIFT) + offset);
                        dc_texturefrac = R_CalcFrac ();
                        colfunc();
                    }
                }
                R_UnlockTextureCompositePatchNum (texture);
            }