From 473f58c7dee469057a9af896a0171fd6cb3007f5 Mon Sep 17 00:00:00 2001 From: sireus Date: Fri, 21 Sep 2012 23:14:34 +0000 Subject: [PATCH] flag collision fixes * extend pickup collision radius over full height * make flags collide with plclips git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6883 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/entities.cpp | 3 ++- source/src/entity.h | 3 ++- source/src/physics.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source/src/entities.cpp b/source/src/entities.cpp index 14ad1f56..d2a0a08b 100644 --- a/source/src/entities.cpp +++ b/source/src/entities.cpp @@ -437,7 +437,7 @@ void checkitems(playerent *d) if(OUTBORD(f.pos.x, f.pos.y)) continue; if(f.state==CTFF_DROPPED) // 3d collision for dropped ctf flags { - if(objcollide(d, f.pos, 2.5f, 4.0f)) trypickupflag(i, d); + if(objcollide(d, f.pos, 2.5f, 8.0f)) trypickupflag(i, d); } else // simple 2d collision { @@ -565,6 +565,7 @@ void flagdropped(int flag, float x, float y, float z) flaginfo &f = flaginfos[flag]; if(OUTBORD(x, y)) return; // valid pos bounceent p; + p.plclipped = true; p.rotspeed = 0.0f; p.o.x = x; p.o.y = y; diff --git a/source/src/entity.h b/source/src/entity.h index b3e19a01..fce77b94 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -569,9 +569,10 @@ class bounceent : public physent public: int millis, timetolive, bouncetype; // see enum above float rotspeed; + bool plclipped; playerent *owner; - bounceent() : bouncetype(BT_NONE), rotspeed(1.0f), owner(NULL) + bounceent() : bouncetype(BT_NONE), rotspeed(1.0f), plclipped(false), owner(NULL) { type = ENT_BOUNCE; maxspeed = 40; diff --git a/source/src/physics.cpp b/source/src/physics.cpp index 3abfe0ec..39fbfdcc 100644 --- a/source/src/physics.cpp +++ b/source/src/physics.cpp @@ -117,7 +117,7 @@ bool mmcollide(physent *d, float &hi, float &lo) // collide with a map { entity &e = ents[i]; // if(e.type==CLIP || (e.type == PLCLIP && d->type == ENT_PLAYER)) - if (e.type==CLIP || (e.type == PLCLIP && (d->type == ENT_BOT || d->type == ENT_PLAYER))) // don't allow bots to hack themselves into plclips - Bukz 2011/04/14 + if (e.type==CLIP || (e.type == PLCLIP && (d->type == ENT_BOT || d->type == ENT_PLAYER || (d->type == ENT_BOUNCE && ((bounceent *)d)->plclipped)))) // don't allow bots to hack themselves into plclips - Bukz 2011/04/14 { if(fabs(e.x-d->o.x) < e.attr2 + d->radius && fabs(e.y-d->o.y) < e.attr3 + d->radius) {