ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/Client.xs
(Generate patch)

Comparing deliantra/Deliantra-Client/Client.xs (file contents):
Revision 1.275 by root, Thu Aug 28 00:53:53 2008 UTC vs.
Revision 1.279 by root, Thu Oct 2 15:59:40 2008 UTC

90 90
91#define MIN_FONT_HEIGHT 10 91#define MIN_FONT_HEIGHT 10
92 92
93/* mask out modifiers we are not interested in */ 93/* mask out modifiers we are not interested in */
94#define MOD_MASK (KMOD_CTRL | KMOD_SHIFT | KMOD_ALT | KMOD_META) 94#define MOD_MASK (KMOD_CTRL | KMOD_SHIFT | KMOD_ALT | KMOD_META)
95
96#define KMOD_LRAM 0x10000 // our extension
95 97
96static AV *texture_av; 98static AV *texture_av;
97 99
98static struct 100static struct
99{ 101{
525 svp = hv_fetch (self, "can_events", sizeof ("can_events") - 1, 0); 527 svp = hv_fetch (self, "can_events", sizeof ("can_events") - 1, 0);
526 if (!svp || !SvTRUE (*svp)) 528 if (!svp || !SvTRUE (*svp))
527 return 0; 529 return 0;
528 530
529 return 1; 531 return 1;
532}
533
534/******************************************************************************/
535
536/* process keyboard modifiers */
537static int
538mod_munge (int mod)
539{
540 mod &= MOD_MASK;
541
542 if (mod & (KMOD_META | KMOD_ALT))
543 mod |= KMOD_LRAM;
544
545 return mod;
530} 546}
531 547
532static void 548static void
533deliantra_main () 549deliantra_main ()
534{ 550{
737 const_iv (KMOD_RMETA), 753 const_iv (KMOD_RMETA),
738 const_iv (KMOD_NUM), 754 const_iv (KMOD_NUM),
739 const_iv (KMOD_CAPS), 755 const_iv (KMOD_CAPS),
740 const_iv (KMOD_MODE), 756 const_iv (KMOD_MODE),
741 757
758 const_iv (KMOD_LRAM),
759
742 const_iv (MIX_DEFAULT_FORMAT), 760 const_iv (MIX_DEFAULT_FORMAT),
743 761
744 const_iv (SDL_INIT_TIMER), 762 const_iv (SDL_INIT_TIMER),
745 const_iv (SDL_INIT_AUDIO), 763 const_iv (SDL_INIT_AUDIO),
746 const_iv (SDL_INIT_VIDEO), 764 const_iv (SDL_INIT_VIDEO),
933 { 951 {
934 case SDL_KEYDOWN: 952 case SDL_KEYDOWN:
935 case SDL_KEYUP: 953 case SDL_KEYUP:
936 hv_store (hv, "state", 5, newSViv (ev.key.state), 0); 954 hv_store (hv, "state", 5, newSViv (ev.key.state), 0);
937 hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0); 955 hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0);
938 hv_store (hv, "mod", 3, newSViv (ev.key.keysym.mod & MOD_MASK), 0); 956 hv_store (hv, "mod", 3, newSViv (mod_munge (ev.key.keysym.mod)), 0);
939 hv_store (hv, "cmod", 4, newSViv (SDL_GetModState () & MOD_MASK), 0); /* current mode */ 957 hv_store (hv, "cmod", 4, newSViv (mod_munge (SDL_GetModState ())), 0); /* current mode */
940 hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0); 958 hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0);
941 break; 959 break;
942 960
943 case SDL_ACTIVEEVENT: 961 case SDL_ACTIVEEVENT:
944 hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0); 962 hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0);
962 x = ev.motion.x; 980 x = ev.motion.x;
963 y = ev.motion.y; 981 y = ev.motion.y;
964 SDL_PeepEvents (&ev, 1, SDL_GETEVENT, SDL_EVENTMASK (SDL_MOUSEMOTION)); 982 SDL_PeepEvents (&ev, 1, SDL_GETEVENT, SDL_EVENTMASK (SDL_MOUSEMOTION));
965 } 983 }
966 984
967 hv_store (hv, "mod", 3, newSViv (SDL_GetModState () & MOD_MASK), 0); 985 hv_store (hv, "mod", 3, newSViv (mod_munge (SDL_GetModState ())), 0);
968 hv_store (hv, "state", 5, newSViv (state), 0); 986 hv_store (hv, "state", 5, newSViv (state), 0);
969 hv_store (hv, "x", 1, newSViv (x), 0); 987 hv_store (hv, "x", 1, newSViv (x), 0);
970 hv_store (hv, "y", 1, newSViv (y), 0); 988 hv_store (hv, "y", 1, newSViv (y), 0);
971 hv_store (hv, "xrel", 4, newSViv (xrel), 0); 989 hv_store (hv, "xrel", 4, newSViv (xrel), 0);
972 hv_store (hv, "yrel", 4, newSViv (yrel), 0); 990 hv_store (hv, "yrel", 4, newSViv (yrel), 0);
2233 { 2251 {
2234 mapcell *cell = row->col + (x + mx - row->c0); 2252 mapcell *cell = row->col + (x + mx - row->c0);
2235 2253
2236 int px = x * T; 2254 int px = x * T;
2237 int py = y * T; 2255 int py = y * T;
2256
2257 if (expect_false (cell->player == player))
2258 {
2259 px += sdx;
2260 py += sdy;
2261 }
2238 2262
2239 if (cell->stat_hp) 2263 if (cell->stat_hp)
2240 { 2264 {
2241 int width = cell->stat_width * T; 2265 int width = cell->stat_width * T;
2242 int thick = (sh * T / 32 + 27) / 28 + 1 + cell->stat_width; 2266 int thick = (sh * T / 32 + 27) / 28 + 1 + cell->stat_width;
2983void glRotate (float angle, float x, float y, float z) 3007void glRotate (float angle, float x, float y, float z)
2984 CODE: 3008 CODE:
2985 glRotatef (angle, x, y, z); 3009 glRotatef (angle, x, y, z);
2986 3010
2987void glColor (float r, float g, float b, float a = 1.0) 3011void glColor (float r, float g, float b, float a = 1.0)
3012 PROTOTYPE: @
2988 ALIAS: 3013 ALIAS:
2989 glColor_premultiply = 1 3014 glColor_premultiply = 1
2990 CODE: 3015 CODE:
2991 if (ix) 3016 if (ix)
2992 { 3017 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines