wonx/WWSprite.c
Hiroaki Sakai c0b964b4f4 Added dummy function of _asm_*().
Set FP_OFF ​(), FP_SEG() for the callback function at interrupt setting in WonderWitch
Adjust appropriately according to the setting method.  (Fit to wwterm)

UNIXTimer.c: UNIXTimer_Unpause()
((unix_timer -> pause == 1) && (unix_timer -> interrupt_in_pause == 0))
Fixed a bug that was not unix_timer-> pause--; when it was.
(It was not unposted when interrupt was not applied during pause)

Serial receive interrupt, keyboard interrupt added.  (corresponding to wwterm, operation confirmed)
Added UNIXSerialPort class.

With this, at WonderWitch,
com_intvector.callback = (void (near *) ()) FP_OFF ​​(com_handler);
com_intvector.cs = _ asm_inline ("\tmov \tax, cs");
com_intvector.ds = _ asm_inline ("\tmov \tax, ds");
sys_interrupt_set_hook (SYS_INT_RECEIVEREADY,
& com_intvector, & com_last_intvector);
Interrupt setting like that shown in Fig.

For warning, add WonX_Warning ().
Move WonX_Error () to WonX.c.

comm_send_string (), text_put_string (), text_put_substring () When executed
Fix output message.

Implement cursor display function.  (Add WWCursor class) (Do not blink. Display only)
When displaying the cursor, text information inside WWDisplay_DrawLCDPanel ()
Since we need to be able to read it, we will discontinue the WonXText class and add the WWText class
I moved to a member of the WWDisplay class.

In palette_get_color (), transparent color is displayed when executing WWPalette_GetMappedColors ()
Since it was not considered to be returned as -1, palette_get_color ()
Fixed a bug where return value was wrong value.

Character color palette, LCD color palette initial value, with WonderWitch
It was made to coincide with the initial value.

As a sample, add wwterm - b 05.  (Add wwterm target to Makefile)

Version 1.1 - from wonx-1.1.tar.gz
2018-03-07 23:07:04 +00:00

127 lines
4.4 KiB
C

/*****************************************************************************/
/* ここから */
/*****************************************************************************/
#include "WWSpriteP.h"
#include "WonX.h"
#include "etc.h"
/*****************************************************************************/
/* メンバ関数の定義 */
/*****************************************************************************/
int WWSprite_GetNumber( WWSprite s) { return (s->number); }
int WWSprite_GetHorizontal(WWSprite s) { return (s->horizontal); }
int WWSprite_GetVertical( WWSprite s) { return (s->vertical); }
int WWSprite_GetPriority( WWSprite s) { return (s->priority); }
int WWSprite_GetClipping( WWSprite s) { return (s->clipping); }
WWPalette WWSprite_GetPalette( WWSprite s) { return (s->palette); }
WWCharacter WWSprite_GetCharacter( WWSprite s) { return (s->character); }
int WWSprite_SetNumber( WWSprite s, int n) { return (s->number = n); }
int WWSprite_SetHorizontal(WWSprite s, int f) { return (s->horizontal = f); }
int WWSprite_SetVertical( WWSprite s, int f) { return (s->vertical = f); }
int WWSprite_SetPriority( WWSprite s, int f) { return (s->priority = f); }
int WWSprite_SetClipping( WWSprite s, int f) { return (s->clipping = f); }
WWPalette WWSprite_SetPalette(WWSprite s, WWPalette p)
{ return (s->palette = p); }
WWCharacter WWSprite_SetCharacter(WWSprite s, WWCharacter c)
{ return (s->character = c); }
int WWSprite_GetX(WWSprite sprite) { return (sprite->x); }
int WWSprite_GetY(WWSprite sprite) { return (sprite->y); }
int WWSprite_SetPosition(WWSprite sprite, int x, int y)
{
sprite->x = x;
sprite->y = y;
return (0);
}
/* スプライトのピクセル値を返す.(透明色は-1を返す) */
int WWSprite_GetPixel(WWSprite sprite, int x, int y)
{
WWPalette p;
WWCharacter c;
int pixel;
p = WWSprite_GetPalette(sprite);
c = WWSprite_GetCharacter(sprite);
if (WWSprite_GetHorizontal(sprite)) x = 7 - x;
if (WWSprite_GetVertical( sprite)) y = 7 - y;
pixel = WWCharacter_GetPixel(c, x, y);
pixel = WWPalette_GetMappedColor(p, pixel); /* 透明色は -1 を返す */
return (pixel);
}
WWSprite WWSprite_Create(int number, int x, int y,
int horizontal, int vertical,
int priority, int clipping,
WWPalette palette, WWCharacter character)
{
WWSprite sprite;
sprite = (WWSprite)malloc(sizeof(_WWSprite));
if (sprite == NULL)
WonX_Error("WWSprite_Create", "Cannot allocate memory.");
WWSprite_SetNumber(sprite, number);
WWSprite_SetHorizontal(sprite, horizontal);
WWSprite_SetVertical(sprite, vertical);
WWSprite_SetPriority(sprite, priority);
WWSprite_SetClipping(sprite, clipping);
WWSprite_SetPalette(sprite, palette);
WWSprite_SetCharacter(sprite, character);
WWSprite_SetPosition(sprite, x, y);
return (sprite);
}
WWSprite WWSprite_Destroy(WWSprite sprite)
{
if (sprite == NULL) return (NULL);
free(sprite);
return (NULL);
}
int WWSprite_PrintData(WWSprite s, FILE * f)
{
int n;
n = WWSprite_GetNumber(s);
fprintf(f, "\n");
fprintf(f, "sprite[%d] :\tnumber = %d\n", n, WWSprite_GetNumber(s));
fprintf(f, "sprite[%d] :\thorizontal = %s\n",
n, wonx_true_false(WWSprite_GetHorizontal(s)));
fprintf(f, "sprite[%d] :\tvertical = %s\n",
n, wonx_true_false(WWSprite_GetVertical( s)));
fprintf(f, "sprite[%d] :\tpriority = %s\n",
n, wonx_true_false(WWSprite_GetPriority( s)));
fprintf(f, "sprite[%d] :\tclipping = %s\n",
n, wonx_true_false(WWSprite_GetClipping( s)));
fprintf(f, "sprite[%d] :\tpalette number = %d\n",
n, WWPalette_GetNumber(WWSprite_GetPalette(s)));
fprintf(f, "sprite[%d] :\tcharacter number = %d\n",
n, WWCharacter_GetNumber(WWSprite_GetCharacter(s)));
fprintf(f, "sprite[%d] :\tx = %d\n", n, WWSprite_GetX(s));
fprintf(f, "sprite[%d] :\ty = %d\n", n, WWSprite_GetY(s));
fflush(f);
return (0);
}
/*****************************************************************************/
/* ここまで */
/*****************************************************************************/
/*****************************************************************************/
/* End of File. */
/*****************************************************************************/