Diff for games/_shared/mouse.c between version 1.1 and 1.2
| version 1.1, 2003/05/11 18:50:18 |
version 1.2, 2003/05/21 13:55:45 |
|
|
| /* $Platon: $ */
|
/* $Platon: games/_shared/mouse.c,v 1.1.1.1 2003/05/11 18:50:18 nepto Exp $ */ |
|
|
|
| #include <dos.h>
|
#include <dos.h> |
|
|
|
| #include "mouse.h"
|
#include "mouse.h" |
|
|
|
| /* Mouse handler implementation */
|
/* Mouse handler implementation */ |
|
|
|
| BYTE initmouse(void)
|
BYTE initmouse(void) /* {{{ */ |
| {
|
{ |
| struct REGPACK rg;
|
struct REGPACK rg; |
| rg.r_ax=0x0;
|
rg.r_ax=0x0; |
| intr(0x33,&rg);
|
intr(0x33,&rg); |
| return(rg.r_ax&rg.r_bx);
|
return(rg.r_ax&rg.r_bx); |
| }
|
} /* }}} */ |
|
|
|
| void showmouse(void)
|
void showmouse(void) /* {{{ */ |
| {
|
{ |
| struct REGPACK rg;
|
struct REGPACK rg; |
| rg.r_ax=0x1;
|
rg.r_ax=0x1; |
| intr(0x33,&rg);
|
intr(0x33,&rg); |
| }
|
} /* }}} */ |
|
|
|
| void hidemouse(void)
|
void hidemouse(void) /* {{{ */ |
| {
|
{ |
| struct REGPACK rg;
|
struct REGPACK rg; |
| rg.r_ax=0x2;
|
rg.r_ax=0x2; |
| intr(0x33,&rg);
|
intr(0x33,&rg); |
| }
|
} /* }}} */ |
|
|
|
| BYTE getmousepos(WORD*x,WORD*y)
|
BYTE getmousepos(WORD*x,WORD*y) /* {{{ */ |
| {
|
{ |
| struct REGPACK rg;
|
struct REGPACK rg; |
| rg.r_ax=0x3;
|
rg.r_ax=0x3; |
| intr(0x33,&rg);
|
intr(0x33,&rg); |
| *x=rg.r_cx;
|
*x=rg.r_cx; |
| *y=rg.r_dx;
|
*y=rg.r_dx; |
| return(rg.r_bx);
|
return(rg.r_bx); |
| }
|
} /* }}} */ |
|
|
|
| void setmousepos(WORD x,WORD y)
|
void setmousepos(WORD x,WORD y) /* {{{ */ |
| {
|
{ |
| struct REGPACK rg;
|
struct REGPACK rg; |
| rg.r_cx=x;
|
rg.r_cx=x; |
| rg.r_dx=y;
|
rg.r_dx=y; |
| rg.r_ax=0x4;
|
rg.r_ax=0x4; |
| intr(0x33,&rg);
|
intr(0x33,&rg); |
| }
|
} /* }}} */ |
|
|
|
| BYTE pressbutton(BYTE but,WORD*x,WORD*y)
|
BYTE pressbutton(BYTE but,WORD*x,WORD*y) /* {{{ */ |
| {
|
{ |
| struct REGPACK rg;
|
struct REGPACK rg; |
| rg.r_bx=but;
|
rg.r_bx=but; |
| rg.r_ax=0x5;
|
rg.r_ax=0x5; |
| intr(0x33,&rg);
|
intr(0x33,&rg); |
| *x=rg.r_cx;
|
*x=rg.r_cx; |
| *y=rg.r_dx;
|
*y=rg.r_dx; |
| return(rg.r_bx);
|
return(rg.r_bx); |
| }
|
} /* }}} */ |
|
|
|
| BYTE releasebutton(BYTE but,WORD*x,WORD*y)
|
BYTE releasebutton(BYTE but,WORD*x,WORD*y) /* {{{ */ |
| {
|
{ |
| struct REGPACK rg;
|
struct REGPACK rg; |
| rg.r_bx=but;
|
rg.r_bx=but; |
| rg.r_ax=0x6;
|
rg.r_ax=0x6; |
| intr(0x33,&rg);
|
intr(0x33,&rg); |
| *x=rg.r_cx;
|
*x=rg.r_cx; |
| *y=rg.r_dx;
|
*y=rg.r_dx; |
| return(rg.r_bx);
|
return(rg.r_bx); |
| }
|
} /* }}} */ |
|
|
|
| void rangex(WORD a_min,WORD a_max)
|
void rangex(WORD a_min,WORD a_max) /* {{{ */ |
| {
|
{ |
| struct REGPACK rg;
|
struct REGPACK rg; |
| rg.r_cx=a_min;
|
rg.r_cx=a_min; |
| rg.r_dx=a_max;
|
rg.r_dx=a_max; |
| rg.r_ax=0x7;
|
rg.r_ax=0x7; |
| intr(0x33,&rg);
|
intr(0x33,&rg); |
| }
|
} /* }}} */ |
|
|
|
| void rangey(WORD a_min,WORD a_max)
|
void rangey(WORD a_min,WORD a_max) /* {{{ */ |
| {
|
{ |
| struct REGPACK rg;
|
struct REGPACK rg; |
| rg.r_cx=a_min;
|
rg.r_cx=a_min; |
| rg.r_dx=a_max;
|
rg.r_dx=a_max; |
| rg.r_ax=0x8;
|
rg.r_ax=0x8; |
| intr(0x33,&rg);
|
intr(0x33,&rg); |
| }
|
} /* }}} */ |
|
|
|
| void setmousecur(WORD x,WORD y,void *p)
|
void setmousecur(WORD x,WORD y,void *p) /* {{{ */ |
| {
|
{ |
| struct REGPACK rg;
|
struct REGPACK rg; |
| rg.r_es=FP_SEG(p);
|
rg.r_es=FP_SEG(p); |
| rg.r_dx=FP_OFF(p);
|
rg.r_dx=FP_OFF(p); |
| rg.r_cx=y;rg.r_bx=x;
|
rg.r_cx=y;rg.r_bx=x; |
| rg.r_ax=0x9;
|
rg.r_ax=0x9; |
| intr(0x33,&rg);
|
intr(0x33,&rg); |
| }
|
} /* }}} */ |
|
|
|
| void exclude(WORD x1,WORD y1,WORD x2,WORD y2)
|
void exclude(WORD x1,WORD y1,WORD x2,WORD y2) /* {{{ */ |
| {
|
{ |
| struct REGPACK rg;
|
struct REGPACK rg; |
| rg.r_cx=x1;
|
rg.r_cx=x1; |
| rg.r_dx=y1;
|
rg.r_dx=y1; |
| rg.r_si=x2;
|
rg.r_si=x2; |
| rg.r_di=y2;
|
rg.r_di=y2; |
| rg.r_ax=0x10;
|
rg.r_ax=0x10; |
| intr(0x33,&rg);
|
intr(0x33,&rg); |
| }
|
} /* }}} */ |
|
|
|
| void mousesensitive(WORD x,WORD y)
|
void mousesensitive(WORD x,WORD y) /* {{{ */ |
| {
|
{ |
| struct REGPACK rg;
|
struct REGPACK rg; |
| rg.r_cx=x;
|
rg.r_cx=x; |
| rg.r_dx=y;
|
rg.r_dx=y; |
| rg.r_ax=0xf;
|
rg.r_ax=0xf; |
| intr(0x33,&rg);
|
intr(0x33,&rg); |
| }
|
} /* }}} */ |
|
|
|
| void setmousespeed(WORD speed)
|
void setmousespeed(WORD speed) /* {{{ */ |
| {
|
{ |
| struct REGPACK rg;
|
struct REGPACK rg; |
| rg.r_dx=speed;
|
rg.r_dx=speed; |
| rg.r_ax=0x13;
|
rg.r_ax=0x13; |
| intr(0x33,&rg);
|
intr(0x33,&rg); |
| }
|
} /* }}} */ |
|
|
|
| |
/* Modeline for ViM {{{ |
| |
* vim: set ts=4: |
| |
* vim600: fdm=marker fdl=0 fdc=0: |
| |
* }}} */ |
| |
|
Platon Group <platon@platon.org> http://platon.org/
|
|