Notifications (#3002)

This commit is contained in:
Totoo
2026-02-19 14:33:01 +01:00
committed by GitHub
parent 77f747aab2
commit 6498f5a1b2
27 changed files with 424 additions and 70 deletions
+13 -13
View File
@@ -204,11 +204,11 @@ void spawn_entity(uint8_t type, uint8_t x, uint8_t y) {
void spawn_random_entity(uint8_t type) {
if (num_entities >= MAX_ENTITIES) return;
std::srand(LPC_RTC->CTIME0);
srand(LPC_RTC->CTIME0);
uint8_t spawn_x, spawn_y;
do {
spawn_x = std::rand() % LEVEL_WIDTH;
spawn_y = std::rand() % LEVEL_HEIGHT;
spawn_x = rand() % LEVEL_WIDTH;
spawn_y = rand() % LEVEL_HEIGHT;
} while (get_block_at(spawn_x, spawn_y) == 0xF ||
(spawn_x == (uint8_t)player.pos.x && spawn_y == (uint8_t)player.pos.y));
@@ -227,9 +227,9 @@ void remove_entity(uint8_t index) {
bool spawned = false;
while (!spawned && attempts < 50) {
std::srand(LPC_RTC->CTIME0 + attempts);
uint8_t spawn_x = std::rand() % LEVEL_WIDTH;
uint8_t spawn_y = std::rand() % LEVEL_HEIGHT;
srand(LPC_RTC->CTIME0 + attempts);
uint8_t spawn_x = rand() % LEVEL_WIDTH;
uint8_t spawn_y = rand() % LEVEL_HEIGHT;
int16_t dx = (int16_t)spawn_x - (int16_t)player.pos.x;
int16_t dy = (int16_t)spawn_y - (int16_t)player.pos.y;
@@ -270,9 +270,9 @@ void initialize_level() {
uint8_t attempts = 0;
while (initial_enemies < 2 && num_entities < MAX_ENTITIES && attempts < 50) {
std::srand(LPC_RTC->CTIME0 + attempts);
int8_t offset_x = (std::rand() % 11) - 5;
int8_t offset_y = (std::rand() % 11) - 5;
srand(LPC_RTC->CTIME0 + attempts);
int8_t offset_x = (rand() % 11) - 5;
int8_t offset_y = (rand() % 11) - 5;
if (abs(offset_x) < 3 && abs(offset_y) < 3) {
attempts++;
@@ -307,10 +307,10 @@ void initialize_level() {
attempts = 0;
while (num_entities < MIN_ENTITIES && attempts < 100) {
std::srand(LPC_RTC->CTIME0 + attempts + 100);
srand(LPC_RTC->CTIME0 + attempts + 100);
uint8_t spawn_x = std::rand() % LEVEL_WIDTH;
uint8_t spawn_y = std::rand() % LEVEL_HEIGHT;
uint8_t spawn_x = rand() % LEVEL_WIDTH;
uint8_t spawn_y = rand() % LEVEL_HEIGHT;
int16_t dx = (int16_t)spawn_x - (int16_t)player.pos.x;
int16_t dy = (int16_t)spawn_y - (int16_t)player.pos.y;
@@ -1045,7 +1045,7 @@ void DoomView::on_show() {
void DoomView::paint(Painter& painter) {
if (!initialized) {
initialized = true;
std::srand(LPC_RTC->CTIME0);
srand(LPC_RTC->CTIME0);
scene = 0;
up = down = left = right = fired = false;
jogging = view_height = 0;