adding multiplayer
This commit is contained in:
@@ -4,7 +4,7 @@ target_sources(${PROJECT_NAME} PRIVATE
|
||||
entity_handler.c
|
||||
cells.c
|
||||
world.c
|
||||
player/player_packet.c
|
||||
player/player_data.c
|
||||
|
||||
)
|
||||
|
||||
|
||||
@@ -37,8 +37,9 @@ int CammeraResize(cammera* c, int sx, int sy) {
|
||||
|
||||
int CammeraRender(cammera*c) {
|
||||
jump(c->tw, (tart_vec2){0,0});
|
||||
int ne = 1;
|
||||
for(int i = 0; i < c->size_y; i++) {
|
||||
for(int j = 0; j < c->size_x - 1; j++) {
|
||||
for(int j = 0; j < c->size_x; j++) {
|
||||
|
||||
if(c->pos_y+i < c->w->size_y-1 && c->pos_y+i >= 0 && c->pos_x+j < c->w->size_x-1 && c->pos_x+j >= 0){
|
||||
c->tw->palette[2].background.r = c->w->wells[at(c->pos_x+j,c->pos_y+i,c->w)].cell->tile.background.r;
|
||||
@@ -49,6 +50,7 @@ int CammeraRender(cammera*c) {
|
||||
c->tw->palette[2].forground.b = c->w->wells[at(c->pos_x+j,c->pos_y+i,c->w)].cell->tile.forground.b;
|
||||
|
||||
tart_jump(c->tw, (tart_vec2){j,i});
|
||||
ne = 1;
|
||||
|
||||
for(int k = 0; k < 1; k++) {
|
||||
if(c->w->wells[at((c->pos_x+j) ,(c->pos_y+i),c->w)].entityIds[0] != 0000) {
|
||||
@@ -65,12 +67,14 @@ int CammeraRender(cammera*c) {
|
||||
c->tw->palette[2].forground.b = c->w->wells[at(c->pos_x+j,c->pos_y+i,c->w)].entityIds[k]->tile.forground.b;
|
||||
tart_insert_cell(c->tw, 2, c->w->wells[at((c->pos_x+j) ,(c->pos_y+i),c->w)]
|
||||
.entityIds[k]->tile.simble);
|
||||
printf("found entity %c\n", c->w->wells[at((c->pos_x+j) ,(c->pos_y+i),c->w)]
|
||||
.entityIds[k]->tile.simble);
|
||||
tart_jump(c->tw,(tart_vec2){j, i});
|
||||
ne = 0;
|
||||
}
|
||||
}
|
||||
if(ne) {
|
||||
tart_insert_cell(c->tw, 2, c->w->wells[at((c->pos_x+j) ,(c->pos_y+i),c->w)]
|
||||
.cell->tile.simble);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
target_sources(${PROJECT_NAME} PRIVATE
|
||||
Player.c
|
||||
Player_c.c
|
||||
Player_e.c
|
||||
Centery.c
|
||||
Gun.c
|
||||
)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "Centery.h"
|
||||
#include "../../server_source/transactions.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int CenteryInit(void* self) {
|
||||
entity* ent = self;
|
||||
@@ -13,8 +15,42 @@ int CenteryUpdate(int arg, void* self) {
|
||||
entity* e = self;
|
||||
world* w = e->world;
|
||||
centery* cen = e->data;
|
||||
vec2 moveTo = {0,0};
|
||||
vec2 moveTo = e->position;
|
||||
int goodMove;
|
||||
user_transaction pos_ut;
|
||||
memset(&pos_ut, 0, sizeof(pos_ut));
|
||||
printf("getting transaction\n");
|
||||
|
||||
//printf("Has Connection\n");
|
||||
//printf("cli sock %d, entity sock ,\n", e->server->socket);
|
||||
if(cen->cli->server.game_info.socket > 0) {
|
||||
|
||||
|
||||
if(RecvUserTransaction(&pos_ut, e->server)) {
|
||||
printf("Centery NG\n");
|
||||
}else {
|
||||
|
||||
memcpy(&moveTo, pos_ut.userArg,sizeof(vec2));
|
||||
printf("size of post_ut %d\n", pos_ut.argsize);
|
||||
printf("move to %d,%d\n", moveTo.x,moveTo.y);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!EntityMove(e, &moveTo)) {
|
||||
|
||||
// st_move = (user_transaction){
|
||||
// .userArg = &mv,
|
||||
// .action = PlayerMove,
|
||||
// .id = SERVER_T_USER_FLAG,
|
||||
// .argsize = sizeof(mv),
|
||||
//};
|
||||
|
||||
|
||||
//w->wells[at(mv.x, mv.y, w)].cell = SetCell(6);
|
||||
}
|
||||
|
||||
//do{
|
||||
// goodMove = EntityMove(e,(vec2){e->position.x+ 0, e-> position.y + 1});
|
||||
// if(goodMove == 1) {
|
||||
@@ -64,7 +100,7 @@ int CenteryUpdate(int arg, void* self) {
|
||||
|
||||
|
||||
|
||||
printf("name of entity %s\n",e->name);
|
||||
//printf("name of entity %s\n",e->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -78,7 +114,7 @@ int CenteryFree(void* self) {
|
||||
|
||||
|
||||
|
||||
entity* CreateCentery(int tear, int classification, world* w) {
|
||||
entity* CreateCentery(int tear, client* cli, world* w) {
|
||||
entity* ent = (entity*)malloc(sizeof(entity));
|
||||
centery* cen = (centery*)malloc(sizeof(centery));
|
||||
|
||||
@@ -94,6 +130,7 @@ entity* CreateCentery(int tear, int classification, world* w) {
|
||||
.str = 3,
|
||||
.wis = 3,
|
||||
.dex = 3,
|
||||
.cli = cli,
|
||||
};
|
||||
|
||||
*ent = (entity){
|
||||
@@ -103,7 +140,7 @@ entity* CreateCentery(int tear, int classification, world* w) {
|
||||
.tile = {
|
||||
.simble = 'C',
|
||||
.background = {0,0,0},
|
||||
.forground = {0x3f,0x5f,0x10},
|
||||
.forground = {0xff,0x10,0x10},
|
||||
},
|
||||
.position = (vec2){5,5},
|
||||
.data = cen,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#define CENTERY_ID 1
|
||||
#include "../entity.h"
|
||||
#include "../world.h"
|
||||
#include "../../client_source/client.h"
|
||||
|
||||
typedef struct {
|
||||
int weapon;
|
||||
@@ -17,9 +18,11 @@ typedef struct {
|
||||
int str;
|
||||
int wis;
|
||||
int dex;
|
||||
client* cli;
|
||||
|
||||
} centery;
|
||||
|
||||
entity* CreateCentery(int tear, int classification,world* w);
|
||||
entity* CreateCentery(int tear, client* cli,world* w);
|
||||
|
||||
int ServerUpdate(void*);
|
||||
int ClientUpdate(int, void*);
|
||||
|
||||
@@ -16,7 +16,7 @@ int GunUpdate(int action, void* data) {
|
||||
case SHOOT_W: bullet_pos.x -= 1; break;
|
||||
}
|
||||
}
|
||||
int entity_colied = EntityMove(e, bullet_pos);
|
||||
int entity_colied = EntityMove(e, &bullet_pos);
|
||||
if((entity_colied) && g->inpact == 0) {
|
||||
if(w->wells[at(bullet_pos.x, bullet_pos.y, w)].cell->id == 1) {
|
||||
w->wells[at(bullet_pos.x, bullet_pos.y, w)].cell = SetCell(2);
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
#ifndef PLAYER_H
|
||||
#define PLAYER_H
|
||||
|
||||
#include "../entity.h"
|
||||
#include "../../client_source/client.h"
|
||||
#include "../world.h"
|
||||
|
||||
typedef struct {
|
||||
int holding;
|
||||
int class;
|
||||
|
||||
int health;
|
||||
int ac;
|
||||
int str;
|
||||
int wis;
|
||||
int dex;
|
||||
client* cli;
|
||||
|
||||
|
||||
int invintory[30];
|
||||
} player;
|
||||
|
||||
entity* CreatePlayer(const char* username, client* cli ,world* w);
|
||||
|
||||
int PlayerServerUpdate(void*);
|
||||
int PlayerClientUpdate(int, void*);
|
||||
int PlayerInit(void*);
|
||||
int PlayerFree(void*);
|
||||
|
||||
#endif
|
||||
@@ -1,9 +1,17 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "Player.h"
|
||||
#include "Player_c.h"
|
||||
#include "Gun.h"
|
||||
#include "Centery.h"
|
||||
#include "../../client_source/client.h"
|
||||
#include "../../server_source/transactions.h"
|
||||
|
||||
typedef struct {
|
||||
player_data pd;
|
||||
client* cli;
|
||||
}player_c;
|
||||
|
||||
#define PlayerMove 1
|
||||
|
||||
|
||||
void Shoot(entity* e,int direction) {
|
||||
if(direction == SHOOT_N) {
|
||||
@@ -36,9 +44,9 @@ void Shoot(entity* e,int direction) {
|
||||
}
|
||||
}
|
||||
|
||||
int PlayerUpdate(int action, void* data) {
|
||||
int PlayerUpdateC(int action, void* data) {
|
||||
entity* e = (entity*)data;
|
||||
player* p= (player*)e->data;
|
||||
player_c* p= (player_c*)e->data;
|
||||
world* w = e->world;
|
||||
ssh_terminal_data* td = &p->cli->term;
|
||||
vec2 mv = {e->position.x, e->position.y};
|
||||
@@ -48,23 +56,46 @@ int PlayerUpdate(int action, void* data) {
|
||||
};
|
||||
int cammera_fallow_readious = 14;
|
||||
|
||||
printf("input buffer for player %s\n", td->inputBuffer);
|
||||
|
||||
if(!strcmp(td->inputBuffer, "k")) {mv.y -= 1;}
|
||||
if(!strcmp(td->inputBuffer, "j")) {mv.y += 1;}
|
||||
if(!strcmp(td->inputBuffer, "h")) {mv.x -= 1;}
|
||||
if(!strcmp(td->inputBuffer, "l")) {mv.x += 1;}
|
||||
char* ib = td->inputBuffer;
|
||||
int ibsize = strlen(ib);
|
||||
|
||||
while(ib < ib+ibsize) {
|
||||
|
||||
int entity_can_move = EntityMove(e, mv);
|
||||
if(!strcmp(td->inputBuffer, "w")) {Shoot(e,SHOOT_N);}
|
||||
if(!strcmp(td->inputBuffer, "d")) {Shoot(e,SHOOT_E);}
|
||||
if(!strcmp(td->inputBuffer, "s")) {Shoot(e,SHOOT_S);}
|
||||
if(!strcmp(td->inputBuffer, "a")) {Shoot(e,SHOOT_W);}
|
||||
printf("Cammera Position %d,%d\n", cammera_pos.x, cammera_pos.y);
|
||||
if(!strcmp(ib, "\e[A")) {mv.y -= 1; ib += 3; continue;}
|
||||
if(!strcmp(ib, "\e[B")) {mv.y += 1; ib += 3; continue;}
|
||||
if(!strcmp(ib, "\e[D")) {mv.x -= 1; ib += 3; continue;}
|
||||
if(!strcmp(ib, "\e[C")) {mv.x += 1; ib += 3; continue;}
|
||||
|
||||
user_transaction st_move;
|
||||
memset(&st_move, 0, sizeof(st_move));
|
||||
|
||||
st_move = (user_transaction){
|
||||
.userArg = &mv,
|
||||
.action = PlayerMove,
|
||||
.id = SERVER_T_USER_FLAG,
|
||||
.argsize = sizeof(mv),
|
||||
};
|
||||
|
||||
|
||||
if(p->cli->server.game_info.socket > 0) {
|
||||
printf("Has Connection\n");
|
||||
if(SendUserTransaction(&st_move, p->cli->server.game_info.socket)) {
|
||||
printf("NG\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!strcmp(ib, "w")) {Shoot(e,SHOOT_N); ib += 1; continue;}
|
||||
if(!strcmp(ib, "d")) {Shoot(e,SHOOT_E); ib += 1; continue;}
|
||||
if(!strcmp(ib, "s")) {Shoot(e,SHOOT_S); ib += 1; continue;}
|
||||
if(!strcmp(ib, "a")) {Shoot(e,SHOOT_W); ib += 1; continue;}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int entity_can_move = EntityMove(e, &mv);
|
||||
|
||||
|
||||
if((e->position.x < cammera_pos.x - cammera_fallow_readious )){
|
||||
p->cli->cam.pos_x += - 1;
|
||||
@@ -83,10 +114,9 @@ int PlayerUpdate(int action, void* data) {
|
||||
|
||||
|
||||
|
||||
if(!entity_can_move) {
|
||||
w->wells[at(mv.x, mv.y, w)].cell = SetCell(6);
|
||||
if(entity_can_move) {
|
||||
//w->wells[at(mv.x, mv.y, w)].cell = SetCell(6);
|
||||
}
|
||||
printf("is this a good move? %d\n", EntityMove(e, mv));
|
||||
|
||||
|
||||
|
||||
@@ -94,22 +124,20 @@ int PlayerUpdate(int action, void* data) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
entity* CreatePlayer(const char* username, client* cli,world* w) {
|
||||
int PlayerCFree(void* data) {
|
||||
return 0;
|
||||
}
|
||||
int PlayerCInit(void* data) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
entity* CreatePlayerCharecter(player_data pd, client* cli ,world* w) {
|
||||
entity* ent = malloc(sizeof(entity));
|
||||
player* p= malloc(sizeof(player));
|
||||
player_c* p= malloc(sizeof(player_c));
|
||||
|
||||
*p = (player){
|
||||
.holding = 0,
|
||||
.class = 0,
|
||||
|
||||
.health = 0,
|
||||
.ac = 0,
|
||||
.str = 0,
|
||||
.wis = 0,
|
||||
.dex = 0,
|
||||
.cli = cli,
|
||||
|
||||
|
||||
*p = (player_c){
|
||||
.pd = pd,
|
||||
.cli = cli,
|
||||
};
|
||||
|
||||
|
||||
@@ -126,9 +154,9 @@ entity* CreatePlayer(const char* username, client* cli,world* w) {
|
||||
.data = p,
|
||||
.world = w,
|
||||
.callback = {
|
||||
.init = PlayerInit,
|
||||
.update = PlayerUpdate,
|
||||
.free = PlayerFree,
|
||||
.init = PlayerCInit,
|
||||
.update = PlayerUpdateC,
|
||||
.free = PlayerCFree,
|
||||
},
|
||||
.cleanup = 0,
|
||||
|
||||
@@ -139,8 +167,3 @@ entity* CreatePlayer(const char* username, client* cli,world* w) {
|
||||
return ent;
|
||||
}
|
||||
|
||||
int PlayerServerUpdate(void*);
|
||||
int PlayerClientUpdate(int, void*);
|
||||
int PlayerInit(void* ent) {return 0;}
|
||||
int PlayerFree(void* ent) {return 0;}
|
||||
|
||||
13
source/game_source/entities/Player_c.h
Normal file
13
source/game_source/entities/Player_c.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef PLAYER_C_H
|
||||
#define PLAYER_C_H
|
||||
|
||||
#include "../entity.h"
|
||||
#include "../../client_source/client.h"
|
||||
#include "../world.h"
|
||||
#include "../player/player_data.h"
|
||||
|
||||
|
||||
entity* CreatePlayerCharecter(player_data pd, client* cli ,world* w);
|
||||
|
||||
|
||||
#endif
|
||||
105
source/game_source/entities/Player_e.c
Normal file
105
source/game_source/entities/Player_e.c
Normal file
@@ -0,0 +1,105 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "Player_e.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "../../server_source/transactions.h"
|
||||
|
||||
|
||||
#define PlayerMove 1
|
||||
|
||||
|
||||
|
||||
int PlayerEUpdate(int action, void* data) {
|
||||
entity* e = (entity*)data;
|
||||
player_data* p= (player_data*)e->data;
|
||||
world* w = e->world;
|
||||
vec2 moveTo = e->position;
|
||||
int goodMove;
|
||||
user_transaction pos_ut;
|
||||
memset(&pos_ut, 0, sizeof(pos_ut));
|
||||
printf("getting transaction\n");
|
||||
|
||||
//printf("Has Connection\n");
|
||||
//printf("cli sock %d, entity sock ,\n", e->server->socket);
|
||||
if(e->server > 0) {
|
||||
|
||||
|
||||
if(RecvUserTransaction(&pos_ut, e->server)) {
|
||||
printf("Centery NG\n");
|
||||
}else {
|
||||
|
||||
memcpy(&moveTo, pos_ut.userArg,sizeof(vec2));
|
||||
printf("size of post_ut %d\n", pos_ut.argsize);
|
||||
printf("move to %d,%d\n", moveTo.x,moveTo.y);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!EntityMove(e, &moveTo)) {
|
||||
|
||||
// st_move = (user_transaction){
|
||||
// .userArg = &mv,
|
||||
// .action = PlayerMove,
|
||||
// .id = SERVER_T_USER_FLAG,
|
||||
// .argsize = sizeof(mv),
|
||||
//};
|
||||
|
||||
|
||||
//w->wells[at(mv.x, mv.y, w)].cell = SetCell(6);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int PlayerEFree(void* data) {
|
||||
return 0;
|
||||
}
|
||||
int PlayerEInit(void* data) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
entity* CreatePlayerEntity(player_data pd, int serverfd,world* w) {
|
||||
entity* ent = malloc(sizeof(entity));
|
||||
player_data* p= malloc(sizeof(player_data));
|
||||
|
||||
*p = (player_data){
|
||||
.holding = pd.holding,
|
||||
.class = pd.class,
|
||||
|
||||
.health = pd.health,
|
||||
.ac = pd.ac,
|
||||
.str = pd.str,
|
||||
.wis = pd.wis,
|
||||
.dex = pd.dex,
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
*ent = (entity){
|
||||
.id = 30,
|
||||
.name = "Testing",
|
||||
.description = "This is a player",
|
||||
.tile = {
|
||||
.simble = '@',
|
||||
.background = {0,0,0},
|
||||
.forground = {0x5f,0x3f,0x10},
|
||||
},
|
||||
.position = (vec2){5,5},
|
||||
.data = p,
|
||||
.world = w,
|
||||
.callback = {
|
||||
.init = PlayerEInit,
|
||||
.update = PlayerEUpdate,
|
||||
.free = PlayerEFree,
|
||||
},
|
||||
.cleanup = 0,
|
||||
|
||||
};
|
||||
|
||||
return ent;
|
||||
}
|
||||
|
||||
11
source/game_source/entities/Player_e.h
Normal file
11
source/game_source/entities/Player_e.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef PLAYER_E_H
|
||||
#define PLAYER_E_H
|
||||
|
||||
#include "../entity.h"
|
||||
#include "../world.h"
|
||||
#include "../player/player_data.h"
|
||||
|
||||
entity* CreatePlayerEntity(player_data pd, int serverfd, world* w);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -3,19 +3,30 @@
|
||||
#include "vector.h"
|
||||
#include "world.h"
|
||||
|
||||
int EntityMove(entity* e, vec2 pos) {
|
||||
#include "stdio.h"
|
||||
int EntityMove(entity* e, vec2* pos) {
|
||||
world* world = e->world;
|
||||
|
||||
if(world->wells[at(pos.x,pos.y, world)].cell->flags & (CELL_FLAG_BLOCKING)){
|
||||
vec2 p = *pos;
|
||||
if(pos->x < 0) {
|
||||
p.x = (world->size_x + (pos->x- 1)) ;
|
||||
printf("x less then 0 setting p.x to %d\n", p.x);
|
||||
pos->x = p.x;
|
||||
}
|
||||
if(pos->y < 0) {
|
||||
p.y = (world->size_y + (pos->y - 1)) ;
|
||||
printf("y less then 0 setting p.y to %d\n", p.y);
|
||||
pos->y = p.y;
|
||||
}
|
||||
if(world->wells[at(p.x,p.y, world)].cell->flags & (CELL_FLAG_BLOCKING)){
|
||||
return 1;
|
||||
}
|
||||
if(world->wells[at(pos.x,pos.y, world)].entityIds[0] != NULL){
|
||||
if(world->wells[at(p.x,p.y, world)].entityIds[0] != NULL){
|
||||
return 2;
|
||||
}
|
||||
|
||||
world->wells[at(e->position.x,e->position.y, world)].entityIds[0] = 0;
|
||||
world->wells[at(pos.x,pos.y, world)].entityIds[0] = e;
|
||||
e->position = pos;
|
||||
world->wells[at(p.x,p.y, world)].entityIds[0] = e;
|
||||
e->position = p;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -34,12 +34,13 @@ typedef struct {
|
||||
entity_callbacks callback;
|
||||
entity_transaction ta;
|
||||
unsigned char cleanup;
|
||||
int server;
|
||||
} entity;
|
||||
|
||||
entity* CreateEntity(const char* name, const char* description);
|
||||
int EntityAddCallbacks(entity* e, entity_callbacks cb);
|
||||
int EntitySetUserdat(entity* e, void* userdata);
|
||||
int EntityMove(entity* e, vec2 pos);
|
||||
int EntityMove(entity* e, vec2* pos);
|
||||
|
||||
// Gets
|
||||
const char* GetEntityDescription(entity* e);
|
||||
|
||||
@@ -17,10 +17,9 @@ int EntityListUpdate(entity_list* list) {
|
||||
clock_gettime(CLOCK_MONOTONIC, &list->current);
|
||||
double elapsed = (list->current.tv_sec - list->start.tv_sec);
|
||||
elapsed += (list->current.tv_nsec - list->start.tv_nsec) / 1000000000.0;
|
||||
if(elapsed > 0.125/4) {
|
||||
if(elapsed > 0.000125) {
|
||||
for(int i = 0; i < 256; i++) {
|
||||
if(list->entities[i] != NULL) {
|
||||
printf("running index %d\n", i);
|
||||
list->entities[i]->callback.update(0,list->entities[i]);
|
||||
}
|
||||
}
|
||||
|
||||
2
source/game_source/player/player_data.c
Normal file
2
source/game_source/player/player_data.c
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "player_data.h"
|
||||
|
||||
37
source/game_source/player/player_data.h
Normal file
37
source/game_source/player/player_data.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef PLAYER_PACKET_H
|
||||
#define PLAYER_PACKET_H
|
||||
#include "../color.h"
|
||||
|
||||
#define MOVE_UP 1
|
||||
#define MOVE_DOWN 2
|
||||
#define MOVE_LEFT 3
|
||||
#define MOVE_RIGHT 4
|
||||
#define ATTACK_LEFT 5
|
||||
#define ATTACK_RIGHT 6
|
||||
#define ATTACK_UP 7
|
||||
#define ATTACK_DOWN 8
|
||||
|
||||
#define ATTACK_MELEE 11
|
||||
#define ATTACK_WEAPON_1 12
|
||||
#define ATTACK_WEAPON_2 13
|
||||
#define ATTACK_WEAPON_3 14
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
int holding;
|
||||
int class;
|
||||
int health;
|
||||
int ac;
|
||||
int str;
|
||||
int wis;
|
||||
int intel;
|
||||
int dex;
|
||||
char name[32];
|
||||
color c;
|
||||
}player_data;
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,8 +0,0 @@
|
||||
#include "player_packet.h"
|
||||
|
||||
int SendPlayerPacket(player_packet *pakcet, game_server *config) {
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#ifndef PLAYER_PACKET_H
|
||||
#define PLAYER_PACKET_H
|
||||
#include "../../server_source/game_client.h"
|
||||
|
||||
#define MOVE_UP 1
|
||||
#define MOVE_DOWN 2
|
||||
#define MOVE_LEFT 3
|
||||
#define MOVE_RIGHT 4
|
||||
|
||||
#define ATTACK_MELEE 11
|
||||
#define ATTACK_WEAPON_1 12
|
||||
#define ATTACK_WEAPON_2 13
|
||||
#define ATTACK_WEAPON_3 14
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
}player_packet;
|
||||
|
||||
|
||||
|
||||
int SendPlayerPacket(player_packet* pakcet, game_server* config);
|
||||
|
||||
#endif
|
||||
@@ -2,8 +2,6 @@
|
||||
#include "cells.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "./entities/Centery.h"
|
||||
#include "./entities/Player.h"
|
||||
#include "entity_handler.h"
|
||||
#include "vector.h"
|
||||
#include <stdio.h>
|
||||
@@ -96,9 +94,11 @@ int GenerateWorld(world *w) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < w->ent_list->count; i++) {
|
||||
for(int i = 0; i < 255; i++) {
|
||||
entity* ent = w->ent_list->entities[i];
|
||||
w->wells[at(ent->position.x + 1, ent->position.y + 1, w)].entityIds[0] = ent;
|
||||
if(ent != NULL) {
|
||||
w->wells[at(ent->position.x , ent->position.y , w)].entityIds[0] = ent;
|
||||
}
|
||||
}
|
||||
|
||||
vec2 building_position = {50,50};
|
||||
|
||||
Reference in New Issue
Block a user