<commit_before>/*
 * Copyright (C) 2016, <NAME> <<EMAIL>>
 * MIT License
 */

#include <allegro.h>
#include <stdbool.h>
#include <stdio.h>

#include "src/game/handlers/flying.h"
#include "src/game/state.h"
#include "src/gfx/res/flim.h"
#include "src/gfx/modes.h"
#include "src/gfx/text.h"

//test
#include "src/gfx/res/usp_talon.h"
#include "src/audio/midi.h"
#include "src/game/sprites/ships.h"

SHIP theship;

/**
 * Request the flying handler dependencies.
 */
void flying_deps() {
    load_flim_dat();
    load_usp_talon_dat();
}

/**
 * Initialize the flying handler.
 */
void flying_init() {
    add_flim_palette_colors(USP_TALON_DAT[USP_TALON_PALETTE].dat);
    set_palette(USP_TALON_DAT[USP_TALON_PALETTE].dat);

    theship = ship_create(USP_TALON);
    ship_set_pos(&theship, 150, 80);
}

/**
 * Update the internal state of the flying handler.
 *
 * Polls the keyboard and then calculates the appropriate effect
 * on the game state.
 */
void flying_update() {
    poll_keyboard();
    ship_feed_input(&theship);
}

/**
 * Renders the output of the flying handler's current game state.
 */
void flying_render(BITMAP *buffer) {
    clear_to_color(buffer, palette_color[252]);
    ship_draw(&theship, buffer);

    if (DEBUG) {
        draw_textf(buffer, 0, 0, TXT_WHITE, -1, -1, TXT_REGULAR, TXT_LEFT,
            "x: %03d, y: %03d, w: %03d, h: %03d, pivot: %03d", theship.x, theship.y, theship.w, theship.h, theship.pivot);<commit_msg>Minor style fix<commit_after>/*
 * Copyright (C) 2016, <NAME> <<EMAIL>>
 * MIT License
 */

#include <allegro.h>
#include <stdbool.h>
#include <stdio.h>

#include "src/game/handlers/flying.h"
#include "src/game/state.h"
#include "src/gfx/res/flim.h"
#include "src/gfx/modes.h"
#include "src/gfx/text.h"

//test
#include "src/gfx/res/usp_talon.h"
#include "src/audio/midi.h"
#include "src/game/sprites/ships.h"

SHIP theship;

/**
 * Request the flying handler dependencies.
 */
void flying_deps() {
    load_flim_dat();
    load_usp_talon_dat();
}

/**
 * Initialize the flying handler.
 */
void flying_init() {
    add_flim_palette_colors(USP_TALON_DAT[USP_TALON_PALETTE].dat);
    set_palette(USP_TALON_DAT[USP_TALON_PALETTE].dat);

    theship = ship_create(USP_TALON);
    ship_set_pos(&theship, 150, 80);
}

/**
 * Update the internal state of the flying handler.
 *
 * Polls the keyboard and then calculates the appropriate effect
 * on the game state.
 */
void flying_update() {
    poll_keyboard();
    ship_feed_input(&theship);
}

/**
 * Renders the output of the flying handler's current game state.
 */
void flying_render(BITMAP *buffer) {
    clear_to_color(buffer, palette_color[252]);
    ship_draw(&theship, buffer);

    if (DEBUG) {
        draw_textf(buffer, 0, 0, TXT_WHITE, -1, -1, TXT_REGULAR, TXT_LEFT,
            "x: %03d, y: %03d, w: %03d, h: %03d, pivot: %03d",
            theship.x, theship.y, theship.w, theship.h, theship.pivot);
{'fraction_non_alphanumeric': 0.15278733654507914, 'fraction_numerical': 0.017894012388162423, 'mean_word_length': 3.8369384359401, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '1330898', 'n_tokens_mistral': 1198, 'n_tokens_neox': 1137, 'n_words': 245}