2023-03-22 20:44:56 +00:00
|
|
|
#pragma option -zPmain_01
|
|
|
|
|
2023-03-21 19:46:10 +00:00
|
|
|
#include "platform.h"
|
|
|
|
#include "pc98.h"
|
2023-03-22 20:44:56 +00:00
|
|
|
#include "th01/rank.h"
|
|
|
|
#include "th02/v_colors.hpp"
|
|
|
|
#include "th02/core/globals.hpp"
|
2023-03-22 21:24:53 +00:00
|
|
|
#include "th02/hardware/pages.hpp"
|
2023-03-21 19:46:10 +00:00
|
|
|
#include "th02/main/entity.hpp"
|
2023-03-22 21:24:53 +00:00
|
|
|
#include "th02/main/playfld.hpp"
|
2023-03-22 20:44:56 +00:00
|
|
|
#include "th02/main/pointnum/pointnum.hpp"
|
2023-03-22 21:24:53 +00:00
|
|
|
#include "th02/main/tile/tile.hpp"
|
2023-03-21 19:46:10 +00:00
|
|
|
#include "th02/sprites/pointnum.h"
|
|
|
|
|
2023-03-22 20:44:56 +00:00
|
|
|
#pragma option -a2
|
|
|
|
|
2023-03-21 19:46:10 +00:00
|
|
|
static const int POINTNUM_COUNT = 20;
|
|
|
|
|
|
|
|
struct CPointnums {
|
|
|
|
uint8_t col;
|
|
|
|
int8_t unused;
|
|
|
|
screen_x_t left[POINTNUM_COUNT];
|
|
|
|
screen_y_t top[POINTNUM_COUNT][2];
|
|
|
|
uint16_t points[POINTNUM_COUNT];
|
|
|
|
entity_flag_t flag[POINTNUM_COUNT];
|
|
|
|
uint8_t age[POINTNUM_COUNT];
|
|
|
|
pointnum_cel_t op; // `operator` is a keyword.
|
|
|
|
pointnum_cel_t operand;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern CPointnums pointnums;
|
2023-03-22 20:44:56 +00:00
|
|
|
|
|
|
|
void near pointnums_init_for_rank_and_reset(void)
|
|
|
|
{
|
|
|
|
for(int i = 0; i < POINTNUM_COUNT; i++) {
|
|
|
|
pointnums.flag[i] = F_FREE;
|
|
|
|
}
|
|
|
|
pointnums.col = V_WHITE;
|
|
|
|
|
|
|
|
switch(rank) {
|
|
|
|
case RANK_EASY:
|
|
|
|
case RANK_NORMAL:
|
|
|
|
pointnums.op = POINTNUM_EMPTY;
|
|
|
|
pointnums.operand = POINTNUM_EMPTY;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RANK_HARD:
|
|
|
|
pointnums.op = POINTNUM_MUL;
|
|
|
|
pointnums.operand = POINTNUM_2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RANK_LUNATIC:
|
|
|
|
pointnums.op = POINTNUM_MUL;
|
|
|
|
pointnums.operand = POINTNUM_4;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RANK_EXTRA:
|
|
|
|
pointnums.op = POINTNUM_MUL;
|
|
|
|
pointnums.operand = POINTNUM_8;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2023-03-22 21:15:42 +00:00
|
|
|
|
|
|
|
void pascal near pointnums_add(
|
|
|
|
screen_x_t left_, screen_y_t top_, uint16_t points_
|
|
|
|
)
|
|
|
|
{
|
|
|
|
register screen_x_t left = left_;
|
|
|
|
register screen_y_t top = top_;
|
|
|
|
register uint16_t points = points_;
|
|
|
|
for(register int i = 0; i < POINTNUM_COUNT; i++) {
|
|
|
|
if(pointnums.flag[i] == F_FREE) {
|
|
|
|
pointnums.flag[i] = F_ALIVE;
|
|
|
|
pointnums.age[i] = 0;
|
|
|
|
pointnums.points[i] = points;
|
|
|
|
pointnums.left[i] = left;
|
|
|
|
pointnums.top[i][0] = top;
|
|
|
|
pointnums.top[i][1] = top;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-03-22 21:24:53 +00:00
|
|
|
|
|
|
|
void near pointnums_invalidate(void)
|
|
|
|
{
|
|
|
|
for(int i = 0; i < POINTNUM_COUNT; i++) {
|
|
|
|
if(pointnums.flag[i] == F_FREE) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
tiles_invalidate_rect(
|
|
|
|
pointnums.left[i],
|
|
|
|
pointnums.top[i][page_back],
|
|
|
|
|
|
|
|
// Adding the trailing 0, operator, and operand.
|
|
|
|
// ZUN bloat: And one unnecessary glyph?
|
|
|
|
(POINTNUM_W * (POINTNUM_DIGITS + 3 + 1)),
|
|
|
|
|
|
|
|
POINTNUM_H
|
|
|
|
);
|
|
|
|
|
|
|
|
if(pointnums.flag[i] == F_REMOVE) {
|
|
|
|
pointnums.flag[i] = F_FREE;
|
|
|
|
} else {
|
|
|
|
pointnums.top[i][page_back] = pointnums.top[i][page_front];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|