Made Caret.cpp ASM-accurate
This commit is contained in:
parent
0eaca9966c
commit
75e062c775
2 changed files with 147 additions and 43 deletions
|
@ -187,6 +187,90 @@ addr = 0x408FC0
|
||||||
name = "IsActiveSomeBullet"
|
name = "IsActiveSomeBullet"
|
||||||
addr = 0x4095C0
|
addr = 0x4095C0
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "InitCaret"
|
||||||
|
addr = 0x409650
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ActCaret00"
|
||||||
|
addr = 0x409670
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ActCaret01"
|
||||||
|
addr = 0x409680
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ActCaret02"
|
||||||
|
addr = 0x409880
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ActCaret03"
|
||||||
|
addr = 0x409B80
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ActCaret04"
|
||||||
|
addr = 0x409C70
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ActCaret05"
|
||||||
|
addr = 0x409E00
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ActCaret07"
|
||||||
|
addr = 0x409F60
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ActCaret08"
|
||||||
|
addr = 0x40A120
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ActCaret09"
|
||||||
|
addr = 0x40A1B0
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ActCaret10"
|
||||||
|
addr = 0x40A280
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ActCaret11"
|
||||||
|
addr = 0x40A3F0
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ActCaret12"
|
||||||
|
addr = 0x40A5A0
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ActCaret13"
|
||||||
|
addr = 0x40A650
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ActCaret14"
|
||||||
|
addr = 0x40A7E0
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ActCaret15"
|
||||||
|
addr = 0x40A8F0
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ActCaret16"
|
||||||
|
addr = 0x40A9E0
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ActCaret17"
|
||||||
|
addr = 0x40AAA0
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "ActCaret"
|
||||||
|
addr = 0x40AB50
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "PutCaret"
|
||||||
|
addr = 0x40ABC0
|
||||||
|
|
||||||
|
[[func]]
|
||||||
|
name = "SetCaret"
|
||||||
|
addr = 0x40AC90
|
||||||
|
|
||||||
[[func]]
|
[[func]]
|
||||||
name = "Call_Escape"
|
name = "Call_Escape"
|
||||||
addr = 0x40DD70
|
addr = 0x40DD70
|
||||||
|
|
|
@ -34,7 +34,7 @@ void ActCaret01(CARET *crt)
|
||||||
{64, 24, 72, 32},
|
{64, 24, 72, 32},
|
||||||
{72, 24, 80, 32},
|
{72, 24, 80, 32},
|
||||||
{80, 24, 88, 32},
|
{80, 24, 88, 32},
|
||||||
{88, 24, 92, 32},
|
{88, 24, 96, 32},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!crt->act_no)
|
if (!crt->act_no)
|
||||||
|
@ -55,10 +55,10 @@ void ActCaret01(CARET *crt)
|
||||||
crt->cond = 0;
|
crt->cond = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crt->direct)
|
if (crt->direct == 0)
|
||||||
crt->rect = rcRight[crt->ani_no];
|
|
||||||
else
|
|
||||||
crt->rect = rcLeft[crt->ani_no];
|
crt->rect = rcLeft[crt->ani_no];
|
||||||
|
else
|
||||||
|
crt->rect = rcRight[crt->ani_no];
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActCaret02(CARET *crt)
|
void ActCaret02(CARET *crt)
|
||||||
|
@ -88,20 +88,17 @@ void ActCaret02(CARET *crt)
|
||||||
case 0:
|
case 0:
|
||||||
crt->ym -= 0x10;
|
crt->ym -= 0x10;
|
||||||
crt->y += crt->ym;
|
crt->y += crt->ym;
|
||||||
|
|
||||||
if (++crt->ani_wait > 5)
|
if (++crt->ani_wait > 5)
|
||||||
{
|
{
|
||||||
crt->ani_wait = 0;
|
crt->ani_wait = 0;
|
||||||
++crt->ani_no;
|
++crt->ani_no;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crt->ani_no > 3)
|
if (crt->ani_no > 3)
|
||||||
crt->cond = 0;
|
crt->cond = 0;
|
||||||
crt->rect = rect_left[crt->ani_no];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
crt->rect = rect_left[crt->ani_no];
|
||||||
crt->rect = rect_up[++crt->ani_wait / 2 % 3];
|
|
||||||
if (crt->ani_wait > 24)
|
|
||||||
crt->cond = 0;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -110,10 +107,20 @@ void ActCaret02(CARET *crt)
|
||||||
crt->ani_wait = 0;
|
crt->ani_wait = 0;
|
||||||
++crt->ani_no;
|
++crt->ani_no;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crt->ani_no > 3)
|
if (crt->ani_no > 3)
|
||||||
crt->cond = 0;
|
crt->cond = 0;
|
||||||
|
|
||||||
crt->rect = rect_right[crt->ani_no];
|
crt->rect = rect_right[crt->ani_no];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
crt->rect = rect_up[++crt->ani_wait / 2 % 3];
|
||||||
|
|
||||||
|
if (crt->ani_wait > 24)
|
||||||
|
crt->cond = 0;
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +165,7 @@ void ActCaret04(CARET *crt)
|
||||||
crt->cond = 0;
|
crt->cond = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
crt->rect = rect[crt->ani_no + 3 * crt->direct];
|
crt->rect = rect[3 * crt->direct + crt->ani_no];
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActCaret05(CARET *crt)
|
void ActCaret05(CARET *crt)
|
||||||
|
@ -243,8 +250,9 @@ void ActCaret09(CARET *crt)
|
||||||
RECT rcLeft = {0, 80, 16, 96};
|
RECT rcLeft = {0, 80, 16, 96};
|
||||||
RECT rcRight = {48, 64, 64, 80};
|
RECT rcRight = {48, 64, 64, 80};
|
||||||
|
|
||||||
if (++crt->ani_wait <= 4)
|
if (++crt->ani_wait < 5)
|
||||||
crt->y -= 0x800;
|
crt->y -= 0x800;
|
||||||
|
|
||||||
if (crt->ani_wait == 32)
|
if (crt->ani_wait == 32)
|
||||||
crt->cond = 0;
|
crt->cond = 0;
|
||||||
|
|
||||||
|
@ -268,33 +276,37 @@ void ActCaret10(CARET *crt)
|
||||||
|
|
||||||
++crt->ani_wait;
|
++crt->ani_wait;
|
||||||
|
|
||||||
if (crt->direct)
|
if (crt->direct == 0)
|
||||||
{
|
{
|
||||||
if (crt->ani_wait < 20)
|
if (crt->ani_wait < 20)
|
||||||
crt->y -= 0x200;
|
crt->y -= 0x400;
|
||||||
|
|
||||||
if (crt->ani_wait == 80)
|
if (crt->ani_wait == 80)
|
||||||
crt->cond = 0;
|
crt->cond = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (crt->ani_wait < 20)
|
if (crt->ani_wait < 20)
|
||||||
crt->y -= 0x400;
|
crt->y -= 0x200;
|
||||||
|
|
||||||
if (crt->ani_wait == 80)
|
if (crt->ani_wait == 80)
|
||||||
crt->cond = 0;
|
crt->cond = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crt->direct)
|
if (crt->direct == 0)
|
||||||
crt->rect = rcRight[crt->ani_wait / 2 % 2];
|
|
||||||
else
|
|
||||||
crt->rect = rcLeft[crt->ani_wait / 2 % 2];
|
crt->rect = rcLeft[crt->ani_wait / 2 % 2];
|
||||||
|
else
|
||||||
|
crt->rect = rcRight[crt->ani_wait / 2 % 2];
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActCaret11(CARET *crt)
|
void ActCaret11(CARET *crt)
|
||||||
{
|
{
|
||||||
|
unsigned char deg;
|
||||||
|
|
||||||
if (!crt->act_no)
|
if (!crt->act_no)
|
||||||
{
|
{
|
||||||
crt->act_no = 1;
|
crt->act_no = 1;
|
||||||
uint8_t deg = Random(0, 0xFF);
|
deg = Random(0, 0xFF);
|
||||||
crt->xm = 2 * GetCos(deg);
|
crt->xm = 2 * GetCos(deg);
|
||||||
crt->ym = 2 * GetSin(deg);
|
crt->ym = 2 * GetSin(deg);
|
||||||
}
|
}
|
||||||
|
@ -346,7 +358,7 @@ void ActCaret13(CARET *crt)
|
||||||
{0, 0, 0, 0},
|
{0, 0, 0, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!crt->act_no)
|
if (crt->act_no == 0)
|
||||||
{
|
{
|
||||||
crt->act_no = 1;
|
crt->act_no = 1;
|
||||||
|
|
||||||
|
@ -363,10 +375,12 @@ void ActCaret13(CARET *crt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!crt->direct)
|
switch (crt->direct)
|
||||||
{
|
{
|
||||||
|
case 0:
|
||||||
crt->xm = 4 * crt->xm / 5;
|
crt->xm = 4 * crt->xm / 5;
|
||||||
crt->ym = 4 * crt->ym / 5;
|
crt->ym = 4 * crt->ym / 5;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
crt->x += crt->xm;
|
crt->x += crt->xm;
|
||||||
|
@ -502,10 +516,16 @@ CARETFUNCTION gpCaretFuncTbl[] =
|
||||||
|
|
||||||
void ActCaret()
|
void ActCaret()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < CARET_MAX; i++)
|
int i;
|
||||||
|
int code;
|
||||||
|
|
||||||
|
for (i = 0; i < CARET_MAX; i++)
|
||||||
{
|
{
|
||||||
if (gCrt[i].cond & 0x80)
|
if (gCrt[i].cond & 0x80)
|
||||||
gpCaretFuncTbl[gCrt[i].code](&gCrt[i]);
|
{
|
||||||
|
code = gCrt[i].code;
|
||||||
|
gpCaretFuncTbl[code](&gCrt[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,9 +548,12 @@ void PutCaret(int fx, int fy)
|
||||||
void SetCaret(int x, int y, int code, int dir)
|
void SetCaret(int x, int y, int code, int dir)
|
||||||
{
|
{
|
||||||
for (int c = 0; c < CARET_MAX; c++)
|
for (int c = 0; c < CARET_MAX; c++)
|
||||||
{
|
if (gCrt[c].cond == 0)
|
||||||
if (!gCrt[c].cond)
|
break;
|
||||||
{
|
|
||||||
|
if (c == CARET_MAX)
|
||||||
|
return;
|
||||||
|
|
||||||
memset(&gCrt[c], 0, sizeof(CARET));
|
memset(&gCrt[c], 0, sizeof(CARET));
|
||||||
gCrt[c].cond = 0x80;
|
gCrt[c].cond = 0x80;
|
||||||
gCrt[c].code = code;
|
gCrt[c].code = code;
|
||||||
|
@ -539,7 +562,4 @@ void SetCaret(int x, int y, int code, int dir)
|
||||||
gCrt[c].view_left = gCaretTable[code].view_left;
|
gCrt[c].view_left = gCaretTable[code].view_left;
|
||||||
gCrt[c].view_top = gCaretTable[code].view_top;
|
gCrt[c].view_top = gCaretTable[code].view_top;
|
||||||
gCrt[c].direct = dir;
|
gCrt[c].direct = dir;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue