mouse cursor managed by compositor, earthquake spell supported

This commit is contained in:
Ondřej Novák 2025-02-16 18:01:08 +01:00
parent 8fb866f2f5
commit 04ab5898ef
10 changed files with 179 additions and 71 deletions

View file

@ -51,6 +51,8 @@ void char2_32(word *posit,const word *font,char znak);
word charsize(const word *font,char znak);
//#pragma aux charsize parm [esi] [eax]
void put_picture(word x,word y,const void *p);
void put_picture_ex(word x,word y,const void *p, word *target_addr, size_t pitch);
//#pragma aux put_picture parm [esi] [eax] [edi] modify [ebx ecx edx]
void get_picture(word x,word y,word xs,word ys,void *p);
//#pragma aux get_picture parm [esi] [eax] [ebx] [ecx] [edi] modify [edx]
@ -113,6 +115,7 @@ void line32(word x1,word y1, word x2, word y2);
void position(word x,word y);
void show_ms_cursor(integer x,integer y);
void *register_ms_cursor(const void *cursor);
const void *get_registered_ms_cursor();
void move_ms_cursor(integer newx,integer newy,char nodraw);
void hide_ms_cursor(void);
void redraw_ms_cursor_on_screen(void);

View file

@ -508,6 +508,10 @@ void showview_lo(word x,word y,word xs,word ys)
*/
const void *get_registered_ms_cursor() {
return mscursor;
}
void show_ms_cursor(integer x,integer y)
{
integer xs,ys;

View file

@ -315,11 +315,12 @@ chsend: and eax,0ffffh
}*/
}
void put_picture(word x,word y,const void *p)
void put_picture_ex(word x,word y,const void *p, word *target_addr, size_t pitch)
//#pragma aux put_picture parm [esi] [eax] [edi] modify [ebx ecx edx]
{
int32_t scr_linelen2 = GetScreenPitch();
word *adr=GetScreenAdr()+scr_linelen2*y+x;
int32_t scr_linelen2 = pitch;
word *adr=target_addr+scr_linelen2*y+x;
const word *data=p;
word xs=data[0];
word ys=data[1];
@ -391,6 +392,10 @@ void put_picture(word x,word y,const void *p)
}
}
}
void put_picture(word x,word y,const void *p) {
put_picture_ex(x, y, p, GetScreenAdr(), GetScreenPitch());
}
void get_picture(word x,word y,word xs,word ys,void *p)
{
int32_t scr_linelen2 = GetScreenPitch();

View file

@ -20,14 +20,20 @@ void ukaz_mysku()
visible--;
if (!visible)
{
#ifdef FORCE_SOFTWARE_CURSOR
show_ms_cursor(ms_last_event.x-h_x,ms_last_event.y-h_y);
#else
game_display_show_mouse((const word *)get_registered_ms_cursor(),h_x, h_y);
#endif
}
}
void schovej_mysku()
{
#ifdef FORCE_SOFTWARE_CURSOR
if (!visible)
hide_ms_cursor();
#endif
visible++;
}
@ -57,6 +63,7 @@ void ms_idle_event(EVENT_MSG *info,void *user_data)
void ms_draw_event(EVENT_MSG *info,void *user_data)
{
#ifdef FORCE_SOFTWARE_CURSOR
MS_EVENT *ms_ev;
user_data;
@ -66,11 +73,13 @@ void ms_draw_event(EVENT_MSG *info,void *user_data)
if (ms_ev->event_type & 1)
if (!visible) move_ms_cursor(ms_ev->x-h_x,ms_ev->y-h_y,0);
}
#endif
}
void update_mysky(void)
{
#ifdef FORCE_SOFTWARE_CURSOR
MS_EVENT x;
get_ms_event(&x);
@ -80,6 +89,7 @@ void update_mysky(void)
x.event = 0;
}
if(!visible) move_ms_cursor(x.x-h_x,x.y-h_y,0);
#endif
}
char je_myska_zobrazena()
@ -94,12 +104,6 @@ void set_ms_finger(int x,int y)
h_y=y;
}
void *mouse()
{
send_message(E_ADD,E_WATCH,ms_idle_event);
send_message(E_ADD,E_MOUSE,ms_draw_event);
return NULL;
}
short init_mysky()
{
@ -107,7 +111,10 @@ short init_mysky()
// i=install_mouse_handler();
// hranice_mysky(0,0,639,479);
visible=1;
send_message(E_INIT,mouse);
send_message(E_ADD,E_WATCH,ms_idle_event);
#ifdef FORCE_SOFTWARE_CURSOR
send_message(E_ADD,E_MOUSE,ms_draw_event);
#endif
return 0;
}
@ -116,7 +123,9 @@ short done_mysky()
// i=deinstall_mouse_handler();
send_message(E_DONE,E_WATCH,ms_idle_event);
#ifdef FORCE_SOFTWARE_CURSOR
send_message(E_DONE,E_MOUSE,ms_draw_event);
#endif
return 0;
}