Example #1
0
static int32_t osdcmd_hicsetpalettetint(const osdfuncparm_t *parm)
{
    int32_t pal, cols[3], eff;

    if (parm->numparms != 5) return OSDCMD_SHOWHELP;

    pal = Batol(parm->parms[0]);
    cols[0] = Batol(parm->parms[1]);
    cols[1] = Batol(parm->parms[2]);
    cols[2] = Batol(parm->parms[3]);
    eff = Batol(parm->parms[4]);

    hicsetpalettetint(pal,cols[0],cols[1],cols[2],eff);

    return OSDCMD_OK;
}
Example #2
0
static int osdcmd_vidmode(const osdfuncparm_t *parm)
{
	int newbpp = ScreenBPP, newwidth = ScreenWidth,
		newheight = ScreenHeight, newfs = ScreenMode;
	if (parm->numparms < 1 || parm->numparms > 4) return OSDCMD_SHOWHELP;

	switch (parm->numparms) {
		case 1:	// bpp switch
			newbpp = Batol(parm->parms[0]);
			break;
		case 2: // res switch
			newwidth = Batol(parm->parms[0]);
			newheight = Batol(parm->parms[1]);
			break;
		case 3:	// res & bpp switch
		case 4:
			newwidth = Batol(parm->parms[0]);
			newheight = Batol(parm->parms[1]);
			newbpp = Batol(parm->parms[2]);
			if (parm->numparms == 4)
				newfs = (Batol(parm->parms[3]) != 0);
			break;
	}

	if (setgamemode(newfs,newwidth,newheight,newbpp)) {
		initprintf("vidmode: Mode change failed!\n");
		if (setgamemode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP))
			gameexit("vidmode: Reset failed!\n");
	}
	ScreenBPP = newbpp; ScreenWidth = newwidth; ScreenHeight = newheight;
	ScreenMode = newfs;
	onvideomodechange(ScreenBPP>8);
	vscrn();
	return OSDCMD_OK;
}
Example #3
0
static int osdcmd_setstatusbarscale(const osdfuncparm_t *parm)
{
	if (parm->numparms == 0) {
		OSD_Printf("setstatusbarscale: scale is %d%%\n", ud.statusbarscale);
		return OSDCMD_OK;
	} else if (parm->numparms != 1) return OSDCMD_SHOWHELP;

	setstatusbarscale(Batol(parm->parms[0]));
	OSD_Printf("setstatusbarscale: new scale is %d%%\n", ud.statusbarscale);
	return OSDCMD_OK;
}
Example #4
0
static int osdcmd_spawn(const osdfuncparm_t *parm)
{
	long x=0,y=0,z=0;
	unsigned short cstat=0,picnum=0;
	unsigned char pal=0;
	short ang=0;
	short set=0, idx;

	if (numplayers > 1 || !(ps[myconnectindex].gm & MODE_GAME)) {
		OSD_Printf("spawn: Can't spawn sprites in multiplayer games or demos\n");
		return OSDCMD_OK;
	}
	
	switch (parm->numparms) {
		case 7:	// x,y,z
			x = Batol(parm->parms[4]);
			y = Batol(parm->parms[5]);
			z = Batol(parm->parms[6]);
			set |= 8;
		case 4:	// ang
			ang = Batol(parm->parms[3]) & 2047; set |= 4;
		case 3:	// cstat
			cstat = (unsigned short)Batol(parm->parms[2]); set |= 2;
		case 2:	// pal
			pal = (unsigned char)Batol(parm->parms[1]); set |= 1;
		case 1:	// tile number
			if (isdigit(parm->parms[0][0])) {
				picnum = (unsigned short)Batol(parm->parms[0]);
			} else {
				int i,j;
				for (j=0; j<2; j++) {
					for (i=0; i<labelcnt; i++) {
						if (
						    (j == 0 && !Bstrcmp(label+(i<<6),     parm->parms[0])) ||
						    (j == 1 && !Bstrcasecmp(label+(i<<6), parm->parms[0]))
						   ) {
							picnum = (unsigned short)labelcode[i];
							break;
						}
					}
					if (i<labelcnt) break;
				}
				if (i==labelcnt) {
					OSD_Printf("spawn: Invalid tile label given\n");
					return OSDCMD_OK;
				}
			}
			
			if (picnum >= MAXTILES) {
				OSD_Printf("spawn: Invalid tile number\n");
				return OSDCMD_OK;
			}
			break;
		default:
			return OSDCMD_SHOWHELP;
	}

	idx = spawn(ps[myconnectindex].i, (short)picnum);
	if (set & 1) sprite[idx].pal = (char)pal;
	if (set & 2) sprite[idx].cstat = (short)cstat;
	if (set & 4) sprite[idx].ang = ang;
	if (set & 8) {
		if (setsprite(idx, x,y,z) < 0) {
			OSD_Printf("spawn: Sprite can't be spawned into null space\n");
			deletesprite(idx);
		}
	}
	
	return OSDCMD_OK;
}