CoolFace
Datasetpublic

hschumann2/TempleOS-Source-Code

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes838downloads
TTFGlbls.txt110 linesDownload Raw Back to ToTheFront
1 2#define MAP_WIDTH               640     //Change this, if you like.3#define UNITS_NUM               32      //Change this, if you like.4#define HEX_SIDE                115 6U0 InitDefines()7{8  DefinePrint("MAP_HEIGHT","%d",(GR_HEIGHT-FONT_HEIGHT*2)*MAP_WIDTH/GR_WIDTH);9  DefinePrint("DCOS",      "%12.9f",    HEX_SIDE*Cos(60.0/180*pi));10  DefinePrint("DSIN",      "%12.9f",    HEX_SIDE*Sin(60.0/180*pi));11  DefinePrint("HEX_RADIUS","%12.9f",    HEX_SIDE*Sin(60.0/180*pi)+0.01); //Slop12} InitDefines;13 14I64     map_cols=(MAP_WIDTH-DCOS)/(2*HEX_SIDE+2*DCOS),15        map_rows=ToI64((MAP_HEIGHT-DSIN)/DSIN)&~1,16        map_width=map_cols*(2*HEX_SIDE+2*DCOS)+DCOS,17        map_height=map_rows*DSIN+DSIN+1,18        x0,y0;19 20CDC     *map_dc;21U8      terrain[map_rows][map_cols];22 23//Centers of hexes24class Pt25{26  F64 x,y;27};28Pt      hex_centers[map_rows][map_cols];29 30I64     show_vis_row,show_vis_col;31Bool    roads[map_rows][map_cols],32        rivers[map_rows][map_cols],33        vis_map[map_rows][map_cols];34 35//Other options for PLAINS are WHITE or YELLOW36#define PLAINS          LTGREEN37#define TREES           GREEN38#define MOUNTAINS       DKGRAY39 40//These are used to display a range circle when they player41//is firing.42F64     fire_radius,fire_radius_x,fire_radius_y;43 44//These display "phase", "turn" and "game over".45U8      msg_buf[STR_LEN];46I64     msg_off_timeout; //Jiffies. Goes away after a time.47 48//Unit types49#define UT_INFANTRY     050#define UT_ARTILLERY    151#define UT_LT_TANK      252#define UT_MD_TANK      353 54class Unit55{56  U8    *img;57  I64   num,row,col,58        armored_attack,unarmored_attack,armor;59  I8    type,player,facing,movement,life,60        range,remaining_movement,accuracy;61  Bool  vis[2],fired,infantry,indirect_fire,pad[3];62};63 64Unit    units[2][UNITS_NUM];65 66// Bt(vis_unit_bitmap,player1+player0*((UNITS_NUM+7)&~7))67U8      vis_unit_bitmap[2][(((UNITS_NUM+7)&~7)*UNITS_NUM)>>3];68 69#define PHASE_START     070#define PHASE_INDIRECT  071#define PHASE_INDIRECT0 072#define PHASE_INDIRECT1 173#define PHASE_MOVE      274#define PHASE_MOVE0     275#define PHASE_MOVE1     376#define PHASE_DIRECT    477#define PHASE_DIRECT0   478#define PHASE_DIRECT1   579#define PHASE_END       680 81I64     phase,cur_player,enemy_player,view_player,turn,82        cursor_row,cursor_col,alive_cnt[2],83        player_indirect[2],player_move[2],player_direct[2];84F64     animation_delay=0.5;85 86Bool    moving=FALSE;87I64     move_x,move_y;88F64     move_facing;89Unit    *moving_unit;90extern I64 HexMoveOne(I64 *_row,I64 *_col,F64 x,F64 y);91 92class IndirectOrders93{94  IndirectOrders *next,*last;95  Unit  *attacker;96  I64   row,col;97} indirect_head;98 99Bool    firing=FALSE;100I64     fire_x,fire_y;101Unit    *target_unit;102Bool    target_hit;103 104Bool    indirect_explosion=FALSE;105I64     indirect_row,indirect_col;106 107I64     row_offsets[7]={-1,-2,-1,1,2,1,0};108I64     col_offsets_even[7]={-1, 0, 0,0,0,-1,0};109I64     col_offsets_odd [7]={ 0, 0, 1,1,0, 0,0};110