abse/gameboy-advance

A tscircuit package created by abse.

Version
0.0.45
License
unset
Stars
0

firmware/game-console/doomgeneric/d_event.h

//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// DESCRIPTION:
//
//    


#ifndef __D_EVENT__
#define __D_EVENT__


#include "doomtype.h"


//
// Event handling.
//

// Input event types.
typedef enum
{
    ev_keydown,
    ev_keyup,
    ev_mouse,
    ev_joystick,
    ev_quit
} evtype_t;

// Event structure.
typedef struct
{
    evtype_t type;

    // Event-related data that depends on the type of event:
    //
    // ev_keydown/ev_keyup:
    //    data1: Key code (from doomkeys.h) of the key that was
    //           pressed or released.
    //    data2: Ascii text of the character that was pressed,
    //           shifted appropriately (eg. '$' if 4 was pressed
    //           while shift was held).
    //
    // ev_mouse:
    //    data1: Bitfield of buttons currently held down.
    //           (bit 0 = left; bit 1 = right; bit 2 = middle).
    //    data2: X axis mouse movement (turn).
    //    data3: Y axis mouse movement (forward/backward).
    //
    // ev_joystick:
    //    data1: Bitfield of buttons currently pressed.
    //    data2: X axis mouse movement (turn).
    //    data3: Y axis mouse movement (forward/backward).
    //    data4: Third axis mouse movement (strafe).

    int data1, data2, data3, data4;
} event_t;

 
//
// Button/action code definitions.
//
typedef enum
{
    // Press "Fire".
    BT_ATTACK		= 1,
    // Use button, to open doors, activate switches.
    BT_USE		= 2,

    // Flag: game events, not really buttons.
    BT_SPECIAL		= 128,
    BT_SPECIALMASK	= 3,
    
    // Flag, weapon change pending.
    // If true, the next 3 bits hold weapon num.
    BT_CHANGE		= 4,
    // The 3bit weapon mask and shift, convenience.
    BT_WEAPONMASK	= (8+16+32),
    BT_WEAPONSHIFT	= 3,

    // Pause the game.
    BTS_PAUSE		= 1,
    // Save the game at each console.
    BTS_SAVEGAME	= 2,

    // Savegame slot numbers
    //  occupy the second byte of buttons.    
    BTS_SAVEMASK	= (4+8+16),
    BTS_SAVESHIFT 	= 2,
  
} buttoncode_t;

// villsa [STRIFE] Strife specific buttons
// TODO - not finished
typedef enum
{
    // Player view look up
    BT2_LOOKUP          = 1,
    // Player view look down
    BT2_LOOKDOWN        = 2,
    // Center player's view
    BT2_CENTERVIEW      = 4,
    // Use inventory item
    BT2_INVUSE          = 8,
    // Drop inventory item
    BT2_INVDROP         = 16,
    // Jump up and down
    BT2_JUMP            = 32,
    // Use medkit
    BT2_HEALTH          = 128,
  
} buttoncode2_t;




// Called by IO functions when input is detected.
void D_PostEvent (event_t *ev);

// Read an event from the event queue

event_t *D_PopEvent(void);


#endif

if 4 was pressed\n // while shift was held).\n //\n // ev_mouse:\n // data1: Bitfield of buttons currently held down.\n // (bit 0 = left; bit 1 = right; bit 2 = middle).\n // data2: X axis mouse movement (turn).\n // data3: Y axis mouse movement (forward/backward).\n //\n // ev_joystick:\n // data1: Bitfield of buttons currently pressed.\n // data2: X axis mouse movement (turn).\n // data3: Y axis mouse movement (forward/backward).\n // data4: Third axis mouse movement (strafe).\n\n int data1, data2, data3, data4;\n} event_t;\n\n \n//\n// Button/action code definitions.\n//\ntypedef enum\n{\n // Press \"Fire\".\n BT_ATTACK\t\t= 1,\n // Use button, to open doors, activate switches.\n BT_USE\t\t= 2,\n\n // Flag: game events, not really buttons.\n BT_SPECIAL\t\t= 128,\n BT_SPECIALMASK\t= 3,\n \n // Flag, weapon change pending.\n // If true, the next 3 bits hold weapon num.\n BT_CHANGE\t\t= 4,\n // The 3bit weapon mask and shift, convenience.\n BT_WEAPONMASK\t= (8+16+32),\n BT_WEAPONSHIFT\t= 3,\n\n // Pause the game.\n BTS_PAUSE\t\t= 1,\n // Save the game at each console.\n BTS_SAVEGAME\t= 2,\n\n // Savegame slot numbers\n // occupy the second byte of buttons. \n BTS_SAVEMASK\t= (4+8+16),\n BTS_SAVESHIFT \t= 2,\n \n} buttoncode_t;\n\n// villsa [STRIFE] Strife specific buttons\n// TODO - not finished\ntypedef enum\n{\n // Player view look up\n BT2_LOOKUP = 1,\n // Player view look down\n BT2_LOOKDOWN = 2,\n // Center player's view\n BT2_CENTERVIEW = 4,\n // Use inventory item\n BT2_INVUSE = 8,\n // Drop inventory item\n BT2_INVDROP = 16,\n // Jump up and down\n BT2_JUMP = 32,\n // Use medkit\n BT2_HEALTH = 128,\n \n} buttoncode2_t;\n\n\n\n\n// Called by IO functions when input is detected.\nvoid D_PostEvent (event_t *ev);\n\n// Read an event from the event queue\n\nevent_t *D_PopEvent(void);\n\n\n#endif\n\n","content_mimetype":"text/x-c","created_at":"2026-11-05T18:49:26.149Z"}; window.SSR_PACKAGE_BUILDS = []; window.SSR_RELATED_PACKAGES = [{"package_id":"1bb71080-c9d9-4806-8dad-9546e8b9913b","creator_account_id":"03854e77-22c2-44a0-9cfc-2d4ed6741105","latest_package_release_id":"92d10956-aa95-4eba-8e98-42e66c16f463","last_built_release_id":"92d10956-aa95-4eba-8e98-42e66c16f463","latest_package_release_fs_sha":"md5-73c7349eef4667e7cbc7beecb7e35036","latest_pcb_preview_image_url":"https://api.tscircuit.com/package_files/view?package_release_id=92d10956-aa95-4eba-8e98-42e66c16f463\u0026file_path=dist%2Findex%2Fpcb.svg","latest_sch_preview_image_url":"https://api.tscircuit.com/package_files/view?package_release_id=92d10956-aa95-4eba-8e98-42e66c16f463\u0026file_path=dist%2Findex%2Fschematic.svg","latest_cad_preview_image_url":"https://api.tscircuit.com/package_files/view?package_release_id=92d10956-aa95-4eba-8e98-42e66c16f463\u0026file_path=dist%2Findex%2F3d.png","latest_version":"1.0.5","license":"unset","owner_org_id":"7978967e-b956-4ac2-b813-667a08f6310a","org_owner_tscircuit_handle":"abse","owner_github_username":null,"github_repo_full_name":null,"is_source_from_github":false,"description":null,"name":"abse/boostxl-uln2003","unscoped_name":"boostxl-uln2003","star_count":0,"created_at":"2026-08-12T10:10:06.978Z","updated_at":"2026-08-12T22:29:23.783Z","ai_description":"This code defines a React component that models a through-hole or surface-mount LED with specified pin labels, footprint, silkscreen, and 3D CAD model for PCB layout.","ai_usage_instructions":null,"is_private":false,"is_unlisted":false,"is_public":true,"public_dist_enabled":false,"has_public_dist":true,"starred_at":null,"default_view":"files","website":null,"github_installation_id":null,"allow_pr_previews":false,"related_type":"same_author","thumbnail_url":"https://api.tscircuit.com/package_files/view?package_release_id=92d10956-aa95-4eba-8e98-42e66c16f463\u0026file_path=dist%2Findex%2Fpcb.svg"},{"package_id":"1a688437-24fc-4e9f-921c-1ddc4fc53cf5","creator_account_id":"84198f66-bb86-4dc1-97f0-cdf2cf2c843a","latest_package_release_id":"37e98b52-0b1d-4f91-8f06-8e5e321f5e45","last_built_release_id":"37e98b52-0b1d-4f91-8f06-8e5e321f5e45","latest_package_release_fs_sha":"md5-a234ce80dacb6ff214fc7c28c619fd53","latest_pcb_preview_image_url":"https://api.tscircuit.com/package_files/view?package_release_id=37e98b52-0b1d-4f91-8f06-8e5e321f5e45\u0026file_path=dist%2Fassembly%2Fpcb.svg","latest_sch_preview_image_url":"https://api.tscircuit.com/package_files/view?package_release_id=37e98b52-0b1d-4f91-8f06-8e5e321f5e45\u0026file_path=dist%2Fassembly%2Fschematic.svg","latest_cad_preview_image_url":"https://api.tscircuit.com/package_files/view?package_release_id=37e98b52-0b1d-4f91-8f06-8e5e321f5e45\u0026file_path=dist%2Fassembly%2F3d.png","latest_version":"1.12.2","license":"ISC","owner_org_id":"07e44f25-c5d3-4583-9c34-2c7bb568f85b","org_owner_tscircuit_handle":"AnasSarkiz","owner_github_username":"AnasSarkiz","github_repo_full_name":null,"is_source_from_github":false,"description":null,"name":"AnasSarkiz/NEMA14_CH32X035G8U6","unscoped_name":"NEMA14_CH32X035G8U6","star_count":0,"created_at":"2026-10-07T17:53:37.598Z","updated_at":"2026-10-16T19:05:31.590Z","ai_description":"A NEMA stepper motor is shown with proposed M3 screws/spacers, four wired motor leads and splices, and a JST SHR-04V-S connector.","ai_usage_instructions":null,"is_private":false,"is_unlisted":false,"is_public":true,"public_dist_enabled":true,"has_public_dist":true,"starred_at":null,"default_view":"files","website":null,"github_installation_id":null,"allow_pr_previews":false,"related_type":"random","thumbnail_url":"https://api.tscircuit.com/package_files/view?package_release_id=37e98b52-0b1d-4f91-8f06-8e5e321f5e45\u0026file_path=dist%2Fassembly%2Fpcb.svg"}]; window.SSR_PACKAGE_ROUTE = {"author":"abse","packageName":"gameboy-advance","packageNameWithScope":"abse/gameboy-advance","version":null,"isLegacyRoute":false,"kind":"file","filePath":"firmware/game-console/doomgeneric/d_event.h"};