// File: /workspace/github_c_makefile_star2_O1/QwazyWabbitWOS[P]lmctf60/g_runes.c
// Function: SpawnRune
void SpawnRune (int type)
{
	edict_t		*ent, *spot; 
	char *name = NULL, *model = NULL; //MJD Uninitialized
	int effects = 0, renderfx = 0;    //MJD Uninitialized
	
	
	//	if (!deathmatch->value)
	//		return;
	//surt single player runes support
	
	spot = SelectFarthestRuneSpawnPoint();
	if (!spot)
		spot = redflag;
	
	if (spot)
	{
		switch (type)
		{
		case RUNE_DAMAGE:
			name = "damage_rune";
			effects = 0; //EF_COLOR_SHELL;
			renderfx = 0; //RF_SHELL_RED;
			model = "models/ctf/damage/tris.md2";
			break;
			
		case RUNE_HASTE:
			name = "haste_rune";
			effects = 0;//EF_COLOR_SHELL;
			renderfx = 0;//RF_SHELL_BLUE;
			model = "models/ctf/haste/tris.md2";
			break;
			
		case RUNE_RESIST:
			name = "resist_rune";
			effects = 0;//EF_COLOR_SHELL;
			renderfx = 0;//RF_SHELL_RED | RF_SHELL_BLUE;
			model = "models/ctf/resist/tris.md2";
			break;
			
		case RUNE_REGEN:
			name = "regen_rune";
			effects = 0;//EF_COLOR_SHELL;
			renderfx = 0;//RF_SHELL_GREEN;
			model = "models/ctf/regen/tris.md2";
			break;
			
		case RUNE_VAMP:                                   //added by Vampire
			name = "vampire_rune";
			//effects = EF_TELEPORTER | EF_ANIM01;//EF_COLOR_SHELL;
			effects = EF_ANIM01;//EF_COLOR_SHELL;
			renderfx = RF_SHELL_RED;
			model = "models/ctf/resist/tris.md2";
			break;
			
		default:
			gi.dprintf("Bad rune model selected.\n");
			break;  // MJD If we hit this line, then name,
			// effects, renderfx, and model would
			// stay uninitialized, which would be
			// a bad thing, I think.
		}
		
		ent = G_Spawn();
		ent->classname = ED_NewString (name);
		ED_CallSpawn(ent);
		
		VectorCopy (spot->s.origin, ent->s.origin);
		ent->takedamage = DAMAGE_NO; //no damage on runes
		ent->dontfree = 1;
		gi.soundindex ("items/m_health.wav");
		ent->s.effects |= effects;
		ent->s.renderfx |= renderfx;
		ent->model = model;
		ent->runetype = type; // We store our rune type here
		tossrune(ent, 0);
		//		gi.dprintf("Spawned rune.\n");
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
callq 0x18430
movq %rax, %r14
testq %rax, %rax
jne 0x1fb86
movq 0x49c75(%rip), %rax     # 0x697f8
movq (%rax), %r14
testq %r14, %r14
je 0x1fbb5
leal -0x1(%rbx), %eax
cmpl $0x7, %eax
ja 0x1fbc4
xorl %ebp, %ebp
leaq 0x34734(%rip), %rcx     # 0x542d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x3478f(%rip), %r13     # 0x5433b
leaq 0x3474d(%rip), %r15     # 0x54300
jmp 0x1fc29
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x10, %ebx
jne 0x1fbde
movl $0x400, %ebp            # imm = 0x400
leaq 0x3479b(%rip), %r13     # 0x54370
leaq 0x34752(%rip), %r15     # 0x5432e
jmp 0x1fc29
movq 0x49a1b(%rip), %rcx     # 0x69600
leaq 0x347b9(%rip), %rdi     # 0x543a5
xorl %r15d, %r15d
xorl %eax, %eax
callq *0x8(%rcx)
xorl %r13d, %r13d
xorl %ebp, %ebp
jmp 0x1fc29
leaq 0x34754(%rip), %r13     # 0x54356
leaq 0x34703(%rip), %r15     # 0x5430c
jmp 0x1fc29
leaq 0x34779(%rip), %r13     # 0x5438b
leaq 0x3470a(%rip), %r15     # 0x54323
jmp 0x1fc29
leaq 0x3474e(%rip), %r13     # 0x54370
leaq 0x346ee(%rip), %r15     # 0x54317
callq 0x19710
movq %rax, %r12
movq %r15, %rdi
callq 0x18260
movq %rax, 0x138(%r12)
movq %r12, %rdi
callq 0x19310
movss 0x4(%r14), %xmm0
movss %xmm0, 0x4(%r12)
movss 0x8(%r14), %xmm0
movss %xmm0, 0x8(%r12)
movss 0xc(%r14), %xmm0
movss %xmm0, 0xc(%r12)
movl $0x0, 0x27c(%r12)
movl $0x1, 0x49c(%r12)
movq 0x49971(%rip), %rax     # 0x69600
leaq 0x382f5(%rip), %rdi     # 0x57f8b
callq *0x48(%rax)
orl %ebp, 0x40(%r12)
orl %ebp, 0x44(%r12)
movq %r13, 0x120(%r12)
movl %ebx, 0x478(%r12)
movq %r12, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1f93a