]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/minigames/cl_minigames.qc
Merge branch 'master' into TimePath/waypointsprites
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / minigames / cl_minigames.qc
index 6d250ac702199c05ad9e65bdf9ff87c4a5b81303..2fefd53227580bb3204bb56623a02a01df4f3272 100644 (file)
@@ -80,6 +80,7 @@ string minigame_texture(string name)
 #define MSLE_CLEAN_Byte(x)
 #define MSLE_CLEAN_Char(x)
 #define MSLE_CLEAN_Short(x)
+#define MSLE_CLEAN_Long(x)
 #define MSLE_CLEAN_Coord(x)
 #define MSLE_CLEAN_Angle(x)
 #define MSLE_CLEAN_Float(x)
@@ -102,11 +103,12 @@ void HUD_MinigameMenu_CurrentButton();
 bool auto_close_minigamemenu;
 void deactivate_minigame()
 {
-       if ( !active_minigame || active_minigame != self )
+       if ( !active_minigame )
                return;
+
        active_minigame.minigame_event(active_minigame,"deactivate");
        entity e = world;
-       while( (e = findentity(e, owner, self)) )
+       while( (e = findentity(e, owner, active_minigame)) )
                if ( e.minigame_autoclean )
                {
                        minigame_autoclean_entity(e);
@@ -124,6 +126,12 @@ void deactivate_minigame()
                HUD_MinigameMenu_CurrentButton();
 }
 
+void minigame_entremove()
+{
+       if ( self == active_minigame )
+               deactivate_minigame();
+}
+
 void activate_minigame(entity minigame)
 {
        if ( !minigame )
@@ -143,9 +151,7 @@ void activate_minigame(entity minigame)
        
        if ( active_minigame )
        {
-               entity olds = minigame_self;
                deactivate_minigame();
-               minigame_self = olds;
        }
        
        if ( minigame_self.owner != minigame )
@@ -172,7 +178,6 @@ vector ReadVector2D() { vector v; v_x = ReadCoord(); v_y = ReadCoord(); v_z = 0;
 vector ReadVector() { vector v; v_x = ReadCoord(); v_y = ReadCoord(); v_z = ReadCoord(); return v; }
 string() ReadString_Raw = #366;
 string ReadString_Zoned() { return strzone(ReadString_Raw()); }
-#define ReadFloat ReadCoord
 #define ReadString ReadString_Zoned
 #define FIELD(Flags, Type,Name) if ( sf & (Flags) ) self.Name = Read##Type();
 #define MSLE(Name,Fields) \
@@ -211,7 +216,7 @@ void ent_read_minigame()
                
                if ( sf & MINIG_SF_CREATE )
                {
-                       self.entremove = deactivate_minigame;
+                       self.entremove = minigame_entremove;
                        self.descriptor = minigame_get_descriptor(ReadString_Raw());
                        if ( !self.descriptor )
                                dprint("Got a minigame without a client-side descriptor!\n");
@@ -250,7 +255,7 @@ void ent_read_minigame()
        
        if ( minigame_ent )
                minigame_ent.minigame_event(minigame_ent,"network_receive",self,sf);
-       
+
        if ( sf & MINIG_SF_CREATE )
        {
                dprint("CL Reading entity: ",ftos(num_for_edict(self)),
@@ -258,7 +263,6 @@ void ent_read_minigame()
                dprint(" sf:",ftos(sf)," netname:",self.netname,"\n\n");
        }
 }
-#undef ReadFloat
 #undef ReadString
 #undef FIELD
 #undef MSLE
@@ -282,7 +286,7 @@ string minigame_getWrappedLine(float w, vector theFontSize, textLengthUpToWidth_
        
        if ( take_until > strlen(s) )
                take_until = strlen(s);
-       
+
        for ( int i = 0; i < take_until; i++ )
                if ( substring(s,i,1) == "\n" )
                {
@@ -399,4 +403,4 @@ void minigame_prompt()
                HUD_Notify_Push(sprintf("minigames/%s/icon_notif",active_minigame.descriptor.netname),
                        _("It's your turn"), "");
        }
-}
\ No newline at end of file
+}