Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //==========Object.h===========
- #ifndef OBJECT_H_INCLUDED
- #define OBJECT_H_INCLUDED
- //=================================
- // included dependencies
- #include "SDL.h"
- #include "SDL_image.h"
- //#include <GL/glext.h>
- #include "SDL_opengl.h"
- #include <string>
- #include <vector>
- #include <fstream>
- //=================================
- SDL_Color translate_color(Uint32 int_color);
- struct Coord
- {
- GLfloat x;
- GLfloat y;
- };
- struct LVertexData2D
- {
- Coord position;
- Coord texCoord;
- };
- int GetPowerOf2(int num);
- struct inputah
- {
- int click;
- int time;
- };
- void DrawCircle(float cx, float cy, float r, int num_segments, float color[], int flag);
- bool Collision_Occurs_Rect(int b[], int r[]);
- class object;
- struct objcopy
- {
- int rectdensity[20]= {4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321,4321};
- std::string hit_xNO="0";
- int inputarray[12]= {4321, 4321, 4321, 4321, 4321, 4321, 4321, 4321, 4321, 4321, 4321, 4321};
- int hit_xINTERVAL=0;
- int picn=999, gridn=0;
- int id;
- int delayU, nextframe, facing, U_loop_length, hitground;
- float currhp=0, currsp=0, currrp=0, currdp, currkp;
- int previousframe=4321;
- bool showshadow=true;
- bool deleted=false;
- bool deleteobj=false;
- float total_fx=0, total_fy=0, total_fz=0;
- float GROUNDPOS=0;
- bool jumpforward=false, isdead;
- int doloop[2]= {0, 4321};
- float posx , posy, posz;
- int team, currframe;
- int lasthitby=4321;
- bool caught=false;
- int curse_id=4321;
- int hitcounter=0;
- bool iscom=false;
- int movedirx, movedirz=2;
- bool P_UP, P_DOWN, P_LEFT, P_RIGHT, P_ATTACK, P_DEFEND, P_JUMP, P_SPECIAL;
- bool P_ATTACK_C=false, P_DEFEND_C=false, P_JUMP_C=false, P_SPECIAL_C=false, P_UP_C=false, P_DOWN_C=false, P_LEFT_C=false, P_RIGHT_C=false;
- bool Tu=true, Td=true, Tl=true, Tr=true, TA=true, TJ=true, TD=true, TS=true;
- int DshClksIntrvlR, DshClksIntrvlL, DASHL, DASHR=0;
- bool newframe = true;
- int accU=0;
- float FRICTION;
- float GRAVITY;
- void init(object*, int, bool, float, float, int, int);
- float ltstpltfrmvl=0.0;
- int playerno=4321;
- int regs[52]= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
- int index=4321;
- int followerID=4321;
- int onscreen_id;
- int lasthit=4321;
- bool newid=false;
- int rndrbackid=4321;
- int rndrngpriority=4321;
- };
- objcopy copy_object(objcopy old_);
- class LOAD;
- class bdy
- {
- public:
- std::string frameline;
- bool exists;
- int startpos;
- int endpos;
- std::string x, y, z, w, h, z_w, block, respond, flg, rsstvty, inrt, bdgdp, reggy, reggyval, effreggy, effreggyval;
- bdy();
- void init(std::string);
- };
- class rect
- {
- public:
- std::string frameline;
- bool exists;
- int startpos;
- int endpos;
- bool flags[14]= {false, false, false, false, false, false, false, false, false, false, false, false, false, false};
- std::string x, y, z, w, h, z_w, damage, sccss, x_impct, y_impct, z_impct, hitfreq, effect, strength, knock, rmtid;
- std::string tfgoto, tbgoto, t_x, t_y, t_z, crsid, rctdnsty, c_timer, effectf, flg, reggy, reggyval, tarreggy, tarreggyval;
- std::string copysrc, copydst, trans[3];
- rect();
- void init(std::string);
- };
- class combination
- {
- public:
- bool exists;
- std::string input,time_interval, delay, nxt, reggy, reggyval;;
- int inputseq[6]= {4321, 4321, 4321, 4321, 4321, 4321}; //0-0:ca, 1:cd, 2:cj, 3:cs, 4:cf, 5:cb, 6:cu_a, 7:cd_a, 8:cl_a, 9:cr_a
- //1-0:ha, 1:hd, 2:hj, 3:hs, 4:hf, 5:hb, 6:hu_a, 7:hd_a, 8:hl_a, 9:hr_a
- int depth=0;
- int startpos;
- int endpos;
- combination();
- void init(std::string);
- };
- class drawshape
- {
- public:
- std::string frameline;
- bool exists;
- int startpos;
- int endpos;
- bool flags[4]= {false, false, false, false};
- std::string x, y, w, h, x_r, y_r, strt_angle, arc_angle, border_width, vertices, cndtn,z,d,fill_color;
- std::string color[4]= {"0", "0", "0", "0"}; //RGBA
- drawshape();
- void init(std::string);
- };
- class callobject
- {
- public:
- std::string frameline;
- bool exists;
- int startpos;
- int endpos;
- bool flags[7]= {false, false, false, false, false, false, false};
- std::string x, y, z, id, qntty, f_x, f_y, f_z, xhlddstnc, zhlddstnc, frm, delay, reggy, reggyval, cndtn;
- callobject();
- void init(std::string);
- };
- class frame
- {
- std::string frameline;
- public:
- bool exists=false;
- bool flags[23]= {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
- bool menuflags[11]= {false, false, false, false, false, false, false, false, false, false, false};
- int rectindx=0;
- int bdyindx=0;
- int combinationindx=0;
- int callobjectindx=0;
- int drawshapeindx=0;
- std::vector<bdy> BDYS;
- std::vector<rect> RECTS;
- std::vector<combination> COMBINATIONS;
- std::vector<callobject> CALLOBJECTS;
- std::vector<drawshape> DRAWSHAPES;
- std::string f, img, grid, delay, nxt, state, center_X, center_Y, f_x, f_y, f_z, loop_length, loop_goto, loop_condition, acc, alpha;
- std::string zhlddstnc, xhlddstnc, zhldacc, xhldacc, mxlmtvx, mxlmtvy, mxlmtvz, counter, addhp, addsp, addrp, hitground, arrsstnc;
- std::string c_a, c_j, c_d, c_s, c_b, c_f, c_ua, c_da, h_a, h_j, h_d, h_s, h_b, h_f, h_ua, h_da, c_ra, c_la, h_ra, h_la, nxtid;
- std::string adptx, adpty, adptz;
- std::string rndrngpriority, yacc;
- std::string trans[3], reggy, reggyval;
- int no;
- void init(std::string, int);
- };
- class spritegrid
- {
- public:
- int w, h, col, row, frameno;
- int gw, gh;
- std::string colk;
- //SDL_Surface *grid, *grid_;
- //SDL_Texture *grid, *grid_;
- GLuint grid;
- GLuint shad;
- int GetPowerOf2(int);
- std::vector<SDL_Rect> clip;
- std::vector<SDL_Rect> clip_;
- void ini(std::string dir_, int w_, int h_, int col_, int row_, std::string colk_, int * number, int filtering);
- };
- class layer
- {
- public:
- std::string img, x, y, rptx, rpty, prllxfctr, delay, restart, f_x, f_y;
- int no, delayU=0;
- int posx, posy;
- int overalldelay=0;
- bool flags[3]= {false, false, false};
- bool exists=false;
- std::vector<callobject> CALLOBJECTS;
- std::vector<spritegrid> IMG;
- int callobjectindx=0;
- void init(std::string, int);
- };
- class background
- {
- std::string name, bgcolor, arresstnc;
- public:
- LVertexData2D V_DATA [4];
- GLuint I_DATA[4]= {0, 1, 2, 3};
- GLuint VBO_ID, IBO_ID;
- //SDL_Texture *backgroundTex;
- //SDL_Texture *shadow;
- std::vector<layer> LAYERS;
- GLuint backgroundTex;
- GLuint shadow;
- SDL_Rect position;
- SDL_Rect shadowpos;
- int zbound, zboundwidth, xbound, xboundwidth, id;
- float shadangx, shadangy;
- void init (int, std::string, std::string);
- void Blit(LOAD * LOADED);
- };
- class object
- {
- public:
- LOAD*LOADED;
- float wkspdxz_x,wkspdxz_z;
- int wkspdx=0, wkspdz=0, frameno, w, h, facing=0, id, maxhp, maxsp, maxrp, inihp, inisp, inirp, delayU, nxt, currhp, currsp, currrp;
- int rphit, rpsec, rpdam, sphit, spsec, spdam, armor, armorrate, walking, standing, fallingb, previousframe, U_loop_length, accU, falling, knockrate;
- int jumping, jmpspdx, jmpspdz, hitground, whenhit, whenhitb, type, knocked, maxdp, dpsec, maxkp, lying, hittxtwidth, hitnowidth, fatigue, inair;
- int height=0, width=0, allctfrms=650, allctimgs=10, spawn=1;
- std::vector<frame> Frames;
- std::vector<spritegrid> IMGS;
- int spritecount=0, imgindx=0;
- std::string sprtfl, name, dpndncs, afildir;
- void init (int id, std::string dpndncs, std::string afildir);
- int Eval(objcopy *objcop, std::string liny);
- void Blit (objcopy * objcop);
- void CallObject(objcopy *);
- void Walk(objcopy *objcop);
- void Move (float value, char axis, objcopy * objcop);
- void Update_Frame_If_Time(objcopy * objcop);
- void Apply_loop(objcopy * objcop);
- void Apply_f_x(objcopy * objcop);
- void Apply_f_y(objcopy * objcop);
- void Apply_f_z(objcopy * objcop);
- void Apply_FRICTION(objcopy * objcop);
- void Apply_GRAVITY(objcopy * objcop);
- void Apply_acc(objcopy * objcop);
- void Apply_x_z_hold_distance(objcopy * objcop);
- void Apply_x_hold_distance(objcopy * objcop);
- void Basic_Stand_Walk_Dash(objcopy * objcop);
- void Apply_max_limit_vx(objcopy * objcop);
- void Apply_max_limit_vy(objcopy * objcop);
- void Basic_Jump(objcopy * objcop);
- void BlitShadow(objcopy * objcop);
- void Respond_ToInput(objcopy * objcop);
- void Regenerate_Deplete_Stuff(objcopy * objcop);
- void Set_IMG_No_On_Current_Grid(objcopy * objcop);
- void CallObj(int paras[], bool flags[] );
- void Platforming_Solid(objcopy * objcop, objcopy * target_objcop, int rect_index, int r[]);
- void Collision_Related(objcopy * objcop, objcopy * target_objcop, int rect_index, int r[]);
- void Adopt_Data(objcopy * objcop);
- void Update(objcopy * objcop);
- void LiteUpdate(objcopy * objcop);
- void UpdateStat(objcopy * objcop);
- void CheckCollision(objcopy * objcop);
- void UpdateMove(objcopy * objcop);
- };
- struct dataline
- {
- int id;
- std::string dependencies;
- std::string directory;
- int type;
- };
- class LoadTxt
- {
- public:
- std::vector<dataline> DATA_LINES;
- int DATA_LINES_INDEX=0;
- LoadTxt(std::string loadtxtdir);
- };
- class LOAD
- {
- const char* LOAD_DIR;
- const char* LOAD_TOKEN;
- std::string line;
- public:
- std::vector<std::vector<bool> > PKEYS;
- int _playermenuorigins[20]= {0,0 ,0,0 ,0,0 ,0,0 ,0,0 ,0,0 ,0,0 ,0,0 ,0,0 ,0,0};
- bool HITSYS=false;
- int FPS;
- std::vector<std::vector<int> > CATCHINGIDS; //0:framefront 1:frameback 2:x-pos 3:y-pos 4:z-pos 5:facing 6:timer
- int DELETED_OBJS[1000];
- int D_O_INDEX=0;
- int GLOBALREGS[100];
- int IDS[600];
- int BGIDS[100];
- int OBJSBEHIND[100];
- int OBJSBEHIND_INDEX=0;
- std::string settings[12]; //0-9 effects 10-gravity 11-friction
- std::string BARS[19]= {"None", "None", "None", "", "", "", "", "", "", "", "", "", "None", "", "", "None", "None", "None", "None"};
- std::vector<spritegrid> BARSG;
- std::vector<objcopy*> ON_SCREEN_OBJS;
- std::vector<dataline> DATA_LINES;
- //std::vector<objcopy*> ON_SCREEN_OBJS_TO_BE_SORTED;
- std::vector<objcopy> ON_SCREEN_REAL_OBJS;
- std::vector<objcopy> OBJS_STRUCTS;
- std::vector<object> OBJECTS;
- std::vector<background> BACKGROUNDS;
- int OBJID_INDEX;
- int BGID_INDEX;
- int CURRBG;
- float FRICTION, GRAVITY;
- int ON_SCREEN_OBJCOUNT=0;
- void LoadSettigns_OnScreenObjs(void);
- void LoadLOADTXTLite(void);
- void initHeavy(std::string);
- void initLite(void);
- void LoadBG(std::string, int);
- void LoadOBJ(std::string, int);
- void CreateOBJECTCOPY(int, int, int, int);
- void LoadObjsForGame(LoadTxt Txt, std::string objlines, int bgid, LOAD * LOADADDRESS);
- int controllers[10]= {4321, 4321, 4321, 4321, 4321, 4321, 4321, 4321, 4321, 4321};
- };
- #endif // OBJECT_H_INCLUDED
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement