<commit_before>#include <cstdio>
#include "Interrupts.h"
#include "Map.h"
#include "render/TileRenderer.h"
#include "Graphics.h"
#include "sprites.h"
#include "utility/Rect.h"
#include "utility/misc.h"

#define MAP WalrusRPG::Map
using namespace WalrusRPG;
using namespace WalrusRPG::Utils;

MAP::Map(int width, int height, uint16_t *layer0, uint16_t *layer1) : anim()
{
    this->renderer = new TileRenderer(overworld, 16, 16);
    this->width = width;
    this->height = height;
    this->layer0 = layer0;
    this->layer1 = layer1;
}

MAP::~Map()
{
    // TODO if you allocate dynamically members
}

void MAP::update(unsigned dt)
{
    // TODO update map's data according to elasped time
    UNUSED(dt);
}

void MAP::render(WalrusRPG::Camera &camera, unsigned dt)
{
    anim.update(dt);
    signed t_width = renderer->get_tile_width();
    signed t_height = renderer->get_tile_height();
    // By Eiyeron : I assumed that the camera's position is the top left pixel.
    // Margins moves the rendered map if we go outside of the bounds (specially on the
    // left or on the top).
    signed offset_x = camera.get_x() % t_width * -1 - (camera.get_x() < 0) * t_width;
    signed offset_y = camera.get_y() % t_height * -1 - (camera.get_y() < 0) * t_height;
    signed start_x = camera.get_x() / t_width - (camera.get_x() < 0);
    signed start_y = camera.get_y() / t_height - (camera.get_y() < 0);
    Interrupts::off();
    printf("%i %i\n", start_x, start_y);
    Interrupts::init();

    // pre-calculating variables to speed up loop condition check
    signed delta_x = 320 / t_width + 1;<commit_msg>Add a comment for @Eiyeron's sexual pleasure<commit_after>#include <cstdio>
#include "Interrupts.h"
#include "Map.h"
#include "render/TileRenderer.h"
#include "Graphics.h"
#include "sprites.h"
#include "utility/Rect.h"
#include "utility/misc.h"

#define MAP WalrusRPG::Map
using namespace WalrusRPG;
using namespace WalrusRPG::Utils;

MAP::Map(int width, int height, uint16_t *layer0, uint16_t *layer1) : anim()
{
    this->renderer = new TileRenderer(overworld, 16, 16);
    this->width = width;
    this->height = height;
    this->layer0 = layer0;
    this->layer1 = layer1;
}

MAP::~Map()
{
    // TODO if you allocate dynamically members
}

void MAP::update(unsigned dt)
{
    // TODO update map's data according to elasped time
    UNUSED(dt);
}

void MAP::render(WalrusRPG::Camera &camera, unsigned dt)
{
    anim.update(dt);
    signed t_width = renderer->get_tile_width();
    signed t_height = renderer->get_tile_height();

    // Substractions here because we want to always round down when dividing
    signed offset_x = camera.get_x() % t_width * -1 - (camera.get_x() < 0) * t_width;
    signed offset_y = camera.get_y() % t_height * -1 - (camera.get_y() < 0) * t_height;
    signed start_x = camera.get_x() / t_width - (camera.get_x() < 0);
    signed start_y = camera.get_y() / t_height - (camera.get_y() < 0);
    Interrupts::off();
    printf("%i %i\n", start_x, start_y);
    Interrupts::init();

    // pre-calculating variables to speed up loop condition check
    signed delta_x = 320 / t_width + 1;
{'fraction_non_alphanumeric': 0.1413947536788228, 'fraction_numerical': 0.015355086372360844, 'mean_word_length': 3.660208643815201, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3573898', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1094, 'n_words': 299}