Code: Show/Hide Example: W-183,E1,IMAGE59,TopMost,ServerControlled,0,688 |
50% Packetloss wrote: |
No promisses that ill get it done, but Im editing Baw's source for that purpose. Mostly its just cutting pieces out. Trying to think of how im going to detect when everyone is out of the coord's area so that the bot will do a *objon after that(put the roof back on). I need some damn lunch |
Smong wrote: |
I was thinking of doing this in an asss module, but never figured out MGB's sparse array thing (what if you are on the border between two regions?). So my current methods of player position detection are not as efficient as they could be. |
Code: Show/Hide #pragma pack(4) struct Obj { Sint32 x1, y1, x2, y2; //holds area of the obj bool On_Off; //object's state Sint32 objNum; //Holds object number Sint32 title; //Holds the area number, found in .ini, ex- [obj0] }; #pragma pack() struct InsideEntry { char name[20]; //player name thats inside area Sint32 title; //the area he is inside, ex- [obj1] found in .ini InsideEntry(char *nname,Sint32 ttitle) //constuctor { memcpy(name, nname, 20); title=ttitle; } }; |
Code: Show/Hide TEMPLATE void _linkedlist <AnonymousStruct>::append(AnonymousStruct *item) { _listnode <AnonymousStruct> *new_tail = new _listnode <AnonymousStruct> (item); new_tail->last = tail; new_tail->next = NULL; if (head == NULL) head = new_tail; else tail->next = new_tail; tail = new_tail; total++; } |
Code: Show/Hide case EVENT_PlayerMove:
{ Player *p = (Player*)event.p[0]; if(Enabled) { _listnode <Obj> *parse = ObjLocations.head; // Holds All the obj locations String s; // String for turning on and off objects if (!CheckInside(p->name)) //if player isnt inside obj area { while (parse) //Scroll through obj locations { if (p->tile.x > parse->item->x1 && p->tile.x < parse->item->x2 && p->tile.y > parse->item->y1 && p->tile.y < parse->item->y2) { // Check locations if(!CheckTitle(parse->item->title)) //Is anyone already in the obj area?? { if(parse->item->On_Off) //No one in obj area, switch its state for new person { s = "*objoff "; //object off command parse->item->On_Off=false; } else { s="*objon "; //object on command parse->item->On_Off=true; } } AddInside(p->name,parse->item->title); //Add to inside bot list s += parse->item->objNum; //add on object number sendPublic(s.msg); //send command break; //break out of loop } parse = parse->next; //go to next positions in list } } else //if the player was inside obj area, see if they are still there { while (parse) //cylce through locations { if (p->tile.x > parse->item->x1 && p->tile.x < parse->item->x2 && p->tile.y > parse->item->y1 && p->tile.y < parse->item->y2) { break; //they have been found inside, exit the loop } parse = parse->next;//go to next positions in list } if(!parse) //if no more locations; then they left the obj area { sendPublic("*arena You have left the area, removing name"); RemoveInsidePerson(p->name);//remove them from inside of obj area list sendPublic("*arena Name Removed"); if(!CheckTitle(parse->item->title)) // If no one inside obj area { if(parse->item->On_Off) //switch its state becuase everyone left { s = "*objoff "; //object off command parse->item->On_Off=false; } else { s="*objon "; //object on command parse->item->On_Off=true; } s += parse->item->objNum; //add on object number sendPublic(s.msg); //send command } } } } |
Code: Show/Hide if(!parseObj) //if no more locations; then they left the obj area
{ sendPublic("*arena You have left the area, removing name"); RemoveInsidePerson(p->name);//remove them from inside of obj area list sendPublic("*arena Name Removed"); if(!CheckTitle(parseObj->item->title)) // If no one inside obj area { if(parseObj->item->On_Off) //switch its state becuase everyone left { S = "*objoff "; //object off command parseObj->item->On_Off=false; } else { S="*objon "; //object on command parseObj->item->On_Off=true; } S += parseObj->item->objNum; //add on object number sendPublic(S.msg); //send command } } } |
lp wrote: |
im trying to bring up the images in diagonal slices in certain parts of the level. as in, you could see only what your ship could see. |