X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=protocol.c;h=71cfa159190fb5aaccae78facd2e2b79df351137;hb=be511c50c3e4e5fa25e56fb957690072d51314c5;hp=ba64a13c92f06dac01ab6305928ff0e5d2b68f6b;hpb=43ef53cb79682640fb1f8f304ce2daca44184001;p=xonotic%2Fdarkplaces.git diff --git a/protocol.c b/protocol.c index ba64a13c..71cfa159 100644 --- a/protocol.c +++ b/protocol.c @@ -9,11 +9,17 @@ entity_state_t defaultstate = {0,0,0},//float netcenter[3]; // ! for network prioritization, this is the center of the bounding box (which may differ from the origin) {0,0,0},//float origin[3]; {0,0,0},//float angles[3]; - 0,//int number; // entity number this state is for 0,//int effects; + 0,//unsigned int customizeentityforclient; // ! + 0,//unsigned short number; // entity number this state is for 0,//unsigned short modelindex; 0,//unsigned short frame; 0,//unsigned short tagentity; + 0,//unsigned short specialvisibilityradius; // ! larger if it has effects/light + 0,//unsigned short viewmodelforclient; // ! + 0,//unsigned short exteriormodelforclient; // ! not shown if first person viewing from this entity, shown in all other cases + 0,//unsigned short nodrawtoclient; // ! + 0,//unsigned short drawonlytoclient; // ! {0,0,0,0},//unsigned short light[4]; // color*256 (0.00 to 255.996), and radius*1 0,//unsigned char active; // true if a valid state 0,//unsigned char lightstyle; @@ -29,7 +35,7 @@ entity_state_t defaultstate = 0,//unsigned char tagindex; {32, 32, 32},//unsigned char colormod[3]; // padding to a multiple of 8 bytes (to align the double time) - 0//unsigned char unused; // ! + {0,0,0,0,0}//unsigned char unused[5]; // ! }; // LordHavoc: I own protocol ranges 96, 97, 3500-3599 @@ -53,6 +59,9 @@ protocolversioninfo[] = {250, "NEHAHRAMOVIE"}, {15, "QUAKE"}, {28, "QW"}, + {10000, "NEHAHRABJP"}, + {10001, "NEHAHRABJP2"}, + {10002, "NEHAHRABJP3"}, {0, NULL} }; @@ -149,7 +158,13 @@ void EntityFrameQuake_ReadEntity(int bits) s.number = num; s.time = cl.mtime[0]; s.flags = 0; - if (bits & U_MODEL) s.modelindex = (s.modelindex & 0xFF00) | MSG_ReadByte(); + if (bits & U_MODEL) + { + if (cls.protocol == PROTOCOL_NEHAHRABJP || cls.protocol == PROTOCOL_NEHAHRABJP2 || cls.protocol == PROTOCOL_NEHAHRABJP3) + s.modelindex = (unsigned short) MSG_ReadShort(); + else + s.modelindex = (s.modelindex & 0xFF00) | MSG_ReadByte(); + } if (bits & U_FRAME) s.frame = (s.frame & 0xFF00) | MSG_ReadByte(); if (bits & U_COLORMAP) s.colormap = MSG_ReadByte(); if (bits & U_SKIN) s.skin = MSG_ReadByte(); @@ -521,7 +536,7 @@ void EntityFrameQuake_WriteFrame(sizebuf_t *msg, int numstates, const entity_sta if (baseline.modelindex != s->modelindex) { bits |= U_MODEL; - if (s->modelindex & 0xFF00) + if ((s->modelindex & 0xFF00) && sv.protocol != PROTOCOL_NEHAHRABJP && sv.protocol != PROTOCOL_NEHAHRABJP2 && sv.protocol != PROTOCOL_NEHAHRABJP3) bits |= U_MODEL2; } if (baseline.alpha != s->alpha) @@ -561,7 +576,13 @@ void EntityFrameQuake_WriteFrame(sizebuf_t *msg, int numstates, const entity_sta if (bits & U_LONGENTITY) MSG_WriteShort(&buf, s->number); else MSG_WriteByte(&buf, s->number); - if (bits & U_MODEL) MSG_WriteByte(&buf, s->modelindex); + if (bits & U_MODEL) + { + if (sv.protocol == PROTOCOL_NEHAHRABJP || sv.protocol == PROTOCOL_NEHAHRABJP2 || sv.protocol == PROTOCOL_NEHAHRABJP3) + MSG_WriteShort(&buf, s->modelindex); + else + MSG_WriteByte(&buf, s->modelindex); + } if (bits & U_FRAME) MSG_WriteByte(&buf, s->frame); if (bits & U_COLORMAP) MSG_WriteByte(&buf, s->colormap); if (bits & U_SKIN) MSG_WriteByte(&buf, s->skin); @@ -2214,7 +2235,7 @@ void EntityFrame5_LostFrame(entityframe5_database_t *d, int framenum) { d->deltabits[s->number] |= bits; // if it was a very important update, set priority higher - if (bits & (E5_FULLUPDATE | E5_ATTACHMENT | E5_MODEL || E5_COLORMAP)) + if (bits & (E5_FULLUPDATE | E5_ATTACHMENT | E5_MODEL | E5_COLORMAP)) d->priorities[s->number] = max(d->priorities[s->number], 4); else d->priorities[s->number] = max(d->priorities[s->number], 1); @@ -2357,7 +2378,7 @@ void EntityFrame5_WriteFrame(sizebuf_t *msg, entityframe5_database_t *d, int num packetlog->packetnumber = framenum; packetlog->numstates = 0; // write stat updates - if (sv.protocol != PROTOCOL_QUAKE && sv.protocol != PROTOCOL_QUAKEDP && sv.protocol != PROTOCOL_NEHAHRAMOVIE && sv.protocol != PROTOCOL_DARKPLACES1 && sv.protocol != PROTOCOL_DARKPLACES2 && sv.protocol != PROTOCOL_DARKPLACES3 && sv.protocol != PROTOCOL_DARKPLACES4 && sv.protocol != PROTOCOL_DARKPLACES5) + if (sv.protocol != PROTOCOL_QUAKE && sv.protocol != PROTOCOL_QUAKEDP && sv.protocol != PROTOCOL_NEHAHRAMOVIE && sv.protocol != PROTOCOL_NEHAHRABJP && sv.protocol != PROTOCOL_NEHAHRABJP2 && sv.protocol != PROTOCOL_NEHAHRABJP3 && sv.protocol != PROTOCOL_DARKPLACES1 && sv.protocol != PROTOCOL_DARKPLACES2 && sv.protocol != PROTOCOL_DARKPLACES3 && sv.protocol != PROTOCOL_DARKPLACES4 && sv.protocol != PROTOCOL_DARKPLACES5) { for (i = 0;i < MAX_CL_STATS && msg->cursize + 6 + 11 <= msg->maxsize;i++) {