mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-05 06:00:33 -04:00
89 lines
3.2 KiB
C
89 lines
3.2 KiB
C
#include <platform.h>
|
|
#include "types.h"
|
|
#include <stdio.h>
|
|
#include <bios.h>
|
|
#include "event.h"
|
|
#include "devices.h"
|
|
#include <time.h>
|
|
|
|
/* Data touched at mouse callback time -- they are in a structure to
|
|
simplify calculating the size of the region to lock.
|
|
*/
|
|
|
|
extern MS_EVENT win_mouseEvent;
|
|
|
|
|
|
TMS_BASIC_INFO ms_basic_info={0};
|
|
static char ms_keys;
|
|
|
|
/*
|
|
void get_ms_event(MS_EVENT *event)
|
|
{
|
|
CheckMessageQueue();
|
|
*event=win_mouseEvent;
|
|
win_mouseEvent.event=0;
|
|
}
|
|
*/
|
|
char cz_table_1[] = { 0x20, 0x31, 0x21, 0x33, 0x34, 0x35, 0x37, 0xad, 0x39,
|
|
0x30, 0x38, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x82, 0x2b, 0x88, 0xa8, 0x87,
|
|
0xa9, 0x91, 0x98, 0xa0, 0xa1, 0x5c, 0x22, 0x96, 0x3f, 0x3d, 0x3a, 0x5f,
|
|
0x32, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b,
|
|
0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
|
|
0x58, 0x59, 0x5a, 0xa3, 0x5c, 0x5c, 0x29, 0x36, 0x3d, 0x3b, 0x61, 0x62,
|
|
0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e,
|
|
0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a,
|
|
0x2f, 0x7c, 0x28, 0x3b, 0x20 };
|
|
char cz_table_2[] = { 0x20, 0x21, 0x5c, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
|
|
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33,
|
|
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
|
0x40, 0x8f, 0x42, 0x43, 0x44, 0x90, 0x46, 0x47, 0x48, 0x8b, 0x4a, 0x4b,
|
|
0x8a, 0x4d, 0x4e, 0x95, 0x50, 0x51, 0xab, 0x53, 0x54, 0x97, 0x56, 0x57,
|
|
0x58, 0x9d, 0x5a, 0x5b, 0x5c, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0xa0, 0x62,
|
|
0x63, 0x64, 0x82, 0x66, 0x67, 0x68, 0xa1, 0x6a, 0x6b, 0x8d, 0x6d, 0x6e,
|
|
0xa2, 0x70, 0x71, 0xaa, 0x73, 0x74, 0xa3, 0x76, 0x77, 0x78, 0x98, 0x7a,
|
|
0x7b, 0x7c, 0x7d, 0x7e, 0x20 };
|
|
char cz_table_3[] = { 0x20, 0x21, 0x5c, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
|
|
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33,
|
|
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
|
0x40, 0x41, 0x42, 0x80, 0x85, 0x89, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b,
|
|
0x9c, 0x4d, 0xa5, 0xa7, 0x50, 0x51, 0x9e, 0x9b, 0x86, 0xa6, 0x56, 0x57,
|
|
0x58, 0x59, 0x92, 0x5b, 0x5c, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62,
|
|
0x87, 0x83, 0x88, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x8c, 0x6d, 0xa4,
|
|
0x93, 0x70, 0x71, 0xa9, 0xa8, 0x9f, 0x96, 0x76, 0x77, 0x78, 0x79, 0x91,
|
|
0x7b, 0x7c, 0x7d, 0x7e, 0x20 };
|
|
char *cz_key_tabs[]={cz_table_1,cz_table_2,cz_table_3};
|
|
|
|
void keyboard(EVENT_MSG *msg,void *user_data)
|
|
{
|
|
int i;
|
|
static char cz_mode=0;
|
|
char c,d;
|
|
|
|
msg;user_data;
|
|
if (msg->msg==E_WATCH)
|
|
{
|
|
*otevri_zavoru=1;
|
|
if (!_bios_keybrd(_KEYBRD_READY)) return;
|
|
i=_bios_keybrd(_KEYBRD_READ);
|
|
d=i>>8;
|
|
c=i & 0xff;
|
|
if (c=='+' && d<55 && !cz_mode) cz_mode=2;
|
|
else if (c=='=' && d<55 && !cz_mode) cz_mode=1;
|
|
else if (c>32 && c<127 && d<=53)
|
|
{
|
|
c=cz_key_tabs[cz_mode][c-32];
|
|
i=d;
|
|
i=(i<<8)+c;
|
|
send_message(E_KEYBOARD,i);
|
|
cz_mode=0;
|
|
}
|
|
else
|
|
send_message(E_KEYBOARD,i);
|
|
|
|
}
|
|
}
|
|
|
|
char ms_get_keycount()
|
|
{
|
|
return ms_keys;
|
|
}
|