mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-11-24 06:19:25 +03:00
Add edentity blocks & associated script commands
This PR is a redo of #909 which improves the edentity handling, abstracting activity zone types to level data rather than being a part of entity data. This commit allows users to place down the game's "blocks" in the editor, being collision blocks, hurt boxes, gamestate triggers, script boxes, activity zones, "safe" boxes, and one-ways. Activity zones now have some level XML to allow defining new activity zone IDs: ```xml <ActivityZones> <activityZone id="36" colour="red"></activityZone> <activityZone id="37" colour="orange">Press {button} to do something</activityZone> </ActivityZones> ``` These add IDs 36 and 37 (with 0-35 replacing the built-in ones), for use with custom spawned or placed activity zones. If the text is empty, it will use the built-in localization string "Press {button} to interact", and if "colour" is missing, it will default to "orange". New commands: - `createcollision(x,y,w,h)` - Creates a collision block - `createtrigger(x,y,w,h,gamestate)` - Creates a gamestate trigger - `createscript(x,y,w,h,script)` - Creates a (custom!) script box - `createdamage(x,y,w,h)` - Creates a damage block - `createdirectional(x,y,w,h,dir)` - Creates a "directional" block - `createsafe(x,y,w,h)` - Creates a "safe" block - `createactivity(x,y,w,h,script[,id])` - Creates an activity zone If `id` is not passed into `createactivity`, it will default to 35. Custom activity zones created this way can also be affected by `setactivitytext`, `setactivitycolour` and `setactivityposition`. Co-authored-by: Dav999 <dav999.tolp@gmail.com>
This commit is contained in:
1 parent
fc89b2e7bf
commit
7d163c0f93
9 files changed
+258
-31
No files matched your search
@@ -90,6 +90,8 @@ mapclass::mapclass(void)
|
||||
|
||||
currentregion = 0;
|
||||
SDL_zeroa(region);
|
||||
|
||||
tempscriptbox = 0;
|
||||
}
|
||||
|
||||
static char roomname_static[SCREEN_WIDTH_CHARS];
|
||||
@@ -1815,7 +1817,9 @@ void mapclass::loadlevel(int rx, int ry)
|
||||
|
||||
// Entities have to be created HERE, akwardly
|
||||
int tempcheckpoints = 0;
|
||||
int tempscriptbox = 0;
|
||||
|
||||
tempscriptbox = 0;
|
||||
|
||||
for (size_t edi = 0; edi < customentities.size(); edi++)
|
||||
{
|
||||
// If entity is in this room, create it
|
||||
@@ -1954,6 +1958,25 @@ void mapclass::loadlevel(int rx, int ry)
|
||||
obj.createblock(TRIGGER, ex, ey, ent.p1 * 8, ent.p2 * 8, 300 + tempscriptbox, "custom_" + ent.scriptname);
|
||||
tempscriptbox++;
|
||||
break;
|
||||
case 20: // Activity Zone
|
||||
obj.customscript = ent.scriptname;
|
||||
obj.createblock(ACTIVITY, ex, ey, ent.p1 * 8, ent.p2 * 8, ent.p3, "custom_" + ent.scriptname, ActivityContext_CUSTOM);
|
||||
break;
|
||||
case 21: // Collision Box
|
||||
obj.createblock(BLOCK, ex, ey, ent.p1 * 8, ent.p2 * 8);
|
||||
break;
|
||||
case 22: // Damage Box
|
||||
obj.createblock(DAMAGE, ex, ey, ent.p1 * 8, ent.p2 * 8);
|
||||
break;
|
||||
case 23: // Directional Box
|
||||
obj.createblock(DIRECTIONAL, ex, ey, ent.p1 * 8, ent.p2 * 8, ent.p3);
|
||||
break;
|
||||
case 24: // Safe Box
|
||||
obj.createblock(SAFE, ex, ey, ent.p1 * 8, ent.p2 * 8);
|
||||
break;
|
||||
case 25: // Trigger
|
||||
obj.createblock(TRIGGER, ex, ey, ent.p1 * 8, ent.p2 * 8, ent.p3);
|
||||
break;
|
||||
case 50: // Warp Lines
|
||||
obj.customwarpmode=true;
|
||||
switch (ent.p1)
|
||||
|
||||
Reference in new issue
Block a user