void ESvnBase::ShowLine (EView *V,int line) {
    if (line>=0&&line<LineCount&&Lines[line]->File) {
        if (Lines[line]->Buf!=0) {
            V->SwitchToModel (Lines[line]->Buf);
            if (Lines[line]->Line!=-1) {
                char book[16];
                sprintf(book,"_SVN.%d",line);
                Lines[line]->Buf->GotoBookmark (book);
            }
        } else {
            char path[MAXPATH];
            strcpy (path,Directory);Slash (path,1);strcat (path,Lines[line]->File);
            if (FileLoad (0,path,0,V)==1) {
                V->SwitchToModel (ActiveModel);
                if (Lines[line]->Line!=-1) ((EBuffer *)ActiveModel)->CenterNearPosR (0,Lines[line]->Line);
            }
        }
    }
}
Exemple #2
0
FileFind::FileFind(const char *aDirectory, const char *aPattern, int aFlags) {
    Directory = new char[strlen(aDirectory) + 1];
    if (Directory) {
        strcpy(Directory, aDirectory);
        Slash(Directory, 0);
    }
    if (aPattern) {
        Pattern = new char[strlen(aPattern) + 1];
        if (Pattern)
            strcpy(Pattern, aPattern);
    } else {
        Pattern = 0;
    }
    Flags = aFlags;
#if defined(USE_DIRENT)
    dir = 0;
#elif defined(OS2) && !defined(USE_DIRENT)
    dir = 0;
#elif defined(NT) && !defined(USE_DIRENT)
    dir = 0;
#endif
}
Exemple #3
0
int EDirectory::ChangeDir(ExState &State) {
    char Dir[MAXPATH];
    char Dir2[MAXPATH];

    if (State.GetStrParam(View, Dir, sizeof(Dir)) == 0) {
        strcpy(Dir, Path);
        if (View->MView->Win->GetStr("Set directory", sizeof(Dir), Dir, HIST_PATH) == 0)
            return 0;
    }
    if (ExpandPath(Dir, Dir2, sizeof(Dir2)) == -1)
        return 0;
#if 0
    // is this needed for other systems as well ?
    Slash(Dir2, 1);
#endif
    if (Path)
        free(Path);
    Path = strdup(Dir2);
    Row = -1;
    UpdateTitle();
    return RescanDir();
}
Exemple #4
0
int MultiFileLoad(int createFlags, const char *FileName, const char *Mode, EView *View) {
    char fX[MAXPATH];
    int count = 0;
    char FPath[MAXPATH];
    char FName[MAXPATH];
    FileFind *ff;
    FileInfo *fi;
    int rc;

    assert(View != 0);

    JustDirectory(FileName, fX, sizeof (fX));
    if (fX[0] == 0) strcpy(fX, ".");
    JustFileName(FileName, FName, sizeof(FName));
    if (ExpandPath(fX, FPath, sizeof(FPath)) == -1) return 0;
    Slash(FPath, 1);

    ff = new FileFind(FPath, FName, ffHIDDEN | ffFULLPATH);
    if (ff == 0)
        return 0;
    rc = ff->FindFirst(&fi);
    while (rc == 0) {
        count++;
        if (FileLoad(createFlags, fi->Name(), Mode, View) == 0) {
            delete fi;
            delete ff;
            return 0;
        }
        delete fi;
        rc = ff->FindNext(&fi);
    }
    delete ff;
    if (count == 0)
        return FileLoad(createFlags, FileName, Mode, View);
    return 1;
}
// Used to get default directory of model
void ESvnBase::GetPath (char *APath,int MaxLen) {
    strncpy (APath,Directory,MaxLen);
    APath[MaxLen-1]=0;
    Slash (APath,0);
}
Exemple #6
0
void EDirectory::GetPath(char *APath, int MaxLen) {
    strncpy(APath, Path, MaxLen);
    APath[MaxLen - 1] = 0;
    Slash(APath, 0);
}
Exemple #7
0
void EDirectory::GetName(char *AName, int MaxLen) {
    strncpy(AName, Path, MaxLen);
    AName[MaxLen - 1] = 0;
    Slash(AName, 0);
}
Exemple #8
0
int CompletePath(const char *Base, char *Match, int Count) {
    char Name[MAXPATH];
    const char *dirp;
    char *namep;
    int len, count = 0;
    char cname[MAXPATH];
    int hascname = 0;
    RxMatchRes RM;
    FileFind *ff;
    FileInfo *fi;
    int rc;

    if (strcmp(Base, "") == 0) {
        if (ExpandPath(".", Name, sizeof(Name)) != 0) return -1;
    } else {
        if (ExpandPath(Base, Name, sizeof(Name)) != 0) return -1;
    }
//    SlashDir(Name);
    dirp = Name;
    namep = SepRChr(Name);
    if (namep == Name) {
        dirp = SSLASH;
        namep = Name + 1;
    } else if (namep == NULL) {
        namep = Name;
        dirp = SDOT;
    } else {
        *namep = 0;
        namep++;
    }

    len = strlen(namep);
    strcpy(Match, dirp);
    SlashDir(Match);
    cname[0] = 0;

    ff = new FileFind(dirp, "*",
                      ffDIRECTORY | ffHIDDEN
#if defined(USE_DIRENT)
                      | ffFAST // for SPEED
#endif
                     );
    if (ff == 0)
        return 0;
    rc = ff->FindFirst(&fi);
    while (rc == 0) {
        const char *dname = fi->Name();

        // filter out unwanted files
        if ((strcmp(dname, ".") != 0) &&
                (strcmp(dname, "..") != 0) &&
                (!CompletionFilter || RxExec(CompletionFilter, dname, strlen(dname), dname, &RM) != 1)) {
            if ((
#if defined(UNIX)
                        strncmp
#else // os2, nt, ...
                        strnicmp
#endif
                        (namep, dname, len) == 0)
                    && (dname[0] != '.' || namep[0] == '.')) {
                count++;
                if (Count == count) {
                    Slash(Match, 1);
                    strcat(Match, dname);
                    if (
#if defined(USE_DIRENT) // for SPEED
                        IsDirectory(Match)
#else
                        fi->Type() == fiDIRECTORY
#endif
                    )
                        Slash(Match, 1);
                } else if (Count == -1) {

                    if (!hascname) {
                        strcpy(cname, dname);
                        hascname = 1;
                    } else {
                        int o = 0;
#ifdef UNIX
                        while (cname[o] && dname[o] && (cname[o] == dname[o])) o++;
#endif
#if defined(OS2) || defined(NT)
                        while (cname[o] && dname[o] && (toupper(cname[o]) == toupper(dname[o]))) o++;
#endif
                        cname[o] = 0;
                    }
                }
            }
        }
        delete fi;
        rc = ff->FindNext(&fi);
    }
    delete ff;
    if (Count == -1) {
        Slash(Match, 1);
        strcat(Match, cname);
        if (count == 1) SlashDir(Match);
    }
    return count;
}
void UpdateMonster(Entity *self)
{
  int *frames;
  if(self->state == MS_Deadbody)
  {
    return;
  }
  if(self->state == MS_Dead)
  {
    /*run death animation*/
    if((self->frame < deadframes[0])||(self->frame > deadframes[1]))
    {
      self->frame = deadframes[0] - 1;
    }
    self->frame++;
    if(self->frame != deadframes[1])return;
    if(GetObjKey(self->data,"persists",NULL))
    {
      SetPlayerProgress(level.name,self->name, self->objindex,"dead");
    }
    /*spawndeadbody, unless nocorpse*/
    self->state = MS_Deadbody;
    self->update = NULL;
    self->think = NULL;
    self->solid = 0;
    self->FloorDraw = 1;
    self->activate = NULL;
    return;
  }
  if(self->attacking)
  {
    /*this is going to become a lot more robust*/
    self->attackframe++;
      switch(self->attacktype)
      {
        case AT_Slash:
          frames = slashframes;
          if(self->attackframe >=4)
          {
            if((self->attackframe > (8 * self->attackspeed))||(Slash(self,self->p,self->targetpoint,self->attackrange,35,-35,2, self->attackframe/8.0, 1, 1, self->damagetype)))
            {
              self->attacking = 0;
              AddDelays(self,8);
              self->Rcd = 8  + (8 * self->attackspeed);
              self->Acd = 4 + (4 * self->attackspeed);
            }
          }
          break;
        case AT_Crush:
          frames = crushframes;
          if(self->attackframe >=4)
          {
            if((self->attackframe > (8 * self->attackspeed))||(Crush(self,self->p,self->targetpoint,self->attackrange,35,-35,2, self->attackframe/8.0, 1, 1, self->damagetype)))
            {
              self->attacking = 0;
              AddDelays(self,8);
              self->Rcd = 8  + (8 * self->attackspeed);
              self->Acd = 4 + (4 * self->attackspeed);
            }
          }
          break;
        case AT_Stab:
          frames = stabframes;
          if(self->attackframe >=4)
          {
            if((self->attackframe > (8 * self->attackspeed))||(Stab(self,self->p,self->targetpoint,self->attackrange,2, self->attackframe/8.0, 1, 1, self->damagetype)))
            {
              self->attacking = 0;
              AddDelays(self,8);
              self->Rcd = 8  + (8 * self->attackspeed);
              self->Acd = 4 + (4 * self->attackspeed);
            }
          }
          break;
        case AT_Shoot:
          frames = shootframes;
          if((int)self->attackframe == 6)
          {
            ShootArrow(self);
          }
          if(self->attackframe > 8)
          {
            self->attacking = 0;
            AddDelays(self,8);
            self->Rcd = 8  + (8 * self->attackspeed);
            self->Acd = 4 + (4 * self->attackspeed);
          }
          break;
      }

    self->frame = frames[0] + ((frames[1] - frames[0])*(self->attackframe/(8 * self->attackspeed)));
  }
  else if(self->guard)
  {
    /*using the shield, Set left arm sprite to guard*/
    self->frame = 1;
  }
  else
  {
    /*when idle*/
    if(self->frame < idleframes[0])self->frame = idleframes[0];
    else if (self->frame > idleframes[1])self->frame = idleframes[0];
    else
    {
      self->frame = self->frame + 0.2;
    }
  }
  if(RelativeSize(self->v.x, self->v.y) > 0)
  {
    UpdateEntityPosition(self,NULL);
  }
  CoolDowns(self);
}