// File: /workspace/github_c_makefile_star2_O2/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 0x18460
movq %rax, %r14
testq %rax, %rax
jne 0x1e2b3
movq 0x48548(%rip), %rax     # 0x667f8
movq (%rax), %r14
testq %r14, %r14
je 0x1e2e2
leal -0x1(%rbx), %eax
cmpl $0x7, %eax
ja 0x1e2f1
xorl %ebp, %ebp
leaq 0x31007(%rip), %rcx     # 0x4f2d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x31072(%rip), %r13     # 0x4f34b
leaq 0x31030(%rip), %r15     # 0x4f310
jmp 0x1e356
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x10, %ebx
jne 0x1e30b
movl $0x400, %ebp            # imm = 0x400
leaq 0x3107e(%rip), %r13     # 0x4f380
leaq 0x31035(%rip), %r15     # 0x4f33e
jmp 0x1e356
movq 0x482ee(%rip), %rcx     # 0x66600
leaq 0x3109c(%rip), %rdi     # 0x4f3b5
xorl %r15d, %r15d
xorl %eax, %eax
callq *0x8(%rcx)
xorl %r13d, %r13d
xorl %ebp, %ebp
jmp 0x1e356
leaq 0x31037(%rip), %r13     # 0x4f366
leaq 0x30fe6(%rip), %r15     # 0x4f31c
jmp 0x1e356
leaq 0x3105c(%rip), %r13     # 0x4f39b
leaq 0x30fed(%rip), %r15     # 0x4f333
jmp 0x1e356
leaq 0x31031(%rip), %r13     # 0x4f380
leaq 0x30fd1(%rip), %r15     # 0x4f327
callq 0x198d0
movq %rax, %r12
movq %r15, %rdi
callq 0x18280
movq %rax, 0x138(%r12)
movq %r12, %rdi
callq 0x194a0
movss 0x4(%r14), %xmm0
movss %xmm0, 0x4(%r12)
movss 0x8(%r14), %xmm0
movss %xmm0, 0x8(%r12)
movss 0xc(%r14), %xmm0
movss %xmm0, 0xc(%r12)
andl $0x0, 0x27c(%r12)
movl $0x1, 0x49c(%r12)
movq 0x48247(%rip), %rax     # 0x66600
leaq 0x34c9f(%rip), %rdi     # 0x5305f
callq *0x48(%rax)
movq 0x40(%r12), %xmm0
movd %ebp, %xmm1
pshufd $0x50, %xmm1, %xmm1     # xmm1 = xmm1[0,0,1,1]
por %xmm0, %xmm1
movq %xmm1, 0x40(%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 0x1e086